Documentation
¶
Index ¶
- type ArcherAPI
- func (o *ArcherAPI) AddMiddlewareFor(method, path string, builder middleware.Builder)
- func (o *ArcherAPI) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]runtime.Authenticator
- func (o *ArcherAPI) Authorizer() runtime.Authorizer
- func (o *ArcherAPI) ConsumersFor(mediaTypes []string) map[string]runtime.Consumer
- func (o *ArcherAPI) Context() *middleware.Context
- func (o *ArcherAPI) DefaultConsumes() string
- func (o *ArcherAPI) DefaultProduces() string
- func (o *ArcherAPI) Formats() strfmt.Registry
- func (o *ArcherAPI) HandlerFor(method, path string) (http.Handler, bool)
- func (o *ArcherAPI) Init()
- func (o *ArcherAPI) ProducersFor(mediaTypes []string) map[string]runtime.Producer
- func (o *ArcherAPI) RegisterConsumer(mediaType string, consumer runtime.Consumer)
- func (o *ArcherAPI) RegisterFormat(name string, format strfmt.Format, validator strfmt.Validator)
- func (o *ArcherAPI) RegisterProducer(mediaType string, producer runtime.Producer)
- func (o *ArcherAPI) Serve(builder middleware.Builder) http.Handler
- func (o *ArcherAPI) ServeErrorFor(operationID string) func(http.ResponseWriter, *http.Request, error)
- func (o *ArcherAPI) SetDefaultConsumes(mediaType string)
- func (o *ArcherAPI) SetDefaultProduces(mediaType string)
- func (o *ArcherAPI) SetSpec(spec *loads.Document)
- func (o *ArcherAPI) UseRedoc()
- func (o *ArcherAPI) UseSwaggerUI()
- func (o *ArcherAPI) Validate() error
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) (any, 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
// AgentGetAgentsHandler sets the operation handler for the get agents operation
AgentGetAgentsHandler agent.GetAgentsHandler
// AgentGetAgentsAgentHostHandler sets the operation handler for the get agents agent host operation
AgentGetAgentsAgentHostHandler agent.GetAgentsAgentHostHandler
// 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
// ServicePostServiceServiceIDMigrateHandler sets the operation handler for the post service service ID migrate operation
ServicePostServiceServiceIDMigrateHandler service.PostServiceServiceIDMigrateHandler
// 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, ...any)
// contains filtered or unexported fields
}
ArcherAPI # Documentation Archer is an OpenStack-style API service that privately connects services across [OpenStack Networks](https://docs.openstack.org/neutron/latest/admin/intro-os-networking.html). Consumers pick a *service* from a catalog and **inject** it into their own network — the service becomes reachable through a private IP, without exposing either network to the other.
Archer integrates with *OpenStack Keystone* for authentication and *OpenStack Neutron* for network and port management.
### Concepts Archer exposes two resource types:
* **Services** — private or public services registered in Archer. They are reached by creating an endpoint. * **Endpoints** — IP endpoints in a local network that transparently forward to a service living in another private network.
### Features * Multi-tenant via OpenStack Identity * OpenStack `policy.json` access policies * Prometheus exporter * Rate limiting and CORS * CADF-compatible audit trail * Sentry error reporting * OpenStack-style CLI client (`archerctl`)
### Supported Backends * **F5 BigIP** — provisioned via the `archer-f5-agent` * **Network Injection** — the `archer-ni-agent`, using HAProxy inside Linux network namespaces; works alongside `openvswitch-agent` or `linuxbridge-agent`
### Requirements * PostgreSQL * OpenStack Keystone * OpenStack Neutron
## API properties Archer exposes a RESTful HTTP API.
#### Request / Response format Requests and responses use JSON. `POST` requests must set `Content-Type: application/json`; responses always come back with `Content-Type: application/json`.
#### Authentication Archer uses OpenStack Keystone. Requests must include a Keystone token in the `X-Auth-Token` header. Because the project ID is derived from the token, `project_id` is not required on create requests.
#### Pagination List operations return a bounded number of items. Navigate the collection with URI parameters:
``` ?limit=100&marker=1234&page_reverse=False ```
* `marker` — the ID of the last item from the previous page * `limit` — page size (clamped to the deployment maximum) * `page_reverse` — reverse pagination direction
Responses include atom `next` and `previous` links. The final forward page has no `next`; the final reverse page has no `previous`. Deployments advertise pagination support through the `pagination` capability on the API detail endpoint.
#### Sorting Use `sort` with a comma-separated list of keys, in priority order. Prefix a key with `-` to sort descending:
``` ?sort=key1,-key2,key3 ```
Sort support is advertised through the `sort` capability on the API detail endpoint.
#### Filtering by tags Most resources (services, endpoints, …) accept tags. Archer supports four tag filters on list operations:
* `tags` — entities that have **all** the given tags * `tags-any` — entities that have **any** of the given tags * `not-tags` — entities that do **not** have all of the given tags * `not-tags-any` — entities that do **not** have any of the given tags
Each tag is limited to 64 characters. Filters can be combined:
``` ?tags=red,blue&tags-any=green,orange ```
#### Response Codes (Faults)
| Code | Description | | ----- | ----------------- | | 400 | Validation error | | 401 | Unauthorized | | 403 | Policy denies the action, or the project is over quota | | 404 | Resource not found | | 409 | Conflict | | 422 | Unprocessable Entity | | 429 | Rate limit exceeded | | 500 | Internal server error |
## Endpoint identification
Archer supports the Proxy Protocol v2 for endpoint identification.
The Proxy Protocol is a widely used protocol for passing client connection information through a load balancer to the backend server. It is used to identify the original client IP address and port number. The Proxy Protocol v2 is a binary protocol that is more efficient than the original text-based Proxy Protocol v1.
The proxy protocol header also includes the ID of the endpoint. This information is encoded using a custom Type-Length-Value (TLV) vector as follows.
| Field | Length (Octets) | Description | | ----- | --------------- | -------------------------------------------------------------- | | Type | 1 | PP2_TYPE_SAPCC (0xEC) | | Length| 2 | Length of the value (UUIDv4 is always 36 byte as ASCII string) | | Value | 36 | ASCII UUID of the endpoint |
func NewArcherAPI ¶
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 ¶
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 ¶
DefaultConsumes returns the default consumes media type
func (*ArcherAPI) DefaultProduces ¶
DefaultProduces returns the default produces media type
func (*ArcherAPI) HandlerFor ¶
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 ¶
ProducersFor gets the producers for the specified media types.
MIME type parameters are ignored here.
func (*ArcherAPI) RegisterConsumer ¶
RegisterConsumer allows you to add (or override) a consumer for a media type.
func (*ArcherAPI) RegisterFormat ¶
RegisterFormat registers a custom format validator
func (*ArcherAPI) RegisterProducer ¶
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 ¶
SetDefaultConsumes returns the default consumes media type
func (*ArcherAPI) SetDefaultProduces ¶
SetDefaultProduces sets the default produces media type
func (*ArcherAPI) UseSwaggerUI ¶
func (o *ArcherAPI) UseSwaggerUI()
UseSwaggerUI for documentation at /docs