|
| 1 | +package store |
| 2 | + |
| 3 | +import ( |
| 4 | + "context" |
| 5 | + |
| 6 | + "github.com/aws/aws-sdk-go-v2/service/s3" |
| 7 | + "github.com/aws/aws-sdk-go-v2/service/secretsmanager" |
| 8 | + "github.com/aws/aws-sdk-go-v2/service/ssm" |
| 9 | + "github.com/aws/aws-sdk-go-v2/service/sts" |
| 10 | +) |
| 11 | + |
| 12 | +// The interfaces defined here collect together all of the SDK functions used |
| 13 | +// throughout chamber. Code that works with AWS does so through these interfaces. |
| 14 | +// The "real" AWS SDK client objects implement these interfaces, since they |
| 15 | +// contain all of the methods (and more). Mock versions of these interfaces are |
| 16 | +// generated using the moq utility for substitution in unit tests. For more, see |
| 17 | +// https://aws.github.io/aws-sdk-go-v2/docs/unit-testing/ . |
| 18 | + |
| 19 | +//go:generate moq -out awsapi_mock.go . apiS3 apiSSM apiSTS apiSecretsManager |
| 20 | + |
| 21 | +type apiS3 interface { |
| 22 | + DeleteObject(ctx context.Context, params *s3.DeleteObjectInput, optFns ...func(*s3.Options)) (*s3.DeleteObjectOutput, error) |
| 23 | + GetObject(ctx context.Context, params *s3.GetObjectInput, optFns ...func(*s3.Options)) (*s3.GetObjectOutput, error) |
| 24 | + ListObjectsV2(ctx context.Context, params *s3.ListObjectsV2Input, optFns ...func(*s3.Options)) (*s3.ListObjectsV2Output, error) |
| 25 | + PutObject(ctx context.Context, params *s3.PutObjectInput, optFns ...func(*s3.Options)) (*s3.PutObjectOutput, error) |
| 26 | +} |
| 27 | + |
| 28 | +type apiSSM interface { |
| 29 | + DeleteParameter(ctx context.Context, params *ssm.DeleteParameterInput, optFns ...func(*ssm.Options)) (*ssm.DeleteParameterOutput, error) |
| 30 | + DescribeParameters(ctx context.Context, params *ssm.DescribeParametersInput, optFns ...func(*ssm.Options)) (*ssm.DescribeParametersOutput, error) |
| 31 | + GetParameterHistory(ctx context.Context, params *ssm.GetParameterHistoryInput, optFns ...func(*ssm.Options)) (*ssm.GetParameterHistoryOutput, error) |
| 32 | + GetParameters(ctx context.Context, params *ssm.GetParametersInput, optFns ...func(*ssm.Options)) (*ssm.GetParametersOutput, error) |
| 33 | + GetParametersByPath(ctx context.Context, params *ssm.GetParametersByPathInput, optFns ...func(*ssm.Options)) (*ssm.GetParametersByPathOutput, error) |
| 34 | + PutParameter(ctx context.Context, params *ssm.PutParameterInput, optFns ...func(*ssm.Options)) (*ssm.PutParameterOutput, error) |
| 35 | +} |
| 36 | + |
| 37 | +type apiSTS interface { |
| 38 | + GetCallerIdentity(ctx context.Context, params *sts.GetCallerIdentityInput, optFns ...func(*sts.Options)) (*sts.GetCallerIdentityOutput, error) |
| 39 | +} |
| 40 | + |
| 41 | +type apiSecretsManager interface { |
| 42 | + CreateSecret(ctx context.Context, params *secretsmanager.CreateSecretInput, optFns ...func(*secretsmanager.Options)) (*secretsmanager.CreateSecretOutput, error) |
| 43 | + DescribeSecret(ctx context.Context, params *secretsmanager.DescribeSecretInput, optFns ...func(*secretsmanager.Options)) (*secretsmanager.DescribeSecretOutput, error) |
| 44 | + GetSecretValue(ctx context.Context, params *secretsmanager.GetSecretValueInput, optFns ...func(*secretsmanager.Options)) (*secretsmanager.GetSecretValueOutput, error) |
| 45 | + ListSecretVersionIds(ctx context.Context, params *secretsmanager.ListSecretVersionIdsInput, optFns ...func(*secretsmanager.Options)) (*secretsmanager.ListSecretVersionIdsOutput, error) |
| 46 | + PutSecretValue(ctx context.Context, params *secretsmanager.PutSecretValueInput, optFns ...func(*secretsmanager.Options)) (*secretsmanager.PutSecretValueOutput, error) |
| 47 | +} |
0 commit comments