Documentation
¶
Overview ¶
Package secrets provides a client for interacting with Keyvault's secret storage.
Index ¶
- type Bundle
- type ChangeOption
- type Deleted
- type DeletedBundle
- type GetOption
- type Secrets
- func (s Secrets) Backup(ctx context.Context, name string) (string, error)
- func (s Secrets) Delete(ctx context.Context, name string) error
- func (s Secrets) Deleted(ctx context.Context, name string) (DeletedBundle, error)
- func (s Secrets) Get(ctx context.Context, name string, options ...GetOption) ([]byte, Bundle, error)
- func (s Secrets) List(ctx context.Context, maxResults int32) ([]string, error)
- func (s Secrets) ListDeleted(ctx context.Context, maxResults int32) ([]Deleted, error)
- func (s Secrets) Purge(ctx context.Context, name string) error
- func (s Secrets) Recover(ctx context.Context, name string) (Bundle, error)
- func (s Secrets) Restore(ctx context.Context, value string) (Bundle, error)
- func (s Secrets) Set(ctx context.Context, name string, value []byte, options ...SetOption) error
- func (s Secrets) UpdateAttr(ctx context.Context, name, version string, options ...UpdateOption) error
- func (s Secrets) Versions(ctx context.Context, name string, maxResults int32) ([]secret.Version, error)
- type SetOption
- type UpdateOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 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 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 ¶
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 ¶
Secrets provides methods for extracting secrets from keyvault.
func (Secrets) Backup ¶
Backup returns a string representing a blob of all versions of a secret. This is in an undisclosed format.
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) ListDeleted ¶
ListDeleted returns a list of deleted secrets.
func (Secrets) Purge ¶
Purge permanently deletes a secret, without the possibility of recovery. Name is the name of a deleted secret.
func (Secrets) Recover ¶
Recover recovers a deleted secret that has not been purged to the latest version.
func (Secrets) Restore ¶
Restore restores a key from the value passed. That vlaue comes from a call to Backup().
func (Secrets) Set ¶
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.
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.