operations

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArcherAPI

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

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

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

	// EndpointDeleteEndpointEndpointIDHandler sets the operation handler for the delete endpoint endpoint ID operation
	EndpointDeleteEndpointEndpointIDHandler endpoint.DeleteEndpointEndpointIDHandler
	// QuotaDeleteQuotasProjectIDHandler sets the operation handler for the delete quotas project ID operation
	QuotaDeleteQuotasProjectIDHandler quota.DeleteQuotasProjectIDHandler
	// RbacDeleteRbacPoliciesRbacPolicyIDHandler sets the operation handler for the delete rbac policies rbac policy ID operation
	RbacDeleteRbacPoliciesRbacPolicyIDHandler rbac.DeleteRbacPoliciesRbacPolicyIDHandler
	// ServiceDeleteServiceServiceIDHandler sets the operation handler for the delete service service ID operation
	ServiceDeleteServiceServiceIDHandler service.DeleteServiceServiceIDHandler
	// VersionGetHandler sets the operation handler for the get operation
	VersionGetHandler version.GetHandler
	// EndpointGetEndpointHandler sets the operation handler for the get endpoint operation
	EndpointGetEndpointHandler endpoint.GetEndpointHandler
	// EndpointGetEndpointEndpointIDHandler sets the operation handler for the get endpoint endpoint ID operation
	EndpointGetEndpointEndpointIDHandler endpoint.GetEndpointEndpointIDHandler
	// QuotaGetQuotasHandler sets the operation handler for the get quotas operation
	QuotaGetQuotasHandler quota.GetQuotasHandler
	// QuotaGetQuotasDefaultsHandler sets the operation handler for the get quotas defaults operation
	QuotaGetQuotasDefaultsHandler quota.GetQuotasDefaultsHandler
	// QuotaGetQuotasProjectIDHandler sets the operation handler for the get quotas project ID operation
	QuotaGetQuotasProjectIDHandler quota.GetQuotasProjectIDHandler
	// RbacGetRbacPoliciesHandler sets the operation handler for the get rbac policies operation
	RbacGetRbacPoliciesHandler rbac.GetRbacPoliciesHandler
	// RbacGetRbacPoliciesRbacPolicyIDHandler sets the operation handler for the get rbac policies rbac policy ID operation
	RbacGetRbacPoliciesRbacPolicyIDHandler rbac.GetRbacPoliciesRbacPolicyIDHandler
	// ServiceGetServiceHandler sets the operation handler for the get service operation
	ServiceGetServiceHandler service.GetServiceHandler
	// ServiceGetServiceServiceIDHandler sets the operation handler for the get service service ID operation
	ServiceGetServiceServiceIDHandler service.GetServiceServiceIDHandler
	// ServiceGetServiceServiceIDEndpointsHandler sets the operation handler for the get service service ID endpoints operation
	ServiceGetServiceServiceIDEndpointsHandler service.GetServiceServiceIDEndpointsHandler
	// EndpointPostEndpointHandler sets the operation handler for the post endpoint operation
	EndpointPostEndpointHandler endpoint.PostEndpointHandler
	// RbacPostRbacPoliciesHandler sets the operation handler for the post rbac policies operation
	RbacPostRbacPoliciesHandler rbac.PostRbacPoliciesHandler
	// ServicePostServiceHandler sets the operation handler for the post service operation
	ServicePostServiceHandler service.PostServiceHandler
	// EndpointPutEndpointEndpointIDHandler sets the operation handler for the put endpoint endpoint ID operation
	EndpointPutEndpointEndpointIDHandler endpoint.PutEndpointEndpointIDHandler
	// QuotaPutQuotasProjectIDHandler sets the operation handler for the put quotas project ID operation
	QuotaPutQuotasProjectIDHandler quota.PutQuotasProjectIDHandler
	// RbacPutRbacPoliciesRbacPolicyIDHandler sets the operation handler for the put rbac policies rbac policy ID operation
	RbacPutRbacPoliciesRbacPolicyIDHandler rbac.PutRbacPoliciesRbacPolicyIDHandler
	// ServicePutServiceServiceIDHandler sets the operation handler for the put service service ID operation
	ServicePutServiceServiceIDHandler service.PutServiceServiceIDHandler
	// ServicePutServiceServiceIDAcceptEndpointsHandler sets the operation handler for the put service service ID accept endpoints operation
	ServicePutServiceServiceIDAcceptEndpointsHandler service.PutServiceServiceIDAcceptEndpointsHandler
	// ServicePutServiceServiceIDRejectEndpointsHandler sets the operation handler for the put service service ID reject endpoints operation
	ServicePutServiceServiceIDRejectEndpointsHandler service.PutServiceServiceIDRejectEndpointsHandler

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

ArcherAPI Archer is an API service that can privately connect services from one private [OpenStack Network](https://docs.openstack.org/neutron/latest/admin/intro-os-networking.html) to another. Consumers can select a *service* from a service catalog and **inject** it to their network, which means making this *service* available via a private ip address.

Archer implements an *OpenStack* like API and integrates with *OpenStack Keystone* and *OpenStack Neutron*.

### Architecture There are two types of resources: **services** and **endpoints**

* **Services** are private or public services that are manually configured in *Archer*. They can be accessed by creating an endpoint. * **Service endpoints**, or short **endpoints**, are IP endpoints in a local network used to transparently access services residing in different private networks.

### Features * Multi-tenant capable via OpenStack Identity service * OpenStack `policy.json` access policy support * Prometheus Exporter * Rate limiting

### Supported Backends * F5 BigIP

### Requirements * PostgreSQL Database

### API This section describes properties of the Archer API. It uses a ReSTful HTTP API.

#### Request format The Archer API only accepts requests with the JSON data serialization format. The Content-Type header for POST requests is always expected to be `application/json`.

#### Response format The Archer API always response with JSON data serialization format. The Content-Type header is always `Content-Type: application/json`.

#### Authentication and authorization The **Archer API** uses the OpenStack Identity service as the default authentication service. When Keystone is enabled, users that submit requests to the OpenStack Networking service must provide an authentication token in `X-Auth-Token` request header. You obtain the token by authenticating to the Keystone endpoint.

When Keystone is enabled, the `project_id` attribute is not required in create requests because the project ID is derived from the authentication token.

#### Pagination To reduce load on the service, list operations will return a maximum number of items at a time. To navigate the collection, the parameters limit, marker and page_reverse can be set in the URI. For example:

``` ?limit=100&marker=1234&page_reverse=False ```

The `marker` parameter is the ID of the last item in the previous list. The `limit` parameter sets the page size. The `page_reverse` parameter sets the page direction. These parameters are optional. If the client requests a limit beyond the maximum limit configured by the deployment, the server returns the maximum limit number of items.

For convenience, list responses contain atom **next** links and **previous** links. The last page in the list requested with `page_reverse=False` will not contain **next** link, and the last page in the list requested with `page_reverse=True` will not contain **previous** link.

To determine if pagination is supported, a user can check whether the `pagination` capability is available through the Archer API detail endpoint.

#### Sorting You can use the `sort` parameter to sort the results of list operations. The sort parameter contains a comma-separated list of sort keys, in order of the sort priority. Each sort key can be optionally prepended with a minus **-** character to reverse default sort direction (ascending).

For example:

``` ?sort=key1,-key2,key3 ```

**key1** is the first key (ascending order), **key2** is the second key (descending order) and **key3** is the third key in ascending order.

To determine if sorting is supported, a user can check whether the `sort` capability is available through the Archer API detail endpoint.

#### Filtering by tags Most resources (e.g. service and endpoint) support adding tags to the resource attributes. Archer supports advanced filtering using these tags for list operations. The following tag filters are supported by the Archer API:

* `tags` - Return the list of entities that have this tag or tags. * `tags-any` - Return the list of entities that have one or more of the given tags. * `not-tags` - Return the list of entities that do not have one or more of the given tags. * `not-tags-any` - Return the list of entities that do not have at least one of the given tags.

Each tag supports a maximum amount of 64 characters.

For example to get a list of resources having both, **red** and **blue** tags:

``` ?tags=red,blue ```

To get a list of resourcing having either, **red** or **blue** tags:

``` ?tags-any=red,blue ```

Tag filters can also be combined in the same request:

``` ?tags=red,blue&tags-any=green,orange ```

#### Response Codes (Faults)

| Code | Description | | ----- | ----------------- | | 400 | Validation Error | | 401 | Unauthorized | | 403 | Policy does not allow current user to do this <br> The project is over quota for the request | | 404 | Not Found <br> Resource not found | | 409 | Conflict | | 422 | Unprocessable Entity | | 429 | You have reached maximum request limit | | 500 | Internal server error |

func NewArcherAPI

func NewArcherAPI(spec *loads.Document) *ArcherAPI

NewArcherAPI creates a new Archer instance

func (*ArcherAPI) AddMiddlewareFor

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

AddMiddlewareFor adds a http middleware to existing handler

func (*ArcherAPI) AuthenticatorsFor

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

AuthenticatorsFor gets the authenticators for the specified security schemes

func (*ArcherAPI) Authorizer

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

Authorizer returns the registered authorizer

func (*ArcherAPI) ConsumersFor

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

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

func (*ArcherAPI) Context

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

Context returns the middleware context for the archer API

func (*ArcherAPI) DefaultConsumes

func (o *ArcherAPI) DefaultConsumes() string

DefaultConsumes returns the default consumes media type

func (*ArcherAPI) DefaultProduces

func (o *ArcherAPI) DefaultProduces() string

DefaultProduces returns the default produces media type

func (*ArcherAPI) Formats

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

Formats returns the registered string formats

func (*ArcherAPI) HandlerFor

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

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

func (*ArcherAPI) Init

func (o *ArcherAPI) Init()

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

func (*ArcherAPI) ProducersFor

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

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

func (*ArcherAPI) RegisterConsumer

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

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

func (*ArcherAPI) RegisterFormat

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

RegisterFormat registers a custom format validator

func (*ArcherAPI) RegisterProducer

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

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

func (*ArcherAPI) Serve

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

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

ServeErrorFor gets a error handler for a given operation id

func (*ArcherAPI) SetDefaultConsumes

func (o *ArcherAPI) SetDefaultConsumes(mediaType string)

SetDefaultConsumes returns the default consumes media type

func (*ArcherAPI) SetDefaultProduces

func (o *ArcherAPI) SetDefaultProduces(mediaType string)

SetDefaultProduces sets the default produces media type

func (*ArcherAPI) SetSpec

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

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

func (*ArcherAPI) UseRedoc

func (o *ArcherAPI) UseRedoc()

UseRedoc for documentation at /docs

func (*ArcherAPI) UseSwaggerUI

func (o *ArcherAPI) UseSwaggerUI()

UseSwaggerUI for documentation at /docs

func (*ArcherAPI) Validate

func (o *ArcherAPI) Validate() error

Validate validates the registrations in the ArcherAPI

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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