Documentation
¶
Index ¶
- Constants
- Variables
- type ArtifactoryClient
- type ArtifactoryStore
- type ArtifactoryStoreOptions
- type AzureKeyVaultClient
- type AzureKeyVaultStore
- type AzureKeyVaultStoreOptions
- type GSMClient
- type GSMStore
- type GSMStoreOptions
- type RedisClient
- type RedisStore
- type RedisStoreOptions
- type SSMClient
- type SSMStore
- type SSMStoreOptions
- type STSClient
- type Store
- func NewArtifactoryStore(options ArtifactoryStoreOptions) (Store, error)
- func NewAzureKeyVaultStore(options AzureKeyVaultStoreOptions) (Store, error)
- func NewGSMStore(options GSMStoreOptions) (Store, error)
- func NewRedisStore(options RedisStoreOptions) (Store, error)
- func NewSSMStore(options SSMStoreOptions) (Store, error)
- type StoreConfig
- type StoreFactory
- type StoreRegistry
- type StoresConfig
Constants ¶
const (
// AzureKeyVaultHyphen is the hyphen character used for Azure Key Vault secret name normalization.
AzureKeyVaultHyphen = "-"
)
Variables ¶
var ( // Common validation errors. ErrEmptyStack = errors.New("stack cannot be empty") ErrEmptyComponent = errors.New("component cannot be empty") ErrEmptyKey = errors.New("key cannot be empty") ErrStackDelimiterNotSet = errors.New("stack delimiter is not set") ErrGetKey = errors.New("failed to get key") // AWS SSM specific errors. ErrRegionRequired = errors.New("region is required in ssm store configuration") ErrLoadAWSConfig = errors.New("failed to load AWS config") ErrSetParameter = errors.New("failed to set parameter") ErrGetParameter = errors.New("failed to get parameter") // Azure Key Vault specific errors. ErrVaultURLRequired = errors.New("vault_url is required in azure key vault store configuration") ErrCreateClient = errors.New("failed to create client") ErrAccessSecret = errors.New("failed to access secret") ErrResourceNotFound = errors.New("resource not found") ErrPermissionDenied = errors.New("permission denied") // Redis specific errors. ErrParseRedisURL = errors.New("failed to parse redis url") ErrMissingRedisURL = errors.New("either url must be set in options or ATMOS_REDIS_URL environment variable must be set") ErrGetRedisKey = errors.New("failed to get key from redis") // Artifactory specific errors. ErrMissingArtifactoryToken = errors.New("either access_token must be set in options or one of JFROG_ACCESS_TOKEN or ARTIFACTORY_ACCESS_TOKEN environment variables must be set") ErrCreateTempDir = errors.New("failed to create temp dir") ErrCreateTempFile = errors.New("failed to create temp file") ErrDownloadFile = errors.New("failed to download file") ErrNoFilesDownloaded = errors.New("no files downloaded") ErrReadFile = errors.New("failed to read file") ErrUnmarshalFile = errors.New("failed to unmarshal file") ErrWriteTempFile = errors.New("failed to write to temp file") ErrUploadFile = errors.New("failed to upload file") // Google Secret Manager specific errors. ErrProjectIDRequired = errors.New("project_id is required in Google Secret Manager store configuration") ErrValueMustBeString = errors.New("value must be a string") ErrCreateSecret = errors.New("failed to create secret") ErrAddSecretVersion = errors.New("failed to add secret version") // Registry specific errors. ErrParseArtifactoryOptions = errors.New("failed to parse Artifactory store options") ErrParseSSMOptions = errors.New("failed to parse SSM store options") ErrParseRedisOptions = errors.New("failed to parse Redis store options") ErrStoreTypeNotFound = errors.New("store type not found") // Shared errors. ErrSerializeJSON = errors.New("failed to serialize value to JSON") ErrMarshalValue = errors.New("failed to marshal value") ErrNilValue = errors.New("cannot store nil value") )
Common errors shared across store implementations.
Functions ¶
This section is empty.
Types ¶
type ArtifactoryClient ¶ added in v1.148.1
type ArtifactoryClient interface {
DownloadFiles(...services.DownloadParams) (int, int, error)
UploadFiles(artifactory.UploadServiceOptions, ...services.UploadParams) (int, int, error)
}
ArtifactoryClient interface allows us to mock the Artifactory Services Manager in test with only the methods we are using in the ArtifactoryStore.
type ArtifactoryStore ¶ added in v1.148.1
type ArtifactoryStore struct {
// contains filtered or unexported fields
}
func (*ArtifactoryStore) Get ¶ added in v1.148.1
func (s *ArtifactoryStore) Get(stack string, component string, key string) (interface{}, error)
func (*ArtifactoryStore) GetKey ¶ added in v1.187.0
func (s *ArtifactoryStore) GetKey(key string) (interface{}, error)
type ArtifactoryStoreOptions ¶ added in v1.148.1
type AzureKeyVaultClient ¶ added in v1.181.0
type AzureKeyVaultClient interface {
SetSecret(ctx context.Context, name string, parameters azsecrets.SetSecretParameters, options *azsecrets.SetSecretOptions) (azsecrets.SetSecretResponse, error)
GetSecret(ctx context.Context, name string, version string, options *azsecrets.GetSecretOptions) (azsecrets.GetSecretResponse, error)
}
AzureKeyVaultClient interface allows us to mock the Azure Key Vault client.
type AzureKeyVaultStore ¶ added in v1.181.0
type AzureKeyVaultStore struct {
// contains filtered or unexported fields
}
AzureKeyVaultStore is an implementation of the Store interface for Azure Key Vault.
func (*AzureKeyVaultStore) Get ¶ added in v1.181.0
func (s *AzureKeyVaultStore) Get(stack string, component string, key string) (interface{}, error)
func (*AzureKeyVaultStore) GetKey ¶ added in v1.187.0
func (s *AzureKeyVaultStore) GetKey(key string) (interface{}, error)
type AzureKeyVaultStoreOptions ¶ added in v1.181.0
type GSMClient ¶ added in v1.166.0
type GSMClient interface {
CreateSecret(ctx context.Context, req *secretmanagerpb.CreateSecretRequest, opts ...gax.CallOption) (*secretmanagerpb.Secret, error)
AddSecretVersion(ctx context.Context, req *secretmanagerpb.AddSecretVersionRequest, opts ...gax.CallOption) (*secretmanagerpb.SecretVersion, error)
AccessSecretVersion(ctx context.Context, req *secretmanagerpb.AccessSecretVersionRequest, opts ...gax.CallOption) (*secretmanagerpb.AccessSecretVersionResponse, error)
Close() error
}
GSMClient is the interface that wraps the Google Secret Manager client methods we use.
type GSMStore ¶ added in v1.166.0
type GSMStore struct {
// contains filtered or unexported fields
}
GSMStore is an implementation of the Store interface for Google Secret Manager.
type GSMStoreOptions ¶ added in v1.166.0
type GSMStoreOptions struct {
Prefix *string `mapstructure:"prefix"`
ProjectID string `mapstructure:"project_id"`
StackDelimiter *string `mapstructure:"stack_delimiter"`
Credentials *string `mapstructure:"credentials"` // Optional JSON credentials
Locations *[]string `mapstructure:"locations"` // Optional replication locations
}
GSMStoreOptions defines the configuration options for Google Secret Manager store.
type RedisClient ¶ added in v1.159.0
type RedisClient interface {
Get(ctx context.Context, key string) *redis.StringCmd
Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *redis.StatusCmd
}
RedisClient interface allows us to mock the Redis Client in test with only the methods we are using in the RedisStore.
type RedisStore ¶ added in v1.159.0
type RedisStore struct {
// contains filtered or unexported fields
}
func (*RedisStore) Get ¶ added in v1.159.0
func (s *RedisStore) Get(stack string, component string, key string) (interface{}, error)
func (*RedisStore) GetKey ¶ added in v1.187.0
func (s *RedisStore) GetKey(key string) (interface{}, error)
func (*RedisStore) RedisClient ¶ added in v1.187.0
func (s *RedisStore) RedisClient() RedisClient
RedisClient returns the underlying Redis client for testing purposes.
type RedisStoreOptions ¶ added in v1.159.0
type SSMClient ¶
type SSMClient interface {
PutParameter(ctx context.Context, params *ssm.PutParameterInput, optFns ...func(*ssm.Options)) (*ssm.PutParameterOutput, error)
GetParameter(ctx context.Context, params *ssm.GetParameterInput, optFns ...func(*ssm.Options)) (*ssm.GetParameterOutput, error)
}
SSMClient interface allows us to mock the AWS SSM client.
type SSMStore ¶
type SSMStore struct {
// contains filtered or unexported fields
}
SSMStore is an implementation of the Store interface for AWS SSM Parameter Store.
func (*SSMStore) Get ¶
Get retrieves a value by key for an Atmos component in a stack from AWS SSM Parameter Store.
type SSMStoreOptions ¶
type STSClient ¶ added in v1.168.0
type STSClient interface {
AssumeRole(ctx context.Context, params *sts.AssumeRoleInput, optFns ...func(*sts.Options)) (*sts.AssumeRoleOutput, error)
}
STSClient interface allows us to mock the AWS STS client.
type Store ¶
type Store interface {
Set(stack string, component string, key string, value any) error
Get(stack string, component string, key string) (any, error)
GetKey(key string) (any, error)
}
Store defines the common interface for all store implementations.
func NewArtifactoryStore ¶ added in v1.148.1
func NewArtifactoryStore(options ArtifactoryStoreOptions) (Store, error)
func NewAzureKeyVaultStore ¶ added in v1.181.0
func NewAzureKeyVaultStore(options AzureKeyVaultStoreOptions) (Store, error)
func NewGSMStore ¶ added in v1.166.0
func NewGSMStore(options GSMStoreOptions) (Store, error)
NewGSMStore initializes a new Google Secret Manager Store.
func NewRedisStore ¶ added in v1.159.0
func NewRedisStore(options RedisStoreOptions) (Store, error)
func NewSSMStore ¶
func NewSSMStore(options SSMStoreOptions) (Store, error)
NewSSMStore initializes a new SSMStore.
type StoreConfig ¶
type StoreFactory ¶
StoreFactory is a function type to initialize a new store.
type StoreRegistry ¶
func NewStoreRegistry ¶
func NewStoreRegistry(config *StoresConfig) (StoreRegistry, error)
type StoresConfig ¶
type StoresConfig = map[string]StoreConfig