zotregistry.io/zot@v1.4.4-0.20231124084042-02a8ed785457/pkg/test/mocks/secrets_manager_mock.go (about) 1 package mocks 2 3 import ( 4 "context" 5 6 "github.com/aws/aws-sdk-go-v2/service/secretsmanager" 7 ) 8 9 type SecretsManagerMock struct { 10 CreateSecretFn func(ctx context.Context, params *secretsmanager.CreateSecretInput, 11 optFns ...func(*secretsmanager.Options)) (*secretsmanager.CreateSecretOutput, error) 12 DeleteSecretFn func(ctx context.Context, params *secretsmanager.DeleteSecretInput, 13 optFns ...func(*secretsmanager.Options)) (*secretsmanager.DeleteSecretOutput, error) 14 ListSecretsFn func(ctx context.Context, params *secretsmanager.ListSecretsInput, 15 optFns ...func(*secretsmanager.Options)) (*secretsmanager.ListSecretsOutput, error) 16 } 17 18 func (secretsManagerMock SecretsManagerMock) CreateSecret(ctx context.Context, params *secretsmanager.CreateSecretInput, 19 optFns ...func(*secretsmanager.Options), 20 ) (*secretsmanager.CreateSecretOutput, error) { 21 if secretsManagerMock.CreateSecretFn != nil { 22 return secretsManagerMock.CreateSecretFn(ctx, params, optFns...) 23 } 24 25 return &secretsmanager.CreateSecretOutput{}, nil 26 } 27 28 func (secretsManagerMock SecretsManagerMock) DeleteSecret(ctx context.Context, params *secretsmanager.DeleteSecretInput, 29 optFns ...func(*secretsmanager.Options), 30 ) (*secretsmanager.DeleteSecretOutput, error) { 31 if secretsManagerMock.DeleteSecretFn != nil { 32 return secretsManagerMock.DeleteSecretFn(ctx, params, optFns...) 33 } 34 35 return &secretsmanager.DeleteSecretOutput{}, nil 36 } 37 38 func (secretsManagerMock SecretsManagerMock) ListSecrets(ctx context.Context, params *secretsmanager.ListSecretsInput, 39 optFns ...func(*secretsmanager.Options), 40 ) (*secretsmanager.ListSecretsOutput, error) { 41 if secretsManagerMock.ListSecretsFn != nil { 42 return secretsManagerMock.ListSecretsFn(ctx, params, optFns...) 43 } 44 45 return &secretsmanager.ListSecretsOutput{}, nil 46 } 47 48 type SecretsManagerCacheMock struct { 49 GetSecretStringFn func(string) (string, error) 50 } 51 52 func (secretsManagerCacheMock SecretsManagerCacheMock) GetSecretString(secretID string) (string, error) { 53 if secretsManagerCacheMock.GetSecretStringFn != nil { 54 return secretsManagerCacheMock.GetSecretStringFn(secretID) 55 } 56 57 return "", nil 58 }