aws

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2020 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Credentials

type Credentials struct {
	AccessKey    string // The AWS access key
	SecretKey    string // The AWS secret key
	SessionToken string // The AWS session token
}

Credentials represents static AWS credentials: access key, secret key and a session token

type SecretsManager

type SecretsManager struct {
	// Addr is the HTTP address of the AWS Secret
	// Manager. In general, you want to AWS directly.
	// Therefore, use an address of the following
	// form: secretsmanager.<region>.amazonaws.com
	Addr string
	// Region is the AWS region. Even though the Addr
	// endpoint contains that information already, this
	// field is mandatory.
	Region string
	// The AWS-KMS key ID specifying the AWS-KMS key
	// that is used to encrypt (and decrypt) the
	// secret values stored at AWS Secrets Manager.
	KmsKeyID string

	// Login contains the AWS credentials (access/secret key).
	Login Credentials

	// CacheExpireAfter is the duration after which
	// cache entries expire such that they have to
	// be loaded from the backend storage again.
	CacheExpireAfter time.Duration

	// CacheExpireUnusedAfter is the duration after
	// which not recently used cache entries expire
	// such that they have to be loaded from the
	// backend storage again.
	// Not recently is defined as: CacheExpireUnusedAfter / 2
	CacheExpireUnusedAfter time.Duration

	// ErrorLog specifies an optional logger for errors
	// when files cannot be opened, deleted or contain
	// invalid content.
	// If nil, logging is done via the log package's
	// standard logger.
	ErrorLog *log.Logger
	// contains filtered or unexported fields
}

SecretsManager is a secret key store that saves/fetches secret keys on/from the AWS Secrets Manager. See: https://aws.amazon.com/secrets-manager

func (*SecretsManager) Authenticate

func (store *SecretsManager) Authenticate() error

Authenticate tries to establish a connection to the AWS Secrets Manager using the login credentials.

func (*SecretsManager) Create

func (store *SecretsManager) Create(name string, secret secret.Secret) error

Create adds the given secret key to the store if and only if no entry for name exists. If an entry already exists it returns kes.ErrKeyExists.

In particular, Create creates a new entry on AWS Secrets Manager with the given name containing the secret.

func (*SecretsManager) Delete

func (store *SecretsManager) Delete(name string) error

Delete removes a the secret key with the given name from the key store and deletes the corresponding AWS Secrets Manager entry, if it exists.

func (*SecretsManager) Get

func (store *SecretsManager) Get(name string) (secret.Secret, error)

Get returns the secret key associated with the given name. If no entry for name exists, Get returns kes.ErrKeyNotFound.

In particular, Get reads the secret key from the corresponding entry at AWS Secrets Manager.

Jump to

Keyboard shortcuts

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