externalapi

package
v0.0.0-...-1ac4f16 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(handler MetadataHandler, middlewares []mux.MiddlewareFunc) http.Handler

func NewHealthCheckHandler

func NewHealthCheckHandler() http.Handler

NewHealthCheckHandler creates handler for performing health check

func NewStaticFileHandler

func NewStaticFileHandler(path string) http.Handler

NewStaticFileHandler creates handler for returning API spec

Types

type API

type API struct {
	TargetUrl        string          `json:"targetUrl" valid:"url,required~targetUrl field cannot be empty."`
	Credentials      *Credentials    `json:"credentials,omitempty"`
	Spec             json.RawMessage `json:"spec,omitempty"`
	SpecificationUrl string          `json:"specificationUrl,omitempty"`
	ApiType          string          `json:"apiType,omitempty"`
}

func (API) MarshalJSON

func (api API) MarshalJSON() ([]byte, error)

type BasicAuth

type BasicAuth struct {
	Username string `json:"username" valid:"required~basic auth username field cannot be empty"`
	Password string `json:"password" valid:"required~basic auth password field cannot be empty"`
}

type CertificateGen

type CertificateGen struct {
	CommonName string `json:"commonName"`
}

type CreateServiceResponse

type CreateServiceResponse struct {
	ID string `json:"id"`
}

type Credentials

type Credentials struct {
	Oauth          *Oauth          `json:"oauth,omitempty"`
	Basic          *BasicAuth      `json:"basic,omitempty"`
	CertificateGen *CertificateGen `json:"certificateGen,omitempty"`
}

type DocsObject

type DocsObject struct {
	Title  string `json:"title"`
	Type   string `json:"type"`
	Source string `json:"source"`
}

type Documentation

type Documentation struct {
	DisplayName string       `json:"displayName" valid:"required~displayName field cannot be empty in documentation"`
	Description string       `json:"description" valid:"required~description field cannot be empty in documentation"`
	Type        string       `json:"type" valid:"required~type field cannot be empty in documentation"`
	Tags        []string     `json:"tags,omitempty"`
	Docs        []DocsObject `json:"docs,omitempty"`
}

type ErrorHandler

type ErrorHandler struct {
	Message string
	Code    int
}

func NewErrorHandler

func NewErrorHandler(code int, message string) *ErrorHandler

func (*ErrorHandler) ServeHTTP

func (eh *ErrorHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Events

type Events struct {
	Spec json.RawMessage `json:"spec" valid:"required~spec cannot be empty"`
}

type MetadataHandler

type MetadataHandler interface {
	CreateService(w http.ResponseWriter, r *http.Request)
	GetService(w http.ResponseWriter, r *http.Request)
	GetServices(w http.ResponseWriter, r *http.Request)
	UpdateService(w http.ResponseWriter, r *http.Request)
	DeleteService(w http.ResponseWriter, r *http.Request)
}

func NewInvalidStateMetadataHandler

func NewInvalidStateMetadataHandler(message string) MetadataHandler

func NewMetadataHandler

func NewMetadataHandler(validator ServiceDetailsValidator, serviceDefinitionService metadata.ServiceDefinitionService, detailedErrorResponse bool) MetadataHandler

type Oauth

type Oauth struct {
	URL          string `json:"url" valid:"url,required~oauth url field cannot be empty"`
	ClientID     string `json:"clientId" valid:"required~oauth clientId field cannot be empty"`
	ClientSecret string `json:"clientSecret" valid:"required~oauth clientSecret cannot be empty"`
}

type RedirectionHandler

type RedirectionHandler interface {
	Redirect(w http.ResponseWriter, r *http.Request)
}

func NewRedirectionHandler

func NewRedirectionHandler(destination string, status int) RedirectionHandler

NewRedirectionHandler creates handler for redirection that replaces path variables

type Service

type Service struct {
	ID          string             `json:"id"`
	Provider    string             `json:"provider"`
	Name        string             `json:"name"`
	Description string             `json:"description"`
	Identifier  string             `json:"identifier,omitempty"`
	Labels      *map[string]string `json:"labels,omitempty"`
}

type ServiceDetails

type ServiceDetails struct {
	Provider         string             `json:"provider" valid:"required~Provider field cannot be empty."`
	Name             string             `json:"name" valid:"required~Name field cannot be empty."`
	Description      string             `json:"description" valid:"required~Description field cannot be empty."`
	ShortDescription string             `json:"shortDescription,omitempty"`
	Identifier       string             `json:"identifier,omitempty"`
	Labels           *map[string]string `json:"labels,omitempty"`
	Api              *API               `json:"api,omitempty"`
	Events           *Events            `json:"events,omitempty"`
	Documentation    *Documentation     `json:"documentation,omitempty"`
}

type ServiceDetailsValidator

type ServiceDetailsValidator interface {
	Validate(details ServiceDetails) apperrors.AppError
}

func NewServiceDetailsValidator

func NewServiceDetailsValidator() ServiceDetailsValidator

type ServiceDetailsValidatorFunc

type ServiceDetailsValidatorFunc func(details ServiceDetails) apperrors.AppError

func (ServiceDetailsValidatorFunc) Validate

Jump to

Keyboard shortcuts

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