Documentation ¶
Overview ¶
Package parameterstore provides interfaces to interact with parameters (including sensitive secrets) stored in AWS Systems Manager Parameter Store.
Index ¶
- Constants
- func BumpParameterRecord(ctx context.Context, db *mongo.Database, name string, lastUpdated time.Time) error
- func GetBasename(name string) string
- type Parameter
- type ParameterManager
- func (pm *ParameterManager) Delete(ctx context.Context, names ...string) error
- func (pm *ParameterManager) Get(ctx context.Context, names ...string) ([]Parameter, error)
- func (pm *ParameterManager) GetStrict(ctx context.Context, names ...string) ([]Parameter, error)
- func (pm *ParameterManager) Put(ctx context.Context, name, value string) (*Parameter, error)
- type ParameterManagerOptions
- type ParameterRecord
- type SSMClient
Constants ¶
const Collection = "parameter_records"
Collection holds metadata information about parameters.
const ParamValueMaxLength = 8192
ParamValueMaxLength is the maximum allowed length (in bytes) of an SSM parameter value.
Variables ¶
This section is empty.
Functions ¶
func BumpParameterRecord ¶
func BumpParameterRecord(ctx context.Context, db *mongo.Database, name string, lastUpdated time.Time) error
BumpParameterRecord bumps the parameter record to indicate that the parameter was changed. information. It will not modify the record if it already exists and its latest update is more recent than lastUpdated.
func GetBasename ¶
GetBasename returns the parameter basename without any intermediate paths.
Types ¶
type Parameter ¶
type Parameter struct { // Name is the full name of the parameter, including its path. This is a // unique identifier. For example, the full name could be // /evergreen/path/to/my-parameter. Name string `bson:"-" json:"-" yaml:"-"` // Basename is the parameter's name without any hierarchical paths. For // example, if the full name including the path is // /evergreen/path/to/my-parameter, the basename is my-parameter. Basename string `bson:"-" json:"-" yaml:"-"` // Value is the parameter's plaintext value. This value should never be // persisted in the DB. Value string `bson:"-" json:"-" yaml:"-"` }
Parameter represents a parameter kept in Parameter Store.
type ParameterManager ¶
type ParameterManager struct {
// contains filtered or unexported fields
}
ParameterManager is an intermediate abstraction layer for interacting with parameters in AWS Systems Manager Parameter Store. It supports caching to optimize parameter retrieval.
func NewParameterManager ¶
func NewParameterManager(ctx context.Context, opts ParameterManagerOptions) (*ParameterManager, error)
NewParameterManager creates a new ParameterManager instance.
func (*ParameterManager) Delete ¶
func (pm *ParameterManager) Delete(ctx context.Context, names ...string) error
Delete deletes the parameters given by the provided name(s).
func (*ParameterManager) Get ¶
Get retrieves the parameters given by the provided name(s). If some parameters cannot be found, they will not be returned. Use GetStrict to both get the parameters and validate that all the requested parameters were found.
type ParameterManagerOptions ¶
type ParameterManagerOptions struct { // PathPrefix is the prefix path in the Parameter Store hierarchy. If set, // all parameters should be stored under this prefix. PathPrefix string CachingEnabled bool SSMClient SSMClient DB *mongo.Database }
ParameterManagerOptions represent options to create a parameter manager.
type ParameterRecord ¶
type ParameterRecord struct { // Name is the unique full path identifier for the parameter. The name is // intentionally tagged as the BSON _id to ensure that the parameter's // unique name is the document's unique and primary identifier. Name string `bson:"_id" json:"_id"` // LastUpdated is the time the parameter was most recently updated. LastUpdated time.Time `bson:"last_updated" json:"last_updated"` }
ParameterRecord stores metadata information about parameters. This never stores the value of the parameter itself.
func FindByNames ¶
func FindByNames(ctx context.Context, db *mongo.Database, names ...string) ([]ParameterRecord, error)
FindByNames finds all parameter records by their parameter names.
func FindOneName ¶
FindOneName finds one parameter record by its parameter name.
type SSMClient ¶
type SSMClient interface { // PutParameter puts a parameter into Parameter Store. PutParameter(context.Context, *ssm.PutParameterInput) (*ssm.PutParameterOutput, error) // DeleteParametersSimple is the same as DeleteParameters but only returns // the names of the deleted parameters rather than the full output. DeleteParametersSimple(context.Context, *ssm.DeleteParametersInput) ([]string, error) // DeleteParameters deletes the specified parameters. Parameter Store limits // how many parameters can be deleted per call, so implementations are // expected to handle batching transparently. The returned output slice // contains the output of each batched request. DeleteParameters(context.Context, *ssm.DeleteParametersInput) ([]*ssm.DeleteParametersOutput, error) // GetParametersSimple is the same as GetParameters but only returns the // parameter information rather than the full output. GetParametersSimple(context.Context, *ssm.GetParametersInput) ([]ssmTypes.Parameter, error) // GetParameters retrieves the specified parameters. Parameter Store // limits how many parameters can be retrieved per call, so implementations // must handle batching transparently. The returned output slice contains // the output of each batched request. GetParameters(context.Context, *ssm.GetParametersInput) ([]*ssm.GetParametersOutput, error) }
SSMClient is an interface to interact with AWS Systems Manager (SSM) Parameter Store.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package fakeparameter contains the data model and helpers for testing code that uses Parameter Store.
|
Package fakeparameter contains the data model and helpers for testing code that uses Parameter Store. |