cors

package
v0.0.0-...-089673d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2019 License: Apache-2.0 Imports: 4 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CORS

type CORS struct {
	Space            string   `json:"space" validate:"required,min=3,space"`
	ID               ID       `json:"corsId"`
	Method           string   `json:"method" validate:"eq=GET|eq=POST|eq=DELETE|eq=PUT|eq=PATCH|eq=HEAD|eq=OPTIONS"`
	Path             string   `json:"path" validate:"path"`
	AllowedOrigins   []string `json:"allowedOrigins" validate:"min=1"`
	AllowedMethods   []string `json:"allowedMethods" validate:"min=1"`
	AllowedHeaders   []string `json:"allowedHeaders" validate:"min=1"`
	AllowCredentials bool     `json:"allowCredentials"`

	Metadata metadata.Metadata `json:"metadata,omitempty"`
}

CORS is used to configure CORS on HTTP subscriptions.

func (CORS) MarshalLogObject

func (c CORS) MarshalLogObject(enc zapcore.ObjectEncoder) error

MarshalLogObject is a part of zapcore.ObjectMarshaler interface

type CORSes

type CORSes []*CORS

CORSes is an array of CORS configurations.

type ErrCORSAlreadyExists

type ErrCORSAlreadyExists struct {
	ID ID
}

ErrCORSAlreadyExists occurs when CORS config with the same ID already exists.

func (ErrCORSAlreadyExists) Error

func (e ErrCORSAlreadyExists) Error() string

type ErrCORSNotFound

type ErrCORSNotFound struct {
	ID ID
}

ErrCORSNotFound occurs when CORS config cannot be found.

func (ErrCORSNotFound) Error

func (e ErrCORSNotFound) Error() string

type ErrCORSValidation

type ErrCORSValidation struct {
	Message string
}

ErrCORSValidation occurs when CORS configuration payload doesn't validate.

func (ErrCORSValidation) Error

func (e ErrCORSValidation) Error() string

type ErrInvalidCORSUpdate

type ErrInvalidCORSUpdate struct {
	Field string
}

ErrInvalidCORSUpdate occurs when a client tries to update a CORS config in a way that changes the CORS ID.

func (ErrInvalidCORSUpdate) Error

func (e ErrInvalidCORSUpdate) Error() string

type ID

type ID string

ID uniquely identifies a CORS configuration.

type Service

type Service interface {
	GetCORS(space string, id ID) (*CORS, error)
	ListCORS(space string, filters ...metadata.Filter) (CORSes, error)
	CreateCORS(c *CORS) (*CORS, error)
	UpdateCORS(c *CORS) (*CORS, error)
	DeleteCORS(space string, id ID) error
}

Service represents service for managing CORS configuration.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL