operations

package
v0.0.0-...-b54bbe8 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2018 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const HealthCheckOKCode int = 200

HealthCheckOKCode is the HTTP code returned for type HealthCheckOK

View Source
const HealthCheckServiceUnavailableCode int = 503

HealthCheckServiceUnavailableCode is the HTTP code returned for type HealthCheckServiceUnavailable

Variables

This section is empty.

Functions

This section is empty.

Types

type AppAPI

type AppAPI struct {
	Middleware func(middleware.Builder) http.Handler

	// BasicAuthenticator generates a runtime.Authenticator from the supplied basic auth function.
	// It has a default implemention in the security package, however you can replace it for your particular usage.
	BasicAuthenticator func(security.UserPassAuthentication) runtime.Authenticator
	// APIKeyAuthenticator generates a runtime.Authenticator from the supplied token auth function.
	// It has a default implemention in the security package, however you can replace it for your particular usage.
	APIKeyAuthenticator func(string, string, security.TokenAuthentication) runtime.Authenticator
	// BearerAuthenticator generates a runtime.Authenticator from the supplied bearer token auth function.
	// It has a default implemention in the security package, however you can replace it for your particular usage.
	BearerAuthenticator func(string, security.ScopedTokenAuthentication) runtime.Authenticator

	// JSONConsumer registers a consumer for a "application/json" mime type
	JSONConsumer runtime.Consumer

	// JSONProducer registers a producer for a "application/json" mime type
	JSONProducer runtime.Producer

	// HealthCheckHandler sets the operation handler for the health check operation
	HealthCheckHandler HealthCheckHandler

	// ServeError is called when an error is received, there is a default handler
	// but you can set your own with this
	ServeError func(http.ResponseWriter, *http.Request, error)

	// ServerShutdown is called when the HTTP(S) server is shut down and done
	// handling all active connections and does not accept connections any more
	ServerShutdown func()

	// Custom command line argument groups with their descriptions
	CommandLineOptionsGroups []swag.CommandLineOptionsGroup

	// User defined logger function.
	Logger func(string, ...interface{})
	// contains filtered or unexported fields
}

AppAPI Template Application

func NewAppAPI

func NewAppAPI(spec *loads.Document) *AppAPI

NewAppAPI creates a new App instance

func (*AppAPI) AuthenticatorsFor

func (o *AppAPI) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]runtime.Authenticator

AuthenticatorsFor gets the authenticators for the specified security schemes

func (*AppAPI) Authorizer

func (o *AppAPI) Authorizer() runtime.Authorizer

Authorizer returns the registered authorizer

func (*AppAPI) ConsumersFor

func (o *AppAPI) ConsumersFor(mediaTypes []string) map[string]runtime.Consumer

ConsumersFor gets the consumers for the specified media types

func (*AppAPI) Context

func (o *AppAPI) Context() *middleware.Context

Context returns the middleware context for the app API

func (*AppAPI) DefaultConsumes

func (o *AppAPI) DefaultConsumes() string

DefaultConsumes returns the default consumes media type

func (*AppAPI) DefaultProduces

func (o *AppAPI) DefaultProduces() string

DefaultProduces returns the default produces media type

func (*AppAPI) Formats

func (o *AppAPI) Formats() strfmt.Registry

Formats returns the registered string formats

func (*AppAPI) HandlerFor

func (o *AppAPI) HandlerFor(method, path string) (http.Handler, bool)

HandlerFor gets a http.Handler for the provided operation method and path

func (*AppAPI) Init

func (o *AppAPI) Init()

Init allows you to just initialize the handler cache, you can then recompose the middelware as you see fit

func (*AppAPI) ProducersFor

func (o *AppAPI) ProducersFor(mediaTypes []string) map[string]runtime.Producer

ProducersFor gets the producers for the specified media types

func (*AppAPI) RegisterFormat

func (o *AppAPI) RegisterFormat(name string, format strfmt.Format, validator strfmt.Validator)

RegisterFormat registers a custom format validator

func (*AppAPI) Serve

func (o *AppAPI) Serve(builder middleware.Builder) http.Handler

Serve creates a http handler to serve the API over HTTP can be used directly in http.ListenAndServe(":8000", api.Serve(nil))

func (*AppAPI) ServeErrorFor

func (o *AppAPI) ServeErrorFor(operationID string) func(http.ResponseWriter, *http.Request, error)

ServeErrorFor gets a error handler for a given operation id

func (*AppAPI) SetDefaultConsumes

func (o *AppAPI) SetDefaultConsumes(mediaType string)

SetDefaultConsumes returns the default consumes media type

func (*AppAPI) SetDefaultProduces

func (o *AppAPI) SetDefaultProduces(mediaType string)

SetDefaultProduces sets the default produces media type

func (*AppAPI) SetSpec

func (o *AppAPI) SetSpec(spec *loads.Document)

SetSpec sets a spec that will be served for the clients.

func (*AppAPI) Validate

func (o *AppAPI) Validate() error

Validate validates the registrations in the AppAPI

type HealthCheck

type HealthCheck struct {
	Context *middleware.Context
	Handler HealthCheckHandler
}

HealthCheck swagger:route GET /healthcheck healthCheck

Health Check

The healthcheck endpoint provides information about the health of the service.

func NewHealthCheck

func NewHealthCheck(ctx *middleware.Context, handler HealthCheckHandler) *HealthCheck

NewHealthCheck creates a new http.Handler for the health check operation

func (*HealthCheck) ServeHTTP

func (o *HealthCheck) ServeHTTP(rw http.ResponseWriter, r *http.Request)

type HealthCheckHandler

type HealthCheckHandler interface {
	Handle(HealthCheckParams) middleware.Responder
}

HealthCheckHandler interface for that can handle valid health check params

type HealthCheckHandlerFunc

type HealthCheckHandlerFunc func(HealthCheckParams) middleware.Responder

HealthCheckHandlerFunc turns a function with the right signature into a health check handler

func (HealthCheckHandlerFunc) Handle

Handle executing the request and returning a response

type HealthCheckOK

type HealthCheckOK struct {

	/*
	  In: Body
	*/
	Payload *models.HealthCheckResponse `json:"body,omitempty"`
}

HealthCheckOK The service is functioning nominally

swagger:response healthCheckOK

func NewHealthCheckOK

func NewHealthCheckOK() *HealthCheckOK

NewHealthCheckOK creates HealthCheckOK with default headers values

func (*HealthCheckOK) SetPayload

func (o *HealthCheckOK) SetPayload(payload *models.HealthCheckResponse)

SetPayload sets the payload to the health check o k response

func (*HealthCheckOK) WithPayload

func (o *HealthCheckOK) WithPayload(payload *models.HealthCheckResponse) *HealthCheckOK

WithPayload adds the payload to the health check o k response

func (*HealthCheckOK) WriteResponse

func (o *HealthCheckOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer)

WriteResponse to the client

type HealthCheckParams

type HealthCheckParams struct {

	// HTTP Request Object
	HTTPRequest *http.Request `json:"-"`
}

HealthCheckParams contains all the bound params for the health check operation typically these are obtained from a http.Request

swagger:parameters healthCheck

func NewHealthCheckParams

func NewHealthCheckParams() HealthCheckParams

NewHealthCheckParams creates a new HealthCheckParams object with the default values initialized.

func (*HealthCheckParams) BindRequest

func (o *HealthCheckParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error

BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface for simple values it will use straight method calls

type HealthCheckServiceUnavailable

type HealthCheckServiceUnavailable struct {

	/*
	  In: Body
	*/
	Payload *models.HealthCheckResponse `json:"body,omitempty"`
}

HealthCheckServiceUnavailable The service is not working correctly

swagger:response healthCheckServiceUnavailable

func NewHealthCheckServiceUnavailable

func NewHealthCheckServiceUnavailable() *HealthCheckServiceUnavailable

NewHealthCheckServiceUnavailable creates HealthCheckServiceUnavailable with default headers values

func (*HealthCheckServiceUnavailable) SetPayload

SetPayload sets the payload to the health check service unavailable response

func (*HealthCheckServiceUnavailable) WithPayload

WithPayload adds the payload to the health check service unavailable response

func (*HealthCheckServiceUnavailable) WriteResponse

func (o *HealthCheckServiceUnavailable) WriteResponse(rw http.ResponseWriter, producer runtime.Producer)

WriteResponse to the client

type HealthCheckURL

type HealthCheckURL struct {
	// contains filtered or unexported fields
}

HealthCheckURL generates an URL for the health check operation

func (*HealthCheckURL) Build

func (o *HealthCheckURL) Build() (*url.URL, error)

Build a url path and query string

func (*HealthCheckURL) BuildFull

func (o *HealthCheckURL) BuildFull(scheme, host string) (*url.URL, error)

BuildFull builds a full url with scheme, host, path and query string

func (*HealthCheckURL) Must

func (o *HealthCheckURL) Must(u *url.URL, err error) *url.URL

Must is a helper function to panic when the url builder returns an error

func (*HealthCheckURL) SetBasePath

func (o *HealthCheckURL) SetBasePath(bp string)

SetBasePath sets the base path for this url builder, only required when it's different from the base path specified in the swagger spec. When the value of the base path is an empty string

func (*HealthCheckURL) String

func (o *HealthCheckURL) String() string

String returns the string representation of the path with query string

func (*HealthCheckURL) StringFull

func (o *HealthCheckURL) StringFull(scheme, host string) string

StringFull returns the string representation of a complete url

func (*HealthCheckURL) WithBasePath

func (o *HealthCheckURL) WithBasePath(bp string) *HealthCheckURL

WithBasePath sets the base path for this url builder, only required when it's different from the base path specified in the swagger spec. When the value of the base path is an empty string

Jump to

Keyboard shortcuts

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