Help us shape the future of Go! Take the 2026 Go Developer Survey

operations

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HtaAPI

type HtaAPI 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

	// BearerTokenAuth registers a function that takes a token and returns a principal
	// it performs authentication based on an api key x-token provided in the header
	BearerTokenAuth func(string) (*schemas.User, error)

	// OauthSecurityAuth registers a function that takes an access token and a collection of required scopes and returns a principal
	// it performs authentication based on an oauth2 bearer token provided in the request
	OauthSecurityAuth func(string, []string) (*schemas.User, error)

	// APIAuthorizer provides access control (ACL/RBAC/ABAC) by providing access to the request and authenticated principal
	APIAuthorizer runtime.Authorizer

	// CategoryDeleteCategoryIDHandler sets the operation handler for the delete category ID operation
	CategoryDeleteCategoryIDHandler category.DeleteCategoryIDHandler
	// EntryDeleteEntriesIDHandler sets the operation handler for the delete entries ID operation
	EntryDeleteEntriesIDHandler entry.DeleteEntriesIDHandler
	// CategoryDeleteMultiChoiceIDHandler sets the operation handler for the delete multi choice ID operation
	CategoryDeleteMultiChoiceIDHandler category.DeleteMultiChoiceIDHandler
	// CategoryDeleteSingleChoiceGroupIDHandler sets the operation handler for the delete single choice group ID operation
	CategoryDeleteSingleChoiceGroupIDHandler category.DeleteSingleChoiceGroupIDHandler
	// CategoryDeleteSingleChoiceIDHandler sets the operation handler for the delete single choice ID operation
	CategoryDeleteSingleChoiceIDHandler category.DeleteSingleChoiceIDHandler
	// CategoryGetCategoryHandler sets the operation handler for the get category operation
	CategoryGetCategoryHandler category.GetCategoryHandler
	// CategoryGetCategoryCategoryIDMultiChoiceHandler sets the operation handler for the get category category ID multi choice operation
	CategoryGetCategoryCategoryIDMultiChoiceHandler category.GetCategoryCategoryIDMultiChoiceHandler
	// CategoryGetCategoryCategoryIDSingleChoiceGroupHandler sets the operation handler for the get category category ID single choice group operation
	CategoryGetCategoryCategoryIDSingleChoiceGroupHandler category.GetCategoryCategoryIDSingleChoiceGroupHandler
	// CategoryGetCategoryIDHandler sets the operation handler for the get category ID operation
	CategoryGetCategoryIDHandler category.GetCategoryIDHandler
	// EntryGetEntriesHandler sets the operation handler for the get entries operation
	EntryGetEntriesHandler entry.GetEntriesHandler
	// EntryGetEntriesIDHandler sets the operation handler for the get entries ID operation
	EntryGetEntriesIDHandler entry.GetEntriesIDHandler
	// CategoryGetMultiChoiceIDHandler sets the operation handler for the get multi choice ID operation
	CategoryGetMultiChoiceIDHandler category.GetMultiChoiceIDHandler
	// LoginGetOidcInfoHandler sets the operation handler for the get oidc info operation
	LoginGetOidcInfoHandler login.GetOidcInfoHandler
	// CategoryGetSingleChoiceGroupGroupIDSingleChoiceHandler sets the operation handler for the get single choice group group ID single choice operation
	CategoryGetSingleChoiceGroupGroupIDSingleChoiceHandler category.GetSingleChoiceGroupGroupIDSingleChoiceHandler
	// CategoryGetSingleChoiceGroupIDHandler sets the operation handler for the get single choice group ID operation
	CategoryGetSingleChoiceGroupIDHandler category.GetSingleChoiceGroupIDHandler
	// CategoryGetSingleChoiceIDHandler sets the operation handler for the get single choice ID operation
	CategoryGetSingleChoiceIDHandler category.GetSingleChoiceIDHandler
	// LoginGetUserHandler sets the operation handler for the get user operation
	LoginGetUserHandler login.GetUserHandler
	// CategoryPostCategoryHandler sets the operation handler for the post category operation
	CategoryPostCategoryHandler category.PostCategoryHandler
	// CategoryPostCategoryCategoryIDMultiChoiceHandler sets the operation handler for the post category category ID multi choice operation
	CategoryPostCategoryCategoryIDMultiChoiceHandler category.PostCategoryCategoryIDMultiChoiceHandler
	// CategoryPostCategoryCategoryIDSingleChoiceGroupHandler sets the operation handler for the post category category ID single choice group operation
	CategoryPostCategoryCategoryIDSingleChoiceGroupHandler category.PostCategoryCategoryIDSingleChoiceGroupHandler
	// EntryPostEntriesHandler sets the operation handler for the post entries operation
	EntryPostEntriesHandler entry.PostEntriesHandler
	// CategoryPostSingleChoiceGroupGroupIDSingleChoiceHandler sets the operation handler for the post single choice group group ID single choice operation
	CategoryPostSingleChoiceGroupGroupIDSingleChoiceHandler category.PostSingleChoiceGroupGroupIDSingleChoiceHandler
	// CategoryPutCategoryIDHandler sets the operation handler for the put category ID operation
	CategoryPutCategoryIDHandler category.PutCategoryIDHandler
	// EntryPutEntriesIDHandler sets the operation handler for the put entries ID operation
	EntryPutEntriesIDHandler entry.PutEntriesIDHandler
	// CategoryPutMultiChoiceIDHandler sets the operation handler for the put multi choice ID operation
	CategoryPutMultiChoiceIDHandler category.PutMultiChoiceIDHandler
	// CategoryPutSingleChoiceGroupIDHandler sets the operation handler for the put single choice group ID operation
	CategoryPutSingleChoiceGroupIDHandler category.PutSingleChoiceGroupIDHandler
	// CategoryPutSingleChoiceIDHandler sets the operation handler for the put single choice ID operation
	CategoryPutSingleChoiceIDHandler category.PutSingleChoiceIDHandler

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

HtaAPI Track Health Parameters

func NewHtaAPI

func NewHtaAPI(spec *loads.Document) *HtaAPI

NewHtaAPI creates a new Hta instance

func (*HtaAPI) AddMiddlewareFor

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

AddMiddlewareFor adds a http middleware to existing handler

func (*HtaAPI) AuthenticatorsFor

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

AuthenticatorsFor gets the authenticators for the specified security schemes

func (*HtaAPI) Authorizer

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

Authorizer returns the registered authorizer

func (*HtaAPI) ConsumersFor

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

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

func (*HtaAPI) Context

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

Context returns the middleware context for the hta API

func (*HtaAPI) DefaultConsumes

func (o *HtaAPI) DefaultConsumes() string

DefaultConsumes returns the default consumes media type

func (*HtaAPI) DefaultProduces

func (o *HtaAPI) DefaultProduces() string

DefaultProduces returns the default produces media type

func (*HtaAPI) Formats

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

Formats returns the registered string formats

func (*HtaAPI) HandlerFor

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

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

func (*HtaAPI) Init

func (o *HtaAPI) Init()

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

func (*HtaAPI) ProducersFor

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

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

func (*HtaAPI) RegisterConsumer

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

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

func (*HtaAPI) RegisterFormat

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

RegisterFormat registers a custom format validator

func (*HtaAPI) RegisterProducer

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

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

func (*HtaAPI) Serve

func (o *HtaAPI) 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 (*HtaAPI) ServeErrorFor

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

ServeErrorFor gets a error handler for a given operation id

func (*HtaAPI) SetDefaultConsumes

func (o *HtaAPI) SetDefaultConsumes(mediaType string)

SetDefaultConsumes returns the default consumes media type

func (*HtaAPI) SetDefaultProduces

func (o *HtaAPI) SetDefaultProduces(mediaType string)

SetDefaultProduces sets the default produces media type

func (*HtaAPI) SetSpec

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

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

func (*HtaAPI) UseRedoc

func (o *HtaAPI) UseRedoc()

UseRedoc for documentation at /docs

func (*HtaAPI) UseSwaggerUI

func (o *HtaAPI) UseSwaggerUI()

UseSwaggerUI for documentation at /docs

func (*HtaAPI) Validate

func (o *HtaAPI) Validate() error

Validate validates the registrations in the HtaAPI

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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