gcp

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: MIT Imports: 8 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 {
	// contains filtered or unexported fields
}

Client is the GCP Secret Manager Client wrapper. Implements secretly.Client

func NewClient

func NewClient(ctx context.Context, cfg Config, opts ...option.ClientOption) (*Client, error)

NewClient returns a GCP client wrapper with the options applied. Will error if authentication with the secret manager fails.

func Wrap

func Wrap(client *secretmanager.Client, cfg Config) *Client

Wrap wraps the GCP client.

func (*Client) Close

func (c *Client) Close() error

Close releases resources consumed by the client.

func (*Client) GetSecret

func (c *Client) GetSecret(ctx context.Context, name string) ([]byte, error)

GetSecret retrieves the latest secret version for name from GCP Secret Manager.

func (*Client) GetSecretWithVersion

func (c *Client) GetSecretWithVersion(ctx context.Context, name, version string) ([]byte, error)

GetSecretWithVersion retrieves the specific secret version for name from GCP Secret Manager.

func (*Client) Process

func (c *Client) Process(spec any, opts ...secretly.ProcessOption) error

Process resolves the provided specification using GCP Secret Manager. ProcessOptions can be provided to add additional processing for the fields, like reading version info from the env or a file.

(*Client).Process is a convenience for calling secretly.Process with the Client.

type Config

type Config struct {
	// ProjectID identifies the GCP project from which to retrieve the secrets.
	ProjectID string

	SecretlyConfig secretly.Config
}

Config provides both GCP Secret Manager client and secretly wrapper configurations.

Jump to

Keyboard shortcuts

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