secretmanager

package
v0.0.0-...-37c3036 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

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 NewClient

func NewClient(projectID string, dryrun bool) (*Client, error)

NewClient creates a client for secretmanager, it would fail if not authenticated

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

func (c *Client) AddSecretVersion(ctx context.Context, secretName string, payload []byte) error

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) GetSecret

func (c *Client) GetSecret(ctx context.Context, secretName string) (*secretmanagerpb.Secret, error)

GetSecret gets secret by name

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

func (c *Client) ListSecrets(ctx context.Context) ([]*secretmanagerpb.Secret, error)

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

Jump to

Keyboard shortcuts

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