externalapi

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(handler MetadataHandler) http.Handler

func NewHealthCheckHandler

func NewHealthCheckHandler() http.Handler

NewHealthCheckHandler creates handler for performing health check

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"`
}

type CreateServiceResponse

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

type Credentials

type Credentials struct {
	Oauth Oauth `json:"oauth" valid:"required~oauth field cannot be empty"`
}

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) 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 Service

type Service struct {
	ID          string `json:"id"`
	Provider    string `json:"provider"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

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."`
	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