Documentation ¶
Index ¶
- Constants
- Variables
- func Connect(ctx context.Context, cfg ClientConfig, vault VaultConfig) (*grpc.ClientConn, error)
- func DefaultHTTPHeaders(options HeaderOptions) func(next http.Handler) http.Handler
- func FxContext(ctx context.Context) fx.Option
- func FxOptions(o ProvidesFxOptions) fx.Option
- func FxServiceName(n string) fx.Option
- func GenerateCertificates(ctx context.Context, vault VaultConfig, cfg CertGenerationConfig, cert *[]byte, ...) error
- func GetVariablesFromConfig(prefix string, cfg interface{}) ([]string, error)
- func LoadEnvironment(env Environment, files ...string)
- func LoadKey(ctx context.Context, cfg KeyConfig, vault VaultConfig, which string) ([]byte, error)
- func LoadPrivateKey(key []byte) (*rsa.PrivateKey, error)
- func LoadPublicKeys(key []byte) (publicKeys []*rsa.PublicKey, err error)
- func Logging(cfg HttpLoggingConfig) func(http.Handler) http.Handler
- func Metrics(next http.Handler) http.Handler
- func NewClientTLSConfig(ctx context.Context, cfg TLSConfig, vault VaultConfig) (*tls.Config, error)
- func NewMetricsHandler() http.Handler
- func NewServerTLSConfig(ctx context.Context, cfg TLSConfig, vault VaultConfig) (*tls.Config, error)
- func RegisterConfigParser(typeName string, parser func(value reflect.Value, input string) error)
- func Run(prefix string, runner interface{}, cfg interface{})
- func RunGrpcTest(ctx context.Context, t *testing.T, s *TestServer, name string, fn GrpcTestFunc)
- func RunGrpcTestSuite(ctx context.Context, t *testing.T, serviceName string, options []ServerOption, ...)
- func Serve(ctx context.Context, serviceName string, options ...ServerOption) error
- func ServeLifecycle(params ServeLifecycleParams)
- func URLParamFromContext(ctx context.Context, key string) string
- func URLParamFromRequest(r *http.Request, key string) string
- func Unmarshal(prefix string, cfg interface{}) error
- func UnmarshalFromEnv(prefix string, vars []string, cfg interface{}) error
- type BinaryMarshaler
- type CertGenerationConfig
- type ClientConfig
- type ContextCredentials
- type Credentials
- type CredentialsConfig
- type Enabled
- type Environment
- type ErrorMessage
- func (*ErrorMessage) Descriptor() ([]byte, []int)
- func (this *ErrorMessage) Equal(that interface{}) bool
- func (m *ErrorMessage) GetCode() int32
- func (m *ErrorMessage) GetError() string
- func (m *ErrorMessage) GetMessage() string
- func (this *ErrorMessage) GoString() string
- func (m *ErrorMessage) Marshal() (dAtA []byte, err error)
- func (m *ErrorMessage) MarshalTo(dAtA []byte) (int, error)
- func (m *ErrorMessage) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*ErrorMessage) ProtoMessage()
- func (m *ErrorMessage) Reset()
- func (m *ErrorMessage) Size() (n int)
- func (this *ErrorMessage) String() string
- func (m *ErrorMessage) Unmarshal(dAtA []byte) error
- func (m *ErrorMessage) XXX_DiscardUnknown()
- func (m *ErrorMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ErrorMessage) XXX_Merge(src proto.Message)
- func (m *ErrorMessage) XXX_Size() int
- func (m *ErrorMessage) XXX_Unmarshal(b []byte) error
- type File
- type GrpcTestFunc
- type HasEnabled
- type HasFile
- type HeaderOptions
- type HealthChecker
- type HealthHandler
- type HttpClient
- func (c *HttpClient) Delete(ctx context.Context, url string) (resp *http.Response, err error)
- func (c *HttpClient) Do(req *http.Request) (*http.Response, error)
- func (c *HttpClient) Get(ctx context.Context, url string) (resp *http.Response, err error)
- func (c *HttpClient) GetJSON(ctx context.Context, url string, out interface{}) error
- func (c *HttpClient) Head(ctx context.Context, url string) (resp *http.Response, err error)
- func (c *HttpClient) Patch(ctx context.Context, url, contentType string, body io.Reader) (resp *http.Response, err error)
- func (c *HttpClient) PatchJSON(ctx context.Context, url string, in interface{}, out interface{}) error
- func (c *HttpClient) Post(ctx context.Context, url, contentType string, body io.Reader) (resp *http.Response, err error)
- func (c *HttpClient) PostJSON(ctx context.Context, url string, in interface{}, out interface{}) error
- func (c *HttpClient) Put(ctx context.Context, url, contentType string, body io.Reader) (resp *http.Response, err error)
- func (c *HttpClient) PutJSON(ctx context.Context, url string, in interface{}, out interface{}) error
- type HttpLoggingConfig
- type KeyConfig
- type MetricsHandler
- type ProvidesFxOptions
- type Redirect
- func (*Redirect) Descriptor() ([]byte, []int)
- func (this *Redirect) Equal(that interface{}) bool
- func (m *Redirect) GetLocation() string
- func (this *Redirect) GoString() string
- func (m *Redirect) Marshal() (dAtA []byte, err error)
- func (m *Redirect) MarshalTo(dAtA []byte) (int, error)
- func (m *Redirect) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Redirect) ProtoMessage()
- func (m *Redirect) Reset()
- func (m *Redirect) Size() (n int)
- func (this *Redirect) String() string
- func (m *Redirect) Unmarshal(dAtA []byte) error
- func (m *Redirect) XXX_DiscardUnknown()
- func (m *Redirect) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Redirect) XXX_Merge(src proto.Message)
- func (m *Redirect) XXX_Size() int
- func (m *Redirect) XXX_Unmarshal(b []byte) error
- type Runner
- type ServeLifecycleParams
- type ServerConfig
- type ServerOption
- func WithAuthentication(...) ServerOption
- func WithDELETE(pattern string, handler http.Handler) ServerOption
- func WithGET(pattern string, handler http.Handler) ServerOption
- func WithGRPCServices(registerServices func(ctx context.Context, grpcServer *grpc.Server)) ServerOption
- func WithHandler(pattern string, handler http.Handler) ServerOption
- func WithHandlerFunc(pattern string, handler http.HandlerFunc) ServerOption
- func WithHealth(checker http.Handler) ServerOption
- func WithHealthCheck(check string, checker http.Handler) ServerOption
- func WithHttpHandler(method string, pattern string, handler http.Handler) ServerOption
- func WithLogger(log *logrus.Entry) ServerOption
- func WithMethodNotAllowedHandler(handler http.Handler) ServerOption
- func WithMetrics(handler http.Handler) ServerOption
- func WithMiddleware(middlewares ...func(http.Handler) http.Handler) ServerOption
- func WithNotFoundHandler(handler http.Handler) ServerOption
- func WithOPTIONS(pattern string, handler http.Handler) ServerOption
- func WithPATCH(pattern string, handler http.Handler) ServerOption
- func WithPOST(pattern string, handler http.Handler) ServerOption
- func WithPUT(pattern string, handler http.Handler) ServerOption
- func WithProfiler() ServerOption
- func WithServerConfig(config ServerConfig) ServerOption
- func WithSwagger(fs http.FileSystem) ServerOption
- func WithTLS(cfg TLSConfig) ServerOption
- func WithVault(vault VaultConfig) ServerOption
- type SharedContextCredentials
- type TLSConfig
- type TestServer
- type TokenConfig
- type VaultClient
- func (c VaultClient) Delete(ctx context.Context, p string) error
- func (c VaultClient) IsNotFound(err error) bool
- func (c VaultClient) List(ctx context.Context, p string) ([]string, error)
- func (c VaultClient) Read(ctx context.Context, p string) (*vault.Secret, error)
- func (c VaultClient) ReadObject(ctx context.Context, p string, out interface{}) error
- func (c VaultClient) Write(ctx context.Context, p string, data map[string]interface{}) (*vault.Secret, error)
- func (c VaultClient) WriteObject(ctx context.Context, p string, in interface{}) error
- type VaultConfig
Constants ¶
const ( // TLSCertificateKey is the key of the TLS certificate in Vault TLSCertificateKey = "certificate" // TLSPrivateKey is the key of the TLS private key in Vault TLSPrivateKey = "private_key" // TLSRootCAKey is the key of the TLS root CA in Vault TLSRootCAKey = "issuing_ca" )
const EnvironmentKey = "KETCH_ENVIRONMENT"
EnvironmentKey is the environment variable we look for to set the environment
Variables ¶
var ( ErrInvalidLengthOrlop = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowOrlop = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupOrlop = fmt.Errorf("proto: unexpected end of group") )
var AuthToken struct{}
AuthToken is the context key to retrieve the Authentication token from context
Functions ¶
func Connect ¶
func Connect(ctx context.Context, cfg ClientConfig, vault VaultConfig) (*grpc.ClientConn, error)
Connect creates a new client from configuration
func DefaultHTTPHeaders ¶ added in v1.44.1
func DefaultHTTPHeaders(options HeaderOptions) func(next http.Handler) http.Handler
DefaultHTTPHeaders is middleware to handle default HTTP headers
func FxOptions ¶ added in v1.45.0
func FxOptions(o ProvidesFxOptions) fx.Option
func FxServiceName ¶ added in v1.46.0
func GenerateCertificates ¶
func GenerateCertificates(ctx context.Context, vault VaultConfig, cfg CertGenerationConfig, cert *[]byte, key *[]byte) error
GenerateCertificates calls Vault to generate a certificate
func GetVariablesFromConfig ¶
GetVariablesFromConfig returns the environment variables from the given config object
func LoadEnvironment ¶ added in v1.40.0
func LoadEnvironment(env Environment, files ...string)
LoadEnvironment loads the environment variables from the specified files and from the standard locations
func LoadPrivateKey ¶
func LoadPrivateKey(key []byte) (*rsa.PrivateKey, error)
LoadPrivateKey loads a private key from the given bytes
func LoadPublicKeys ¶
LoadPublicKeys loads an array of public keys from the given bytes
func Logging ¶ added in v1.36.0
func Logging(cfg HttpLoggingConfig) func(http.Handler) http.Handler
Logging is middleware to log each HTTP request
func NewClientTLSConfig ¶
NewClientTLSConfig returns a new tls.VaultConfig from the given configuration input
func NewMetricsHandler ¶
NewMetricsHandler creates a new MetricsHandler
func NewServerTLSConfig ¶
NewServerTLSConfig returns a new tls.VaultConfig from the given configuration input
func RegisterConfigParser ¶
RegisterConfigParser registers a config parser
func Run ¶
func Run(prefix string, runner interface{}, cfg interface{})
Run loads config and then executes the given runner
func RunGrpcTest ¶ added in v1.40.0
func RunGrpcTest(ctx context.Context, t *testing.T, s *TestServer, name string, fn GrpcTestFunc)
RunGrpcTest runs a test function with a client GRPC connection connected to the given server
func RunGrpcTestSuite ¶ added in v1.40.0
func RunGrpcTestSuite(ctx context.Context, t *testing.T, serviceName string, options []ServerOption, testCases ...GrpcTestFunc)
RunGrpcTestSuite runs a suite of GRPC tests
func Serve ¶
func Serve(ctx context.Context, serviceName string, options ...ServerOption) error
Serve sets up the server and listens for requests
func ServeLifecycle ¶ added in v1.42.0
func ServeLifecycle(params ServeLifecycleParams)
func URLParamFromContext ¶
URLParamFromContext returns the url parameter from a context.Context object.
func URLParamFromRequest ¶
URLParamFromRequest returns the url parameter from a http.Request object.
func UnmarshalFromEnv ¶
UnmarshalFromEnv reads configuration into the cfg object from the env vars
Types ¶
type BinaryMarshaler ¶
type BinaryMarshaler struct{}
BinaryMarshaler marshals the given object as a binary object
func (BinaryMarshaler) ContentType ¶
func (BinaryMarshaler) ContentType() string
ContentType returns the Content-Type which this marshaler is responsible for.
func (BinaryMarshaler) Marshal ¶
func (BinaryMarshaler) Marshal(v interface{}) ([]byte, error)
Marshal marshals "v" into byte sequence.
func (BinaryMarshaler) NewDecoder ¶
func (BinaryMarshaler) NewDecoder(r io.Reader) runtime.Decoder
NewDecoder returns a Decoder which reads byte sequence from "r".
func (BinaryMarshaler) NewEncoder ¶
func (BinaryMarshaler) NewEncoder(w io.Writer) runtime.Encoder
NewEncoder returns an Encoder which writes bytes sequence into "w".
func (BinaryMarshaler) Unmarshal ¶
func (BinaryMarshaler) Unmarshal(data []byte, v interface{}) error
Unmarshal unmarshals "data" into "v". "v" must be a pointer value.
type CertGenerationConfig ¶
type CertGenerationConfig struct { Enabled bool Path string `config:"path,default=/pki/issue/"` CommonName string AltNames string TTL time.Duration }
CertGenerationConfig provides the certificate generation configuration
func (CertGenerationConfig) GetEnabled ¶
func (c CertGenerationConfig) GetEnabled() bool
GetEnabled returns true if certificate generation is enabled
type ClientConfig ¶
type ClientConfig struct { Name string URL string Host string Port int32 Token TokenConfig TLS TLSConfig Headers map[string]string WriteBufferSize int ReadBufferSize int InitialWindowSize int32 InitialConnWindowSize int32 MaxCallRecvMsgSize int MaxCallSendMsgSize int MinConnectTimeout time.Duration ConnTimeout time.Duration Block bool UserAgent string }
ClientConfig is standard configuration of most client commands
func (ClientConfig) GetName ¶
func (c ClientConfig) GetName() string
GetName returns the Name of the client config
func (ClientConfig) GetURL ¶
func (c ClientConfig) GetURL() string
GetURL returns the URL to contact the server
func (ClientConfig) GetUserAgent ¶
func (c ClientConfig) GetUserAgent() string
GetUserAgent returns the user agent
type ContextCredentials ¶
type ContextCredentials struct{}
ContextCredentials provides credentials to the client based on the context
func (ContextCredentials) GetRequestMetadata ¶
func (j ContextCredentials) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error)
GetRequestMetadata returns authorization metadata
func (ContextCredentials) RequireTransportSecurity ¶
func (j ContextCredentials) RequireTransportSecurity() bool
RequireTransportSecurity denotes we require transport security
type Credentials ¶
Credentials provides username/password information
func GetCredentials ¶
func GetCredentials(ctx context.Context, cfg CredentialsConfig, vault VaultConfig) (*Credentials, error)
GetCredentials retrieves credentials
type CredentialsConfig ¶
CredentialsConfig provides credentials configuration
type Environment ¶
type Environment string
Environment is a defined environment
func (Environment) IsLocal ¶
func (e Environment) IsLocal() bool
IsLocal returns true if the environment is not defined (aka local)
func (Environment) IsProduction ¶
func (e Environment) IsProduction() bool
IsProduction returns true if the environment is the production environment.
func (Environment) IsTest ¶
func (e Environment) IsTest() bool
IsTest returns true if the environment is the test environment
func (Environment) String ¶
func (e Environment) String() string
String returns a string version of the environment.
type ErrorMessage ¶
type ErrorMessage struct { // Code description Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` // Error description Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` // Message description Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` }
ErrorMessage represents an error message
func (*ErrorMessage) Descriptor ¶
func (*ErrorMessage) Descriptor() ([]byte, []int)
func (*ErrorMessage) Equal ¶
func (this *ErrorMessage) Equal(that interface{}) bool
func (*ErrorMessage) GetCode ¶
func (m *ErrorMessage) GetCode() int32
func (*ErrorMessage) GetError ¶
func (m *ErrorMessage) GetError() string
func (*ErrorMessage) GetMessage ¶
func (m *ErrorMessage) GetMessage() string
func (*ErrorMessage) GoString ¶
func (this *ErrorMessage) GoString() string
func (*ErrorMessage) Marshal ¶
func (m *ErrorMessage) Marshal() (dAtA []byte, err error)
func (*ErrorMessage) MarshalToSizedBuffer ¶
func (m *ErrorMessage) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*ErrorMessage) ProtoMessage ¶
func (*ErrorMessage) ProtoMessage()
func (*ErrorMessage) Reset ¶
func (m *ErrorMessage) Reset()
func (*ErrorMessage) Size ¶
func (m *ErrorMessage) Size() (n int)
func (*ErrorMessage) String ¶
func (this *ErrorMessage) String() string
func (*ErrorMessage) Unmarshal ¶
func (m *ErrorMessage) Unmarshal(dAtA []byte) error
func (*ErrorMessage) XXX_DiscardUnknown ¶
func (m *ErrorMessage) XXX_DiscardUnknown()
func (*ErrorMessage) XXX_Marshal ¶
func (m *ErrorMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ErrorMessage) XXX_Merge ¶
func (m *ErrorMessage) XXX_Merge(src proto.Message)
func (*ErrorMessage) XXX_Size ¶
func (m *ErrorMessage) XXX_Size() int
func (*ErrorMessage) XXX_Unmarshal ¶
func (m *ErrorMessage) XXX_Unmarshal(b []byte) error
type GrpcTestFunc ¶ added in v1.40.0
GrpcTestFunc defines a function called for a GRPC test
type HasEnabled ¶
type HasEnabled interface {
GetEnabled() bool
}
HasEnabled denotes an object provides an Enabled flag
type HasFile ¶
type HasFile interface {
GetFile() string
}
HasFile denotes an object provides a filename
type HeaderOptions ¶ added in v1.44.1
type HeaderOptions struct {
AllowedOrigins []string
}
type HealthChecker ¶
HealthChecker provides the capability to check the health
type HealthHandler ¶
type HealthHandler struct {
// contains filtered or unexported fields
}
HealthHandler is a HTTP handler for checking health
func (HealthHandler) ServeHTTP ¶
func (h HealthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP serves HTTP requests for `/healthz/`, optionally with a specific check appended
type HttpClient ¶ added in v1.35.0
type HttpClient struct {
// contains filtered or unexported fields
}
HttpClient provides a wrapper around http.Client, providing automatic TLS setup and header management
func NewHttpClient ¶ added in v1.35.0
func NewHttpClient(ctx context.Context, cfg ClientConfig, vault VaultConfig) (*HttpClient, error)
NewHttpClient creates a new HttpClient
func (*HttpClient) Delete ¶ added in v1.35.0
Delete performs a DELETE against the given relative url
func (*HttpClient) GetJSON ¶ added in v1.35.0
func (c *HttpClient) GetJSON(ctx context.Context, url string, out interface{}) error
GetJSON performs a GET against the given relative url and returns the results unmarshalled from JSON
func (*HttpClient) Patch ¶ added in v1.35.3
func (c *HttpClient) Patch(ctx context.Context, url, contentType string, body io.Reader) (resp *http.Response, err error)
Patch performs a PATCH against the given relative url
func (*HttpClient) PatchJSON ¶ added in v1.35.3
func (c *HttpClient) PatchJSON(ctx context.Context, url string, in interface{}, out interface{}) error
PatchJSON performs a PATCH against the given relative url using the JSON body and returns JSON
func (*HttpClient) Post ¶ added in v1.35.0
func (c *HttpClient) Post(ctx context.Context, url, contentType string, body io.Reader) (resp *http.Response, err error)
Post performs a POST against the given relative url
func (*HttpClient) PostJSON ¶ added in v1.35.0
func (c *HttpClient) PostJSON(ctx context.Context, url string, in interface{}, out interface{}) error
PostJSON performs a POST against the given relative url using the JSON body and returns JSON
type HttpLoggingConfig ¶ added in v1.36.0
HttpLoggingConfig provides configuration for HTTP logging
type KeyConfig ¶
KeyConfig provides key-related configurations
func (KeyConfig) GetEnabled ¶
GetEnabled returns true if the key is enabled
type MetricsHandler ¶
type MetricsHandler struct{}
MetricsHandler is the Prometheus metrics exporter
func (*MetricsHandler) ServeHTTP ¶
func (s *MetricsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ProvidesFxOptions ¶ added in v1.45.0
type Redirect ¶
type Redirect struct { // Location to redirect to Location string `protobuf:"bytes,1,opt,name=location,proto3" json:"location,omitempty"` }
Redirect represents a redirection to a new location
func (*Redirect) Descriptor ¶
func (*Redirect) GetLocation ¶
func (*Redirect) MarshalToSizedBuffer ¶
func (*Redirect) ProtoMessage ¶
func (*Redirect) ProtoMessage()
func (*Redirect) XXX_DiscardUnknown ¶
func (m *Redirect) XXX_DiscardUnknown()
func (*Redirect) XXX_Marshal ¶
func (*Redirect) XXX_Unmarshal ¶
type Runner ¶ added in v1.37.0
type Runner struct {
// contains filtered or unexported fields
}
Runner represents a command runner
func (*Runner) Getenv ¶ added in v1.37.0
Getenv returns the value of the environment variabled named `key`
func (*Runner) SetupLogging ¶ added in v1.37.0
func (r *Runner) SetupLogging(env Environment, loglevel string)
SetupLogging sets up logging for the environment and the default log level
type ServeLifecycleParams ¶ added in v1.42.0
type ServerConfig ¶
type ServerConfig struct { Bind string `config:"bind,default=0.0.0.0"` Listen uint `config:"listen,default=5000"` TLS TLSConfig Logging HttpLoggingConfig Profiling Enabled AllowedOrigins []string }
ServerConfig is standard configuration of most server commands
type ServerOption ¶
type ServerOption interface {
// contains filtered or unexported methods
}
ServerOption provides an interface for utilizing custom server options
func WithAuthentication ¶
func WithAuthentication(authenticate func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)) ServerOption
WithAuthentication returns a new authenticateServerOption
func WithDELETE ¶
func WithDELETE(pattern string, handler http.Handler) ServerOption
WithDELETE returns a handlerServerOption
func WithGET ¶
func WithGET(pattern string, handler http.Handler) ServerOption
WithGET returns a handlerServerOption
func WithGRPCServices ¶
func WithGRPCServices(registerServices func(ctx context.Context, grpcServer *grpc.Server)) ServerOption
WithGRPCServices returns a new grpcServicesServerOption
func WithHandler ¶
func WithHandler(pattern string, handler http.Handler) ServerOption
WithHandler returns a handlerServerOption
func WithHandlerFunc ¶
func WithHandlerFunc(pattern string, handler http.HandlerFunc) ServerOption
WithHandlerFunc returns a handlerServerOption
func WithHealth ¶
func WithHealth(checker http.Handler) ServerOption
WithHealth specifies a health handler
func WithHealthCheck ¶
func WithHealthCheck(check string, checker http.Handler) ServerOption
WithHealthCheck specifies a health checker function
func WithHttpHandler ¶ added in v1.33.0
func WithHttpHandler(method string, pattern string, handler http.Handler) ServerOption
WithHttpHandler returns a handlerServerOption
func WithLogger ¶
func WithLogger(log *logrus.Entry) ServerOption
WithLogger returns a new loggerServerOption
func WithMethodNotAllowedHandler ¶
func WithMethodNotAllowedHandler(handler http.Handler) ServerOption
WithMethodNotAllowedHandler returns a notFoundHandlerServerOption
func WithMetrics ¶
func WithMetrics(handler http.Handler) ServerOption
WithMetrics specifies a metrics handler
func WithMiddleware ¶
func WithMiddleware(middlewares ...func(http.Handler) http.Handler) ServerOption
WithMiddleware returns a middlewareServerOption
func WithNotFoundHandler ¶
func WithNotFoundHandler(handler http.Handler) ServerOption
WithNotFoundHandler returns a notFoundHandlerServerOption
func WithOPTIONS ¶
func WithOPTIONS(pattern string, handler http.Handler) ServerOption
WithOPTIONS returns a handlerServerOption
func WithPATCH ¶
func WithPATCH(pattern string, handler http.Handler) ServerOption
WithPATCH returns a handlerServerOption
func WithPOST ¶
func WithPOST(pattern string, handler http.Handler) ServerOption
WithPOST returns a handlerServerOption
func WithPUT ¶
func WithPUT(pattern string, handler http.Handler) ServerOption
WithPUT returns a handlerServerOption
func WithProfiler ¶
func WithProfiler() ServerOption
WithProfiler specifies a profiler handler to provide profiling information to go tool pprof
func WithServerConfig ¶
func WithServerConfig(config ServerConfig) ServerOption
WithServerConfig returns a new serverConfigOption
func WithSwagger ¶
func WithSwagger(fs http.FileSystem) ServerOption
WithSwagger specifies a swagger handler based off the given file system
func WithVault ¶
func WithVault(vault VaultConfig) ServerOption
WithVault returns a new vaultServerOption
type SharedContextCredentials ¶
type SharedContextCredentials struct {
// contains filtered or unexported fields
}
SharedContextCredentials provides context-based or token-based credentials to the client
func (SharedContextCredentials) GetRequestMetadata ¶
func (j SharedContextCredentials) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error)
GetRequestMetadata returns authorization metadata
func (SharedContextCredentials) RequireTransportSecurity ¶
func (j SharedContextCredentials) RequireTransportSecurity() bool
RequireTransportSecurity denotes we require transport security
type TLSConfig ¶
type TLSConfig struct { ClientAuth tls.ClientAuthType `config:"clientauth"` Enabled bool `config:"enabled,default=true"` Insecure bool Override string Cert KeyConfig Key KeyConfig RootCA KeyConfig `config:"rootca"` Generate CertGenerationConfig }
TLSConfig provides TLS configuration
func CloneTLSConfig ¶
CloneTLSConfig clones the given TLS configuration
func FromTLSConfig ¶ added in v1.40.0
FromTLSConfig returns a TLSConfig for the given tls.Config
func (TLSConfig) GetEnabled ¶
GetEnabled returns true of TLS is enabled
type TestServer ¶ added in v1.40.0
TestServer provides functionality for running a test server instance
func NewTestServer ¶ added in v1.40.0
func NewTestServer(ctx context.Context, serviceName string, options ...ServerOption) (*TestServer, error)
NewTestServer sets up the test server and
func (*TestServer) ClientConfig ¶ added in v1.40.0
func (s *TestServer) ClientConfig() ClientConfig
ClientConfig returns a proper ClientConfig for connecting to the server
func (*TestServer) Connect ¶ added in v1.40.0
func (s *TestServer) Connect(ctx context.Context) (*grpc.ClientConn, error)
Connect opens a gRPC client connection to the server
type TokenConfig ¶
type TokenConfig struct { Issuer string KeyMap KeyConfig `config:"keymap"` PrivateKey KeyConfig `config:"privatekey"` PublicKey KeyConfig `config:"publickey"` TTL time.Duration `config:"ttl,default=24h"` }
TokenConfig is the configuration for managing tokens
type VaultClient ¶
type VaultClient struct {
// contains filtered or unexported fields
}
VaultClient is a Vault client
func NewVault ¶
func NewVault(ctx context.Context, cfg VaultConfig) (*VaultClient, error)
NewVault connects to Vault given the configuration
func (VaultClient) Delete ¶
func (c VaultClient) Delete(ctx context.Context, p string) error
Delete a secret at the given path
func (VaultClient) IsNotFound ¶ added in v1.39.0
func (c VaultClient) IsNotFound(err error) bool
IsNotFound returns true if the error means the object was not found
func (VaultClient) ReadObject ¶ added in v1.39.0
func (c VaultClient) ReadObject(ctx context.Context, p string, out interface{}) error
ReadObject returns a secret at the given path
func (VaultClient) Write ¶
func (c VaultClient) Write(ctx context.Context, p string, data map[string]interface{}) (*vault.Secret, error)
Write secret data at the given path
func (VaultClient) WriteObject ¶ added in v1.39.0
func (c VaultClient) WriteObject(ctx context.Context, p string, in interface{}) error
WriteObject writes secret data at the given path from an object
type VaultConfig ¶
VaultConfig provides the configuration options available for Vault
func (VaultConfig) GetEnabled ¶
func (c VaultConfig) GetEnabled() bool
GetEnabled returns true if Vault is enabled
Source Files ¶
- binary_marshaler.go
- cert_generation_config.go
- certificates.go
- client.go
- client_config.go
- cmd.go
- config.go
- context_credentials.go
- credentials.go
- enabled_config.go
- env.go
- file_config.go
- fx.go
- health.go
- http.go
- http_headers.go
- key.go
- key_config.go
- logging.go
- metrics.go
- orlop.pb.go
- proto.go
- server.go
- server_config.go
- server_options.go
- servertest.go
- shared_context_credentials.go
- telemetry.go
- tls_config.go
- tls_credentials.go
- token_config.go
- url_param.go
- vault_client.go
- vault_config.go