forked from evergreen-ci/evergreen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig_parameter_store.go
More file actions
37 lines (29 loc) · 952 Bytes
/
config_parameter_store.go
File metadata and controls
37 lines (29 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package evergreen
import (
"context"
"github.com/mongodb/anser/bsonutil"
"github.com/pkg/errors"
"go.mongodb.org/mongo-driver/bson"
)
// ParameterStoreConfig stores configuration for using SSM Parameter Store.
type ParameterStoreConfig struct {
// Prefix is the Parameter Store path prefix for the Evergreen application.
Prefix string `bson:"prefix" json:"prefix" yaml:"prefix"`
}
var (
prefixKey = bsonutil.MustHaveTag(ParameterStoreConfig{}, "Prefix")
)
func (*ParameterStoreConfig) SectionId() string { return "parameter_store" }
func (c *ParameterStoreConfig) Get(ctx context.Context) error {
return getConfigSection(ctx, c)
}
func (c *ParameterStoreConfig) Set(ctx context.Context) error {
return errors.Wrapf(setConfigSection(ctx, c.SectionId(), bson.M{
"$set": bson.M{
prefixKey: c.Prefix,
}}), "updating config section '%s'", c.SectionId(),
)
}
func (c *ParameterStoreConfig) ValidateAndDefault() error {
return nil
}