Documentation ¶
Index ¶
- func BuildAccessSecretRequest(s *SecretManagerAccessRequestParams) (*secretmanagerpb.AccessSecretVersionRequest, error)
- func ExtractPayload(payload secretmanagerpb.SecretPayload) (map[string]interface{}, error)
- func GetSecretData(client SecretManagerClient, ...) (*secretmanagerpb.SecretPayload, error)
- func NewSecretManagerClient() (*secretmanager.Client, error)
- func RetrieveSecret(client SecretManagerClient, cfg *Config) (map[string]interface{}, error)
- type Config
- type SecretManagerAccessRequestParams
- type SecretManagerClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildAccessSecretRequest ¶
func BuildAccessSecretRequest(s *SecretManagerAccessRequestParams) (*secretmanagerpb.AccessSecretVersionRequest, error)
BuildAccessSecretRequest from params
func ExtractPayload ¶
func ExtractPayload(payload secretmanagerpb.SecretPayload) (map[string]interface{}, error)
ExtractPayload decode JSON respose from secret data
func GetSecretData ¶
func GetSecretData(client SecretManagerClient, accessRequest *secretmanagerpb.AccessSecretVersionRequest) (*secretmanagerpb.SecretPayload, error)
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
Click to show internal directories.
Click to hide internal directories.