Documentation
¶
Overview ¶
Package external provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen version v1.13.0 DO NOT EDIT.
Index ¶
- Constants
- func NewAPIClient(config Config) (spi.Storage, error)
- func NewDeleteSecretRequest(server string, key Key) (*http.Request, error)
- func NewHealthCheckRequest(server string) (*http.Request, error)
- func NewListKeysRequest(server string) (*http.Request, error)
- func NewLookupSecretRequest(server string, key Key) (*http.Request, error)
- func NewStoreSecretRequest(server string, key Key, body StoreSecretJSONRequestBody) (*http.Request, error)
- func NewStoreSecretRequestWithBody(server string, key Key, contentType string, body io.Reader) (*http.Request, error)
- type APIClient
- func (c APIClient) CheckHealth() map[string]core.Health
- func (c APIClient) GetPrivateKey(ctx context.Context, kid string) (crypto.Signer, error)
- func (c APIClient) ListPrivateKeys(ctx context.Context) []string
- func (c APIClient) Name() string
- func (c APIClient) PrivateKeyExists(ctx context.Context, kid string) bool
- func (c APIClient) SavePrivateKey(ctx context.Context, kid string, key crypto.PrivateKey) error
- type Client
- func (c *Client) DeleteSecret(ctx context.Context, key Key, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) HealthCheck(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) ListKeys(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) LookupSecret(ctx context.Context, key Key, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) StoreSecret(ctx context.Context, key Key, body StoreSecretJSONRequestBody, ...) (*http.Response, error)
- func (c *Client) StoreSecretWithBody(ctx context.Context, key Key, contentType string, body io.Reader, ...) (*http.Response, error)
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- func (c *ClientWithResponses) DeleteSecretWithResponse(ctx context.Context, key Key, reqEditors ...RequestEditorFn) (*DeleteSecretResponse, error)
- func (c *ClientWithResponses) HealthCheckWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*HealthCheckResponse, error)
- func (c *ClientWithResponses) ListKeysWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListKeysResponse, error)
- func (c *ClientWithResponses) LookupSecretWithResponse(ctx context.Context, key Key, reqEditors ...RequestEditorFn) (*LookupSecretResponse, error)
- func (c *ClientWithResponses) StoreSecretWithBodyWithResponse(ctx context.Context, key Key, contentType string, body io.Reader, ...) (*StoreSecretResponse, error)
- func (c *ClientWithResponses) StoreSecretWithResponse(ctx context.Context, key Key, body StoreSecretJSONRequestBody, ...) (*StoreSecretResponse, error)
- type ClientWithResponsesInterface
- type Config
- type DeleteSecretResponse
- type ErrorResponse
- type HealthCheckResponse
- type HttpRequestDoer
- type Key
- type KeyList
- type ListKeysResponse
- type LookupSecretResponse
- type RequestEditorFn
- type Secret
- type SecretResponse
- type ServiceStatus
- type ServiceStatusStatus
- type StoreSecretJSONRequestBody
- type StoreSecretRequest
- type StoreSecretResponse
Constants ¶
const StorageType = "external"
StorageType is the name of this storage type, used in health check reports and configuration.
Variables ¶
This section is empty.
Functions ¶
func NewAPIClient ¶
NewAPIClient create a new API Client to communicate with a remote storage server.
func NewDeleteSecretRequest ¶
NewDeleteSecretRequest generates requests for DeleteSecret
func NewHealthCheckRequest ¶
NewHealthCheckRequest generates requests for HealthCheck
func NewListKeysRequest ¶
NewListKeysRequest generates requests for ListKeys
func NewLookupSecretRequest ¶
NewLookupSecretRequest generates requests for LookupSecret
func NewStoreSecretRequest ¶
func NewStoreSecretRequest(server string, key Key, body StoreSecretJSONRequestBody) (*http.Request, error)
NewStoreSecretRequest calls the generic StoreSecret builder with application/json body
Types ¶
type APIClient ¶
type APIClient struct {
// contains filtered or unexported fields
}
APIClient implements the Storage interface. It uses a simple HTTP protocol to connect to an external storage server. This server can either be a secret store itself, or proxy the request to a key store such as Hashicorp Vault or Azure Key Vault. It allows us to keep the codebase clean and allow other parties to write their own adaptor.
func (APIClient) GetPrivateKey ¶
func (APIClient) PrivateKeyExists ¶
func (APIClient) SavePrivateKey ¶
type Client ¶
type Client struct {
// The endpoint of the server conforming to this interface, with scheme,
// https://api.deepmap.com for example. This can contain a path relative
// to the server, such as https://api.deepmap.com/dev-test, and all the
// paths in the swagger spec will be appended to the server.
Server string
// Doer for performing requests, typically a *http.Client with any
// customized settings, such as certificate chains.
Client HttpRequestDoer
// A list of callbacks for modifying requests which are generated before sending over
// the network.
RequestEditors []RequestEditorFn
}
Client which conforms to the OpenAPI3 specification for this service.
func NewClient ¶
func NewClient(server string, opts ...ClientOption) (*Client, error)
Creates a new Client, with reasonable defaults
func (*Client) DeleteSecret ¶
func (*Client) HealthCheck ¶
func (*Client) LookupSecret ¶
func (*Client) StoreSecret ¶
func (c *Client) StoreSecret(ctx context.Context, key Key, body StoreSecretJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
type ClientInterface ¶
type ClientInterface interface {
// HealthCheck request
HealthCheck(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
// ListKeys request
ListKeys(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
// DeleteSecret request
DeleteSecret(ctx context.Context, key Key, reqEditors ...RequestEditorFn) (*http.Response, error)
// LookupSecret request
LookupSecret(ctx context.Context, key Key, reqEditors ...RequestEditorFn) (*http.Response, error)
// StoreSecret request with any body
StoreSecretWithBody(ctx context.Context, key Key, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
StoreSecret(ctx context.Context, key Key, body StoreSecretJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
}
The interface specification for the client above.
type ClientOption ¶
ClientOption allows setting custom parameters during construction
func WithHTTPClient ¶
func WithHTTPClient(doer HttpRequestDoer) ClientOption
WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.
func WithRequestEditorFn ¶
func WithRequestEditorFn(fn RequestEditorFn) ClientOption
WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.
type ClientWithResponses ¶
type ClientWithResponses struct {
ClientInterface
}
ClientWithResponses builds on ClientInterface to offer response payloads
func NewClientWithResponses ¶
func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)
NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling
func (*ClientWithResponses) DeleteSecretWithResponse ¶
func (c *ClientWithResponses) DeleteSecretWithResponse(ctx context.Context, key Key, reqEditors ...RequestEditorFn) (*DeleteSecretResponse, error)
DeleteSecretWithResponse request returning *DeleteSecretResponse
func (*ClientWithResponses) HealthCheckWithResponse ¶
func (c *ClientWithResponses) HealthCheckWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*HealthCheckResponse, error)
HealthCheckWithResponse request returning *HealthCheckResponse
func (*ClientWithResponses) ListKeysWithResponse ¶
func (c *ClientWithResponses) ListKeysWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListKeysResponse, error)
ListKeysWithResponse request returning *ListKeysResponse
func (*ClientWithResponses) LookupSecretWithResponse ¶
func (c *ClientWithResponses) LookupSecretWithResponse(ctx context.Context, key Key, reqEditors ...RequestEditorFn) (*LookupSecretResponse, error)
LookupSecretWithResponse request returning *LookupSecretResponse
func (*ClientWithResponses) StoreSecretWithBodyWithResponse ¶
func (c *ClientWithResponses) StoreSecretWithBodyWithResponse(ctx context.Context, key Key, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*StoreSecretResponse, error)
StoreSecretWithBodyWithResponse request with arbitrary body returning *StoreSecretResponse
func (*ClientWithResponses) StoreSecretWithResponse ¶
func (c *ClientWithResponses) StoreSecretWithResponse(ctx context.Context, key Key, body StoreSecretJSONRequestBody, reqEditors ...RequestEditorFn) (*StoreSecretResponse, error)
type ClientWithResponsesInterface ¶
type ClientWithResponsesInterface interface {
// HealthCheck request
HealthCheckWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*HealthCheckResponse, error)
// ListKeys request
ListKeysWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListKeysResponse, error)
// DeleteSecret request
DeleteSecretWithResponse(ctx context.Context, key Key, reqEditors ...RequestEditorFn) (*DeleteSecretResponse, error)
// LookupSecret request
LookupSecretWithResponse(ctx context.Context, key Key, reqEditors ...RequestEditorFn) (*LookupSecretResponse, error)
// StoreSecret request with any body
StoreSecretWithBodyWithResponse(ctx context.Context, key Key, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*StoreSecretResponse, error)
StoreSecretWithResponse(ctx context.Context, key Key, body StoreSecretJSONRequestBody, reqEditors ...RequestEditorFn) (*StoreSecretResponse, error)
}
ClientWithResponsesInterface is the interface specification for the client with responses above.
type Config ¶
type Config struct {
// Address contains the URL of the remote storage server.
Address string `koanf:"address"`
// Timeout is the timeout for the HTTP client.
Timeout time.Duration `koanf:"timeout"`
}
Config is the configuration for the APIClient.
type DeleteSecretResponse ¶
type DeleteSecretResponse struct {
Body []byte
HTTPResponse *http.Response
JSON404 *ErrorResponse
JSON500 *ErrorResponse
}
func ParseDeleteSecretResponse ¶
func ParseDeleteSecretResponse(rsp *http.Response) (*DeleteSecretResponse, error)
ParseDeleteSecretResponse parses an HTTP response from a DeleteSecretWithResponse call
func (DeleteSecretResponse) Status ¶
func (r DeleteSecretResponse) Status() string
Status returns HTTPResponse.Status
func (DeleteSecretResponse) StatusCode ¶
func (r DeleteSecretResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type ErrorResponse ¶
type ErrorResponse struct {
// Backend The name of the storage backend. This can provide context to the error.
Backend string `json:"backend"`
// Detail A human-readable explanation specific to this occurrence of the problem.
Detail string `json:"detail"`
// Status HTTP status-code
Status int `json:"status"`
// Title A short, human-readable summary of the problem type.
Title string `json:"title"`
}
ErrorResponse The ErrorResponse contains the Problem Details for HTTP APIs as specified in [RFC7807](https://tools.ietf.org/html/rfc7807).
It provides more details about problems occurred in the storage server.
Return values contain the following members: - **title** (string) - A short, human-readable summary of the problem type. - **status** (number) - The HTTP status code generated by the origin server for this occurrence of the problem. - **backend** (string) The name of the storage backend. This can provide context to the error. - **detail** (string) - A human-readable explanation specific to this occurrence of the problem.
type HealthCheckResponse ¶
type HealthCheckResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ServiceStatus
JSON503 *ServiceStatus
}
func ParseHealthCheckResponse ¶
func ParseHealthCheckResponse(rsp *http.Response) (*HealthCheckResponse, error)
ParseHealthCheckResponse parses an HTTP response from a HealthCheckWithResponse call
func (HealthCheckResponse) Status ¶
func (r HealthCheckResponse) Status() string
Status returns HTTPResponse.Status
func (HealthCheckResponse) StatusCode ¶
func (r HealthCheckResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type HttpRequestDoer ¶
Doer performs HTTP requests.
The standard http.Client implements this interface.
type Key ¶
type Key = string
Key The key under which secrets can be stored or retrieved.
The key should be considered opaque and no assumptions should be made about its value or format. Note: When the key is used in the URL path, symbols such as slashes and hash symbols must be escaped.
type KeyList ¶
type KeyList = []Key
KeyList List of keys currently stored in the store. Note: Keys will be in unescaped form. No assumptions should be made about the order of the keys.
type ListKeysResponse ¶
type ListKeysResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *KeyList
JSON500 *ErrorResponse
}
func ParseListKeysResponse ¶
func ParseListKeysResponse(rsp *http.Response) (*ListKeysResponse, error)
ParseListKeysResponse parses an HTTP response from a ListKeysWithResponse call
func (ListKeysResponse) Status ¶
func (r ListKeysResponse) Status() string
Status returns HTTPResponse.Status
func (ListKeysResponse) StatusCode ¶
func (r ListKeysResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type LookupSecretResponse ¶
type LookupSecretResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *SecretResponse
JSON404 *ErrorResponse
JSON500 *ErrorResponse
}
func ParseLookupSecretResponse ¶
func ParseLookupSecretResponse(rsp *http.Response) (*LookupSecretResponse, error)
ParseLookupSecretResponse parses an HTTP response from a LookupSecretWithResponse call
func (LookupSecretResponse) Status ¶
func (r LookupSecretResponse) Status() string
Status returns HTTPResponse.Status
func (LookupSecretResponse) StatusCode ¶
func (r LookupSecretResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type RequestEditorFn ¶
RequestEditorFn is the function signature for the RequestEditor callback function
type SecretResponse ¶
type SecretResponse struct {
// Secret The secret value stored under the provided key.
Secret Secret `json:"secret"`
}
SecretResponse Response object containing the secret value.
type ServiceStatus ¶
type ServiceStatus struct {
// Details Additional details about the service status.
Details *string `json:"details,omitempty"`
// Status Indicates whether the service status is acceptable. Possible values are:
// * **pass**: healthy.
// * **fail**: unhealthy.
// * **warn**: healthy, with some concerns.
Status ServiceStatusStatus `json:"status"`
}
ServiceStatus Response for the health check endpoint.
type ServiceStatusStatus ¶
type ServiceStatusStatus string
ServiceStatusStatus Indicates whether the service status is acceptable. Possible values are: * **pass**: healthy. * **fail**: unhealthy. * **warn**: healthy, with some concerns.
const ( Fail ServiceStatusStatus = "fail" Pass ServiceStatusStatus = "pass" Warn ServiceStatusStatus = "warn" )
Defines values for ServiceStatusStatus.
type StoreSecretJSONRequestBody ¶
type StoreSecretJSONRequestBody = StoreSecretRequest
StoreSecretJSONRequestBody defines body for StoreSecret for application/json ContentType.
type StoreSecretRequest ¶
type StoreSecretRequest struct {
// Secret The secret value stored under the provided key.
Secret Secret `json:"secret"`
}
StoreSecretRequest Request body to store a secret value. The secret value must not be empty.
type StoreSecretResponse ¶
type StoreSecretResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *SecretResponse
JSON400 *ErrorResponse
JSON409 *ErrorResponse
JSON500 *ErrorResponse
}
func ParseStoreSecretResponse ¶
func ParseStoreSecretResponse(rsp *http.Response) (*StoreSecretResponse, error)
ParseStoreSecretResponse parses an HTTP response from a StoreSecretWithResponse call
func (StoreSecretResponse) Status ¶
func (r StoreSecretResponse) Status() string
Status returns HTTPResponse.Status
func (StoreSecretResponse) StatusCode ¶
func (r StoreSecretResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode