Documentation ¶
Index ¶
- func InstrumentingMiddleware(duration metrics.Histogram) endpoint.Middleware
- func LoggingMiddleware(logger log.Logger) endpoint.Middleware
- func MakeConfigureEndpoint(s service.Service) endpoint.Endpoint
- func MakeInitEndpoint(s service.Service) endpoint.Endpoint
- func MakeInitStatusEndpoint(s service.Service) endpoint.Endpoint
- func MakeSealStatusEndpoint(s service.Service) endpoint.Endpoint
- func MakeUnsealEndpoint(s service.Service) endpoint.Endpoint
- type AuthConfigOutput
- type AuthMountOutput
- type ConfigureRequest
- type ConfigureResponse
- type Endpoints
- func (e Endpoints) Configure(ctx context.Context, opts service.ConfigOptions) (service.ConfigState, error)
- func (e Endpoints) Init(ctx context.Context, opts service.InitOptions) (service.InitKeys, error)
- func (e Endpoints) InitStatus(ctx context.Context) (bool, error)
- func (e Endpoints) SealStatus(ctx context.Context) (service.SealState, error)
- func (e Endpoints) Unseal(ctx context.Context, opts service.UnsealOptions) (service.SealState, error)
- type Failer
- type InitRequest
- type InitResponse
- type InitStatusRequest
- type InitStatusResponse
- type MountConfigOutput
- type MountOutput
- type SealStatusRequest
- type SealStatusResponse
- type UnsealRequest
- type UnsealResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InstrumentingMiddleware ¶
func InstrumentingMiddleware(duration metrics.Histogram) endpoint.Middleware
InstrumentingMiddleware returns an endpoint middleware that records the duration of each invocation to the passed histogram. The middleware adds a single field: "success", which is "true" if no error is returned, and "false" otherwise.
func LoggingMiddleware ¶
func LoggingMiddleware(logger log.Logger) endpoint.Middleware
LoggingMiddleware returns an endpoint middleware that logs the duration of each invocation, and the resulting error, if any.
func MakeConfigureEndpoint ¶
MakeConfigureEndpoint returns an endpoint that invokes Configure on the service. Primarily useful in a server.
func MakeInitEndpoint ¶
MakeInitEndpoint returns an endpoint that invokes Init on the service. Primarily useful in a server.
func MakeInitStatusEndpoint ¶
MakeInitStatusEndpoint returns an endpoint that invokes InitStatus on the service. Primarily useful in a server.
func MakeSealStatusEndpoint ¶
MakeSealStatusEndpoint returns an endpoint that invokes SealStatus on the service. Primarily useful in a server.
Types ¶
type AuthConfigOutput ¶
type AuthConfigOutput struct { DefaultLeaseTTL int `json:"default_lease_ttl,omitempty"` MaxLeaseTTL int `json:"max_lease_ttl,omitempty"` }
AuthConfigOutput describes the lease details of an auth backend.
type AuthMountOutput ¶
type AuthMountOutput struct { Type string `json:"type"` Description string `json:"description,omitempty"` Config AuthConfigOutput `json:"config,omitempty"` }
AuthMountOutput maps directly to Vault's own AuthMount. Used by ConfigState to describe the auth backends currently defined in a Vault instance.
type ConfigureRequest ¶
ConfigureRequest collects the request parameters (if any) for the Configure method.
type ConfigureResponse ¶
type ConfigureResponse struct { ConfigID string `json:"config_id,omitempty"` Mounts map[string]MountOutput `json:"mounts,omitempty"` Auths map[string]AuthMountOutput `json:"auths,omitempty"` Policies []string `json:"policies,omitempty"` Err error `json:"-"` // should be intercepted by Failed/errorEncoder }
ConfigureResponse collects the response values for the Configure method.
func (ConfigureResponse) Failed ¶
func (r ConfigureResponse) Failed() error
Failed implements Failer.
type Endpoints ¶
type Endpoints struct { InitStatusEndpoint endpoint.Endpoint InitEndpoint endpoint.Endpoint SealStatusEndpoint endpoint.Endpoint UnsealEndpoint endpoint.Endpoint ConfigureEndpoint endpoint.Endpoint }
Endpoints collects all of the endpoints that compose a vault proxy service. It's meant to be used as a helper struct, to collect all of the endpoints into a single parameter.
In a server, it's useful for functions that need to operate on a per-endpoint basis. For example, you might pass an Endpoints to a function that produces an http.Handler, with each method (endpoint) wired up to specific path. (It is probably a mistake in design to invoke the Service methods on the Endpoints struct in a server).
In a client, it's useful to collect individually constructed endpoints into a single type that implements the Service interface. For example, you might construct individual endpoints using transport/http.NewClient, combine them into an Endpoints, and return it to the caller as a Service.
func New ¶
func New(svc service.Service, logger log.Logger, duration metrics.Histogram, trace stdopentracing.Tracer) Endpoints
New returns an Endpoints that wraps the provided server, and wires in all of the expected endpoint middlewares via the various parameters.
func (Endpoints) Configure ¶
func (e Endpoints) Configure(ctx context.Context, opts service.ConfigOptions) (service.ConfigState, error)
Configure implements Service. Primarily useful in a client
func (Endpoints) InitStatus ¶
InitStatus implements Service. Primarily useful in a client
func (Endpoints) SealStatus ¶
SealStatus implements Service. Primarily useful in a client
type Failer ¶
type Failer interface {
Failed() error
}
Failer is an interface that should be implemented by response types. Response encoders can check if responses are Failer, and if so they've failed and should then encode them using a separate write path based on the error.
type InitRequest ¶
type InitRequest struct {
Opts service.InitOptions
}
InitRequest collects the request parameters (if any) for the Init method.
type InitResponse ¶
type InitResponse struct { Init service.InitKeys `json:"init"` Err error `json:"-"` // should be intercepted by Failed/errorEncoder }
InitResponse collects the response values for the Init method.
type InitStatusRequest ¶
type InitStatusRequest struct{}
InitStatusRequest collects the request parameters (if any) for the InitStatus method.
type InitStatusResponse ¶
type InitStatusResponse struct { Initialized bool `json:"initialized"` Err error `json:"-"` // should be intercepted by Failed/errorEncoder }
InitStatusResponse collects the response values for the InitStatus method.
func (InitStatusResponse) Failed ¶
func (r InitStatusResponse) Failed() error
Failed implements Failer.
type MountConfigOutput ¶
type MountConfigOutput struct { DefaultLeaseTTL int `json:"default_lease_ttl,omitempty"` MaxLeaseTTL int `json:"max_lease_ttl,omitempty"` }
MountConfigOutput describes the lease details of an individual mount.
type MountOutput ¶
type MountOutput struct { Type string `json:"type"` Description string `json:"description,omitempty"` Config MountConfigOutput `json:"config,omitempty"` }
MountOutput maps directly to Vault's own MountOutput. Used by ConfigState to describe the mounts currently defined in a Vault instance.
type SealStatusRequest ¶
type SealStatusRequest struct{}
SealStatusRequest collects the request parameters (if any) for the SealStatus method.
type SealStatusResponse ¶
type SealStatusResponse struct { Sealed bool `json:"sealed"` T int `json:"t"` N int `json:"n"` Progress int `json:"progress"` Version string `json:"version"` ClusterName string `json:"cluster_name,omitempty"` ClusterID string `json:"cluster_id,omitempty"` Err error `json:"-"` // should be intercepted by Failed/errorEncoder }
SealStatusResponse collects the response values for the SealStatus method.
func (SealStatusResponse) Failed ¶
func (r SealStatusResponse) Failed() error
Failed implements Failer.
type UnsealRequest ¶
UnsealRequest collects the request parameters (if any) for the Unseal method.
type UnsealResponse ¶
type UnsealResponse struct { Sealed bool `json:"sealed"` T int `json:"t"` N int `json:"n"` Progress int `json:"progress"` Version string `json:"version"` ClusterName string `json:"cluster_name,omitempty"` ClusterID string `json:"cluster_id,omitempty"` Err error `json:"-"` // should be intercepted by Failed/errorEncoder }
UnsealResponse collects the response values for the Unseal method.