endpoints

package
v0.0.0-...-38d8a97 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

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

func MakeConfigureEndpoint(s service.Service) endpoint.Endpoint

MakeConfigureEndpoint returns an endpoint that invokes Configure on the service. Primarily useful in a server.

func MakeInitEndpoint

func MakeInitEndpoint(s service.Service) endpoint.Endpoint

MakeInitEndpoint returns an endpoint that invokes Init on the service. Primarily useful in a server.

func MakeInitStatusEndpoint

func MakeInitStatusEndpoint(s service.Service) endpoint.Endpoint

MakeInitStatusEndpoint returns an endpoint that invokes InitStatus on the service. Primarily useful in a server.

func MakeSealStatusEndpoint

func MakeSealStatusEndpoint(s service.Service) endpoint.Endpoint

MakeSealStatusEndpoint returns an endpoint that invokes SealStatus on the service. Primarily useful in a server.

func MakeUnsealEndpoint

func MakeUnsealEndpoint(s service.Service) endpoint.Endpoint

MakeUnsealEndpoint returns an endpoint that invokes Unseal 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

type ConfigureRequest struct {
	URL   string
	Token string
}

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

Configure implements Service. Primarily useful in a client

func (Endpoints) Init

Init implements Service. Primarily useful in a client

func (Endpoints) InitStatus

func (e Endpoints) InitStatus(ctx context.Context) (bool, error)

InitStatus implements Service. Primarily useful in a client

func (Endpoints) SealStatus

func (e Endpoints) SealStatus(ctx context.Context) (service.SealState, error)

SealStatus implements Service. Primarily useful in a client

func (Endpoints) Unseal

Unseal 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.

func (InitResponse) Failed

func (r InitResponse) Failed() error

Failed implements Failer.

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

type UnsealRequest struct {
	Key   string
	Reset bool
}

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.

func (UnsealResponse) Failed

func (r UnsealResponse) Failed() error

Failed implements Failer.

Jump to

Keyboard shortcuts

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