Documentation ¶
Index ¶
- Variables
- type Parameter
- type ParameterStore
- func (ps *ParameterStore) GetAllParametersByPath(path string, decrypt bool) (*Parameters, error)
- func (ps *ParameterStore) GetParameter(name string, decrypted bool) (*Parameter, error)
- func (ps *ParameterStore) PutSecureParameter(name, value string, overwrite bool) error
- func (ps *ParameterStore) PutSecureParameterWithCMK(name, value string, overwrite bool, kmsID string) error
- type Parameters
Constants ¶
This section is empty.
Variables ¶
var ( //ErrParameterNotFound error for when the requested Parameter Store parameter can't be found ErrParameterNotFound = errors.New("parameter not found") //ErrParameterInvalidName error for invalid parameter name ErrParameterInvalidName = errors.New("invalid parameter name") )
Functions ¶
This section is empty.
Types ¶
type Parameter ¶
type Parameter struct {
Value *string
}
Parameter holds a Systems Manager parameter from AWS Parameter Store
type ParameterStore ¶
type ParameterStore struct {
// contains filtered or unexported fields
}
ParameterStore holds all the methods tha are supported against AWS Parameter Store
func NewParameterStore ¶
func NewParameterStore(ssmConfig ...*aws.Config) (*ParameterStore, error)
NewParameterStore is creating a new ParameterStore by creating an AWS Session
func NewParameterStoreWithClient ¶
func NewParameterStoreWithClient(client ssmClient) *ParameterStore
NewParameterStoreWithClient is creating a new ParameterStore with the given ssm Client
func (*ParameterStore) GetAllParametersByPath ¶
func (ps *ParameterStore) GetAllParametersByPath(path string, decrypt bool) (*Parameters, error)
GetAllParametersByPath is returning all the Parameters that are hierarchy linked to this path For example a request with path as /my-service/dev/ Will return /my-service/dev/param-a, /my-service/dev/param-b, etc... but will not return recursive paths the `ssm:GetAllParametersByPath` permission is required to the `arn:aws:ssm:aws-region:aws-account-id:/my-service/dev/*`
This will also page through and return all elements in the hierarchy, non-recursively
func (*ParameterStore) GetParameter ¶
func (ps *ParameterStore) GetParameter(name string, decrypted bool) (*Parameter, error)
GetParameter is returning the parameter with the given name For example a request with name as /my-service/dev/param-1 Will return the parameter value if exists or ErrParameterInvalidName if parameter cannot be found The `ssm:GetParameter` permission is required to the `arn:aws:ssm:aws-region:aws-account-id:/my-service/dev/param-1` resource
func (*ParameterStore) PutSecureParameter ¶
func (ps *ParameterStore) PutSecureParameter(name, value string, overwrite bool) error
PutSecureParameter is setting the parameter with the given name to a passed in value. Allow overwriting the value of the parameter already exists, otherwise an error is returned For example a request with name as '/my-service/dev/param-1': Will set the parameter value if exists or ErrParameterInvalidName if parameter already exists or is empty and `overwrite` is false. The `ssm:PutParameter` permission is required to the `arn:aws:ssm:aws-region:aws-account-id:/my-service/dev/param-1` resource
func (*ParameterStore) PutSecureParameterWithCMK ¶
func (ps *ParameterStore) PutSecureParameterWithCMK(name, value string, overwrite bool, kmsID string) error
PutSecureParameterWithCMK is the same as PutSecureParameter but with a passed in CMK (Customer Master Key) For example a request with name as '/my-service/dev/param-1' and a `kmsID` of 'foo': Will set the parameter value if exists or ErrParameterInvalidName if parameter already exists or is empty and `overwrite` is false. The `ssm:PutParameter` permission is required to the `arn:aws:ssm:aws-region:aws-account-id:/my-service/dev/param-1` resource The `kms:Encrypt` permission is required to the `arn:aws:kms:us-east-1:710015040892:key/foo`
type Parameters ¶
type Parameters struct {
// contains filtered or unexported fields
}
Parameters holds the output and all AWS Parameter Store that have the same base path
func NewParameters ¶
func NewParameters(basePath string, parameters map[string]*Parameter) *Parameters
NewParameters creates a Parameters
func (*Parameters) Decode ¶
func (p *Parameters) Decode(output interface{}) error
Decode decodes the parameters into the given struct We are using this package to decode the values to the struct https://github.com/mitchellh/mapstructure For more details how you can use this check the parameter_test.go file
func (*Parameters) GetAllValues ¶
func (p *Parameters) GetAllValues() map[string]string
GetAllValues returns a map with all the keys and values in the store.
func (*Parameters) GetValueByFullPath ¶
func (p *Parameters) GetValueByFullPath(name string) string
GetValueByFullPath returns the value based on the full path
func (*Parameters) GetValueByName ¶
func (p *Parameters) GetValueByName(name string) string
GetValueByName returns the value based on the name so the AWS Parameter Store parameter name is base path + name