Documentation
¶
Index ¶
- type TerseurlAPI
- func (o *TerseurlAPI) AddMiddlewareFor(method, path string, builder middleware.Builder)
- func (o *TerseurlAPI) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]runtime.Authenticator
- func (o *TerseurlAPI) Authorizer() runtime.Authorizer
- func (o *TerseurlAPI) ConsumersFor(mediaTypes []string) map[string]runtime.Consumer
- func (o *TerseurlAPI) Context() *middleware.Context
- func (o *TerseurlAPI) DefaultConsumes() string
- func (o *TerseurlAPI) DefaultProduces() string
- func (o *TerseurlAPI) Formats() strfmt.Registry
- func (o *TerseurlAPI) HandlerFor(method, path string) (http.Handler, bool)
- func (o *TerseurlAPI) Init()
- func (o *TerseurlAPI) ProducersFor(mediaTypes []string) map[string]runtime.Producer
- func (o *TerseurlAPI) RegisterConsumer(mediaType string, consumer runtime.Consumer)
- func (o *TerseurlAPI) RegisterFormat(name string, format strfmt.Format, validator strfmt.Validator)
- func (o *TerseurlAPI) RegisterProducer(mediaType string, producer runtime.Producer)
- func (o *TerseurlAPI) Serve(builder middleware.Builder) http.Handler
- func (o *TerseurlAPI) ServeErrorFor(operationID string) func(http.ResponseWriter, *http.Request, error)
- func (o *TerseurlAPI) SetDefaultConsumes(mediaType string)
- func (o *TerseurlAPI) SetDefaultProduces(mediaType string)
- func (o *TerseurlAPI) SetSpec(spec *loads.Document)
- func (o *TerseurlAPI) UseRedoc()
- func (o *TerseurlAPI) UseSwaggerUI()
- func (o *TerseurlAPI) Validate() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TerseurlAPI ¶ added in v0.0.3
type TerseurlAPI 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
// HTMLProducer registers a producer for the following mime types:
// - text/html
HTMLProducer runtime.Producer
// JSONProducer registers a producer for the following mime types:
// - application/json
JSONProducer runtime.Producer
// JWTAuth registers a function that takes a token and returns a principal
// it performs authentication based on an api key Authorization provided in the header
JWTAuth func(string) (*models.Principal, error)
// APIAuthorizer provides access control (ACL/RBAC/ABAC) by providing access to the request and authenticated principal
APIAuthorizer runtime.Authorizer
// APIExportHandler sets the operation handler for the export operation
APIExportHandler apiops.ExportHandler
// APIFrontendMetaHandler sets the operation handler for the frontend meta operation
APIFrontendMetaHandler apiops.FrontendMetaHandler
// APIImportHandler sets the operation handler for the import operation
APIImportHandler apiops.ImportHandler
// PublicPublicRedirectHandler sets the operation handler for the public redirect operation
PublicPublicRedirectHandler public.PublicRedirectHandler
// APIShortenedDeleteHandler sets the operation handler for the shortened delete operation
APIShortenedDeleteHandler apiops.ShortenedDeleteHandler
// APIShortenedPrefixHandler sets the operation handler for the shortened prefix operation
APIShortenedPrefixHandler apiops.ShortenedPrefixHandler
// APIShortenedSummaryHandler sets the operation handler for the shortened summary operation
APIShortenedSummaryHandler apiops.ShortenedSummaryHandler
// SystemSystemAliveHandler sets the operation handler for the system alive operation
SystemSystemAliveHandler system.SystemAliveHandler
// APITerseReadHandler sets the operation handler for the terse read operation
APITerseReadHandler apiops.TerseReadHandler
// APITerseWriteHandler sets the operation handler for the terse write operation
APITerseWriteHandler apiops.TerseWriteHandler
// APIVisitsDeleteHandler sets the operation handler for the visits delete operation
APIVisitsDeleteHandler apiops.VisitsDeleteHandler
// APIVisitsReadHandler sets the operation handler for the visits read operation
APIVisitsReadHandler apiops.VisitsReadHandler
// 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
}
TerseurlAPI The Terse URL shortener.
func NewTerseurlAPI ¶ added in v0.0.3
func NewTerseurlAPI(spec *loads.Document) *TerseurlAPI
NewTerseurlAPI creates a new Terseurl instance
func (*TerseurlAPI) AddMiddlewareFor ¶ added in v0.0.3
func (o *TerseurlAPI) AddMiddlewareFor(method, path string, builder middleware.Builder)
AddMiddlewareFor adds a http middleware to existing handler
func (*TerseurlAPI) AuthenticatorsFor ¶ added in v0.0.3
func (o *TerseurlAPI) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]runtime.Authenticator
AuthenticatorsFor gets the authenticators for the specified security schemes
func (*TerseurlAPI) Authorizer ¶ added in v0.0.3
func (o *TerseurlAPI) Authorizer() runtime.Authorizer
Authorizer returns the registered authorizer
func (*TerseurlAPI) ConsumersFor ¶ added in v0.0.3
func (o *TerseurlAPI) ConsumersFor(mediaTypes []string) map[string]runtime.Consumer
ConsumersFor gets the consumers for the specified media types. MIME type parameters are ignored here.
func (*TerseurlAPI) Context ¶ added in v0.0.3
func (o *TerseurlAPI) Context() *middleware.Context
Context returns the middleware context for the terseurl API
func (*TerseurlAPI) DefaultConsumes ¶ added in v0.0.3
func (o *TerseurlAPI) DefaultConsumes() string
DefaultConsumes returns the default consumes media type
func (*TerseurlAPI) DefaultProduces ¶ added in v0.0.3
func (o *TerseurlAPI) DefaultProduces() string
DefaultProduces returns the default produces media type
func (*TerseurlAPI) Formats ¶ added in v0.0.3
func (o *TerseurlAPI) Formats() strfmt.Registry
Formats returns the registered string formats
func (*TerseurlAPI) HandlerFor ¶ added in v0.0.3
func (o *TerseurlAPI) HandlerFor(method, path string) (http.Handler, bool)
HandlerFor gets a http.Handler for the provided operation method and path
func (*TerseurlAPI) Init ¶ added in v0.0.3
func (o *TerseurlAPI) Init()
Init allows you to just initialize the handler cache, you can then recompose the middleware as you see fit
func (*TerseurlAPI) ProducersFor ¶ added in v0.0.3
func (o *TerseurlAPI) ProducersFor(mediaTypes []string) map[string]runtime.Producer
ProducersFor gets the producers for the specified media types. MIME type parameters are ignored here.
func (*TerseurlAPI) RegisterConsumer ¶ added in v0.0.3
func (o *TerseurlAPI) RegisterConsumer(mediaType string, consumer runtime.Consumer)
RegisterConsumer allows you to add (or override) a consumer for a media type.
func (*TerseurlAPI) RegisterFormat ¶ added in v0.0.3
RegisterFormat registers a custom format validator
func (*TerseurlAPI) RegisterProducer ¶ added in v0.0.3
func (o *TerseurlAPI) RegisterProducer(mediaType string, producer runtime.Producer)
RegisterProducer allows you to add (or override) a producer for a media type.
func (*TerseurlAPI) Serve ¶ added in v0.0.3
func (o *TerseurlAPI) 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 (*TerseurlAPI) ServeErrorFor ¶ added in v0.0.3
func (o *TerseurlAPI) ServeErrorFor(operationID string) func(http.ResponseWriter, *http.Request, error)
ServeErrorFor gets a error handler for a given operation id
func (*TerseurlAPI) SetDefaultConsumes ¶ added in v0.0.3
func (o *TerseurlAPI) SetDefaultConsumes(mediaType string)
SetDefaultConsumes returns the default consumes media type
func (*TerseurlAPI) SetDefaultProduces ¶ added in v0.0.3
func (o *TerseurlAPI) SetDefaultProduces(mediaType string)
SetDefaultProduces sets the default produces media type
func (*TerseurlAPI) SetSpec ¶ added in v0.0.3
func (o *TerseurlAPI) SetSpec(spec *loads.Document)
SetSpec sets a spec that will be served for the clients.
func (*TerseurlAPI) UseRedoc ¶ added in v0.0.3
func (o *TerseurlAPI) UseRedoc()
UseRedoc for documentation at /docs
func (*TerseurlAPI) UseSwaggerUI ¶ added in v0.0.3
func (o *TerseurlAPI) UseSwaggerUI()
UseSwaggerUI for documentation at /docs
func (*TerseurlAPI) Validate ¶ added in v0.0.3
func (o *TerseurlAPI) Validate() error
Validate validates the registrations in the TerseurlAPI