operations

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FlagrAPI

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

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

	// ConstraintCreateConstraintHandler sets the operation handler for the create constraint operation
	ConstraintCreateConstraintHandler constraint.CreateConstraintHandler
	// FlagCreateFlagHandler sets the operation handler for the create flag operation
	FlagCreateFlagHandler flag.CreateFlagHandler
	// SegmentCreateSegmentHandler sets the operation handler for the create segment operation
	SegmentCreateSegmentHandler segment.CreateSegmentHandler
	// TagCreateTagHandler sets the operation handler for the create tag operation
	TagCreateTagHandler tag.CreateTagHandler
	// VariantCreateVariantHandler sets the operation handler for the create variant operation
	VariantCreateVariantHandler variant.CreateVariantHandler
	// ConstraintDeleteConstraintHandler sets the operation handler for the delete constraint operation
	ConstraintDeleteConstraintHandler constraint.DeleteConstraintHandler
	// FlagDeleteFlagHandler sets the operation handler for the delete flag operation
	FlagDeleteFlagHandler flag.DeleteFlagHandler
	// SegmentDeleteSegmentHandler sets the operation handler for the delete segment operation
	SegmentDeleteSegmentHandler segment.DeleteSegmentHandler
	// TagDeleteTagHandler sets the operation handler for the delete tag operation
	TagDeleteTagHandler tag.DeleteTagHandler
	// VariantDeleteVariantHandler sets the operation handler for the delete variant operation
	VariantDeleteVariantHandler variant.DeleteVariantHandler
	// TagFindAllTagsHandler sets the operation handler for the find all tags operation
	TagFindAllTagsHandler tag.FindAllTagsHandler
	// ConstraintFindConstraintsHandler sets the operation handler for the find constraints operation
	ConstraintFindConstraintsHandler constraint.FindConstraintsHandler
	// DistributionFindDistributionsHandler sets the operation handler for the find distributions operation
	DistributionFindDistributionsHandler distribution.FindDistributionsHandler
	// FlagFindFlagsHandler sets the operation handler for the find flags operation
	FlagFindFlagsHandler flag.FindFlagsHandler
	// SegmentFindSegmentsHandler sets the operation handler for the find segments operation
	SegmentFindSegmentsHandler segment.FindSegmentsHandler
	// TagFindTagsHandler sets the operation handler for the find tags operation
	TagFindTagsHandler tag.FindTagsHandler
	// VariantFindVariantsHandler sets the operation handler for the find variants operation
	VariantFindVariantsHandler variant.FindVariantsHandler
	// ExportGetExportEvalCacheJSONHandler sets the operation handler for the get export eval cache JSON operation
	ExportGetExportEvalCacheJSONHandler export.GetExportEvalCacheJSONHandler
	// ExportGetExportSqliteHandler sets the operation handler for the get export sqlite operation
	ExportGetExportSqliteHandler export.GetExportSqliteHandler
	// FlagGetFlagHandler sets the operation handler for the get flag operation
	FlagGetFlagHandler flag.GetFlagHandler
	// FlagGetFlagEntityTypesHandler sets the operation handler for the get flag entity types operation
	FlagGetFlagEntityTypesHandler flag.GetFlagEntityTypesHandler
	// FlagGetFlagSnapshotsHandler sets the operation handler for the get flag snapshots operation
	FlagGetFlagSnapshotsHandler flag.GetFlagSnapshotsHandler
	// HealthGetHealthHandler sets the operation handler for the get health operation
	HealthGetHealthHandler health.GetHealthHandler
	// EvaluationPostEvaluationHandler sets the operation handler for the post evaluation operation
	EvaluationPostEvaluationHandler evaluation.PostEvaluationHandler
	// EvaluationPostEvaluationBatchHandler sets the operation handler for the post evaluation batch operation
	EvaluationPostEvaluationBatchHandler evaluation.PostEvaluationBatchHandler
	// ConstraintPutConstraintHandler sets the operation handler for the put constraint operation
	ConstraintPutConstraintHandler constraint.PutConstraintHandler
	// DistributionPutDistributionsHandler sets the operation handler for the put distributions operation
	DistributionPutDistributionsHandler distribution.PutDistributionsHandler
	// FlagPutFlagHandler sets the operation handler for the put flag operation
	FlagPutFlagHandler flag.PutFlagHandler
	// SegmentPutSegmentHandler sets the operation handler for the put segment operation
	SegmentPutSegmentHandler segment.PutSegmentHandler
	// SegmentPutSegmentsReorderHandler sets the operation handler for the put segments reorder operation
	SegmentPutSegmentsReorderHandler segment.PutSegmentsReorderHandler
	// VariantPutVariantHandler sets the operation handler for the put variant operation
	VariantPutVariantHandler variant.PutVariantHandler
	// FlagRestoreFlagHandler sets the operation handler for the restore flag operation
	FlagRestoreFlagHandler flag.RestoreFlagHandler
	// FlagSetFlagEnabledHandler sets the operation handler for the set flag enabled operation
	FlagSetFlagEnabledHandler flag.SetFlagEnabledHandler

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

FlagrAPI Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is "/api/v1".

func NewFlagrAPI

func NewFlagrAPI(spec *loads.Document) *FlagrAPI

NewFlagrAPI creates a new Flagr instance

func (*FlagrAPI) AddMiddlewareFor

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

AddMiddlewareFor adds a http middleware to existing handler

func (*FlagrAPI) AuthenticatorsFor

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

AuthenticatorsFor gets the authenticators for the specified security schemes

func (*FlagrAPI) Authorizer

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

Authorizer returns the registered authorizer

func (*FlagrAPI) ConsumersFor

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

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

func (*FlagrAPI) Context

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

Context returns the middleware context for the flagr API

func (*FlagrAPI) DefaultConsumes

func (o *FlagrAPI) DefaultConsumes() string

DefaultConsumes returns the default consumes media type

func (*FlagrAPI) DefaultProduces

func (o *FlagrAPI) DefaultProduces() string

DefaultProduces returns the default produces media type

func (*FlagrAPI) Formats

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

Formats returns the registered string formats

func (*FlagrAPI) HandlerFor

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

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

func (*FlagrAPI) Init

func (o *FlagrAPI) Init()

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

func (*FlagrAPI) ProducersFor

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

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

func (*FlagrAPI) RegisterConsumer

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

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

func (*FlagrAPI) RegisterFormat

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

RegisterFormat registers a custom format validator

func (*FlagrAPI) RegisterProducer

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

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

func (*FlagrAPI) Serve

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

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

ServeErrorFor gets a error handler for a given operation id

func (*FlagrAPI) SetDefaultConsumes

func (o *FlagrAPI) SetDefaultConsumes(mediaType string)

SetDefaultConsumes returns the default consumes media type

func (*FlagrAPI) SetDefaultProduces

func (o *FlagrAPI) SetDefaultProduces(mediaType string)

SetDefaultProduces sets the default produces media type

func (*FlagrAPI) SetSpec

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

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

func (*FlagrAPI) UseRedoc

func (o *FlagrAPI) UseRedoc()

UseRedoc for documentation at /docs

func (*FlagrAPI) UseSwaggerUI

func (o *FlagrAPI) UseSwaggerUI()

UseSwaggerUI for documentation at /docs

func (*FlagrAPI) Validate

func (o *FlagrAPI) Validate() error

Validate validates the registrations in the FlagrAPI

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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