Documentation ¶
Index ¶
- Variables
- type GRPCSecretClient
- type GoogleSecrets
- func (s *GoogleSecrets) AddSecretVersion(ctx context.Context, name string, payload []byte) (err error)
- func (s *GoogleSecrets) CreateSecret(ctx context.Context, name string) (err error)
- func (s *GoogleSecrets) DeleteSecret(ctx context.Context, secret string) error
- func (s *GoogleSecrets) GetLatestVersion(ctx context.Context, name string) (_ []byte, err error)
- type SecretManagerClient
- type SecretsOption
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type GRPCSecretClient ¶
type GRPCSecretClient interface { CreateSecret(context.Context, *secretmanagerpb.CreateSecretRequest, ...gax.CallOption) (*secretmanagerpb.Secret, error) GetSecretVersion(context.Context, *secretmanagerpb.GetSecretVersionRequest, ...gax.CallOption) (*secretmanagerpb.SecretVersion, error) AddSecretVersion(context.Context, *secretmanagerpb.AddSecretVersionRequest, ...gax.CallOption) (*secretmanagerpb.SecretVersion, error) AccessSecretVersion(context.Context, *secretmanagerpb.AccessSecretVersionRequest, ...gax.CallOption) (*secretmanagerpb.AccessSecretVersionResponse, error) DeleteSecret(context.Context, *secretmanagerpb.DeleteSecretRequest, ...gax.CallOption) error }
gRPCSecretClient describes a lower level interface in order to mock the google secret manager client.
type GoogleSecrets ¶
type GoogleSecrets struct {
// contains filtered or unexported fields
}
GoogleSecrets implements the secret manager interface.
func (*GoogleSecrets) AddSecretVersion ¶
func (s *GoogleSecrets) AddSecretVersion(ctx context.Context, name string, payload []byte) (err error)
AddSecretVersion adds a new secret version to the given secret and the provided payload. Returns an error if one occurs. Note: to add a secret version, the secret must first be created using CreateSecret.
func (*GoogleSecrets) CreateSecret ¶
func (s *GoogleSecrets) CreateSecret(ctx context.Context, name string) (err error)
CreateSecret creates a new secret in the child directory of the parent. Does not return an error if the secret already exists.
func (*GoogleSecrets) DeleteSecret ¶
func (s *GoogleSecrets) DeleteSecret(ctx context.Context, secret string) error
DeleteSecret deletes the secret with the given the name, and all of its versions. Note: this is an irreversible operation. Any service or workload that attempts to access a deleted secret receives a Not Found error.
func (*GoogleSecrets) GetLatestVersion ¶
GetLatestVersion returns the payload for the latest version of the given secret, if one exists, else an error.
type SecretManagerClient ¶
type SecretManagerClient interface { GetLatestVersion(ctx context.Context, name string) ([]byte, error) CreateSecret(ctx context.Context, name string) error AddSecretVersion(ctx context.Context, name string, payload []byte) error DeleteSecret(ctx context.Context, name string) error }
SecretManagerClient describes a high level interface for secret manager clients to enable mocking.
func NewClient ¶
func NewClient(conf config.GCPSecretsConfig, opts ...SecretsOption) (_ SecretManagerClient, err error)
NewClient creates a secret manager client from the configuration.
type SecretsOption ¶
type SecretsOption func(s *GoogleSecrets) error
SecretsOption allows us to configure the secrets client when it is created.
func WithGRPCClient ¶
func WithGRPCClient(client GRPCSecretClient) SecretsOption