gcp

package
v0.0.0-...-c2f8fcc Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildAccessSecretRequest

BuildAccessSecretRequest from params

func ExtractPayload

func ExtractPayload(payload secretmanagerpb.SecretPayload) (map[string]interface{}, error)

ExtractPayload decode JSON respose from secret data

func GetSecretData

GetSecretData will fetch the secret from secret manager

func NewSecretManagerClient

func NewSecretManagerClient() (*secretmanager.Client, error)

NewSecretManagerClient create new secret manager client

func RetrieveSecret

func RetrieveSecret(client SecretManagerClient, cfg *Config) (map[string]interface{}, error)

RetrieveSecret Initialize client and get secret data

Types

type Config

type Config struct {
	ProjectID                    string
	SecretName                   string
	SecretVersion                string
	GoogleApplicationCredentials string
	ServiceAccount               string
	UseInTests                   bool
}

Config - configuration for GCP

type SecretManagerAccessRequestParams

type SecretManagerAccessRequestParams struct {
	// Project is the ID or number of the project from which to access secrets.
	Project string

	// Name is the name of the secret to access.
	Name string

	// Version is the version of the secret to access.
	Version string
}

SecretManagerAccessRequestParams is used as input to access a secret from Secret Manager.

type SecretManagerClient

type SecretManagerClient interface {
	AccessSecretVersion(ctx context.Context, req *secretmanagerpb.AccessSecretVersionRequest, opts ...gax.CallOption) (*secretmanagerpb.AccessSecretVersionResponse, error)
}

SecretManagerClient interface

Jump to

Keyboard shortcuts

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