Documentation
¶
Overview ¶
Package gcp provides GCP helpers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSecretByName ¶
GetSecretByName gets a secret from gcp by its name The expected format is [projects/*/secrets/*/versions/*] for versions, you can use "latest" to grab the latest version
Types ¶
type SecretClient ¶
type SecretClient struct {
// contains filtered or unexported fields
}
SecretClient is a wrapper around GCP Secret Service. It provides useful helpers to for getting and creating secrets.
func NewSecretClient ¶
func NewSecretClient(opts ...option.ClientOption) (*SecretClient, error)
NewSecretClient creates a new gcp secret manager service. If no option is provided it will use the Google Cloud ADC to initialize the client.
The returned client must be Closed when it is done being used to clean up its underlying connections by calling the `func Close()`
func (*SecretClient) Close ¶
func (c *SecretClient) Close() error
Close closes the connection to the GCP Secret Service. The user should invoke this when the client is no longer required.
func (*SecretClient) CreateSecret ¶
func (c *SecretClient) CreateSecret(name, value string) error
CreateSecret creates a secret in GCP Secret Service. The expected name format is: - projects/<project>/secrets/<name>
func (*SecretClient) DeleteSecret ¶
func (c *SecretClient) DeleteSecret(name string) error
DeleteSecret deletes a secret. - projects/<project>/secrets/<name>
func (*SecretClient) GetSecret ¶
func (c *SecretClient) GetSecret(name string) (string, error)
GetSecret fetches the secret from GCP Secret Manager and return it as a string.
The expected formats are: - projects/<project>/secrets/<name>/versions/<version> - projects/<project>/secrets/<name>/versions/latest