Documentation ¶
Index ¶
- type Client
- func (c *Client) AddSecretLabel(ctx context.Context, secretID string, labels map[string]string) error
- func (c *Client) AddSecretVersion(ctx context.Context, secretName string, payload []byte) error
- func (c *Client) CreateSecret(ctx context.Context, secretID string) (*secretmanagerpb.Secret, error)
- func (c *Client) GetSecret(ctx context.Context, secretName string) (*secretmanagerpb.Secret, error)
- func (c *Client) GetSecretValue(ctx context.Context, secretName, versionName string) ([]byte, error)
- func (c *Client) ListSecrets(ctx context.Context) ([]*secretmanagerpb.Secret, error)
- type ClientInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { // ProjectID is GCP project in which to store secrets in Secret Manager. ProjectID string // contains filtered or unexported fields }
Client is a wrapper of secretmanager client
func (*Client) AddSecretLabel ¶
func (c *Client) AddSecretLabel(ctx context.Context, secretID string, labels map[string]string) error
AddSecretLabel adds a label to a secret
func (*Client) AddSecretVersion ¶
AddSecretVersion adds a secret version, aka update the value of a secret
func (*Client) CreateSecret ¶
func (c *Client) CreateSecret(ctx context.Context, secretID string) (*secretmanagerpb.Secret, error)
CreateSecret creates a secret
func (*Client) GetSecretValue ¶
func (c *Client) GetSecretValue(ctx context.Context, secretName, versionName string) ([]byte, error)
GetSecretValue gets secret value by its version
func (*Client) ListSecrets ¶
ListSecrets lists all secrets under current project
type ClientInterface ¶
type ClientInterface interface { CreateSecret(ctx context.Context, secretID string) (*secretmanagerpb.Secret, error) AddSecretLabel(ctx context.Context, secretID string, labels map[string]string) error AddSecretVersion(ctx context.Context, secretName string, payload []byte) error ListSecrets(ctx context.Context) ([]*secretmanagerpb.Secret, error) GetSecret(ctx context.Context, secretName string) (*secretmanagerpb.Secret, error) GetSecretValue(ctx context.Context, secretName, versionName string) ([]byte, error) }
ClientInterface is the interface for manipulating secretmanager
Click to show internal directories.
Click to hide internal directories.