secrets

package
v0.0.0-...-b7efc31 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package secrets provides a client for interacting with Keyvault's secret storage.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bundle

type Bundle = secret.Bundle

type ChangeOption

type ChangeOption interface {
	// contains filtered or unexported methods
}

func ContentType

func ContentType(ct string) ChangeOption

ContentType sets the ContentType field to ct. Implements SetOption and UpdateOption.

func Enabled

func Enabled() ChangeOption

Enabled enables the secret.

func NotBefore

func NotBefore(t time.Time) ChangeOption

NotBefore indiates that the key isn't valid before this time.

func RecoverableDays

func RecoverableDays(days int) ChangeOption

RecoverableDays is the soft delete data retention. Must be set to >=7 and <=90.

func RecoveryLevel

func RecoveryLevel(drl secret.DeletionRecoveryLevel) ChangeOption

Recoverylevel sets the level of recovery for this password when deleted. Implements SetOption and UpdateOption.

func Tags

func Tags(tags map[string]string) ChangeOption

Tags sets key/value pairs for the tags field of the secret. Implements SetOption and UpdateOption.

type Deleted

type Deleted = secret.Deleted

type DeletedBundle

type DeletedBundle = secret.DeletedBundle

type GetOption

type GetOption func(o *getOptions)

GetOption is an optional argument for the Get() or Bundle() call.

func AtVersion

func AtVersion(version string) GetOption

AtVersion specifies the particular version of a secret you want. By default this is the latest version.

func Base64Decode

func Base64Decode() GetOption

Base64Decode causes the string returned by Keyvault to be base64 decoded. This should be used when binary data (such as a certificate private key) was stored and not a regular string.

type Secrets

type Secrets struct {
	Ops *ops.REST
}

Secrets provides methods for extracting secrets from keyvault.

func (Secrets) Backup

func (s Secrets) Backup(ctx context.Context, name string) (string, error)

Backup returns a string representing a blob of all versions of a secret. This is in an undisclosed format.

func (Secrets) Delete

func (s Secrets) Delete(ctx context.Context, name string) error

Delete deletes the secret with name "name".

func (Secrets) Deleted

func (s Secrets) Deleted(ctx context.Context, name string) (DeletedBundle, error)

Deleted returns information about a deleted secret.

func (Secrets) Get

func (s Secrets) Get(ctx context.Context, name string, options ...GetOption) ([]byte, Bundle, error)

Get gets a secret stored at name. This is used to get secrets stored in Keyvault. A string can represent binary data, as this REST call is oversubscribed to provide certificate private keys. In those cases, the data is base64 encoded(a method to store binary data as string data). If doing TLS, you should use keyvault.TLS() instead. If doing other certs, you should use keyvault.Certs instead. Returns the data (which will be Base64 decoded if Base64Decode() option is passed) and the Bundle containing the metadata and original .Value as sent by the server (no decoding).

func (Secrets) List

func (s Secrets) List(ctx context.Context, maxResults int32) ([]string, error)

List returns a list of all secrets in the vault.

func (Secrets) ListDeleted

func (s Secrets) ListDeleted(ctx context.Context, maxResults int32) ([]Deleted, error)

ListDeleted returns a list of deleted secrets.

func (Secrets) Purge

func (s Secrets) Purge(ctx context.Context, name string) error

Purge permanently deletes a secret, without the possibility of recovery. Name is the name of a deleted secret.

func (Secrets) Recover

func (s Secrets) Recover(ctx context.Context, name string) (Bundle, error)

Recover recovers a deleted secret that has not been purged to the latest version.

func (Secrets) Restore

func (s Secrets) Restore(ctx context.Context, value string) (Bundle, error)

Restore restores a key from the value passed. That vlaue comes from a call to Backup().

func (Secrets) Set

func (s Secrets) Set(ctx context.Context, name string, value []byte, options ...SetOption) error

Set creates a new secret or adds a new version of a secret if it already exists. SetOption is also implemented by ChangeOption. If value does not represent a string (it represents binary data), you should pass Base64Encode().

func (Secrets) UpdateAttr

func (s Secrets) UpdateAttr(ctx context.Context, name, version string, options ...UpdateOption) error

UpdateAttr updates a secret's attributes. UpdateOption is also implemented by ChangeOption.

func (Secrets) Versions

func (s Secrets) Versions(ctx context.Context, name string, maxResults int32) ([]secret.Version, error)

Versions returns a list of version information for a secret.

type SetOption

type SetOption interface {
	// contains filtered or unexported methods
}

SetOption is an option for the Set() method.

func Base64Encode

func Base64Encode() SetOption

Base64Encode indicates that the value being passed to Set() represents binary data (not string data) and should be encoded to allow for transport.

type UpdateOption

type UpdateOption interface {
	// contains filtered or unexported methods
}

UpdateOption is an option for the UpdateAttr() method.

Jump to

Keyboard shortcuts

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