operations

package
Version: v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2022 License: Apache-2.0 Imports: 19 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExternalTypesDemoAPI

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

	// BasicAuthenticator generates a runtime.Authenticator from the supplied basic auth function.
	// It has a default implementation 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 implementation 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 implementation 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 the following mime types:
	//   - application/json
	JSONConsumer runtime.Consumer

	// JSONProducer registers a producer for the following mime types:
	//   - application/json
	JSONProducer runtime.Producer

	// GetStreamHandler sets the operation handler for the get stream operation
	GetStreamHandler GetStreamHandler
	// GetTestHandler sets the operation handler for the get test operation
	GetTestHandler GetTestHandler
	// PostTestHandler sets the operation handler for the post test operation
	PostTestHandler PostTestHandler
	// PutTestHandler sets the operation handler for the put test operation
	PutTestHandler PutTestHandler

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

	// PreServerShutdown is called before the HTTP(S) server is shutdown
	// This allows for custom functions to get executed before the HTTP(S) server stops accepting traffic
	PreServerShutdown func()

	// 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
}

ExternalTypesDemoAPI This sample specification exercises external types, with both x-go-type in definitions and inlined.

It demonstrates how to use the x-go-type extension to plug external type definitions in the generated code, for models (e.g. for properties, arrays or maps) or operations.

Notice that x-go-type works for schemas and is not supported for simple swagger types, used for response headers and query & path parameters.

func NewExternalTypesDemoAPI

func NewExternalTypesDemoAPI(spec *loads.Document) *ExternalTypesDemoAPI

NewExternalTypesDemoAPI creates a new ExternalTypesDemo instance

func (*ExternalTypesDemoAPI) AddMiddlewareFor

func (o *ExternalTypesDemoAPI) AddMiddlewareFor(method, path string, builder middleware.Builder)

AddMiddlewareFor adds a http middleware to existing handler

func (*ExternalTypesDemoAPI) AuthenticatorsFor

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

AuthenticatorsFor gets the authenticators for the specified security schemes

func (*ExternalTypesDemoAPI) Authorizer

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

Authorizer returns the registered authorizer

func (*ExternalTypesDemoAPI) ConsumersFor

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

ConsumersFor gets the consumers for the specified media types. MIME type parameters are ignored here.

func (*ExternalTypesDemoAPI) Context

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

Context returns the middleware context for the external types demo API

func (*ExternalTypesDemoAPI) DefaultConsumes

func (o *ExternalTypesDemoAPI) DefaultConsumes() string

DefaultConsumes returns the default consumes media type

func (*ExternalTypesDemoAPI) DefaultProduces

func (o *ExternalTypesDemoAPI) DefaultProduces() string

DefaultProduces returns the default produces media type

func (*ExternalTypesDemoAPI) Formats

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

Formats returns the registered string formats

func (*ExternalTypesDemoAPI) HandlerFor

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

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

func (*ExternalTypesDemoAPI) Init

func (o *ExternalTypesDemoAPI) Init()

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

func (*ExternalTypesDemoAPI) ProducersFor

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

ProducersFor gets the producers for the specified media types. MIME type parameters are ignored here.

func (*ExternalTypesDemoAPI) RegisterConsumer

func (o *ExternalTypesDemoAPI) RegisterConsumer(mediaType string, consumer runtime.Consumer)

RegisterConsumer allows you to add (or override) a consumer for a media type.

func (*ExternalTypesDemoAPI) RegisterFormat

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

RegisterFormat registers a custom format validator

func (*ExternalTypesDemoAPI) RegisterProducer

func (o *ExternalTypesDemoAPI) RegisterProducer(mediaType string, producer runtime.Producer)

RegisterProducer allows you to add (or override) a producer for a media type.

func (*ExternalTypesDemoAPI) Serve

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

func (*ExternalTypesDemoAPI) ServeErrorFor

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

ServeErrorFor gets a error handler for a given operation id

func (*ExternalTypesDemoAPI) SetDefaultConsumes

func (o *ExternalTypesDemoAPI) SetDefaultConsumes(mediaType string)

SetDefaultConsumes returns the default consumes media type

func (*ExternalTypesDemoAPI) SetDefaultProduces

func (o *ExternalTypesDemoAPI) SetDefaultProduces(mediaType string)

SetDefaultProduces sets the default produces media type

func (*ExternalTypesDemoAPI) SetSpec

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

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

func (*ExternalTypesDemoAPI) UseRedoc

func (o *ExternalTypesDemoAPI) UseRedoc()

UseRedoc for documentation at /docs

func (*ExternalTypesDemoAPI) UseSwaggerUI

func (o *ExternalTypesDemoAPI) UseSwaggerUI()

UseSwaggerUI for documentation at /docs

func (*ExternalTypesDemoAPI) Validate

func (o *ExternalTypesDemoAPI) Validate() error

Validate validates the registrations in the ExternalTypesDemoAPI

type GetStream

type GetStream struct {
	Context *middleware.Context
	Handler GetStreamHandler
}
GetStream swagger:route GET /stream getStream

GetStream get stream API

func NewGetStream

func NewGetStream(ctx *middleware.Context, handler GetStreamHandler) *GetStream

NewGetStream creates a new http.Handler for the get stream operation

func (*GetStream) ServeHTTP

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

type GetStreamDefault

type GetStreamDefault struct {

	/*
	  In: Body
	*/
	Payload models.MyStreamer `json:"body,omitempty"`
	// contains filtered or unexported fields
}

GetStreamDefault Uses an external definition for an interface (e.g. io.Reader)

No validation is expected on binary format.

swagger:response getStreamDefault

func NewGetStreamDefault

func NewGetStreamDefault(code int) *GetStreamDefault

NewGetStreamDefault creates GetStreamDefault with default headers values

func (*GetStreamDefault) SetPayload

func (o *GetStreamDefault) SetPayload(payload models.MyStreamer)

SetPayload sets the payload to the get stream default response

func (*GetStreamDefault) SetStatusCode

func (o *GetStreamDefault) SetStatusCode(code int)

SetStatusCode sets the status to the get stream default response

func (*GetStreamDefault) WithPayload

func (o *GetStreamDefault) WithPayload(payload models.MyStreamer) *GetStreamDefault

WithPayload adds the payload to the get stream default response

func (*GetStreamDefault) WithStatusCode

func (o *GetStreamDefault) WithStatusCode(code int) *GetStreamDefault

WithStatusCode adds the status to the get stream default response

func (*GetStreamDefault) WriteResponse

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

WriteResponse to the client

type GetStreamHandler

type GetStreamHandler interface {
	Handle(GetStreamParams) middleware.Responder
}

GetStreamHandler interface for that can handle valid get stream params

type GetStreamHandlerFunc

type GetStreamHandlerFunc func(GetStreamParams) middleware.Responder

GetStreamHandlerFunc turns a function with the right signature into a get stream handler

func (GetStreamHandlerFunc) Handle

Handle executing the request and returning a response

type GetStreamParams

type GetStreamParams struct {

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

GetStreamParams contains all the bound params for the get stream operation typically these are obtained from a http.Request

swagger:parameters GetStream

func NewGetStreamParams

func NewGetStreamParams() GetStreamParams

NewGetStreamParams creates a new GetStreamParams object

There are no default values defined in the spec.

func (*GetStreamParams) BindRequest

func (o *GetStreamParams) 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.

To ensure default values, the struct must have been initialized with NewGetStreamParams() beforehand.

type GetStreamURL

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

GetStreamURL generates an URL for the get stream operation

func (*GetStreamURL) Build

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

Build a url path and query string

func (*GetStreamURL) BuildFull

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

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

func (*GetStreamURL) Must

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

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

func (*GetStreamURL) SetBasePath

func (o *GetStreamURL) 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 (*GetStreamURL) String

func (o *GetStreamURL) String() string

String returns the string representation of the path with query string

func (*GetStreamURL) StringFull

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

StringFull returns the string representation of a complete url

func (*GetStreamURL) WithBasePath

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

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

type GetTest

type GetTest struct {
	Context *middleware.Context
	Handler GetTestHandler
}
GetTest swagger:route GET /test getTest

GetTest get test API

func NewGetTest

func NewGetTest(ctx *middleware.Context, handler GetTestHandler) *GetTest

NewGetTest creates a new http.Handler for the get test operation

func (*GetTest) ServeHTTP

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

type GetTestDefault

type GetTestDefault struct {

	/*
	  In: Body
	*/
	Payload *models.Zzz `json:"body,omitempty"`
	// contains filtered or unexported fields
}

GetTestDefault A reference to a type already defined in the models package (defaults to <<target>/models, defined by CLI flag --model-package). The response payload is defined as: *models.Zzz

swagger:response getTestDefault

func NewGetTestDefault

func NewGetTestDefault(code int) *GetTestDefault

NewGetTestDefault creates GetTestDefault with default headers values

func (*GetTestDefault) SetPayload

func (o *GetTestDefault) SetPayload(payload *models.Zzz)

SetPayload sets the payload to the get test default response

func (*GetTestDefault) SetStatusCode

func (o *GetTestDefault) SetStatusCode(code int)

SetStatusCode sets the status to the get test default response

func (*GetTestDefault) WithPayload

func (o *GetTestDefault) WithPayload(payload *models.Zzz) *GetTestDefault

WithPayload adds the payload to the get test default response

func (*GetTestDefault) WithStatusCode

func (o *GetTestDefault) WithStatusCode(code int) *GetTestDefault

WithStatusCode adds the status to the get test default response

func (*GetTestDefault) WriteResponse

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

WriteResponse to the client

type GetTestHandler

type GetTestHandler interface {
	Handle(GetTestParams) middleware.Responder
}

GetTestHandler interface for that can handle valid get test params

type GetTestHandlerFunc

type GetTestHandlerFunc func(GetTestParams) middleware.Responder

GetTestHandlerFunc turns a function with the right signature into a get test handler

func (GetTestHandlerFunc) Handle

Handle executing the request and returning a response

type GetTestParams

type GetTestParams struct {

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

GetTestParams contains all the bound params for the get test operation typically these are obtained from a http.Request

swagger:parameters GetTest

func NewGetTestParams

func NewGetTestParams() GetTestParams

NewGetTestParams creates a new GetTestParams object

There are no default values defined in the spec.

func (*GetTestParams) BindRequest

func (o *GetTestParams) 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.

To ensure default values, the struct must have been initialized with NewGetTestParams() beforehand.

type GetTestURL

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

GetTestURL generates an URL for the get test operation

func (*GetTestURL) Build

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

Build a url path and query string

func (*GetTestURL) BuildFull

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

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

func (*GetTestURL) Must

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

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

func (*GetTestURL) SetBasePath

func (o *GetTestURL) 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 (*GetTestURL) String

func (o *GetTestURL) String() string

String returns the string representation of the path with query string

func (*GetTestURL) StringFull

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

StringFull returns the string representation of a complete url

func (*GetTestURL) WithBasePath

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

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

type PostTest

type PostTest struct {
	Context *middleware.Context
	Handler PostTestHandler
}
PostTest swagger:route POST /test postTest

PostTest post test API

func NewPostTest

func NewPostTest(ctx *middleware.Context, handler PostTestHandler) *PostTest

NewPostTest creates a new http.Handler for the post test operation

func (*PostTest) ServeHTTP

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

type PostTestDefault

type PostTestDefault struct {

	/*
	  In: Body
	*/
	Payload map[string][]map[string]custom.MyAlternateString `json:"body,omitempty"`
	// contains filtered or unexported fields
}

PostTestDefault An inlined reference to an aliased external package. The response is defined as map[string][]map[string]custom.MyAlternateString

No definition is generated in models.

swagger:response postTestDefault

func NewPostTestDefault

func NewPostTestDefault(code int) *PostTestDefault

NewPostTestDefault creates PostTestDefault with default headers values

func (*PostTestDefault) SetPayload

func (o *PostTestDefault) SetPayload(payload map[string][]map[string]custom.MyAlternateString)

SetPayload sets the payload to the post test default response

func (*PostTestDefault) SetStatusCode

func (o *PostTestDefault) SetStatusCode(code int)

SetStatusCode sets the status to the post test default response

func (*PostTestDefault) WithPayload

func (o *PostTestDefault) WithPayload(payload map[string][]map[string]custom.MyAlternateString) *PostTestDefault

WithPayload adds the payload to the post test default response

func (*PostTestDefault) WithStatusCode

func (o *PostTestDefault) WithStatusCode(code int) *PostTestDefault

WithStatusCode adds the status to the post test default response

func (*PostTestDefault) WriteResponse

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

WriteResponse to the client

type PostTestHandler

type PostTestHandler interface {
	Handle(PostTestParams) middleware.Responder
}

PostTestHandler interface for that can handle valid post test params

type PostTestHandlerFunc

type PostTestHandlerFunc func(PostTestParams) middleware.Responder

PostTestHandlerFunc turns a function with the right signature into a post test handler

func (PostTestHandlerFunc) Handle

Handle executing the request and returning a response

type PostTestParams

type PostTestParams struct {

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

	/*Defines a parameter as an array of external types.
	The body parameter is defined as []custom.MyAlternateString

	No definition is generated in models.

	  In: body
	*/
	CustomizedStrings []custom.MyAlternateString
}

PostTestParams contains all the bound params for the post test operation typically these are obtained from a http.Request

swagger:parameters PostTest

func NewPostTestParams

func NewPostTestParams() PostTestParams

NewPostTestParams creates a new PostTestParams object

There are no default values defined in the spec.

func (*PostTestParams) BindRequest

func (o *PostTestParams) 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.

To ensure default values, the struct must have been initialized with NewPostTestParams() beforehand.

type PostTestURL

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

PostTestURL generates an URL for the post test operation

func (*PostTestURL) Build

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

Build a url path and query string

func (*PostTestURL) BuildFull

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

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

func (*PostTestURL) Must

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

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

func (*PostTestURL) SetBasePath

func (o *PostTestURL) 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 (*PostTestURL) String

func (o *PostTestURL) String() string

String returns the string representation of the path with query string

func (*PostTestURL) StringFull

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

StringFull returns the string representation of a complete url

func (*PostTestURL) WithBasePath

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

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

type PutTest

type PutTest struct {
	Context *middleware.Context
	Handler PutTestHandler
}
PutTest swagger:route PUT /test putTest

PutTest put test API

func NewPutTest

func NewPutTest(ctx *middleware.Context, handler PutTestHandler) *PutTest

NewPutTest creates a new http.Handler for the put test operation

func (*PutTest) ServeHTTP

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

type PutTestDefault

type PutTestDefault struct {

	/*
	  In: Body
	*/
	Payload map[string]custom.MyAlternateString `json:"body,omitempty"`
	// contains filtered or unexported fields
}

PutTestDefault A map of an aliased external package. Now the alias is "custom". This response is defined as: map[string]custom.MyAlternateString

swagger:response putTestDefault

func NewPutTestDefault

func NewPutTestDefault(code int) *PutTestDefault

NewPutTestDefault creates PutTestDefault with default headers values

func (*PutTestDefault) SetPayload

func (o *PutTestDefault) SetPayload(payload map[string]custom.MyAlternateString)

SetPayload sets the payload to the put test default response

func (*PutTestDefault) SetStatusCode

func (o *PutTestDefault) SetStatusCode(code int)

SetStatusCode sets the status to the put test default response

func (*PutTestDefault) WithPayload

func (o *PutTestDefault) WithPayload(payload map[string]custom.MyAlternateString) *PutTestDefault

WithPayload adds the payload to the put test default response

func (*PutTestDefault) WithStatusCode

func (o *PutTestDefault) WithStatusCode(code int) *PutTestDefault

WithStatusCode adds the status to the put test default response

func (*PutTestDefault) WriteResponse

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

WriteResponse to the client

type PutTestHandler

type PutTestHandler interface {
	Handle(PutTestParams) middleware.Responder
}

PutTestHandler interface for that can handle valid put test params

type PutTestHandlerFunc

type PutTestHandlerFunc func(PutTestParams) middleware.Responder

PutTestHandlerFunc turns a function with the right signature into a put test handler

func (PutTestHandlerFunc) Handle

Handle executing the request and returning a response

type PutTestParams

type PutTestParams struct {

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

	/*A reference to a type defined in the "fred" package, aliased
	as "alternate".

	MyAlternate alternate.MyAlternateType

	  Required: true
	  In: body
	*/
	MyAlternate alternate.MyAlternateType
}

PutTestParams contains all the bound params for the put test operation typically these are obtained from a http.Request

swagger:parameters PutTest

func NewPutTestParams

func NewPutTestParams() PutTestParams

NewPutTestParams creates a new PutTestParams object

There are no default values defined in the spec.

func (*PutTestParams) BindRequest

func (o *PutTestParams) 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.

To ensure default values, the struct must have been initialized with NewPutTestParams() beforehand.

type PutTestURL

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

PutTestURL generates an URL for the put test operation

func (*PutTestURL) Build

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

Build a url path and query string

func (*PutTestURL) BuildFull

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

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

func (*PutTestURL) Must

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

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

func (*PutTestURL) SetBasePath

func (o *PutTestURL) 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 (*PutTestURL) String

func (o *PutTestURL) String() string

String returns the string representation of the path with query string

func (*PutTestURL) StringFull

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

StringFull returns the string representation of a complete url

func (*PutTestURL) WithBasePath

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

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