client

package
v0.0.0-...-c16e2ab Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: Apache-2.0 Imports: 9 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 {
	*secretmanager.Client
}

func NewClient

func NewClient(ctx context.Context) (*Client, error)

func (*Client) CreateSecret

func (cl *Client) CreateSecret(project, id string) error

CreateSecret creates an empty secret specified by project, id. It returns nil if successful, otherwise error.

func (*Client) DeleteSecretLabel

func (cl *Client) DeleteSecretLabel(project, id, key string) error

DeleteSecretLabel deletes the key-value pair in labels of the secret specified by project, id, key. Returns error if update fails or the secret doesn't exist.

func (*Client) DestroySecretVersion

func (cl *Client) DestroySecretVersion(project, id, version string) error

DestroySecretVersion changes the state of secret version to DESTROYED returns nil if successful, otherwise error.

func (*Client) DisableSecretVersion

func (cl *Client) DisableSecretVersion(project, id, version string) error

DisableSecretVersion changes the state of secret version to DISABLED returns nil if successful, otherwise error.

func (*Client) EnableSecretVersion

func (cl *Client) EnableSecretVersion(project, id, version string) error

EnableSecretVersion changes the state of secret version to ENABLED returns nil if successful, otherwise error.

func (*Client) GetCreateTime

func (cl *Client) GetCreateTime(project, id, version string) (time.Time, error)

GetCreateTime gets the createTime of the secret version specified by project, id, version. Returns createTime if successful, otherwise error.

func (*Client) GetSecretLabels

func (cl *Client) GetSecretLabels(project, id string) (map[string]string, error)

GetSecretLabels gets the labels of the secret specified by project, id. Returns secret labels if successful, otherwise error

func (*Client) GetSecretVersionData

func (cl *Client) GetSecretVersionData(project, id, version string) ([]byte, error)

GetSecretVersionData gets the data of the secret version specified by project, id, version. Returns secret value if successful, otherwise error

func (*Client) GetSecretVersionState

func (cl *Client) GetSecretVersionState(project, id, version string) (secretmanagerpb.SecretVersion_State, error)

GetSecretVersionState gets the state of the secret version specified by project, id, version. Returns state if successful, otherwise error.

func (*Client) UpsertSecret

func (cl *Client) UpsertSecret(project, id string, data []byte) (string, error)

UpsertSecret adds a new version to the secret specified by project, id. It inserts a new secret if id doesn't already exist. If successful the latest version will have 'data' as its secret value, and returns the latest version number if successful, otherwise returns error

func (*Client) UpsertSecretLabel

func (cl *Client) UpsertSecretLabel(project, id, key, val string) error

UpsertSecretLabel updates or inserts the key-value pair in labels of the secret specified by project, id, key. Returns error if update fails or the secret doesn't exist.

func (*Client) ValidateSecret

func (cl *Client) ValidateSecret(project, id string) error

ValidateSecret returns nil if the secret exists, otherwise error.

func (*Client) ValidateSecretVersion

func (cl *Client) ValidateSecretVersion(project, id, version string) error

ValidateSecretVersion returns nil if the secret version exists, otherwise error.

type Interface

type Interface interface {
	ValidateSecret(project, id string) error
	ValidateSecretVersion(project, id, version string) error
	CreateSecret(project, id string) error
	UpsertSecret(project, id string, data []byte) (string, error)
	GetCreateTime(project, id, version string) (time.Time, error)
	GetSecretLabels(project, id string) (map[string]string, error)
	GetSecretVersionData(project, id, version string) ([]byte, error)
	GetSecretVersionState(project, id, version string) (secretmanagerpb.SecretVersion_State, error)
	EnableSecretVersion(project, id, version string) error
	DisableSecretVersion(project, id, version string) error
	DestroySecretVersion(project, id, version string) error
	UpsertSecretLabel(project, id, key, val string) error
	DeleteSecretLabel(project, id, key string) error
}

Jump to

Keyboard shortcuts

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