aws

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2020 License: AGPL-3.0 Imports: 11 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 KMS added in v0.7.0

type KMS struct {
	// Addr is the HTTP address of the AWS KMS.
	// In general, the address has the following
	// form:
	//  kms.<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

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

	// 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
}

KMS is an AWS-KMS client that implements the secret.KMS interface.

It can be used to encrypt secrets before storing them at a key store resp. decrypt them after fetching them from such a store.

func (*KMS) Authenticate added in v0.7.0

func (kms *KMS) Authenticate() error

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

func (*KMS) Decrypt added in v0.7.0

func (kms *KMS) Decrypt(key string, ciphertext []byte) ([]byte, error)

Decrypt tries to decrypt the given ciphertext with the the given key using the AWS-KMS. It returns the decrypted ciphertexts as plaintext on success.

func (*KMS) Encrypt added in v0.7.0

func (kms *KMS) Encrypt(key string, plaintext []byte) ([]byte, error)

Encrypt tries to encrypt the given plaintext with the specified CMK at the AWS-KMS instance. It returns the encrypted plaintext as ciphertext.

type SecretsManager

type SecretsManager struct {
	// Addr is the HTTP address of the AWS Secret
	// Manager. In general, the address has 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 KMSKeyID is the AWS-KMS key ID specifying the
	// AWS-KMS key that is used to encrypt (and decrypt) the
	// values stored at AWS Secrets Manager.
	KMSKeyID string

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

	// 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 key-value store that saves/fetches values as secrets on/from the AWS Secrets Manager. See: https://aws.amazon.com/secrets-manager

func (*SecretsManager) Authenticate

func (s *SecretsManager) Authenticate() error

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

func (*SecretsManager) Create

func (s *SecretsManager) Create(key, value string) error

Create stores the given key-value pair at the AWS SecretsManager if and only if it doesn't exists. If such an entry already exists it returns kes.ErrKeyExists.

If the SecretsManager.KMSKeyID is set AWS will use this key ID to encrypt the values. Otherwise, AWS will use the default key ID for encrypting secrets at the AWS SecretsManager.

func (*SecretsManager) Delete

func (s *SecretsManager) Delete(key string) error

Delete removes the key-value pair from the AWS SecretsManager, if it exists.

func (*SecretsManager) Get

func (s *SecretsManager) Get(key string) (string, error)

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

Jump to

Keyboard shortcuts

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