operations

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const ConnectBadRequestCode int = 400

ConnectBadRequestCode is the HTTP code returned for type ConnectBadRequest

View Source
const ConnectInternalServerErrorCode int = 500

ConnectInternalServerErrorCode is the HTTP code returned for type ConnectInternalServerError

View Source
const ConnectOKCode int = 200

ConnectOKCode is the HTTP code returned for type ConnectOK

View Source
const ConnectUnauthorizedCode int = 401

ConnectUnauthorizedCode is the HTTP code returned for type ConnectUnauthorized

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessAPI

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

	// BearerAuth registers a function that takes a token and returns a principal
	// it performs authentication based on an api key Authorization provided in the header
	BearerAuth func(string) (interface{}, error)

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

	// ConnectHandler sets the operation handler for the connect operation
	ConnectHandler ConnectHandler

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

AccessAPI API for accessing github.com/practable/jump websocket ssh relay

func NewAccessAPI

func NewAccessAPI(spec *loads.Document) *AccessAPI

NewAccessAPI creates a new Access instance

func (*AccessAPI) AddMiddlewareFor

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

AddMiddlewareFor adds a http middleware to existing handler

func (*AccessAPI) AuthenticatorsFor

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

AuthenticatorsFor gets the authenticators for the specified security schemes

func (*AccessAPI) Authorizer

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

Authorizer returns the registered authorizer

func (*AccessAPI) ConsumersFor

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

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

func (*AccessAPI) Context

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

Context returns the middleware context for the access API

func (*AccessAPI) DefaultConsumes

func (o *AccessAPI) DefaultConsumes() string

DefaultConsumes returns the default consumes media type

func (*AccessAPI) DefaultProduces

func (o *AccessAPI) DefaultProduces() string

DefaultProduces returns the default produces media type

func (*AccessAPI) Formats

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

Formats returns the registered string formats

func (*AccessAPI) HandlerFor

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

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

func (*AccessAPI) Init

func (o *AccessAPI) Init()

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

func (*AccessAPI) ProducersFor

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

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

func (*AccessAPI) RegisterConsumer

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

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

func (*AccessAPI) RegisterFormat

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

RegisterFormat registers a custom format validator

func (*AccessAPI) RegisterProducer

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

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

func (*AccessAPI) Serve

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

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

ServeErrorFor gets a error handler for a given operation id

func (*AccessAPI) SetDefaultConsumes

func (o *AccessAPI) SetDefaultConsumes(mediaType string)

SetDefaultConsumes returns the default consumes media type

func (*AccessAPI) SetDefaultProduces

func (o *AccessAPI) SetDefaultProduces(mediaType string)

SetDefaultProduces sets the default produces media type

func (*AccessAPI) SetSpec

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

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

func (*AccessAPI) UseRedoc

func (o *AccessAPI) UseRedoc()

UseRedoc for documentation at /docs

func (*AccessAPI) UseSwaggerUI

func (o *AccessAPI) UseSwaggerUI()

UseSwaggerUI for documentation at /docs

func (*AccessAPI) Validate

func (o *AccessAPI) Validate() error

Validate validates the registrations in the AccessAPI

type Connect added in v0.3.0

type Connect struct {
	Context *middleware.Context
	Handler ConnectHandler
}
Connect swagger:route POST /connect/{host_id} connect

request a websocket connection for host specified by host_id

Request a websocket connection for host specified by host_id.

func NewConnect added in v0.3.0

func NewConnect(ctx *middleware.Context, handler ConnectHandler) *Connect

NewConnect creates a new http.Handler for the connect operation

func (*Connect) ServeHTTP added in v0.3.0

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

type ConnectBadRequest added in v0.3.0

type ConnectBadRequest struct {

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

ConnectBadRequest BadRequest

swagger:response connectBadRequest

func NewConnectBadRequest added in v0.3.0

func NewConnectBadRequest() *ConnectBadRequest

NewConnectBadRequest creates ConnectBadRequest with default headers values

func (*ConnectBadRequest) SetPayload added in v0.3.0

func (o *ConnectBadRequest) SetPayload(payload *models.Error)

SetPayload sets the payload to the connect bad request response

func (*ConnectBadRequest) WithPayload added in v0.3.0

func (o *ConnectBadRequest) WithPayload(payload *models.Error) *ConnectBadRequest

WithPayload adds the payload to the connect bad request response

func (*ConnectBadRequest) WriteResponse added in v0.3.0

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

WriteResponse to the client

type ConnectHandler added in v0.3.0

type ConnectHandler interface {
	Handle(ConnectParams, interface{}) middleware.Responder
}

ConnectHandler interface for that can handle valid connect params

type ConnectHandlerFunc added in v0.3.0

type ConnectHandlerFunc func(ConnectParams, interface{}) middleware.Responder

ConnectHandlerFunc turns a function with the right signature into a connect handler

func (ConnectHandlerFunc) Handle added in v0.3.0

func (fn ConnectHandlerFunc) Handle(params ConnectParams, principal interface{}) middleware.Responder

Handle executing the request and returning a response

type ConnectInternalServerError added in v0.3.0

type ConnectInternalServerError struct {

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

ConnectInternalServerError Internal Error

swagger:response connectInternalServerError

func NewConnectInternalServerError added in v0.3.0

func NewConnectInternalServerError() *ConnectInternalServerError

NewConnectInternalServerError creates ConnectInternalServerError with default headers values

func (*ConnectInternalServerError) SetPayload added in v0.3.0

func (o *ConnectInternalServerError) SetPayload(payload *models.Error)

SetPayload sets the payload to the connect internal server error response

func (*ConnectInternalServerError) WithPayload added in v0.3.0

WithPayload adds the payload to the connect internal server error response

func (*ConnectInternalServerError) WriteResponse added in v0.3.0

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

WriteResponse to the client

type ConnectOK added in v0.3.0

type ConnectOK struct {

	/*
	  In: Body
	*/
	Payload *ConnectOKBody `json:"body,omitempty"`
}

ConnectOK connect o k

swagger:response connectOK

func NewConnectOK added in v0.3.0

func NewConnectOK() *ConnectOK

NewConnectOK creates ConnectOK with default headers values

func (*ConnectOK) SetPayload added in v0.3.0

func (o *ConnectOK) SetPayload(payload *ConnectOKBody)

SetPayload sets the payload to the connect o k response

func (*ConnectOK) WithPayload added in v0.3.0

func (o *ConnectOK) WithPayload(payload *ConnectOKBody) *ConnectOK

WithPayload adds the payload to the connect o k response

func (*ConnectOK) WriteResponse added in v0.3.0

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

WriteResponse to the client

type ConnectOKBody added in v0.3.0

type ConnectOKBody struct {

	// uri
	URI string `json:"uri,omitempty"`
}

ConnectOKBody connect o k body

swagger:model ConnectOKBody

func (*ConnectOKBody) ContextValidate added in v0.3.0

func (o *ConnectOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error

ContextValidate validates this connect o k body based on context it is used

func (*ConnectOKBody) MarshalBinary added in v0.3.0

func (o *ConnectOKBody) MarshalBinary() ([]byte, error)

MarshalBinary interface implementation

func (*ConnectOKBody) UnmarshalBinary added in v0.3.0

func (o *ConnectOKBody) UnmarshalBinary(b []byte) error

UnmarshalBinary interface implementation

func (*ConnectOKBody) Validate added in v0.3.0

func (o *ConnectOKBody) Validate(formats strfmt.Registry) error

Validate validates this connect o k body

type ConnectParams added in v0.3.0

type ConnectParams struct {

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

	/*Jump host identification code
	  Required: true
	  In: path
	*/
	HostID string
}

ConnectParams contains all the bound params for the connect operation typically these are obtained from a http.Request

swagger:parameters connect

func NewConnectParams added in v0.3.0

func NewConnectParams() ConnectParams

NewConnectParams creates a new ConnectParams object

There are no default values defined in the spec.

func (*ConnectParams) BindRequest added in v0.3.0

func (o *ConnectParams) 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 NewConnectParams() beforehand.

type ConnectURL added in v0.3.0

type ConnectURL struct {
	HostID string
	// contains filtered or unexported fields
}

ConnectURL generates an URL for the connect operation

func (*ConnectURL) Build added in v0.3.0

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

Build a url path and query string

func (*ConnectURL) BuildFull added in v0.3.0

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

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

func (*ConnectURL) Must added in v0.3.0

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

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

func (*ConnectURL) SetBasePath added in v0.3.0

func (o *ConnectURL) 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 (*ConnectURL) String added in v0.3.0

func (o *ConnectURL) String() string

String returns the string representation of the path with query string

func (*ConnectURL) StringFull added in v0.3.0

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

StringFull returns the string representation of a complete url

func (*ConnectURL) WithBasePath added in v0.3.0

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

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 ConnectUnauthorized added in v0.3.0

type ConnectUnauthorized struct {

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

ConnectUnauthorized Unauthorized

swagger:response connectUnauthorized

func NewConnectUnauthorized added in v0.3.0

func NewConnectUnauthorized() *ConnectUnauthorized

NewConnectUnauthorized creates ConnectUnauthorized with default headers values

func (*ConnectUnauthorized) SetPayload added in v0.3.0

func (o *ConnectUnauthorized) SetPayload(payload *models.Error)

SetPayload sets the payload to the connect unauthorized response

func (*ConnectUnauthorized) WithPayload added in v0.3.0

func (o *ConnectUnauthorized) WithPayload(payload *models.Error) *ConnectUnauthorized

WithPayload adds the payload to the connect unauthorized response

func (*ConnectUnauthorized) WriteResponse added in v0.3.0

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

WriteResponse to the client

Jump to

Keyboard shortcuts

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