Documentation ¶
Overview ¶
Secrets Manager Store is maintained by Dan MacTough https://github.com/danmactough. Thanks Dan!
Index ¶
- Constants
- Variables
- func ReservedService(service string) bool
- type ChangeEvent
- type ChangeEventType
- type LatestIndexFile
- type LatestValue
- type NullStore
- func (s *NullStore) Config(ctx context.Context) (StoreConfig, error)
- func (s *NullStore) Delete(ctx context.Context, id SecretId) error
- func (s *NullStore) DeleteTags(ctx context.Context, id SecretId, tags []string) error
- func (s *NullStore) History(ctx context.Context, id SecretId) ([]ChangeEvent, error)
- func (s *NullStore) List(ctx context.Context, service string, includeValues bool) ([]Secret, error)
- func (s *NullStore) ListRaw(ctx context.Context, service string) ([]RawSecret, error)
- func (s *NullStore) ListServices(ctx context.Context, service string, includeSecretNames bool) ([]string, error)
- func (s *NullStore) Read(ctx context.Context, id SecretId, version int) (Secret, error)
- func (s *NullStore) ReadTags(ctx context.Context, id SecretId) (map[string]string, error)
- func (s *NullStore) SetConfig(ctx context.Context, config StoreConfig) error
- func (s *NullStore) Write(ctx context.Context, id SecretId, value string) error
- func (s *NullStore) WriteTags(ctx context.Context, id SecretId, tags map[string]string, deleteOtherTags bool) error
- func (s *NullStore) WriteWithTags(ctx context.Context, id SecretId, value string, tags map[string]string) error
- type RawSecret
- type S3KMSStore
- func (s *S3KMSStore) Delete(ctx context.Context, id SecretId) error
- func (s *S3KMSStore) List(ctx context.Context, service string, includeValues bool) ([]Secret, error)
- func (s *S3KMSStore) ListRaw(ctx context.Context, service string) ([]RawSecret, error)
- func (s *S3KMSStore) ListServices(ctx context.Context, service string, includeSecretName bool) ([]string, error)
- func (s *S3KMSStore) Write(ctx context.Context, id SecretId, value string) error
- func (s *S3KMSStore) WriteWithTags(ctx context.Context, id SecretId, value string, tags map[string]string) error
- type S3Store
- func (s *S3Store) Config(ctx context.Context) (StoreConfig, error)
- func (s *S3Store) Delete(ctx context.Context, id SecretId) error
- func (s *S3Store) DeleteTags(ctx context.Context, id SecretId, tagKeys []string) error
- func (s *S3Store) History(ctx context.Context, id SecretId) ([]ChangeEvent, error)
- func (s *S3Store) List(ctx context.Context, service string, includeValues bool) ([]Secret, error)
- func (s *S3Store) ListRaw(ctx context.Context, service string) ([]RawSecret, error)
- func (s *S3Store) ListServices(ctx context.Context, service string, includeSecretName bool) ([]string, error)
- func (s *S3Store) Read(ctx context.Context, id SecretId, version int) (Secret, error)
- func (s *S3Store) ReadTags(ctx context.Context, id SecretId) (map[string]string, error)
- func (s *S3Store) SetConfig(ctx context.Context, config StoreConfig) error
- func (s *S3Store) Write(ctx context.Context, id SecretId, value string) error
- func (s *S3Store) WriteTags(ctx context.Context, id SecretId, tags map[string]string, deleteOtherTags bool) error
- func (s *S3Store) WriteWithTags(ctx context.Context, id SecretId, value string, tags map[string]string) error
- type SSMStore
- func NewSSMStore(ctx context.Context, numRetries int) (*SSMStore, error)
- func NewSSMStoreWithMinThrottleDelay(ctx context.Context, numRetries int, minThrottleDelay time.Duration) (*SSMStore, error)deprecated
- func NewSSMStoreWithRetryMode(ctx context.Context, numRetries int, retryMode aws.RetryMode) (*SSMStore, error)
- func (s *SSMStore) Config(ctx context.Context) (StoreConfig, error)
- func (s *SSMStore) Delete(ctx context.Context, id SecretId) error
- func (s *SSMStore) DeleteTags(ctx context.Context, id SecretId, tagKeys []string) error
- func (s *SSMStore) History(ctx context.Context, id SecretId) ([]ChangeEvent, error)
- func (s *SSMStore) KMSKey() string
- func (s *SSMStore) List(ctx context.Context, serviceName string, includeValues bool) ([]Secret, error)
- func (s *SSMStore) ListRaw(ctx context.Context, serviceName string) ([]RawSecret, error)
- func (s *SSMStore) ListServices(ctx context.Context, service string, includeSecretName bool) ([]string, error)
- func (s *SSMStore) Read(ctx context.Context, id SecretId, version int) (Secret, error)
- func (s *SSMStore) ReadTags(ctx context.Context, id SecretId) (map[string]string, error)
- func (s *SSMStore) SetConfig(ctx context.Context, config StoreConfig) error
- func (s *SSMStore) Write(ctx context.Context, id SecretId, value string) error
- func (s *SSMStore) WriteTags(ctx context.Context, id SecretId, tags map[string]string, deleteOtherTags bool) error
- func (s *SSMStore) WriteWithTags(ctx context.Context, id SecretId, value string, tags map[string]string) error
- type Secret
- type SecretId
- type SecretMetadata
- type SecretsManagerStore
- func (s *SecretsManagerStore) Config(ctx context.Context) (StoreConfig, error)
- func (s *SecretsManagerStore) Delete(ctx context.Context, id SecretId) error
- func (s *SecretsManagerStore) DeleteTags(ctx context.Context, id SecretId, tagKeys []string) error
- func (s *SecretsManagerStore) History(ctx context.Context, id SecretId) ([]ChangeEvent, error)
- func (s *SecretsManagerStore) List(ctx context.Context, serviceName string, includeValues bool) ([]Secret, error)
- func (s *SecretsManagerStore) ListRaw(ctx context.Context, serviceName string) ([]RawSecret, error)
- func (s *SecretsManagerStore) ListServices(ctx context.Context, service string, includeSecretName bool) ([]string, error)
- func (s *SecretsManagerStore) Read(ctx context.Context, id SecretId, version int) (Secret, error)
- func (s *SecretsManagerStore) ReadTags(ctx context.Context, id SecretId) (map[string]string, error)
- func (s *SecretsManagerStore) SetConfig(ctx context.Context, config StoreConfig) error
- func (s *SecretsManagerStore) Write(ctx context.Context, id SecretId, value string) error
- func (s *SecretsManagerStore) WriteTags(ctx context.Context, id SecretId, tags map[string]string, deleteOtherTags bool) error
- func (s *SecretsManagerStore) WriteWithTags(ctx context.Context, id SecretId, value string, tags map[string]string) error
- type Store
- type StoreConfig
Constants ¶
const ( // CustomSSMEndpointEnvVar is the name of the environment variable specifying a custom base SSM // endpoint. CustomSSMEndpointEnvVar = "CHAMBER_AWS_SSM_ENDPOINT" // DefaultKeyID is the default alias for the KMS key used to encrypt/decrypt secrets DefaultKeyID = "alias/parameter_store_key" // DefaultRetryMode is the default retry mode for AWS SDK configurations. DefaultRetryMode = aws.RetryModeStandard )
const (
// ChamberService is the name of the service reserved for chamber's own use.
ChamberService = "_chamber"
)
const ( // CustomSecretsManagerEndpointEnvVar is the name of the environment variable specifying a custom // base Secrets Manager endpoint. CustomSecretsManagerEndpointEnvVar = "CHAMBER_AWS_SECRETS_MANAGER_ENDPOINT" )
const (
LatestStoreConfigVersion = "1"
)
const (
MaximumVersions = 100
)
const (
RegionEnvVar = "CHAMBER_AWS_REGION"
)
Variables ¶
var ( // ErrSecretNotFound is returned if the specified secret is not found in the // parameter store ErrSecretNotFound = errors.New("secret not found") )
Functions ¶
func ReservedService ¶
Types ¶
type ChangeEvent ¶
type ChangeEvent struct { Type ChangeEventType Time time.Time User string Version int }
type ChangeEventType ¶
type ChangeEventType int
const ( Created ChangeEventType = iota Updated )
func (ChangeEventType) String ¶
func (c ChangeEventType) String() string
type LatestIndexFile ¶
type LatestIndexFile struct {
Latest map[string]LatestValue `json:"latest"`
}
latest is used to keep a single object in s3 with all of the most recent values for the given service's secrets. Keeping this in a single s3 object allows us to use a single s3 GetObject for ListRaw (and thus chamber exec).
type LatestValue ¶
type NullStore ¶
type NullStore struct{}
func NewNullStore ¶
func NewNullStore() *NullStore
func (*NullStore) DeleteTags ¶
func (*NullStore) ListServices ¶
func (*NullStore) SetConfig ¶
func (s *NullStore) SetConfig(ctx context.Context, config StoreConfig) error
type S3KMSStore ¶
type S3KMSStore struct { S3Store // contains filtered or unexported fields }
func NewS3KMSStore ¶
func (*S3KMSStore) ListRaw ¶
ListRaw returns RawSecrets by extracting them from the index file. It only ever uses the index file; it never consults the actual secrets, so if the index file is out of sync, these results will reflect that.
func (*S3KMSStore) ListServices ¶
func (*S3KMSStore) WriteWithTags ¶
type S3Store ¶
type S3Store struct {
// contains filtered or unexported fields
}
func NewS3StoreWithBucket ¶
func (*S3Store) DeleteTags ¶
func (*S3Store) ListServices ¶
func (*S3Store) SetConfig ¶
func (s *S3Store) SetConfig(ctx context.Context, config StoreConfig) error
type SSMStore ¶
type SSMStore struct {
// contains filtered or unexported fields
}
SSMStore implements the Store interface for storing secrets in SSM Parameter Store
func NewSSMStore ¶
NewSSMStore creates a new SSMStore
func NewSSMStoreWithMinThrottleDelay
deprecated
func NewSSMStoreWithMinThrottleDelay(ctx context.Context, numRetries int, minThrottleDelay time.Duration) (*SSMStore, error)
NewSSMStoreWithMinThrottleDelay creates a new SSMStore with the aws sdk max retries and min throttle delay are configured.
Deprecated: The AWS SDK no longer supports specifying a minimum throttle delay. Instead, use NewSSMStoreWithRetryMode.
func NewSSMStoreWithRetryMode ¶
func NewSSMStoreWithRetryMode(ctx context.Context, numRetries int, retryMode aws.RetryMode) (*SSMStore, error)
NewSSMStoreWithRetryMode creates a new SSMStore, configuring the underlying AWS SDK with the given maximum number of retries and retry mode.
func (*SSMStore) Delete ¶
Delete removes a secret from the parameter store. Note this removes all versions of the secret.
func (*SSMStore) DeleteTags ¶
func (*SSMStore) History ¶
History returns a list of events that have occurred regarding the given secret.
func (*SSMStore) List ¶
func (s *SSMStore) List(ctx context.Context, serviceName string, includeValues bool) ([]Secret, error)
List lists all secrets for a given service. If includeValues is true, then those secrets are decrypted and returned, otherwise only the metadata about a secret is returned.
func (*SSMStore) ListRaw ¶
ListRaw lists all secrets keys and values for a given service. Does not include any other meta-data. Uses faster AWS APIs with much higher rate-limits. Suitable for use in production environments.
func (*SSMStore) ListServices ¶
func (*SSMStore) Read ¶
Read reads a secret from the parameter store at a specific version. To grab the latest version, use -1 as the version number.
func (*SSMStore) SetConfig ¶
func (s *SSMStore) SetConfig(ctx context.Context, config StoreConfig) error
func (*SSMStore) Write ¶
Write writes a given value to a secret identified by id. If the secret already exists, then write a new version.
type Secret ¶
type Secret struct { Value *string Meta SecretMetadata }
Secret is a secret with metadata.
type SecretMetadata ¶
SecretMetadata is metadata about a secret.
type SecretsManagerStore ¶
type SecretsManagerStore struct {
// contains filtered or unexported fields
}
SecretsManagerStore implements the Store interface for storing secrets in SSM Parameter Store
func NewSecretsManagerStore ¶
func NewSecretsManagerStore(ctx context.Context, numRetries int) (*SecretsManagerStore, error)
NewSecretsManagerStore creates a new SecretsManagerStore
func (*SecretsManagerStore) Config ¶
func (s *SecretsManagerStore) Config(ctx context.Context) (StoreConfig, error)
func (*SecretsManagerStore) Delete ¶
func (s *SecretsManagerStore) Delete(ctx context.Context, id SecretId) error
Delete removes a secret. Note this removes all versions of the secret. (True?)
func (*SecretsManagerStore) DeleteTags ¶
func (*SecretsManagerStore) History ¶
func (s *SecretsManagerStore) History(ctx context.Context, id SecretId) ([]ChangeEvent, error)
History returns a list of events that have occurred regarding the given secret.
func (*SecretsManagerStore) List ¶
func (s *SecretsManagerStore) List(ctx context.Context, serviceName string, includeValues bool) ([]Secret, error)
List lists all secrets for a given service. If includeValues is true, then those secrets are decrypted and returned, otherwise only the metadata about a secret is returned.
func (*SecretsManagerStore) ListRaw ¶
ListRaw lists all secrets keys and values for a given service. Does not include any other metadata. Suitable for use in production environments.
func (*SecretsManagerStore) ListServices ¶
func (s *SecretsManagerStore) ListServices(ctx context.Context, service string, includeSecretName bool) ([]string, error)
ListServices (not implemented)
func (*SecretsManagerStore) Read ¶
Read reads a secret at a specific version. To grab the latest version, use -1 as the version number.
func (*SecretsManagerStore) SetConfig ¶
func (s *SecretsManagerStore) SetConfig(ctx context.Context, config StoreConfig) error
func (*SecretsManagerStore) Write ¶
Write writes a given value to a secret identified by id. If the secret already exists, then write a new version.
func (*SecretsManagerStore) WriteWithTags ¶
type Store ¶
type Store interface { Config(ctx context.Context) (StoreConfig, error) SetConfig(ctx context.Context, config StoreConfig) error Write(ctx context.Context, id SecretId, value string) error WriteWithTags(ctx context.Context, id SecretId, value string, tags map[string]string) error Read(ctx context.Context, id SecretId, version int) (Secret, error) WriteTags(ctx context.Context, id SecretId, tags map[string]string, deleteOtherTags bool) error ReadTags(ctx context.Context, id SecretId) (map[string]string, error) List(ctx context.Context, service string, includeValues bool) ([]Secret, error) ListRaw(ctx context.Context, service string) ([]RawSecret, error) ListServices(ctx context.Context, service string, includeSecretName bool) ([]string, error) History(ctx context.Context, id SecretId) ([]ChangeEvent, error) Delete(ctx context.Context, id SecretId) error DeleteTags(ctx context.Context, id SecretId, tagKeys []string) error }
Store is an interface for a secret store.
type StoreConfig ¶
type StoreConfig struct { Version string `json:"version"` RequiredTags []string `json:"requiredTags,omitempty"` }
StoreConfig holds configuration information for a store. WARNING: Despite its public visibility, the contents of this struct are subject to change at any time, and are not part of the public interface for chamber.