From b6f6fa174893a5d0973afe1db6bd67ebe2165c66 Mon Sep 17 00:00:00 2001 From: Hidde Beydals Date: Fri, 27 May 2022 22:35:50 +0200 Subject: [PATCH] kms: AWS SDK V2, allow creds config, add tests This updates the AWS SDK for Go to V2, adds extensive test coverage based on a mocking server, and a general tidying of bits of code. The improvements are based on a fork of the key source in the Flux project's kustomize-controller, built due to SOPS' limitation around credential management without relying on runtime environment variables. - AWS SDK has been updated to V2. There are still bits in `publish/` which would need updating to drop the dependency on V1. - It introduces a `CredentialsProvider` type which holds an `aws.CredentialsProvider`, and can be applied to the `MasterKey`. When applied, the provider is used in the AWS client configuration instead of relying on the SDK default (environmental) values. This is most useful when working with SOPS as an SDK, in combination with e.g. a local key service server implementation. - Extensive test coverage. STS session implementation details are not tested due to mocking complexities, but the wiring is. The forked version of this has compatibility tests to ensure it works with current SOPS: - https://github.com/fluxcd/kustomize-controller/blob/8b7e7ecb1aea34a7a14ebed159bf0f2fc1f2f7f3/internal/sops/awskms/keysource_test.go#L134 - https://github.com/fluxcd/kustomize-controller/blob/8b7e7ecb1aea34a7a14ebed159bf0f2fc1f2f7f3/internal/sops/awskms/keysource_test.go#L200 Co-authored-by: Sanskar Jaiswal Signed-off-by: Hidde Beydals --- go.mod | 12 + go.sum | 24 + kms/keysource.go | 475 +++-- kms/keysource_test.go | 528 +++++- kms/mocks/KMSAPI.go | 4058 ----------------------------------------- 5 files changed, 802 insertions(+), 4295 deletions(-) delete mode 100644 kms/mocks/KMSAPI.go diff --git a/go.mod b/go.mod index 421e5c962..554a77fc6 100644 --- a/go.mod +++ b/go.mod @@ -10,6 +10,11 @@ require ( github.com/Azure/azure-sdk-for-go/sdk/keyvault/azkeys v0.5.1 github.com/ProtonMail/go-crypto v0.0.0-20220407094043-a94812496cf5 github.com/aws/aws-sdk-go v1.43.43 + github.com/aws/aws-sdk-go-v2 v1.16.4 + github.com/aws/aws-sdk-go-v2/config v1.15.9 + github.com/aws/aws-sdk-go-v2/credentials v1.12.4 + github.com/aws/aws-sdk-go-v2/service/kms v1.17.2 + github.com/aws/aws-sdk-go-v2/service/sts v1.16.6 github.com/blang/semver v3.5.1+incompatible github.com/fatih/color v1.13.0 github.com/golang/protobuf v1.5.2 @@ -49,6 +54,13 @@ require ( github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect github.com/armon/go-metrics v0.3.10 // indirect github.com/armon/go-radix v1.0.0 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.5 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.11 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.5 // indirect + github.com/aws/aws-sdk-go-v2/internal/ini v1.3.12 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.5 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.11.7 // indirect + github.com/aws/smithy-go v1.11.2 // indirect github.com/cenkalti/backoff v2.2.1+incompatible // indirect github.com/cenkalti/backoff/v3 v3.2.2 // indirect github.com/containerd/continuity v0.2.2 // indirect diff --git a/go.sum b/go.sum index 10c214b09..83f09eaaa 100644 --- a/go.sum +++ b/go.sum @@ -96,6 +96,30 @@ github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aws/aws-sdk-go v1.43.43 h1:1L06qzQvl4aC3Skfh5rV7xVhGHjIZoHcqy16NoyQ1o4= github.com/aws/aws-sdk-go v1.43.43/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= +github.com/aws/aws-sdk-go-v2 v1.16.4 h1:swQTEQUyJF/UkEA94/Ga55miiKFoXmm/Zd67XHgmjSg= +github.com/aws/aws-sdk-go-v2 v1.16.4/go.mod h1:ytwTPBG6fXTZLxxeeCCWj2/EMYp/xDUgX+OET6TLNNU= +github.com/aws/aws-sdk-go-v2/config v1.15.9 h1:TK5yNEnFDQ9iaO04gJS/3Y+eW8BioQiCUafW75/Wc3Q= +github.com/aws/aws-sdk-go-v2/config v1.15.9/go.mod h1:rv/l/TbZo67kp99v/3Kb0qV6Fm1KEtKyruEV2GvVfgs= +github.com/aws/aws-sdk-go-v2/credentials v1.12.4 h1:xggwS+qxCukXRVXJBJWQJGyUsvuxGC8+J1kKzv2cxuw= +github.com/aws/aws-sdk-go-v2/credentials v1.12.4/go.mod h1:7g+GGSp7xtR823o1jedxKmqRZGqLdoHQfI4eFasKKxs= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.5 h1:YPxclBeE07HsLQE8vtjC8T2emcTjM9nzqsnDi2fv5UM= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.5/go.mod h1:WAPnuhG5IQ/i6DETFl5NmX3kKqCzw7aau9NHAGcm4QE= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.11 h1:gsqHplNh1DaQunEKZISK56wlpbCg0yKxNVvGWCFuF1k= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.11/go.mod h1:tmUB6jakq5DFNcXsXOA/ZQ7/C8VnSKYkx58OI7Fh79g= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.5 h1:PLFj+M2PgIDHG//hw3T0O0KLI4itVtAjtxrZx4AHPLg= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.5/go.mod h1:fV1AaS2gFc1tM0RCb015FJ0pvWVUfJZANzjwoO4YakM= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.12 h1:j0VqrjtgsY1Bx27tD0ysay36/K4kFMWRp9K3ieO9nLU= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.12/go.mod h1:00c7+ALdPh4YeEUPXJzyU0Yy01nPGOq2+9rUaz05z9g= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.5 h1:gRW1ZisKc93EWEORNJRvy/ZydF3o6xLSveJHdi1Oa0U= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.5/go.mod h1:ZbkttHXaVn3bBo/wpJbQGiiIWR90eTBUVBrEHUEQlho= +github.com/aws/aws-sdk-go-v2/service/kms v1.17.2 h1:g5sAKPf2OyQf6Qk/HmisWJvAbp3+vjfX1d2wLPUXo1Y= +github.com/aws/aws-sdk-go-v2/service/kms v1.17.2/go.mod h1:O99LMSMb/hDB0sQ3OI3SV1rMzwVH/g4608bps5k5dr8= +github.com/aws/aws-sdk-go-v2/service/sso v1.11.7 h1:suAGD+RyiHWPPihZzY+jw4mCZlOFWgmdjb2AeTenz7c= +github.com/aws/aws-sdk-go-v2/service/sso v1.11.7/go.mod h1:TFVe6Rr2joVLsYQ1ABACXgOC6lXip/qpX2x5jWg/A9w= +github.com/aws/aws-sdk-go-v2/service/sts v1.16.6 h1:aYToU0/iazkMY67/BYLt3r6/LT/mUtarLAF5mGof1Kg= +github.com/aws/aws-sdk-go-v2/service/sts v1.16.6/go.mod h1:rP1rEOKAGZoXp4iGDxSXFvODAtXpm34Egf0lL0eshaQ= +github.com/aws/smithy-go v1.11.2 h1:eG/N+CcUMAvsdffgMvjMKwfyDzIkjM6pfxMJ8Mzc6mE= +github.com/aws/smithy-go v1.11.2/go.mod h1:3xHYmszWVx2c0kIwQeEVf9uSm4fYZt67FBJnwub1bgM= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= diff --git a/kms/keysource.go b/kms/keysource.go index 1926fcdc2..8ce11ff4c 100644 --- a/kms/keysource.go +++ b/kms/keysource.go @@ -1,10 +1,12 @@ /* -Package kms contains an implementation of the go.mozilla.org/sops/v3.MasterKey interface that encrypts and decrypts the -data key using AWS KMS with the AWS Go SDK. +Package kms contains an implementation of the go.mozilla.org/sops/v3.MasterKey +interface that encrypts and decrypts the data key using AWS KMS with the SDK +for Go V2. */ package kms //import "go.mozilla.org/sops/v3/kms" import ( + "context" "encoding/base64" "fmt" "os" @@ -12,116 +14,71 @@ import ( "strings" "time" - "go.mozilla.org/sops/v3/logging" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/credentials/stscreds" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/kms" - "github.com/aws/aws-sdk-go/service/kms/kmsiface" - "github.com/aws/aws-sdk-go/service/sts" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/config" + "github.com/aws/aws-sdk-go-v2/credentials" + "github.com/aws/aws-sdk-go-v2/service/kms" + "github.com/aws/aws-sdk-go-v2/service/sts" "github.com/sirupsen/logrus" + "go.mozilla.org/sops/v3/logging" ) -var log *logrus.Logger +const ( + // arnRegex matches an AWS ARN, for example: + // "arn:aws:kms:us-west-2:107501996527:key/612d5f0p-p1l3-45e6-aca6-a5b005693a48". + arnRegex = `^arn:aws[\w-]*:kms:(.+):[0-9]+:(key|alias)/.+$` + // stsSessionRegex matches an AWS STS session name, for example: + // "john_s", "sops@42WQm042". + stsSessionRegex = "[^a-zA-Z0-9=,.@-_]+" + // roleSessionNameLengthLimit is the AWS role session name length limit. + roleSessionNameLengthLimit = 64 + // kmsTTL is the duration after which a MasterKey requires rotation. + kmsTTL = time.Hour * 24 * 30 * 6 +) + +var ( + // log is the global logger for any AWS KMS MasterKey. + log *logrus.Logger + // osHostname returns the hostname as reported by the kernel. + osHostname = os.Hostname +) func init() { log = logging.NewLogger("AWSKMS") } -// this needs to be a global var for unit tests to work (mockKMS redefines -// it in keysource_test.go) -var kmsSvc kmsiface.KMSAPI -var isMocked bool - -// MasterKey is a AWS KMS key used to encrypt and decrypt sops' data key. +// MasterKey is an AWS KMS key used to encrypt and decrypt SOPS' data key using +// AWS SDK for Go V2. type MasterKey struct { - Arn string - Role string - EncryptedKey string - CreationDate time.Time + // Arn associated with the AWS KMS key. + Arn string + // Role ARN used to assume a role through AWS STS. + Role string + // EncryptedKey stores the data key in it's encrypted form. + EncryptedKey string + // CreationDate is when this MasterKey was created. + CreationDate time.Time + // EncryptionContext provides additional context about the data key. + // Ref: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context EncryptionContext map[string]*string - AwsProfile string + // AwsProfile is the profile to use for loading configuration and credentials. + // Ref: https://aws.github.io/aws-sdk-go-v2/docs/configuring-sdk/#specifying-profiles + AwsProfile string + + // credentialsProvider is used to configure the AWS client config with + // credentials. It can be injected by a (local) keyservice.KeyServiceServer + // using CredentialsProvider.ApplyToMasterKey. If nil, the default client is used + // which utilizes runtime environmental values. + credentialsProvider aws.CredentialsProvider + // epResolver can be used to override the endpoint the AWS client resolves + // to by default. This is mostly used for testing purposes as it can not be + // injected using e.g. an environment variable. The field is not publicly + // exposed, nor configurable. + epResolver aws.EndpointResolverWithOptions } -// EncryptedDataKey returns the encrypted data key this master key holds -func (key *MasterKey) EncryptedDataKey() []byte { - return []byte(key.EncryptedKey) -} - -// SetEncryptedDataKey sets the encrypted data key for this master key -func (key *MasterKey) SetEncryptedDataKey(enc []byte) { - key.EncryptedKey = string(enc) -} - -// Encrypt takes a sops data key, encrypts it with KMS and stores the result in the EncryptedKey field -func (key *MasterKey) Encrypt(dataKey []byte) error { - // isMocked is set by unit test to indicate that the KMS service - // has already been initialized. it's ugly, but it works. - if kmsSvc == nil || !isMocked { - sess, err := key.createSession() - if err != nil { - log.WithField("arn", key.Arn).Info("Encryption failed") - return fmt.Errorf("Failed to create session: %w", err) - } - kmsSvc = kms.New(sess) - } - out, err := kmsSvc.Encrypt(&kms.EncryptInput{Plaintext: dataKey, KeyId: &key.Arn, EncryptionContext: key.EncryptionContext}) - if err != nil { - log.WithField("arn", key.Arn).Info("Encryption failed") - return fmt.Errorf("Failed to call KMS encryption service: %w", err) - } - key.EncryptedKey = base64.StdEncoding.EncodeToString(out.CiphertextBlob) - log.WithField("arn", key.Arn).Info("Encryption succeeded") - return nil -} - -// EncryptIfNeeded encrypts the provided sops' data key and encrypts it if it hasn't been encrypted yet -func (key *MasterKey) EncryptIfNeeded(dataKey []byte) error { - if key.EncryptedKey == "" { - return key.Encrypt(dataKey) - } - return nil -} - -// Decrypt decrypts the EncryptedKey field with AWS KMS and returns the result. -func (key *MasterKey) Decrypt() ([]byte, error) { - k, err := base64.StdEncoding.DecodeString(key.EncryptedKey) - if err != nil { - log.WithField("arn", key.Arn).Info("Decryption failed") - return nil, fmt.Errorf("Error base64-decoding encrypted data key: %s", err) - } - // isMocked is set by unit test to indicate that the KMS service - // has already been initialized. it's ugly, but it works. - if kmsSvc == nil || !isMocked { - sess, err := key.createSession() - if err != nil { - log.WithField("arn", key.Arn).Info("Decryption failed") - return nil, fmt.Errorf("Error creating AWS session: %w", err) - } - kmsSvc = kms.New(sess) - } - decrypted, err := kmsSvc.Decrypt(&kms.DecryptInput{CiphertextBlob: k, EncryptionContext: key.EncryptionContext}) - if err != nil { - log.WithField("arn", key.Arn).Info("Decryption failed") - return nil, fmt.Errorf("Error decrypting key: %w", err) - } - log.WithField("arn", key.Arn).Info("Decryption succeeded") - return decrypted.Plaintext, nil -} - -// NeedsRotation returns whether the data key needs to be rotated or not. -func (key *MasterKey) NeedsRotation() bool { - return time.Since(key.CreationDate) > (time.Hour * 24 * 30 * 6) -} - -// ToString converts the key to a string representation -func (key *MasterKey) ToString() string { - return key.Arn -} - -// NewMasterKey creates a new MasterKey from an ARN, role and context, setting the creation date to the current date +// NewMasterKey creates a new MasterKey from an ARN, role and context, setting +// the creation date to the current date. func NewMasterKey(arn string, role string, context map[string]*string) *MasterKey { return &MasterKey{ Arn: arn, @@ -131,24 +88,26 @@ func NewMasterKey(arn string, role string, context map[string]*string) *MasterKe } } -// NewMasterKeyFromArn takes an ARN string and returns a new MasterKey for that ARN +// NewMasterKeyFromArn takes an ARN string and returns a new MasterKey for that +// ARN. func NewMasterKeyFromArn(arn string, context map[string]*string, awsProfile string) *MasterKey { - k := &MasterKey{} + key := &MasterKey{} arn = strings.Replace(arn, " ", "", -1) + key.Arn = arn roleIndex := strings.Index(arn, "+arn:aws:iam::") if roleIndex > 0 { - k.Arn = arn[:roleIndex] - k.Role = arn[roleIndex+1:] - } else { - k.Arn = arn + // Overwrite ARN + key.Arn = arn[:roleIndex] + key.Role = arn[roleIndex+1:] } - k.EncryptionContext = context - k.CreationDate = time.Now().UTC() - k.AwsProfile = awsProfile - return k + key.EncryptionContext = context + key.CreationDate = time.Now().UTC() + key.AwsProfile = awsProfile + return key } -// MasterKeysFromArnString takes a comma separated list of AWS KMS ARNs and returns a slice of new MasterKeys for those ARNs +// MasterKeysFromArnString takes a comma separated list of AWS KMS ARNs, and +// returns a slice of new MasterKeys for those ARNs. func MasterKeysFromArnString(arn string, context map[string]*string, awsProfile string) []*MasterKey { var keys []*MasterKey if arn == "" { @@ -160,88 +119,11 @@ func MasterKeysFromArnString(arn string, context map[string]*string, awsProfile return keys } -func (key MasterKey) createStsSession(config aws.Config, sess *session.Session) (*session.Session, error) { - hostname, err := os.Hostname() - if err != nil { - return nil, err - } - stsRoleSessionNameRe, err := regexp.Compile("[^a-zA-Z0-9=,.@-]+") - if err != nil { - return nil, fmt.Errorf("Failed to compile STS role session name regex: %w", err) - } - sanitizedHostname := stsRoleSessionNameRe.ReplaceAllString(hostname, "") - stsService := sts.New(sess) - name := "sops@" + sanitizedHostname - - // Make sure the name is no longer than 64 characters (role session name length limit from AWS) - roleSessionNameLengthLimit := 64 - if len(name) >= roleSessionNameLengthLimit { - name = name[:roleSessionNameLengthLimit] - } - - out, err := stsService.AssumeRole(&sts.AssumeRoleInput{ - RoleArn: &key.Role, RoleSessionName: &name}) - if err != nil { - return nil, fmt.Errorf("Failed to assume role %q: %w", key.Role, err) - } - config.Credentials = credentials.NewStaticCredentials(*out.Credentials.AccessKeyId, - *out.Credentials.SecretAccessKey, *out.Credentials.SessionToken) - sess, err = session.NewSession(&config) - if err != nil { - return nil, fmt.Errorf("Failed to create new aws session: %w", err) - } - return sess, nil -} - -func (key MasterKey) createSession() (*session.Session, error) { - re := regexp.MustCompile(`^arn:aws[\w-]*:kms:(.+):[0-9]+:(key|alias)/.+$`) - matches := re.FindStringSubmatch(key.Arn) - if matches == nil { - return nil, fmt.Errorf("No valid ARN found in %q", key.Arn) - } - - config := aws.Config{Region: aws.String(matches[1])} - - opts := session.Options{ - Profile: key.AwsProfile, - Config: config, - AssumeRoleTokenProvider: stscreds.StdinTokenProvider, - SharedConfigState: session.SharedConfigEnable, - } - sess, err := session.NewSessionWithOptions(opts) - if err != nil { - return nil, err - } - if key.Role != "" { - return key.createStsSession(config, sess) - } - return sess, nil -} - -// ToMap converts the MasterKey to a map for serialization purposes -func (key MasterKey) ToMap() map[string]interface{} { - out := make(map[string]interface{}) - out["arn"] = key.Arn - if key.Role != "" { - out["role"] = key.Role - } - out["created_at"] = key.CreationDate.UTC().Format(time.RFC3339) - out["enc"] = key.EncryptedKey - if key.EncryptionContext != nil { - outcontext := make(map[string]string) - for k, v := range key.EncryptionContext { - outcontext[k] = *v - } - out["context"] = outcontext - } - return out -} - -// ParseKMSContext takes either a KMS context map or a comma-separated list of KMS context key:value pairs and returns a map +// ParseKMSContext takes either a KMS context map or a comma-separated list of +// KMS context key:value pairs, and returns a map. func ParseKMSContext(in interface{}) map[string]*string { - nonStringValueWarning := "Encryption context contains a non-string value, context will not be used" + const nonStringValueWarning = "Encryption context contains a non-string value, context will not be used" out := make(map[string]*string) - switch in := in.(type) { case map[string]interface{}: if len(in) == 0 { @@ -287,3 +169,214 @@ func ParseKMSContext(in interface{}) map[string]*string { } return out } + +// CredentialsProvider is a wrapper around aws.CredentialsProvider used for +// authentication towards AWS KMS. +type CredentialsProvider struct { + provider aws.CredentialsProvider +} + +// NewCredentialsProvider returns a CredentialsProvider object with the provided +// aws.CredentialsProvider. +func NewCredentialsProvider(cp aws.CredentialsProvider) *CredentialsProvider { + return &CredentialsProvider{ + provider: cp, + } +} + +// ApplyToMasterKey configures the credentials on the provided key. +func (c CredentialsProvider) ApplyToMasterKey(key *MasterKey) { + key.credentialsProvider = c.provider +} + +// Encrypt takes a SOPS data key, encrypts it with KMS and stores the result +// in the EncryptedKey field. +func (key *MasterKey) Encrypt(dataKey []byte) error { + cfg, err := key.createKMSConfig() + if err != nil { + log.WithError(err).WithField("arn", key.Arn).Error("Encryption failed") + return err + } + client := kms.NewFromConfig(*cfg) + input := &kms.EncryptInput{ + KeyId: &key.Arn, + Plaintext: dataKey, + EncryptionContext: stringPointerToStringMap(key.EncryptionContext), + } + out, err := client.Encrypt(context.TODO(), input) + if err != nil { + log.WithError(err).WithField("arn", key.Arn).Error("Encryption failed") + return fmt.Errorf("failed to encrypt sops data key with AWS KMS: %w", err) + } + key.EncryptedKey = base64.StdEncoding.EncodeToString(out.CiphertextBlob) + log.WithField("arn", key.Arn).Info("Encryption succeeded") + return nil +} + +// EncryptIfNeeded encrypts the provided SOPS data key, if it has not been +// encrypted yet. +func (key *MasterKey) EncryptIfNeeded(dataKey []byte) error { + if key.EncryptedKey == "" { + return key.Encrypt(dataKey) + } + return nil +} + +// EncryptedDataKey returns the encrypted data key this master key holds. +func (key *MasterKey) EncryptedDataKey() []byte { + return []byte(key.EncryptedKey) +} + +// SetEncryptedDataKey sets the encrypted data key for this master key. +func (key *MasterKey) SetEncryptedDataKey(enc []byte) { + key.EncryptedKey = string(enc) +} + +// Decrypt decrypts the EncryptedKey with a newly created AWS KMS config, and +// returns the result. +func (key *MasterKey) Decrypt() ([]byte, error) { + k, err := base64.StdEncoding.DecodeString(key.EncryptedKey) + if err != nil { + log.WithError(err).WithField("arn", key.Arn).Error("Decryption failed") + return nil, fmt.Errorf("error base64-decoding encrypted data key: %s", err) + } + cfg, err := key.createKMSConfig() + if err != nil { + log.WithError(err).WithField("arn", key.Arn).Error("Decryption failed") + return nil, err + } + client := kms.NewFromConfig(*cfg) + input := &kms.DecryptInput{ + KeyId: &key.Arn, + CiphertextBlob: k, + EncryptionContext: stringPointerToStringMap(key.EncryptionContext), + } + decrypted, err := client.Decrypt(context.TODO(), input) + if err != nil { + log.WithError(err).WithField("arn", key.Arn).Error("Decryption failed") + return nil, fmt.Errorf("failed to decrypt sops data key with AWS KMS: %w", err) + } + log.WithField("arn", key.Arn).Info("Decryption succeeded") + return decrypted.Plaintext, nil +} + +// NeedsRotation returns whether the data key needs to be rotated or not. +func (key *MasterKey) NeedsRotation() bool { + return time.Since(key.CreationDate) > kmsTTL +} + +// ToString converts the key to a string representation. +func (key *MasterKey) ToString() string { + return key.Arn +} + +// ToMap converts the MasterKey to a map for serialization purposes. +func (key MasterKey) ToMap() map[string]interface{} { + out := make(map[string]interface{}) + out["arn"] = key.Arn + if key.Role != "" { + out["role"] = key.Role + } + out["created_at"] = key.CreationDate.UTC().Format(time.RFC3339) + out["enc"] = key.EncryptedKey + if key.EncryptionContext != nil { + outcontext := make(map[string]string) + for k, v := range key.EncryptionContext { + outcontext[k] = *v + } + out["context"] = outcontext + } + return out +} + +// createKMSConfig returns an AWS config with the credentialsProvider of the +// MasterKey, or the default configuration sources. +func (key MasterKey) createKMSConfig() (*aws.Config, error) { + re := regexp.MustCompile(arnRegex) + matches := re.FindStringSubmatch(key.Arn) + if matches == nil { + return nil, fmt.Errorf("no valid ARN found in '%s'", key.Arn) + } + region := matches[1] + + cfg, err := config.LoadDefaultConfig(context.TODO(), func(lo *config.LoadOptions) error { + // Use the credentialsProvider if present, otherwise default to reading credentials + // from the environment. + if key.credentialsProvider != nil { + lo.Credentials = key.credentialsProvider + } + if key.AwsProfile != "" { + lo.SharedConfigProfile = key.AwsProfile + } + lo.Region = region + + // Set the epResolver, if present. Used ONLY for tests. + if key.epResolver != nil { + lo.EndpointResolverWithOptions = key.epResolver + } + return nil + }) + if err != nil { + return nil, fmt.Errorf("could not load AWS config: %w", err) + } + + if key.Role != "" { + return key.createSTSConfig(&cfg) + } + return &cfg, nil +} + +// createSTSConfig uses AWS STS to assume a role and returns a config +// configured with that role's credentials. It returns an error if +// it fails to construct a session name, or assume the role. +func (key MasterKey) createSTSConfig(config *aws.Config) (*aws.Config, error) { + name, err := stsSessionName() + if err != nil { + return nil, err + } + input := &sts.AssumeRoleInput{ + RoleArn: &key.Role, + RoleSessionName: &name, + } + + client := sts.NewFromConfig(*config) + out, err := client.AssumeRole(context.TODO(), input) + if err != nil { + return nil, fmt.Errorf("failed to assume role '%s': %w", key.Role, err) + } + + config.Credentials = credentials.NewStaticCredentialsProvider(*out.Credentials.AccessKeyId, + *out.Credentials.SecretAccessKey, *out.Credentials.SessionToken, + ) + return config, nil +} + +// stsSessionName returns the name for the STS session in the format of +// `sops@`. It sanitizes the hostname with stsSessionRegex, and +// truncates to roleSessionNameLengthLimit when it exceeds the limit. +func stsSessionName() (string, error) { + hostname, err := osHostname() + if err != nil { + return "", fmt.Errorf("failed to construct STS session name: %w", err) + } + + re := regexp.MustCompile(stsSessionRegex) + sanitizedHostname := re.ReplaceAllString(hostname, "") + + name := "sops@" + sanitizedHostname + if len(name) >= roleSessionNameLengthLimit { + name = name[:roleSessionNameLengthLimit] + } + return name, nil +} + +func stringPointerToStringMap(in map[string]*string) map[string]string { + var out = make(map[string]string) + for k, v := range in { + if v == nil { + continue + } + out[k] = *v + } + return out +} diff --git a/kms/keysource_test.go b/kms/keysource_test.go index c7abffebe..9ae6e1dfb 100644 --- a/kms/keysource_test.go +++ b/kms/keysource_test.go @@ -1,75 +1,172 @@ package kms import ( - "bytes" + "context" + "encoding/base64" + "fmt" + logger "log" + "os" "testing" - "testing/quick" "time" - "github.com/aws/aws-sdk-go/service/kms" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/config" + "github.com/aws/aws-sdk-go-v2/credentials" + "github.com/aws/aws-sdk-go-v2/service/kms" + "github.com/ory/dockertest" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - "go.mozilla.org/sops/v3/kms/mocks" ) -func TestKMS(t *testing.T) { - mockKMS := &mocks.KMSAPI{} - defer mockKMS.AssertExpectations(t) - kmsSvc = mockKMS - isMocked = true - encryptOutput := &kms.EncryptOutput{} - decryptOutput := &kms.DecryptOutput{} - mockKMS.On("Encrypt", mock.AnythingOfType("*kms.EncryptInput")).Return(encryptOutput, nil).Run(func(args mock.Arguments) { - encryptOutput.CiphertextBlob = args.Get(0).(*kms.EncryptInput).Plaintext +var ( + // testKMSServerURL is the URL of the AWS KMS server running in Docker. + // It is loaded by TestMain. + testKMSServerURL string + // testKMSARN is the ARN on the test AWS KMS server. It is loaded + // by TestMain. + testKMSARN string +) + +const ( + // dummyARN is a dummy AWS ARN which passes validation. + dummyARN = "arn:aws:kms:us-west-2:107501996527:key/612d5f0p-p1l3-45e6-aca6-a5b005693a48" + // testLocalKMSImage is a container image repository reference to a mock + // version of AWS' Key Management Service. + // Ref: https://github.com/nsmithuk/local-kms + testLocalKMSImage = "docker.io/nsmithuk/local-kms" + // testLocalKMSImage is the container image tag to use. + testLocalKMSTag = "3.11.1" +) + +// TestMain initializes an AWS KMS server using Docker, writes the HTTP address +// to testKMSServerURL, tries to generate a key for encryption-decryption using a +// backoff retry approach, and then sets testKMSARN to the ID of the generated key. +// It continues to run all the tests, which can make use of the various `test*` +// variables. +func TestMain(m *testing.M) { + // Uses a sensible default on Windows (TCP/HTTP) and Linux/MacOS (socket) + pool, err := dockertest.NewPool("") + if err != nil { + logger.Fatalf("could not connect to docker: %s", err) + } + + // Pull the image, create a container based on it, and run it + // resource, err := pool.Run("nsmithuk/local-kms", testLocalKMSVersion, []string{}) + resource, err := pool.RunWithOptions(&dockertest.RunOptions{ + Repository: testLocalKMSImage, + Tag: testLocalKMSTag, + ExposedPorts: []string{"8080"}, }) - mockKMS.On("Decrypt", mock.AnythingOfType("*kms.DecryptInput")).Return(decryptOutput, nil).Run(func(args mock.Arguments) { - decryptOutput.Plaintext = args.Get(0).(*kms.DecryptInput).CiphertextBlob - }) - k := MasterKey{Arn: "arn:aws:kms:us-east-1:927034868273:key/e9fc75db-05e9-44c1-9c35-633922bac347", Role: "", EncryptedKey: ""} - f := func(x []byte) bool { - err := k.Encrypt(x) - if err != nil { - log.Println(err) + if err != nil { + logger.Fatalf("could not start resource: %s", err) + } + + purgeResource := func() { + if err := pool.Purge(resource); err != nil { + logger.Printf("could not purge resource: %s", err) } - v, err := k.Decrypt() + } + + testKMSServerURL = fmt.Sprintf("http://127.0.0.1:%v", resource.GetPort("8080/tcp")) + masterKey := createTestMasterKey(dummyARN) + + kmsClient, err := createTestKMSClient(masterKey) + if err != nil { + purgeResource() + logger.Fatalf("could not create session: %s", err) + } + + var key *kms.CreateKeyOutput + if err := pool.Retry(func() error { + key, err = kmsClient.CreateKey(context.TODO(), &kms.CreateKeyInput{}) if err != nil { - log.Println(err) + return err } - return bytes.Equal(v, x) + return nil + }); err != nil { + purgeResource() + logger.Fatalf("could not create key: %s", err) } - config := quick.Config{} - if testing.Short() { - config.MaxCount = 10 + + if key.KeyMetadata.Arn != nil { + testKMSARN = *key.KeyMetadata.Arn + } else { + purgeResource() + logger.Fatalf("could not set arn") } - if err := quick.Check(f, &config); err != nil { - t.Error(err) + + // Run the tests, but only if we succeeded in setting up the AWS KMS server. + var code int + if err == nil { + code = m.Run() } + + // This can't be deferred, as os.Exit simpy does not care + if err := pool.Purge(resource); err != nil { + logger.Fatalf("could not purge resource: %s", err) + } + + os.Exit(code) } -func TestKMSKeySourceFromString(t *testing.T) { +func TestNewMasterKey(t *testing.T) { + var ( + dummyRole = "a-role" + dummyEncryptionContext = map[string]*string{ + "foo": aws.String("bar"), + } + ) + key := NewMasterKey(dummyARN, dummyRole, dummyEncryptionContext) + assert.Equal(t, dummyARN, key.Arn) + assert.Equal(t, dummyRole, key.Role) + assert.Equal(t, dummyEncryptionContext, key.EncryptionContext) + assert.NotNil(t, key.CreationDate) +} + +func TestNewMasterKeyFromArn(t *testing.T) { + t.Run("arn", func(t *testing.T) { + var ( + dummyEncryptionContext = map[string]*string{ + "foo": aws.String("bar"), + } + dummyProfile = "a-profile" + ) + key := NewMasterKeyFromArn(dummyARN, dummyEncryptionContext, dummyProfile) + assert.Equal(t, dummyARN, key.Arn) + assert.Equal(t, dummyEncryptionContext, key.EncryptionContext) + assert.Equal(t, dummyProfile, key.AwsProfile) + assert.Empty(t, key.Role) + assert.NotNil(t, key.CreationDate) + }) + + t.Run("arn with spaces", func(t *testing.T) { + key := NewMasterKeyFromArn(" arn:aws:kms:us-west-2 :107501996527:key/612d5f 0p-p1l3-45e6-aca6-a5b00569 3a48 ", nil, "") + assert.Equal(t, "arn:aws:kms:us-west-2:107501996527:key/612d5f0p-p1l3-45e6-aca6-a5b005693a48", key.Arn) + }) + + t.Run("arn with role", func(t *testing.T) { + key := NewMasterKeyFromArn("arn:aws:kms:us-west-2:927034868273:key/fe86dd69-4132-404c-ab86-4269956b4500+arn:aws:iam::927034868273:role/sops-dev-xyz", nil, "") + assert.Equal(t, "arn:aws:kms:us-west-2:927034868273:key/fe86dd69-4132-404c-ab86-4269956b4500", key.Arn) + assert.Equal(t, "arn:aws:iam::927034868273:role/sops-dev-xyz", key.Role) + }) +} + +func TestMasterKeysFromArnString(t *testing.T) { s := "arn:aws:kms:us-east-1:656532927350:key/920aff2e-c5f1-4040-943a-047fa387b27e+arn:aws:iam::927034868273:role/sops-dev, arn:aws:kms:ap-southeast-1:656532927350:key/9006a8aa-0fa6-4c14-930e-a2dfb916de1d" ks := MasterKeysFromArnString(s, nil, "foo") k1 := ks[0] k2 := ks[1] + expectedArn1 := "arn:aws:kms:us-east-1:656532927350:key/920aff2e-c5f1-4040-943a-047fa387b27e" expectedRole1 := "arn:aws:iam::927034868273:role/sops-dev" - if k1.Arn != expectedArn1 { - t.Errorf("ARN mismatch. Expected %s, found %s", expectedArn1, k1.Arn) - } - if k1.Role != expectedRole1 { - t.Errorf("Role mismatch. Expected %s, found %s", expectedRole1, k1.Role) - } + assert.Equal(t, expectedArn1, k1.Arn) + assert.Equal(t, expectedRole1, k1.Role) + expectedArn2 := "arn:aws:kms:ap-southeast-1:656532927350:key/9006a8aa-0fa6-4c14-930e-a2dfb916de1d" - expectedRole2 := "" - if k2.Arn != expectedArn2 { - t.Errorf("ARN mismatch. Expected %s, found %s", expectedArn2, k2.Arn) - } - if k2.Role != expectedRole2 { - t.Errorf("Role mismatch. Expected empty role, found %s.", k2.Role) - } + assert.Equal(t, expectedArn2, k2.Arn) + assert.Empty(t, k2.Role) } -func TestParseEncryptionContext(t *testing.T) { +func TestParseKMSContext(t *testing.T) { value1 := "value1" value2 := "value2" // map from YAML @@ -113,7 +210,151 @@ func TestParseEncryptionContext(t *testing.T) { assert.Nil(t, ParseKMSContext("key1")) } -func TestKeyToMap(t *testing.T) { +func TestCreds_ApplyToMasterKey(t *testing.T) { + creds := NewCredentialsProvider(credentials.NewStaticCredentialsProvider("", "", "")) + key := &MasterKey{} + creds.ApplyToMasterKey(key) + assert.Equal(t, creds.provider, key.credentialsProvider) +} + +func TestMasterKey_Encrypt(t *testing.T) { + t.Run("encrypt", func(t *testing.T) { + key := createTestMasterKey(testKMSARN) + dataKey := []byte("UFO sightings") + assert.NoError(t, key.Encrypt(dataKey)) + assert.NotEmpty(t, key.EncryptedKey) + + kmsClient, err := createTestKMSClient(key) + assert.NoError(t, err) + + k, err := base64.StdEncoding.DecodeString(key.EncryptedKey) + assert.NoError(t, err) + + input := &kms.DecryptInput{ + CiphertextBlob: k, + EncryptionContext: stringPointerToStringMap(key.EncryptionContext), + } + decrypted, err := kmsClient.Decrypt(context.TODO(), input) + assert.NoError(t, err) + assert.Equal(t, dataKey, decrypted.Plaintext) + }) + + t.Run("encrypt error", func(t *testing.T) { + // Valid ARN but invalid for test server. + key := createTestMasterKey(dummyARN) + err := key.Encrypt([]byte("UFO sightings")) + assert.Error(t, err) + assert.ErrorContains(t, err, "failed to encrypt sops data key with AWS KMS") + assert.Empty(t, key.EncryptedKey) + }) + + t.Run("config error", func(t *testing.T) { + key := createTestMasterKey("arn:gcp:kms:antartica-north-2::key/45e6-aca6-a5b005693a48") + err := key.Encrypt([]byte("")) + assert.Error(t, err) + assert.ErrorContains(t, err, "no valid ARN found") + assert.Empty(t, key.EncryptedKey) + }) +} + +func TestMasterKey_EncryptIfNeeded(t *testing.T) { + key := createTestMasterKey(testKMSARN) + assert.NoError(t, key.EncryptIfNeeded([]byte("data"))) + + encryptedKey := key.EncryptedKey + assert.NotEmpty(t, encryptedKey) + + assert.NoError(t, key.EncryptIfNeeded([]byte("some other data"))) + assert.Equal(t, encryptedKey, key.EncryptedKey) +} + +func TestMasterKey_EncryptedDataKey(t *testing.T) { + key := &MasterKey{EncryptedKey: "some key"} + assert.EqualValues(t, key.EncryptedKey, key.EncryptedDataKey()) +} + +func TestMasterKey_SetEncryptedDataKey(t *testing.T) { + key := &MasterKey{} + data := []byte("some data") + key.SetEncryptedDataKey(data) + assert.EqualValues(t, data, key.EncryptedKey) +} + +func TestMasterKey_Decrypt(t *testing.T) { + t.Run("decrypt", func(t *testing.T) { + key := createTestMasterKey(testKMSARN) + kmsClient, err := createTestKMSClient(key) + assert.NoError(t, err) + + dataKey := []byte("it's always DNS") + out, err := kmsClient.Encrypt(context.TODO(), &kms.EncryptInput{ + Plaintext: dataKey, KeyId: &key.Arn, EncryptionContext: stringPointerToStringMap(key.EncryptionContext), + }) + assert.NoError(t, err) + + key.EncryptedKey = base64.StdEncoding.EncodeToString(out.CiphertextBlob) + got, err := key.Decrypt() + assert.NoError(t, err) + assert.Equal(t, dataKey, got) + }) + + t.Run("data key error", func(t *testing.T) { + key := createTestMasterKey(testKMSARN) + key.EncryptedKey = "invalid" + got, err := key.Decrypt() + assert.Error(t, err) + assert.ErrorContains(t, err, "error base64-decoding encrypted data key") + assert.Nil(t, got) + }) + + t.Run("decrypt error", func(t *testing.T) { + // Valid ARN but invalid for test server. + key := createTestMasterKey(dummyARN) + key.EncryptedKey = base64.StdEncoding.EncodeToString([]byte("invalid")) + got, err := key.Decrypt() + assert.Error(t, err) + assert.ErrorContains(t, err, "failed to decrypt sops data key with AWS KMS") + assert.Nil(t, got) + }) + + t.Run("config error", func(t *testing.T) { + key := createTestMasterKey("arn:gcp:kms:antartica-north-2::key/45e6-aca6-a5b005693a48") + got, err := key.Decrypt() + assert.Error(t, err) + assert.ErrorContains(t, err, "no valid ARN found") + assert.Nil(t, got) + }) +} + +func TestMasterKey_EncryptDecrypt_RoundTrip(t *testing.T) { + dataKey := []byte("the wheels on the bus go round and round") + + encryptKey := createTestMasterKey(testKMSARN) + assert.NoError(t, encryptKey.Encrypt(dataKey)) + assert.NotEmpty(t, encryptKey.EncryptedKey) + + decryptKey := createTestMasterKey(testKMSARN) + decryptKey.EncryptedKey = encryptKey.EncryptedKey + + decryptedData, err := decryptKey.Decrypt() + assert.NoError(t, err) + assert.Equal(t, dataKey, decryptedData) +} + +func TestMasterKey_NeedsRotation(t *testing.T) { + key := NewMasterKeyFromArn(dummyARN, nil, "") + assert.False(t, key.NeedsRotation()) + + key.CreationDate = key.CreationDate.Add(-(kmsTTL + time.Second)) + assert.True(t, key.NeedsRotation()) +} + +func TestMasterKey_ToString(t *testing.T) { + key := NewMasterKeyFromArn(dummyARN, nil, "") + assert.Equal(t, dummyARN, key.ToString()) +} + +func TestMasterKey_ToMap(t *testing.T) { value1 := "value1" value2 := "value2" key := MasterKey{ @@ -137,3 +378,198 @@ func TestKeyToMap(t *testing.T) { }, }, key.ToMap()) } + +func TestMasterKey_createKMSConfig(t *testing.T) { + tests := []struct { + name string + key MasterKey + assertFunc func(t *testing.T, cfg *aws.Config, err error) + fallback bool + }{ + { + name: "valid config", + key: MasterKey{ + credentialsProvider: credentials.NewStaticCredentialsProvider("test-id", "test-secret", "test-token"), + AwsProfile: "test-profile", + Arn: "arn:aws:kms:us-west-2:107501996527:key/612d5f0p-p1l3-45e6-aca6-a5b005693a48", + }, + assertFunc: func(t *testing.T, cfg *aws.Config, err error) { + assert.NoError(t, err) + assert.Equal(t, "us-west-2", cfg.Region) + + creds, err := cfg.Credentials.Retrieve(context.TODO()) + assert.NoError(t, err) + assert.Equal(t, "test-id", creds.AccessKeyID) + assert.Equal(t, "test-secret", creds.SecretAccessKey) + assert.Equal(t, "test-token", creds.SessionToken) + + // ConfigSources is a slice of config.Config, which in turn is an interface. + // Since we use a LoadOptions object, we assert the type of cfgSrc and then + // check if the expected profile is present. + for _, cfgSrc := range cfg.ConfigSources { + if src, ok := cfgSrc.(config.LoadOptions); ok { + assert.Equal(t, "test-profile", src.SharedConfigProfile) + } + } + }, + }, + { + name: "invalid arn", + key: MasterKey{ + Arn: "arn:gcp:kms:antartica-north-2::key/45e6-aca6-a5b005693a48", + }, + assertFunc: func(t *testing.T, cfg *aws.Config, err error) { + assert.Error(t, err) + assert.ErrorContains(t, err, "no valid ARN found") + assert.Nil(t, cfg) + }, + }, + { + name: "STS config attempt", + key: MasterKey{ + Arn: dummyARN, + Role: "role", + }, + assertFunc: func(t *testing.T, cfg *aws.Config, err error) { + assert.Error(t, err) + assert.ErrorContains(t, err, "failed to assume role 'role'") + assert.Nil(t, cfg) + }, + }, + { + name: "client default fallback", + key: MasterKey{ + Arn: "arn:aws:kms:us-west-2:107501996527:key/612d5f0p-p1l3-45e6-aca6-a5b005693a48", + }, + fallback: true, + assertFunc: func(t *testing.T, cfg *aws.Config, err error) { + assert.NoError(t, err) + + creds, err := cfg.Credentials.Retrieve(context.TODO()) + assert.Equal(t, "id", creds.AccessKeyID) + assert.Equal(t, "secret", creds.SecretAccessKey) + assert.Equal(t, "token", creds.SessionToken) + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + tt := tt + // Set the environment variables if we want to fallback + if tt.fallback { + t.Setenv("AWS_ACCESS_KEY_ID", "id") + t.Setenv("AWS_SECRET_ACCESS_KEY", "secret") + t.Setenv("AWS_SESSION_TOKEN", "token") + } + cfg, err := tt.key.createKMSConfig() + tt.assertFunc(t, cfg, err) + }) + } +} + +func TestMasterKey_createSTSConfig(t *testing.T) { + t.Run("session name error", func(t *testing.T) { + defer func() { osHostname = os.Hostname }() + osHostname = func() (name string, err error) { + err = fmt.Errorf("an error") + return + } + key := NewMasterKeyFromArn(dummyARN, nil, "") + cfg, err := key.createSTSConfig(nil) + assert.Error(t, err) + assert.ErrorContains(t, err, "failed to construct STS session name") + assert.Nil(t, cfg) + }) + + t.Run("role assumption error", func(t *testing.T) { + key := NewMasterKeyFromArn(dummyARN, nil, "") + key.Role = "role" + got, err := key.createSTSConfig(&aws.Config{}) + assert.Error(t, err) + assert.ErrorContains(t, err, "failed to assume role 'role'") + assert.Nil(t, got) + }) +} + +func Test_stsSessionName(t *testing.T) { + t.Run("STS session name", func(t *testing.T) { + defer func() { osHostname = os.Hostname }() + const mockHostname = "hostname" + osHostname = func() (name string, err error) { + name = mockHostname + return + } + got, err := stsSessionName() + assert.NoError(t, err) + assert.Equal(t, "sops@"+mockHostname, got) + }) + + t.Run("hostname error", func(t *testing.T) { + defer func() { osHostname = os.Hostname }() + osHostname = func() (name string, err error) { + err = fmt.Errorf("an error") + return + } + got, err := stsSessionName() + assert.Error(t, err) + assert.ErrorContains(t, err, "failed to construct STS session nam") + assert.Empty(t, got) + }) + + t.Run("replaces with stsSessionRegex", func(t *testing.T) { + const mockHostname = "some-hostname" + defer func() { osHostname = os.Hostname }() + osHostname = func() (name string, err error) { + name = mockHostname + return + } + got, err := stsSessionName() + assert.NoError(t, err) + assert.Equal(t, "sops@somehostname", got) + }) + + t.Run("hostname exceeding roleSessionNameLengthLimit", func(t *testing.T) { + const mockHostname = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + defer func() { osHostname = os.Hostname }() + osHostname = func() (name string, err error) { + name = mockHostname + return + } + got, err := stsSessionName() + assert.NoError(t, err) + assert.NotEqual(t, "sops@"+mockHostname, got) + assert.Len(t, got, roleSessionNameLengthLimit) + }) +} + +// createTestMasterKey creates a MasterKey with the provided ARN and a dummy +// credentials.StaticCredentialsProvider. +func createTestMasterKey(arn string) MasterKey { + return MasterKey{ + Arn: arn, + credentialsProvider: credentials.NewStaticCredentialsProvider("id", "secret", ""), + epResolver: epResolver{}, + } +} + +// createTestKMSClient creates a new client with the +// aws.EndpointResolverWithOptions set to epResolver. +func createTestKMSClient(key MasterKey) (*kms.Client, error) { + cfg, err := key.createKMSConfig() + if err != nil { + return nil, err + } + cfg.EndpointResolverWithOptions = epResolver{} + return kms.NewFromConfig(*cfg), nil +} + +// epResolver is a dummy resolver that points to the local test KMS server. +type epResolver struct{} + +// ResolveEndpoint always resolves to testKMSServerURL. +func (e epResolver) ResolveEndpoint(_, _ string, _ ...interface{}) (aws.Endpoint, error) { + return aws.Endpoint{ + URL: testKMSServerURL, + }, nil +} diff --git a/kms/mocks/KMSAPI.go b/kms/mocks/KMSAPI.go deleted file mode 100644 index 58185bc33..000000000 --- a/kms/mocks/KMSAPI.go +++ /dev/null @@ -1,4058 +0,0 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. - -package mocks - -import ( - context "context" - - kms "github.com/aws/aws-sdk-go/service/kms" - - mock "github.com/stretchr/testify/mock" - - request "github.com/aws/aws-sdk-go/aws/request" -) - -// KMSAPI is an autogenerated mock type for the KMSAPI type -type KMSAPI struct { - mock.Mock -} - -// CancelKeyDeletion provides a mock function with given fields: _a0 -func (_m *KMSAPI) CancelKeyDeletion(_a0 *kms.CancelKeyDeletionInput) (*kms.CancelKeyDeletionOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.CancelKeyDeletionOutput - if rf, ok := ret.Get(0).(func(*kms.CancelKeyDeletionInput) *kms.CancelKeyDeletionOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.CancelKeyDeletionOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.CancelKeyDeletionInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CancelKeyDeletionRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) CancelKeyDeletionRequest(_a0 *kms.CancelKeyDeletionInput) (*request.Request, *kms.CancelKeyDeletionOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.CancelKeyDeletionInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.CancelKeyDeletionOutput - if rf, ok := ret.Get(1).(func(*kms.CancelKeyDeletionInput) *kms.CancelKeyDeletionOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.CancelKeyDeletionOutput) - } - } - - return r0, r1 -} - -// CancelKeyDeletionWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) CancelKeyDeletionWithContext(_a0 context.Context, _a1 *kms.CancelKeyDeletionInput, _a2 ...request.Option) (*kms.CancelKeyDeletionOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.CancelKeyDeletionOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.CancelKeyDeletionInput, ...request.Option) *kms.CancelKeyDeletionOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.CancelKeyDeletionOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.CancelKeyDeletionInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ConnectCustomKeyStore provides a mock function with given fields: _a0 -func (_m *KMSAPI) ConnectCustomKeyStore(_a0 *kms.ConnectCustomKeyStoreInput) (*kms.ConnectCustomKeyStoreOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.ConnectCustomKeyStoreOutput - if rf, ok := ret.Get(0).(func(*kms.ConnectCustomKeyStoreInput) *kms.ConnectCustomKeyStoreOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.ConnectCustomKeyStoreOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.ConnectCustomKeyStoreInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ConnectCustomKeyStoreRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) ConnectCustomKeyStoreRequest(_a0 *kms.ConnectCustomKeyStoreInput) (*request.Request, *kms.ConnectCustomKeyStoreOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.ConnectCustomKeyStoreInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.ConnectCustomKeyStoreOutput - if rf, ok := ret.Get(1).(func(*kms.ConnectCustomKeyStoreInput) *kms.ConnectCustomKeyStoreOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.ConnectCustomKeyStoreOutput) - } - } - - return r0, r1 -} - -// ConnectCustomKeyStoreWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) ConnectCustomKeyStoreWithContext(_a0 context.Context, _a1 *kms.ConnectCustomKeyStoreInput, _a2 ...request.Option) (*kms.ConnectCustomKeyStoreOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.ConnectCustomKeyStoreOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.ConnectCustomKeyStoreInput, ...request.Option) *kms.ConnectCustomKeyStoreOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.ConnectCustomKeyStoreOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.ConnectCustomKeyStoreInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CreateAlias provides a mock function with given fields: _a0 -func (_m *KMSAPI) CreateAlias(_a0 *kms.CreateAliasInput) (*kms.CreateAliasOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.CreateAliasOutput - if rf, ok := ret.Get(0).(func(*kms.CreateAliasInput) *kms.CreateAliasOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.CreateAliasOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.CreateAliasInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CreateAliasRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) CreateAliasRequest(_a0 *kms.CreateAliasInput) (*request.Request, *kms.CreateAliasOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.CreateAliasInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.CreateAliasOutput - if rf, ok := ret.Get(1).(func(*kms.CreateAliasInput) *kms.CreateAliasOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.CreateAliasOutput) - } - } - - return r0, r1 -} - -// CreateAliasWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) CreateAliasWithContext(_a0 context.Context, _a1 *kms.CreateAliasInput, _a2 ...request.Option) (*kms.CreateAliasOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.CreateAliasOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.CreateAliasInput, ...request.Option) *kms.CreateAliasOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.CreateAliasOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.CreateAliasInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CreateCustomKeyStore provides a mock function with given fields: _a0 -func (_m *KMSAPI) CreateCustomKeyStore(_a0 *kms.CreateCustomKeyStoreInput) (*kms.CreateCustomKeyStoreOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.CreateCustomKeyStoreOutput - if rf, ok := ret.Get(0).(func(*kms.CreateCustomKeyStoreInput) *kms.CreateCustomKeyStoreOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.CreateCustomKeyStoreOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.CreateCustomKeyStoreInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CreateCustomKeyStoreRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) CreateCustomKeyStoreRequest(_a0 *kms.CreateCustomKeyStoreInput) (*request.Request, *kms.CreateCustomKeyStoreOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.CreateCustomKeyStoreInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.CreateCustomKeyStoreOutput - if rf, ok := ret.Get(1).(func(*kms.CreateCustomKeyStoreInput) *kms.CreateCustomKeyStoreOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.CreateCustomKeyStoreOutput) - } - } - - return r0, r1 -} - -// CreateCustomKeyStoreWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) CreateCustomKeyStoreWithContext(_a0 context.Context, _a1 *kms.CreateCustomKeyStoreInput, _a2 ...request.Option) (*kms.CreateCustomKeyStoreOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.CreateCustomKeyStoreOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.CreateCustomKeyStoreInput, ...request.Option) *kms.CreateCustomKeyStoreOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.CreateCustomKeyStoreOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.CreateCustomKeyStoreInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CreateGrant provides a mock function with given fields: _a0 -func (_m *KMSAPI) CreateGrant(_a0 *kms.CreateGrantInput) (*kms.CreateGrantOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.CreateGrantOutput - if rf, ok := ret.Get(0).(func(*kms.CreateGrantInput) *kms.CreateGrantOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.CreateGrantOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.CreateGrantInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CreateGrantRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) CreateGrantRequest(_a0 *kms.CreateGrantInput) (*request.Request, *kms.CreateGrantOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.CreateGrantInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.CreateGrantOutput - if rf, ok := ret.Get(1).(func(*kms.CreateGrantInput) *kms.CreateGrantOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.CreateGrantOutput) - } - } - - return r0, r1 -} - -// CreateGrantWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) CreateGrantWithContext(_a0 context.Context, _a1 *kms.CreateGrantInput, _a2 ...request.Option) (*kms.CreateGrantOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.CreateGrantOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.CreateGrantInput, ...request.Option) *kms.CreateGrantOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.CreateGrantOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.CreateGrantInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CreateKey provides a mock function with given fields: _a0 -func (_m *KMSAPI) CreateKey(_a0 *kms.CreateKeyInput) (*kms.CreateKeyOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.CreateKeyOutput - if rf, ok := ret.Get(0).(func(*kms.CreateKeyInput) *kms.CreateKeyOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.CreateKeyOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.CreateKeyInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CreateKeyRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) CreateKeyRequest(_a0 *kms.CreateKeyInput) (*request.Request, *kms.CreateKeyOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.CreateKeyInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.CreateKeyOutput - if rf, ok := ret.Get(1).(func(*kms.CreateKeyInput) *kms.CreateKeyOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.CreateKeyOutput) - } - } - - return r0, r1 -} - -// CreateKeyWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) CreateKeyWithContext(_a0 context.Context, _a1 *kms.CreateKeyInput, _a2 ...request.Option) (*kms.CreateKeyOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.CreateKeyOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.CreateKeyInput, ...request.Option) *kms.CreateKeyOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.CreateKeyOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.CreateKeyInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Decrypt provides a mock function with given fields: _a0 -func (_m *KMSAPI) Decrypt(_a0 *kms.DecryptInput) (*kms.DecryptOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.DecryptOutput - if rf, ok := ret.Get(0).(func(*kms.DecryptInput) *kms.DecryptOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.DecryptOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.DecryptInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DecryptRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) DecryptRequest(_a0 *kms.DecryptInput) (*request.Request, *kms.DecryptOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.DecryptInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.DecryptOutput - if rf, ok := ret.Get(1).(func(*kms.DecryptInput) *kms.DecryptOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.DecryptOutput) - } - } - - return r0, r1 -} - -// DecryptWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) DecryptWithContext(_a0 context.Context, _a1 *kms.DecryptInput, _a2 ...request.Option) (*kms.DecryptOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.DecryptOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.DecryptInput, ...request.Option) *kms.DecryptOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.DecryptOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.DecryptInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DeleteAlias provides a mock function with given fields: _a0 -func (_m *KMSAPI) DeleteAlias(_a0 *kms.DeleteAliasInput) (*kms.DeleteAliasOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.DeleteAliasOutput - if rf, ok := ret.Get(0).(func(*kms.DeleteAliasInput) *kms.DeleteAliasOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.DeleteAliasOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.DeleteAliasInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DeleteAliasRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) DeleteAliasRequest(_a0 *kms.DeleteAliasInput) (*request.Request, *kms.DeleteAliasOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.DeleteAliasInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.DeleteAliasOutput - if rf, ok := ret.Get(1).(func(*kms.DeleteAliasInput) *kms.DeleteAliasOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.DeleteAliasOutput) - } - } - - return r0, r1 -} - -// DeleteAliasWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) DeleteAliasWithContext(_a0 context.Context, _a1 *kms.DeleteAliasInput, _a2 ...request.Option) (*kms.DeleteAliasOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.DeleteAliasOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.DeleteAliasInput, ...request.Option) *kms.DeleteAliasOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.DeleteAliasOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.DeleteAliasInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DeleteCustomKeyStore provides a mock function with given fields: _a0 -func (_m *KMSAPI) DeleteCustomKeyStore(_a0 *kms.DeleteCustomKeyStoreInput) (*kms.DeleteCustomKeyStoreOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.DeleteCustomKeyStoreOutput - if rf, ok := ret.Get(0).(func(*kms.DeleteCustomKeyStoreInput) *kms.DeleteCustomKeyStoreOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.DeleteCustomKeyStoreOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.DeleteCustomKeyStoreInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DeleteCustomKeyStoreRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) DeleteCustomKeyStoreRequest(_a0 *kms.DeleteCustomKeyStoreInput) (*request.Request, *kms.DeleteCustomKeyStoreOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.DeleteCustomKeyStoreInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.DeleteCustomKeyStoreOutput - if rf, ok := ret.Get(1).(func(*kms.DeleteCustomKeyStoreInput) *kms.DeleteCustomKeyStoreOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.DeleteCustomKeyStoreOutput) - } - } - - return r0, r1 -} - -// DeleteCustomKeyStoreWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) DeleteCustomKeyStoreWithContext(_a0 context.Context, _a1 *kms.DeleteCustomKeyStoreInput, _a2 ...request.Option) (*kms.DeleteCustomKeyStoreOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.DeleteCustomKeyStoreOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.DeleteCustomKeyStoreInput, ...request.Option) *kms.DeleteCustomKeyStoreOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.DeleteCustomKeyStoreOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.DeleteCustomKeyStoreInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DeleteImportedKeyMaterial provides a mock function with given fields: _a0 -func (_m *KMSAPI) DeleteImportedKeyMaterial(_a0 *kms.DeleteImportedKeyMaterialInput) (*kms.DeleteImportedKeyMaterialOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.DeleteImportedKeyMaterialOutput - if rf, ok := ret.Get(0).(func(*kms.DeleteImportedKeyMaterialInput) *kms.DeleteImportedKeyMaterialOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.DeleteImportedKeyMaterialOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.DeleteImportedKeyMaterialInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DeleteImportedKeyMaterialRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) DeleteImportedKeyMaterialRequest(_a0 *kms.DeleteImportedKeyMaterialInput) (*request.Request, *kms.DeleteImportedKeyMaterialOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.DeleteImportedKeyMaterialInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.DeleteImportedKeyMaterialOutput - if rf, ok := ret.Get(1).(func(*kms.DeleteImportedKeyMaterialInput) *kms.DeleteImportedKeyMaterialOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.DeleteImportedKeyMaterialOutput) - } - } - - return r0, r1 -} - -// DeleteImportedKeyMaterialWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) DeleteImportedKeyMaterialWithContext(_a0 context.Context, _a1 *kms.DeleteImportedKeyMaterialInput, _a2 ...request.Option) (*kms.DeleteImportedKeyMaterialOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.DeleteImportedKeyMaterialOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.DeleteImportedKeyMaterialInput, ...request.Option) *kms.DeleteImportedKeyMaterialOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.DeleteImportedKeyMaterialOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.DeleteImportedKeyMaterialInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DescribeCustomKeyStores provides a mock function with given fields: _a0 -func (_m *KMSAPI) DescribeCustomKeyStores(_a0 *kms.DescribeCustomKeyStoresInput) (*kms.DescribeCustomKeyStoresOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.DescribeCustomKeyStoresOutput - if rf, ok := ret.Get(0).(func(*kms.DescribeCustomKeyStoresInput) *kms.DescribeCustomKeyStoresOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.DescribeCustomKeyStoresOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.DescribeCustomKeyStoresInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DescribeCustomKeyStoresRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) DescribeCustomKeyStoresRequest(_a0 *kms.DescribeCustomKeyStoresInput) (*request.Request, *kms.DescribeCustomKeyStoresOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.DescribeCustomKeyStoresInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.DescribeCustomKeyStoresOutput - if rf, ok := ret.Get(1).(func(*kms.DescribeCustomKeyStoresInput) *kms.DescribeCustomKeyStoresOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.DescribeCustomKeyStoresOutput) - } - } - - return r0, r1 -} - -// DescribeCustomKeyStoresWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) DescribeCustomKeyStoresWithContext(_a0 context.Context, _a1 *kms.DescribeCustomKeyStoresInput, _a2 ...request.Option) (*kms.DescribeCustomKeyStoresOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.DescribeCustomKeyStoresOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.DescribeCustomKeyStoresInput, ...request.Option) *kms.DescribeCustomKeyStoresOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.DescribeCustomKeyStoresOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.DescribeCustomKeyStoresInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DescribeKey provides a mock function with given fields: _a0 -func (_m *KMSAPI) DescribeKey(_a0 *kms.DescribeKeyInput) (*kms.DescribeKeyOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.DescribeKeyOutput - if rf, ok := ret.Get(0).(func(*kms.DescribeKeyInput) *kms.DescribeKeyOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.DescribeKeyOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.DescribeKeyInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DescribeKeyRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) DescribeKeyRequest(_a0 *kms.DescribeKeyInput) (*request.Request, *kms.DescribeKeyOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.DescribeKeyInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.DescribeKeyOutput - if rf, ok := ret.Get(1).(func(*kms.DescribeKeyInput) *kms.DescribeKeyOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.DescribeKeyOutput) - } - } - - return r0, r1 -} - -// DescribeKeyWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) DescribeKeyWithContext(_a0 context.Context, _a1 *kms.DescribeKeyInput, _a2 ...request.Option) (*kms.DescribeKeyOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.DescribeKeyOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.DescribeKeyInput, ...request.Option) *kms.DescribeKeyOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.DescribeKeyOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.DescribeKeyInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DisableKey provides a mock function with given fields: _a0 -func (_m *KMSAPI) DisableKey(_a0 *kms.DisableKeyInput) (*kms.DisableKeyOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.DisableKeyOutput - if rf, ok := ret.Get(0).(func(*kms.DisableKeyInput) *kms.DisableKeyOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.DisableKeyOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.DisableKeyInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DisableKeyRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) DisableKeyRequest(_a0 *kms.DisableKeyInput) (*request.Request, *kms.DisableKeyOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.DisableKeyInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.DisableKeyOutput - if rf, ok := ret.Get(1).(func(*kms.DisableKeyInput) *kms.DisableKeyOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.DisableKeyOutput) - } - } - - return r0, r1 -} - -// DisableKeyRotation provides a mock function with given fields: _a0 -func (_m *KMSAPI) DisableKeyRotation(_a0 *kms.DisableKeyRotationInput) (*kms.DisableKeyRotationOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.DisableKeyRotationOutput - if rf, ok := ret.Get(0).(func(*kms.DisableKeyRotationInput) *kms.DisableKeyRotationOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.DisableKeyRotationOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.DisableKeyRotationInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DisableKeyRotationRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) DisableKeyRotationRequest(_a0 *kms.DisableKeyRotationInput) (*request.Request, *kms.DisableKeyRotationOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.DisableKeyRotationInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.DisableKeyRotationOutput - if rf, ok := ret.Get(1).(func(*kms.DisableKeyRotationInput) *kms.DisableKeyRotationOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.DisableKeyRotationOutput) - } - } - - return r0, r1 -} - -// DisableKeyRotationWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) DisableKeyRotationWithContext(_a0 context.Context, _a1 *kms.DisableKeyRotationInput, _a2 ...request.Option) (*kms.DisableKeyRotationOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.DisableKeyRotationOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.DisableKeyRotationInput, ...request.Option) *kms.DisableKeyRotationOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.DisableKeyRotationOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.DisableKeyRotationInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DisableKeyWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) DisableKeyWithContext(_a0 context.Context, _a1 *kms.DisableKeyInput, _a2 ...request.Option) (*kms.DisableKeyOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.DisableKeyOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.DisableKeyInput, ...request.Option) *kms.DisableKeyOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.DisableKeyOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.DisableKeyInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DisconnectCustomKeyStore provides a mock function with given fields: _a0 -func (_m *KMSAPI) DisconnectCustomKeyStore(_a0 *kms.DisconnectCustomKeyStoreInput) (*kms.DisconnectCustomKeyStoreOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.DisconnectCustomKeyStoreOutput - if rf, ok := ret.Get(0).(func(*kms.DisconnectCustomKeyStoreInput) *kms.DisconnectCustomKeyStoreOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.DisconnectCustomKeyStoreOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.DisconnectCustomKeyStoreInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DisconnectCustomKeyStoreRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) DisconnectCustomKeyStoreRequest(_a0 *kms.DisconnectCustomKeyStoreInput) (*request.Request, *kms.DisconnectCustomKeyStoreOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.DisconnectCustomKeyStoreInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.DisconnectCustomKeyStoreOutput - if rf, ok := ret.Get(1).(func(*kms.DisconnectCustomKeyStoreInput) *kms.DisconnectCustomKeyStoreOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.DisconnectCustomKeyStoreOutput) - } - } - - return r0, r1 -} - -// DisconnectCustomKeyStoreWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) DisconnectCustomKeyStoreWithContext(_a0 context.Context, _a1 *kms.DisconnectCustomKeyStoreInput, _a2 ...request.Option) (*kms.DisconnectCustomKeyStoreOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.DisconnectCustomKeyStoreOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.DisconnectCustomKeyStoreInput, ...request.Option) *kms.DisconnectCustomKeyStoreOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.DisconnectCustomKeyStoreOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.DisconnectCustomKeyStoreInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// EnableKey provides a mock function with given fields: _a0 -func (_m *KMSAPI) EnableKey(_a0 *kms.EnableKeyInput) (*kms.EnableKeyOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.EnableKeyOutput - if rf, ok := ret.Get(0).(func(*kms.EnableKeyInput) *kms.EnableKeyOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.EnableKeyOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.EnableKeyInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// EnableKeyRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) EnableKeyRequest(_a0 *kms.EnableKeyInput) (*request.Request, *kms.EnableKeyOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.EnableKeyInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.EnableKeyOutput - if rf, ok := ret.Get(1).(func(*kms.EnableKeyInput) *kms.EnableKeyOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.EnableKeyOutput) - } - } - - return r0, r1 -} - -// EnableKeyRotation provides a mock function with given fields: _a0 -func (_m *KMSAPI) EnableKeyRotation(_a0 *kms.EnableKeyRotationInput) (*kms.EnableKeyRotationOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.EnableKeyRotationOutput - if rf, ok := ret.Get(0).(func(*kms.EnableKeyRotationInput) *kms.EnableKeyRotationOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.EnableKeyRotationOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.EnableKeyRotationInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// EnableKeyRotationRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) EnableKeyRotationRequest(_a0 *kms.EnableKeyRotationInput) (*request.Request, *kms.EnableKeyRotationOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.EnableKeyRotationInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.EnableKeyRotationOutput - if rf, ok := ret.Get(1).(func(*kms.EnableKeyRotationInput) *kms.EnableKeyRotationOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.EnableKeyRotationOutput) - } - } - - return r0, r1 -} - -// EnableKeyRotationWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) EnableKeyRotationWithContext(_a0 context.Context, _a1 *kms.EnableKeyRotationInput, _a2 ...request.Option) (*kms.EnableKeyRotationOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.EnableKeyRotationOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.EnableKeyRotationInput, ...request.Option) *kms.EnableKeyRotationOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.EnableKeyRotationOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.EnableKeyRotationInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// EnableKeyWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) EnableKeyWithContext(_a0 context.Context, _a1 *kms.EnableKeyInput, _a2 ...request.Option) (*kms.EnableKeyOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.EnableKeyOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.EnableKeyInput, ...request.Option) *kms.EnableKeyOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.EnableKeyOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.EnableKeyInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Encrypt provides a mock function with given fields: _a0 -func (_m *KMSAPI) Encrypt(_a0 *kms.EncryptInput) (*kms.EncryptOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.EncryptOutput - if rf, ok := ret.Get(0).(func(*kms.EncryptInput) *kms.EncryptOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.EncryptOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.EncryptInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// EncryptRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) EncryptRequest(_a0 *kms.EncryptInput) (*request.Request, *kms.EncryptOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.EncryptInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.EncryptOutput - if rf, ok := ret.Get(1).(func(*kms.EncryptInput) *kms.EncryptOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.EncryptOutput) - } - } - - return r0, r1 -} - -// EncryptWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) EncryptWithContext(_a0 context.Context, _a1 *kms.EncryptInput, _a2 ...request.Option) (*kms.EncryptOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.EncryptOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.EncryptInput, ...request.Option) *kms.EncryptOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.EncryptOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.EncryptInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GenerateDataKey provides a mock function with given fields: _a0 -func (_m *KMSAPI) GenerateDataKey(_a0 *kms.GenerateDataKeyInput) (*kms.GenerateDataKeyOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.GenerateDataKeyOutput - if rf, ok := ret.Get(0).(func(*kms.GenerateDataKeyInput) *kms.GenerateDataKeyOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.GenerateDataKeyOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.GenerateDataKeyInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GenerateDataKeyPair provides a mock function with given fields: _a0 -func (_m *KMSAPI) GenerateDataKeyPair(_a0 *kms.GenerateDataKeyPairInput) (*kms.GenerateDataKeyPairOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.GenerateDataKeyPairOutput - if rf, ok := ret.Get(0).(func(*kms.GenerateDataKeyPairInput) *kms.GenerateDataKeyPairOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.GenerateDataKeyPairOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.GenerateDataKeyPairInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GenerateDataKeyPairRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) GenerateDataKeyPairRequest(_a0 *kms.GenerateDataKeyPairInput) (*request.Request, *kms.GenerateDataKeyPairOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.GenerateDataKeyPairInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.GenerateDataKeyPairOutput - if rf, ok := ret.Get(1).(func(*kms.GenerateDataKeyPairInput) *kms.GenerateDataKeyPairOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.GenerateDataKeyPairOutput) - } - } - - return r0, r1 -} - -// GenerateDataKeyPairWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) GenerateDataKeyPairWithContext(_a0 context.Context, _a1 *kms.GenerateDataKeyPairInput, _a2 ...request.Option) (*kms.GenerateDataKeyPairOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.GenerateDataKeyPairOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.GenerateDataKeyPairInput, ...request.Option) *kms.GenerateDataKeyPairOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.GenerateDataKeyPairOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.GenerateDataKeyPairInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GenerateDataKeyPairWithoutPlaintext provides a mock function with given fields: _a0 -func (_m *KMSAPI) GenerateDataKeyPairWithoutPlaintext(_a0 *kms.GenerateDataKeyPairWithoutPlaintextInput) (*kms.GenerateDataKeyPairWithoutPlaintextOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.GenerateDataKeyPairWithoutPlaintextOutput - if rf, ok := ret.Get(0).(func(*kms.GenerateDataKeyPairWithoutPlaintextInput) *kms.GenerateDataKeyPairWithoutPlaintextOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.GenerateDataKeyPairWithoutPlaintextOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.GenerateDataKeyPairWithoutPlaintextInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GenerateDataKeyPairWithoutPlaintextRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) GenerateDataKeyPairWithoutPlaintextRequest(_a0 *kms.GenerateDataKeyPairWithoutPlaintextInput) (*request.Request, *kms.GenerateDataKeyPairWithoutPlaintextOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.GenerateDataKeyPairWithoutPlaintextInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.GenerateDataKeyPairWithoutPlaintextOutput - if rf, ok := ret.Get(1).(func(*kms.GenerateDataKeyPairWithoutPlaintextInput) *kms.GenerateDataKeyPairWithoutPlaintextOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.GenerateDataKeyPairWithoutPlaintextOutput) - } - } - - return r0, r1 -} - -// GenerateDataKeyPairWithoutPlaintextWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) GenerateDataKeyPairWithoutPlaintextWithContext(_a0 context.Context, _a1 *kms.GenerateDataKeyPairWithoutPlaintextInput, _a2 ...request.Option) (*kms.GenerateDataKeyPairWithoutPlaintextOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.GenerateDataKeyPairWithoutPlaintextOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.GenerateDataKeyPairWithoutPlaintextInput, ...request.Option) *kms.GenerateDataKeyPairWithoutPlaintextOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.GenerateDataKeyPairWithoutPlaintextOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.GenerateDataKeyPairWithoutPlaintextInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GenerateDataKeyRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) GenerateDataKeyRequest(_a0 *kms.GenerateDataKeyInput) (*request.Request, *kms.GenerateDataKeyOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.GenerateDataKeyInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.GenerateDataKeyOutput - if rf, ok := ret.Get(1).(func(*kms.GenerateDataKeyInput) *kms.GenerateDataKeyOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.GenerateDataKeyOutput) - } - } - - return r0, r1 -} - -// GenerateDataKeyWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) GenerateDataKeyWithContext(_a0 context.Context, _a1 *kms.GenerateDataKeyInput, _a2 ...request.Option) (*kms.GenerateDataKeyOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.GenerateDataKeyOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.GenerateDataKeyInput, ...request.Option) *kms.GenerateDataKeyOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.GenerateDataKeyOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.GenerateDataKeyInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GenerateDataKeyWithoutPlaintext provides a mock function with given fields: _a0 -func (_m *KMSAPI) GenerateDataKeyWithoutPlaintext(_a0 *kms.GenerateDataKeyWithoutPlaintextInput) (*kms.GenerateDataKeyWithoutPlaintextOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.GenerateDataKeyWithoutPlaintextOutput - if rf, ok := ret.Get(0).(func(*kms.GenerateDataKeyWithoutPlaintextInput) *kms.GenerateDataKeyWithoutPlaintextOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.GenerateDataKeyWithoutPlaintextOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.GenerateDataKeyWithoutPlaintextInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GenerateDataKeyWithoutPlaintextRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) GenerateDataKeyWithoutPlaintextRequest(_a0 *kms.GenerateDataKeyWithoutPlaintextInput) (*request.Request, *kms.GenerateDataKeyWithoutPlaintextOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.GenerateDataKeyWithoutPlaintextInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.GenerateDataKeyWithoutPlaintextOutput - if rf, ok := ret.Get(1).(func(*kms.GenerateDataKeyWithoutPlaintextInput) *kms.GenerateDataKeyWithoutPlaintextOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.GenerateDataKeyWithoutPlaintextOutput) - } - } - - return r0, r1 -} - -// GenerateDataKeyWithoutPlaintextWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) GenerateDataKeyWithoutPlaintextWithContext(_a0 context.Context, _a1 *kms.GenerateDataKeyWithoutPlaintextInput, _a2 ...request.Option) (*kms.GenerateDataKeyWithoutPlaintextOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.GenerateDataKeyWithoutPlaintextOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.GenerateDataKeyWithoutPlaintextInput, ...request.Option) *kms.GenerateDataKeyWithoutPlaintextOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.GenerateDataKeyWithoutPlaintextOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.GenerateDataKeyWithoutPlaintextInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GenerateMac provides a mock function with given fields: _a0 -func (_m *KMSAPI) GenerateMac(_a0 *kms.GenerateMacInput) (*kms.GenerateMacOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.GenerateMacOutput - if rf, ok := ret.Get(0).(func(*kms.GenerateMacInput) *kms.GenerateMacOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.GenerateMacOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.GenerateMacInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GenerateMacRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) GenerateMacRequest(_a0 *kms.GenerateMacInput) (*request.Request, *kms.GenerateMacOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.GenerateMacInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.GenerateMacOutput - if rf, ok := ret.Get(1).(func(*kms.GenerateMacInput) *kms.GenerateMacOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.GenerateMacOutput) - } - } - - return r0, r1 -} - -// GenerateMacWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) GenerateMacWithContext(_a0 context.Context, _a1 *kms.GenerateMacInput, _a2 ...request.Option) (*kms.GenerateMacOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.GenerateMacOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.GenerateMacInput, ...request.Option) *kms.GenerateMacOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.GenerateMacOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.GenerateMacInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GenerateRandom provides a mock function with given fields: _a0 -func (_m *KMSAPI) GenerateRandom(_a0 *kms.GenerateRandomInput) (*kms.GenerateRandomOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.GenerateRandomOutput - if rf, ok := ret.Get(0).(func(*kms.GenerateRandomInput) *kms.GenerateRandomOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.GenerateRandomOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.GenerateRandomInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GenerateRandomRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) GenerateRandomRequest(_a0 *kms.GenerateRandomInput) (*request.Request, *kms.GenerateRandomOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.GenerateRandomInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.GenerateRandomOutput - if rf, ok := ret.Get(1).(func(*kms.GenerateRandomInput) *kms.GenerateRandomOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.GenerateRandomOutput) - } - } - - return r0, r1 -} - -// GenerateRandomWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) GenerateRandomWithContext(_a0 context.Context, _a1 *kms.GenerateRandomInput, _a2 ...request.Option) (*kms.GenerateRandomOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.GenerateRandomOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.GenerateRandomInput, ...request.Option) *kms.GenerateRandomOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.GenerateRandomOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.GenerateRandomInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetKeyPolicy provides a mock function with given fields: _a0 -func (_m *KMSAPI) GetKeyPolicy(_a0 *kms.GetKeyPolicyInput) (*kms.GetKeyPolicyOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.GetKeyPolicyOutput - if rf, ok := ret.Get(0).(func(*kms.GetKeyPolicyInput) *kms.GetKeyPolicyOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.GetKeyPolicyOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.GetKeyPolicyInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetKeyPolicyRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) GetKeyPolicyRequest(_a0 *kms.GetKeyPolicyInput) (*request.Request, *kms.GetKeyPolicyOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.GetKeyPolicyInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.GetKeyPolicyOutput - if rf, ok := ret.Get(1).(func(*kms.GetKeyPolicyInput) *kms.GetKeyPolicyOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.GetKeyPolicyOutput) - } - } - - return r0, r1 -} - -// GetKeyPolicyWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) GetKeyPolicyWithContext(_a0 context.Context, _a1 *kms.GetKeyPolicyInput, _a2 ...request.Option) (*kms.GetKeyPolicyOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.GetKeyPolicyOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.GetKeyPolicyInput, ...request.Option) *kms.GetKeyPolicyOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.GetKeyPolicyOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.GetKeyPolicyInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetKeyRotationStatus provides a mock function with given fields: _a0 -func (_m *KMSAPI) GetKeyRotationStatus(_a0 *kms.GetKeyRotationStatusInput) (*kms.GetKeyRotationStatusOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.GetKeyRotationStatusOutput - if rf, ok := ret.Get(0).(func(*kms.GetKeyRotationStatusInput) *kms.GetKeyRotationStatusOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.GetKeyRotationStatusOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.GetKeyRotationStatusInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetKeyRotationStatusRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) GetKeyRotationStatusRequest(_a0 *kms.GetKeyRotationStatusInput) (*request.Request, *kms.GetKeyRotationStatusOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.GetKeyRotationStatusInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.GetKeyRotationStatusOutput - if rf, ok := ret.Get(1).(func(*kms.GetKeyRotationStatusInput) *kms.GetKeyRotationStatusOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.GetKeyRotationStatusOutput) - } - } - - return r0, r1 -} - -// GetKeyRotationStatusWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) GetKeyRotationStatusWithContext(_a0 context.Context, _a1 *kms.GetKeyRotationStatusInput, _a2 ...request.Option) (*kms.GetKeyRotationStatusOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.GetKeyRotationStatusOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.GetKeyRotationStatusInput, ...request.Option) *kms.GetKeyRotationStatusOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.GetKeyRotationStatusOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.GetKeyRotationStatusInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetParametersForImport provides a mock function with given fields: _a0 -func (_m *KMSAPI) GetParametersForImport(_a0 *kms.GetParametersForImportInput) (*kms.GetParametersForImportOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.GetParametersForImportOutput - if rf, ok := ret.Get(0).(func(*kms.GetParametersForImportInput) *kms.GetParametersForImportOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.GetParametersForImportOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.GetParametersForImportInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetParametersForImportRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) GetParametersForImportRequest(_a0 *kms.GetParametersForImportInput) (*request.Request, *kms.GetParametersForImportOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.GetParametersForImportInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.GetParametersForImportOutput - if rf, ok := ret.Get(1).(func(*kms.GetParametersForImportInput) *kms.GetParametersForImportOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.GetParametersForImportOutput) - } - } - - return r0, r1 -} - -// GetParametersForImportWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) GetParametersForImportWithContext(_a0 context.Context, _a1 *kms.GetParametersForImportInput, _a2 ...request.Option) (*kms.GetParametersForImportOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.GetParametersForImportOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.GetParametersForImportInput, ...request.Option) *kms.GetParametersForImportOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.GetParametersForImportOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.GetParametersForImportInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetPublicKey provides a mock function with given fields: _a0 -func (_m *KMSAPI) GetPublicKey(_a0 *kms.GetPublicKeyInput) (*kms.GetPublicKeyOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.GetPublicKeyOutput - if rf, ok := ret.Get(0).(func(*kms.GetPublicKeyInput) *kms.GetPublicKeyOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.GetPublicKeyOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.GetPublicKeyInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetPublicKeyRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) GetPublicKeyRequest(_a0 *kms.GetPublicKeyInput) (*request.Request, *kms.GetPublicKeyOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.GetPublicKeyInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.GetPublicKeyOutput - if rf, ok := ret.Get(1).(func(*kms.GetPublicKeyInput) *kms.GetPublicKeyOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.GetPublicKeyOutput) - } - } - - return r0, r1 -} - -// GetPublicKeyWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) GetPublicKeyWithContext(_a0 context.Context, _a1 *kms.GetPublicKeyInput, _a2 ...request.Option) (*kms.GetPublicKeyOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.GetPublicKeyOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.GetPublicKeyInput, ...request.Option) *kms.GetPublicKeyOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.GetPublicKeyOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.GetPublicKeyInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ImportKeyMaterial provides a mock function with given fields: _a0 -func (_m *KMSAPI) ImportKeyMaterial(_a0 *kms.ImportKeyMaterialInput) (*kms.ImportKeyMaterialOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.ImportKeyMaterialOutput - if rf, ok := ret.Get(0).(func(*kms.ImportKeyMaterialInput) *kms.ImportKeyMaterialOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.ImportKeyMaterialOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.ImportKeyMaterialInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ImportKeyMaterialRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) ImportKeyMaterialRequest(_a0 *kms.ImportKeyMaterialInput) (*request.Request, *kms.ImportKeyMaterialOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.ImportKeyMaterialInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.ImportKeyMaterialOutput - if rf, ok := ret.Get(1).(func(*kms.ImportKeyMaterialInput) *kms.ImportKeyMaterialOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.ImportKeyMaterialOutput) - } - } - - return r0, r1 -} - -// ImportKeyMaterialWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) ImportKeyMaterialWithContext(_a0 context.Context, _a1 *kms.ImportKeyMaterialInput, _a2 ...request.Option) (*kms.ImportKeyMaterialOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.ImportKeyMaterialOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.ImportKeyMaterialInput, ...request.Option) *kms.ImportKeyMaterialOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.ImportKeyMaterialOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.ImportKeyMaterialInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ListAliases provides a mock function with given fields: _a0 -func (_m *KMSAPI) ListAliases(_a0 *kms.ListAliasesInput) (*kms.ListAliasesOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.ListAliasesOutput - if rf, ok := ret.Get(0).(func(*kms.ListAliasesInput) *kms.ListAliasesOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.ListAliasesOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.ListAliasesInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ListAliasesPages provides a mock function with given fields: _a0, _a1 -func (_m *KMSAPI) ListAliasesPages(_a0 *kms.ListAliasesInput, _a1 func(*kms.ListAliasesOutput, bool) bool) error { - ret := _m.Called(_a0, _a1) - - var r0 error - if rf, ok := ret.Get(0).(func(*kms.ListAliasesInput, func(*kms.ListAliasesOutput, bool) bool) error); ok { - r0 = rf(_a0, _a1) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// ListAliasesPagesWithContext provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *KMSAPI) ListAliasesPagesWithContext(_a0 context.Context, _a1 *kms.ListAliasesInput, _a2 func(*kms.ListAliasesOutput, bool) bool, _a3 ...request.Option) error { - _va := make([]interface{}, len(_a3)) - for _i := range _a3 { - _va[_i] = _a3[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1, _a2) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, *kms.ListAliasesInput, func(*kms.ListAliasesOutput, bool) bool, ...request.Option) error); ok { - r0 = rf(_a0, _a1, _a2, _a3...) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// ListAliasesRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) ListAliasesRequest(_a0 *kms.ListAliasesInput) (*request.Request, *kms.ListAliasesOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.ListAliasesInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.ListAliasesOutput - if rf, ok := ret.Get(1).(func(*kms.ListAliasesInput) *kms.ListAliasesOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.ListAliasesOutput) - } - } - - return r0, r1 -} - -// ListAliasesWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) ListAliasesWithContext(_a0 context.Context, _a1 *kms.ListAliasesInput, _a2 ...request.Option) (*kms.ListAliasesOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.ListAliasesOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.ListAliasesInput, ...request.Option) *kms.ListAliasesOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.ListAliasesOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.ListAliasesInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ListGrants provides a mock function with given fields: _a0 -func (_m *KMSAPI) ListGrants(_a0 *kms.ListGrantsInput) (*kms.ListGrantsResponse, error) { - ret := _m.Called(_a0) - - var r0 *kms.ListGrantsResponse - if rf, ok := ret.Get(0).(func(*kms.ListGrantsInput) *kms.ListGrantsResponse); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.ListGrantsResponse) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.ListGrantsInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ListGrantsPages provides a mock function with given fields: _a0, _a1 -func (_m *KMSAPI) ListGrantsPages(_a0 *kms.ListGrantsInput, _a1 func(*kms.ListGrantsResponse, bool) bool) error { - ret := _m.Called(_a0, _a1) - - var r0 error - if rf, ok := ret.Get(0).(func(*kms.ListGrantsInput, func(*kms.ListGrantsResponse, bool) bool) error); ok { - r0 = rf(_a0, _a1) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// ListGrantsPagesWithContext provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *KMSAPI) ListGrantsPagesWithContext(_a0 context.Context, _a1 *kms.ListGrantsInput, _a2 func(*kms.ListGrantsResponse, bool) bool, _a3 ...request.Option) error { - _va := make([]interface{}, len(_a3)) - for _i := range _a3 { - _va[_i] = _a3[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1, _a2) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, *kms.ListGrantsInput, func(*kms.ListGrantsResponse, bool) bool, ...request.Option) error); ok { - r0 = rf(_a0, _a1, _a2, _a3...) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// ListGrantsRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) ListGrantsRequest(_a0 *kms.ListGrantsInput) (*request.Request, *kms.ListGrantsResponse) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.ListGrantsInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.ListGrantsResponse - if rf, ok := ret.Get(1).(func(*kms.ListGrantsInput) *kms.ListGrantsResponse); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.ListGrantsResponse) - } - } - - return r0, r1 -} - -// ListGrantsWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) ListGrantsWithContext(_a0 context.Context, _a1 *kms.ListGrantsInput, _a2 ...request.Option) (*kms.ListGrantsResponse, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.ListGrantsResponse - if rf, ok := ret.Get(0).(func(context.Context, *kms.ListGrantsInput, ...request.Option) *kms.ListGrantsResponse); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.ListGrantsResponse) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.ListGrantsInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ListKeyPolicies provides a mock function with given fields: _a0 -func (_m *KMSAPI) ListKeyPolicies(_a0 *kms.ListKeyPoliciesInput) (*kms.ListKeyPoliciesOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.ListKeyPoliciesOutput - if rf, ok := ret.Get(0).(func(*kms.ListKeyPoliciesInput) *kms.ListKeyPoliciesOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.ListKeyPoliciesOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.ListKeyPoliciesInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ListKeyPoliciesPages provides a mock function with given fields: _a0, _a1 -func (_m *KMSAPI) ListKeyPoliciesPages(_a0 *kms.ListKeyPoliciesInput, _a1 func(*kms.ListKeyPoliciesOutput, bool) bool) error { - ret := _m.Called(_a0, _a1) - - var r0 error - if rf, ok := ret.Get(0).(func(*kms.ListKeyPoliciesInput, func(*kms.ListKeyPoliciesOutput, bool) bool) error); ok { - r0 = rf(_a0, _a1) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// ListKeyPoliciesPagesWithContext provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *KMSAPI) ListKeyPoliciesPagesWithContext(_a0 context.Context, _a1 *kms.ListKeyPoliciesInput, _a2 func(*kms.ListKeyPoliciesOutput, bool) bool, _a3 ...request.Option) error { - _va := make([]interface{}, len(_a3)) - for _i := range _a3 { - _va[_i] = _a3[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1, _a2) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, *kms.ListKeyPoliciesInput, func(*kms.ListKeyPoliciesOutput, bool) bool, ...request.Option) error); ok { - r0 = rf(_a0, _a1, _a2, _a3...) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// ListKeyPoliciesRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) ListKeyPoliciesRequest(_a0 *kms.ListKeyPoliciesInput) (*request.Request, *kms.ListKeyPoliciesOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.ListKeyPoliciesInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.ListKeyPoliciesOutput - if rf, ok := ret.Get(1).(func(*kms.ListKeyPoliciesInput) *kms.ListKeyPoliciesOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.ListKeyPoliciesOutput) - } - } - - return r0, r1 -} - -// ListKeyPoliciesWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) ListKeyPoliciesWithContext(_a0 context.Context, _a1 *kms.ListKeyPoliciesInput, _a2 ...request.Option) (*kms.ListKeyPoliciesOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.ListKeyPoliciesOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.ListKeyPoliciesInput, ...request.Option) *kms.ListKeyPoliciesOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.ListKeyPoliciesOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.ListKeyPoliciesInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ListKeys provides a mock function with given fields: _a0 -func (_m *KMSAPI) ListKeys(_a0 *kms.ListKeysInput) (*kms.ListKeysOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.ListKeysOutput - if rf, ok := ret.Get(0).(func(*kms.ListKeysInput) *kms.ListKeysOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.ListKeysOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.ListKeysInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ListKeysPages provides a mock function with given fields: _a0, _a1 -func (_m *KMSAPI) ListKeysPages(_a0 *kms.ListKeysInput, _a1 func(*kms.ListKeysOutput, bool) bool) error { - ret := _m.Called(_a0, _a1) - - var r0 error - if rf, ok := ret.Get(0).(func(*kms.ListKeysInput, func(*kms.ListKeysOutput, bool) bool) error); ok { - r0 = rf(_a0, _a1) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// ListKeysPagesWithContext provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *KMSAPI) ListKeysPagesWithContext(_a0 context.Context, _a1 *kms.ListKeysInput, _a2 func(*kms.ListKeysOutput, bool) bool, _a3 ...request.Option) error { - _va := make([]interface{}, len(_a3)) - for _i := range _a3 { - _va[_i] = _a3[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1, _a2) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, *kms.ListKeysInput, func(*kms.ListKeysOutput, bool) bool, ...request.Option) error); ok { - r0 = rf(_a0, _a1, _a2, _a3...) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// ListKeysRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) ListKeysRequest(_a0 *kms.ListKeysInput) (*request.Request, *kms.ListKeysOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.ListKeysInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.ListKeysOutput - if rf, ok := ret.Get(1).(func(*kms.ListKeysInput) *kms.ListKeysOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.ListKeysOutput) - } - } - - return r0, r1 -} - -// ListKeysWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) ListKeysWithContext(_a0 context.Context, _a1 *kms.ListKeysInput, _a2 ...request.Option) (*kms.ListKeysOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.ListKeysOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.ListKeysInput, ...request.Option) *kms.ListKeysOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.ListKeysOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.ListKeysInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ListResourceTags provides a mock function with given fields: _a0 -func (_m *KMSAPI) ListResourceTags(_a0 *kms.ListResourceTagsInput) (*kms.ListResourceTagsOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.ListResourceTagsOutput - if rf, ok := ret.Get(0).(func(*kms.ListResourceTagsInput) *kms.ListResourceTagsOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.ListResourceTagsOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.ListResourceTagsInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ListResourceTagsRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) ListResourceTagsRequest(_a0 *kms.ListResourceTagsInput) (*request.Request, *kms.ListResourceTagsOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.ListResourceTagsInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.ListResourceTagsOutput - if rf, ok := ret.Get(1).(func(*kms.ListResourceTagsInput) *kms.ListResourceTagsOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.ListResourceTagsOutput) - } - } - - return r0, r1 -} - -// ListResourceTagsWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) ListResourceTagsWithContext(_a0 context.Context, _a1 *kms.ListResourceTagsInput, _a2 ...request.Option) (*kms.ListResourceTagsOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.ListResourceTagsOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.ListResourceTagsInput, ...request.Option) *kms.ListResourceTagsOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.ListResourceTagsOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.ListResourceTagsInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ListRetirableGrants provides a mock function with given fields: _a0 -func (_m *KMSAPI) ListRetirableGrants(_a0 *kms.ListRetirableGrantsInput) (*kms.ListGrantsResponse, error) { - ret := _m.Called(_a0) - - var r0 *kms.ListGrantsResponse - if rf, ok := ret.Get(0).(func(*kms.ListRetirableGrantsInput) *kms.ListGrantsResponse); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.ListGrantsResponse) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.ListRetirableGrantsInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ListRetirableGrantsRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) ListRetirableGrantsRequest(_a0 *kms.ListRetirableGrantsInput) (*request.Request, *kms.ListGrantsResponse) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.ListRetirableGrantsInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.ListGrantsResponse - if rf, ok := ret.Get(1).(func(*kms.ListRetirableGrantsInput) *kms.ListGrantsResponse); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.ListGrantsResponse) - } - } - - return r0, r1 -} - -// ListRetirableGrantsWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) ListRetirableGrantsWithContext(_a0 context.Context, _a1 *kms.ListRetirableGrantsInput, _a2 ...request.Option) (*kms.ListGrantsResponse, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.ListGrantsResponse - if rf, ok := ret.Get(0).(func(context.Context, *kms.ListRetirableGrantsInput, ...request.Option) *kms.ListGrantsResponse); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.ListGrantsResponse) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.ListRetirableGrantsInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// PutKeyPolicy provides a mock function with given fields: _a0 -func (_m *KMSAPI) PutKeyPolicy(_a0 *kms.PutKeyPolicyInput) (*kms.PutKeyPolicyOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.PutKeyPolicyOutput - if rf, ok := ret.Get(0).(func(*kms.PutKeyPolicyInput) *kms.PutKeyPolicyOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.PutKeyPolicyOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.PutKeyPolicyInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// PutKeyPolicyRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) PutKeyPolicyRequest(_a0 *kms.PutKeyPolicyInput) (*request.Request, *kms.PutKeyPolicyOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.PutKeyPolicyInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.PutKeyPolicyOutput - if rf, ok := ret.Get(1).(func(*kms.PutKeyPolicyInput) *kms.PutKeyPolicyOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.PutKeyPolicyOutput) - } - } - - return r0, r1 -} - -// PutKeyPolicyWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) PutKeyPolicyWithContext(_a0 context.Context, _a1 *kms.PutKeyPolicyInput, _a2 ...request.Option) (*kms.PutKeyPolicyOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.PutKeyPolicyOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.PutKeyPolicyInput, ...request.Option) *kms.PutKeyPolicyOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.PutKeyPolicyOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.PutKeyPolicyInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ReEncrypt provides a mock function with given fields: _a0 -func (_m *KMSAPI) ReEncrypt(_a0 *kms.ReEncryptInput) (*kms.ReEncryptOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.ReEncryptOutput - if rf, ok := ret.Get(0).(func(*kms.ReEncryptInput) *kms.ReEncryptOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.ReEncryptOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.ReEncryptInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ReEncryptRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) ReEncryptRequest(_a0 *kms.ReEncryptInput) (*request.Request, *kms.ReEncryptOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.ReEncryptInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.ReEncryptOutput - if rf, ok := ret.Get(1).(func(*kms.ReEncryptInput) *kms.ReEncryptOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.ReEncryptOutput) - } - } - - return r0, r1 -} - -// ReEncryptWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) ReEncryptWithContext(_a0 context.Context, _a1 *kms.ReEncryptInput, _a2 ...request.Option) (*kms.ReEncryptOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.ReEncryptOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.ReEncryptInput, ...request.Option) *kms.ReEncryptOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.ReEncryptOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.ReEncryptInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ReplicateKey provides a mock function with given fields: _a0 -func (_m *KMSAPI) ReplicateKey(_a0 *kms.ReplicateKeyInput) (*kms.ReplicateKeyOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.ReplicateKeyOutput - if rf, ok := ret.Get(0).(func(*kms.ReplicateKeyInput) *kms.ReplicateKeyOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.ReplicateKeyOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.ReplicateKeyInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ReplicateKeyRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) ReplicateKeyRequest(_a0 *kms.ReplicateKeyInput) (*request.Request, *kms.ReplicateKeyOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.ReplicateKeyInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.ReplicateKeyOutput - if rf, ok := ret.Get(1).(func(*kms.ReplicateKeyInput) *kms.ReplicateKeyOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.ReplicateKeyOutput) - } - } - - return r0, r1 -} - -// ReplicateKeyWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) ReplicateKeyWithContext(_a0 context.Context, _a1 *kms.ReplicateKeyInput, _a2 ...request.Option) (*kms.ReplicateKeyOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.ReplicateKeyOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.ReplicateKeyInput, ...request.Option) *kms.ReplicateKeyOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.ReplicateKeyOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.ReplicateKeyInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// RetireGrant provides a mock function with given fields: _a0 -func (_m *KMSAPI) RetireGrant(_a0 *kms.RetireGrantInput) (*kms.RetireGrantOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.RetireGrantOutput - if rf, ok := ret.Get(0).(func(*kms.RetireGrantInput) *kms.RetireGrantOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.RetireGrantOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.RetireGrantInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// RetireGrantRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) RetireGrantRequest(_a0 *kms.RetireGrantInput) (*request.Request, *kms.RetireGrantOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.RetireGrantInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.RetireGrantOutput - if rf, ok := ret.Get(1).(func(*kms.RetireGrantInput) *kms.RetireGrantOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.RetireGrantOutput) - } - } - - return r0, r1 -} - -// RetireGrantWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) RetireGrantWithContext(_a0 context.Context, _a1 *kms.RetireGrantInput, _a2 ...request.Option) (*kms.RetireGrantOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.RetireGrantOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.RetireGrantInput, ...request.Option) *kms.RetireGrantOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.RetireGrantOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.RetireGrantInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// RevokeGrant provides a mock function with given fields: _a0 -func (_m *KMSAPI) RevokeGrant(_a0 *kms.RevokeGrantInput) (*kms.RevokeGrantOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.RevokeGrantOutput - if rf, ok := ret.Get(0).(func(*kms.RevokeGrantInput) *kms.RevokeGrantOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.RevokeGrantOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.RevokeGrantInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// RevokeGrantRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) RevokeGrantRequest(_a0 *kms.RevokeGrantInput) (*request.Request, *kms.RevokeGrantOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.RevokeGrantInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.RevokeGrantOutput - if rf, ok := ret.Get(1).(func(*kms.RevokeGrantInput) *kms.RevokeGrantOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.RevokeGrantOutput) - } - } - - return r0, r1 -} - -// RevokeGrantWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) RevokeGrantWithContext(_a0 context.Context, _a1 *kms.RevokeGrantInput, _a2 ...request.Option) (*kms.RevokeGrantOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.RevokeGrantOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.RevokeGrantInput, ...request.Option) *kms.RevokeGrantOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.RevokeGrantOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.RevokeGrantInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ScheduleKeyDeletion provides a mock function with given fields: _a0 -func (_m *KMSAPI) ScheduleKeyDeletion(_a0 *kms.ScheduleKeyDeletionInput) (*kms.ScheduleKeyDeletionOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.ScheduleKeyDeletionOutput - if rf, ok := ret.Get(0).(func(*kms.ScheduleKeyDeletionInput) *kms.ScheduleKeyDeletionOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.ScheduleKeyDeletionOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.ScheduleKeyDeletionInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ScheduleKeyDeletionRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) ScheduleKeyDeletionRequest(_a0 *kms.ScheduleKeyDeletionInput) (*request.Request, *kms.ScheduleKeyDeletionOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.ScheduleKeyDeletionInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.ScheduleKeyDeletionOutput - if rf, ok := ret.Get(1).(func(*kms.ScheduleKeyDeletionInput) *kms.ScheduleKeyDeletionOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.ScheduleKeyDeletionOutput) - } - } - - return r0, r1 -} - -// ScheduleKeyDeletionWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) ScheduleKeyDeletionWithContext(_a0 context.Context, _a1 *kms.ScheduleKeyDeletionInput, _a2 ...request.Option) (*kms.ScheduleKeyDeletionOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.ScheduleKeyDeletionOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.ScheduleKeyDeletionInput, ...request.Option) *kms.ScheduleKeyDeletionOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.ScheduleKeyDeletionOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.ScheduleKeyDeletionInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Sign provides a mock function with given fields: _a0 -func (_m *KMSAPI) Sign(_a0 *kms.SignInput) (*kms.SignOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.SignOutput - if rf, ok := ret.Get(0).(func(*kms.SignInput) *kms.SignOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.SignOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.SignInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// SignRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) SignRequest(_a0 *kms.SignInput) (*request.Request, *kms.SignOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.SignInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.SignOutput - if rf, ok := ret.Get(1).(func(*kms.SignInput) *kms.SignOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.SignOutput) - } - } - - return r0, r1 -} - -// SignWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) SignWithContext(_a0 context.Context, _a1 *kms.SignInput, _a2 ...request.Option) (*kms.SignOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.SignOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.SignInput, ...request.Option) *kms.SignOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.SignOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.SignInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// TagResource provides a mock function with given fields: _a0 -func (_m *KMSAPI) TagResource(_a0 *kms.TagResourceInput) (*kms.TagResourceOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.TagResourceOutput - if rf, ok := ret.Get(0).(func(*kms.TagResourceInput) *kms.TagResourceOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.TagResourceOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.TagResourceInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// TagResourceRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) TagResourceRequest(_a0 *kms.TagResourceInput) (*request.Request, *kms.TagResourceOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.TagResourceInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.TagResourceOutput - if rf, ok := ret.Get(1).(func(*kms.TagResourceInput) *kms.TagResourceOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.TagResourceOutput) - } - } - - return r0, r1 -} - -// TagResourceWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) TagResourceWithContext(_a0 context.Context, _a1 *kms.TagResourceInput, _a2 ...request.Option) (*kms.TagResourceOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.TagResourceOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.TagResourceInput, ...request.Option) *kms.TagResourceOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.TagResourceOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.TagResourceInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// UntagResource provides a mock function with given fields: _a0 -func (_m *KMSAPI) UntagResource(_a0 *kms.UntagResourceInput) (*kms.UntagResourceOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.UntagResourceOutput - if rf, ok := ret.Get(0).(func(*kms.UntagResourceInput) *kms.UntagResourceOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.UntagResourceOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.UntagResourceInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// UntagResourceRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) UntagResourceRequest(_a0 *kms.UntagResourceInput) (*request.Request, *kms.UntagResourceOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.UntagResourceInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.UntagResourceOutput - if rf, ok := ret.Get(1).(func(*kms.UntagResourceInput) *kms.UntagResourceOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.UntagResourceOutput) - } - } - - return r0, r1 -} - -// UntagResourceWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) UntagResourceWithContext(_a0 context.Context, _a1 *kms.UntagResourceInput, _a2 ...request.Option) (*kms.UntagResourceOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.UntagResourceOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.UntagResourceInput, ...request.Option) *kms.UntagResourceOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.UntagResourceOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.UntagResourceInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// UpdateAlias provides a mock function with given fields: _a0 -func (_m *KMSAPI) UpdateAlias(_a0 *kms.UpdateAliasInput) (*kms.UpdateAliasOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.UpdateAliasOutput - if rf, ok := ret.Get(0).(func(*kms.UpdateAliasInput) *kms.UpdateAliasOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.UpdateAliasOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.UpdateAliasInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// UpdateAliasRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) UpdateAliasRequest(_a0 *kms.UpdateAliasInput) (*request.Request, *kms.UpdateAliasOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.UpdateAliasInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.UpdateAliasOutput - if rf, ok := ret.Get(1).(func(*kms.UpdateAliasInput) *kms.UpdateAliasOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.UpdateAliasOutput) - } - } - - return r0, r1 -} - -// UpdateAliasWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) UpdateAliasWithContext(_a0 context.Context, _a1 *kms.UpdateAliasInput, _a2 ...request.Option) (*kms.UpdateAliasOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.UpdateAliasOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.UpdateAliasInput, ...request.Option) *kms.UpdateAliasOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.UpdateAliasOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.UpdateAliasInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// UpdateCustomKeyStore provides a mock function with given fields: _a0 -func (_m *KMSAPI) UpdateCustomKeyStore(_a0 *kms.UpdateCustomKeyStoreInput) (*kms.UpdateCustomKeyStoreOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.UpdateCustomKeyStoreOutput - if rf, ok := ret.Get(0).(func(*kms.UpdateCustomKeyStoreInput) *kms.UpdateCustomKeyStoreOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.UpdateCustomKeyStoreOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.UpdateCustomKeyStoreInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// UpdateCustomKeyStoreRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) UpdateCustomKeyStoreRequest(_a0 *kms.UpdateCustomKeyStoreInput) (*request.Request, *kms.UpdateCustomKeyStoreOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.UpdateCustomKeyStoreInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.UpdateCustomKeyStoreOutput - if rf, ok := ret.Get(1).(func(*kms.UpdateCustomKeyStoreInput) *kms.UpdateCustomKeyStoreOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.UpdateCustomKeyStoreOutput) - } - } - - return r0, r1 -} - -// UpdateCustomKeyStoreWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) UpdateCustomKeyStoreWithContext(_a0 context.Context, _a1 *kms.UpdateCustomKeyStoreInput, _a2 ...request.Option) (*kms.UpdateCustomKeyStoreOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.UpdateCustomKeyStoreOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.UpdateCustomKeyStoreInput, ...request.Option) *kms.UpdateCustomKeyStoreOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.UpdateCustomKeyStoreOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.UpdateCustomKeyStoreInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// UpdateKeyDescription provides a mock function with given fields: _a0 -func (_m *KMSAPI) UpdateKeyDescription(_a0 *kms.UpdateKeyDescriptionInput) (*kms.UpdateKeyDescriptionOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.UpdateKeyDescriptionOutput - if rf, ok := ret.Get(0).(func(*kms.UpdateKeyDescriptionInput) *kms.UpdateKeyDescriptionOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.UpdateKeyDescriptionOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.UpdateKeyDescriptionInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// UpdateKeyDescriptionRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) UpdateKeyDescriptionRequest(_a0 *kms.UpdateKeyDescriptionInput) (*request.Request, *kms.UpdateKeyDescriptionOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.UpdateKeyDescriptionInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.UpdateKeyDescriptionOutput - if rf, ok := ret.Get(1).(func(*kms.UpdateKeyDescriptionInput) *kms.UpdateKeyDescriptionOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.UpdateKeyDescriptionOutput) - } - } - - return r0, r1 -} - -// UpdateKeyDescriptionWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) UpdateKeyDescriptionWithContext(_a0 context.Context, _a1 *kms.UpdateKeyDescriptionInput, _a2 ...request.Option) (*kms.UpdateKeyDescriptionOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.UpdateKeyDescriptionOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.UpdateKeyDescriptionInput, ...request.Option) *kms.UpdateKeyDescriptionOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.UpdateKeyDescriptionOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.UpdateKeyDescriptionInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// UpdatePrimaryRegion provides a mock function with given fields: _a0 -func (_m *KMSAPI) UpdatePrimaryRegion(_a0 *kms.UpdatePrimaryRegionInput) (*kms.UpdatePrimaryRegionOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.UpdatePrimaryRegionOutput - if rf, ok := ret.Get(0).(func(*kms.UpdatePrimaryRegionInput) *kms.UpdatePrimaryRegionOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.UpdatePrimaryRegionOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.UpdatePrimaryRegionInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// UpdatePrimaryRegionRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) UpdatePrimaryRegionRequest(_a0 *kms.UpdatePrimaryRegionInput) (*request.Request, *kms.UpdatePrimaryRegionOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.UpdatePrimaryRegionInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.UpdatePrimaryRegionOutput - if rf, ok := ret.Get(1).(func(*kms.UpdatePrimaryRegionInput) *kms.UpdatePrimaryRegionOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.UpdatePrimaryRegionOutput) - } - } - - return r0, r1 -} - -// UpdatePrimaryRegionWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) UpdatePrimaryRegionWithContext(_a0 context.Context, _a1 *kms.UpdatePrimaryRegionInput, _a2 ...request.Option) (*kms.UpdatePrimaryRegionOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.UpdatePrimaryRegionOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.UpdatePrimaryRegionInput, ...request.Option) *kms.UpdatePrimaryRegionOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.UpdatePrimaryRegionOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.UpdatePrimaryRegionInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Verify provides a mock function with given fields: _a0 -func (_m *KMSAPI) Verify(_a0 *kms.VerifyInput) (*kms.VerifyOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.VerifyOutput - if rf, ok := ret.Get(0).(func(*kms.VerifyInput) *kms.VerifyOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.VerifyOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.VerifyInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// VerifyMac provides a mock function with given fields: _a0 -func (_m *KMSAPI) VerifyMac(_a0 *kms.VerifyMacInput) (*kms.VerifyMacOutput, error) { - ret := _m.Called(_a0) - - var r0 *kms.VerifyMacOutput - if rf, ok := ret.Get(0).(func(*kms.VerifyMacInput) *kms.VerifyMacOutput); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.VerifyMacOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*kms.VerifyMacInput) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// VerifyMacRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) VerifyMacRequest(_a0 *kms.VerifyMacInput) (*request.Request, *kms.VerifyMacOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.VerifyMacInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.VerifyMacOutput - if rf, ok := ret.Get(1).(func(*kms.VerifyMacInput) *kms.VerifyMacOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.VerifyMacOutput) - } - } - - return r0, r1 -} - -// VerifyMacWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) VerifyMacWithContext(_a0 context.Context, _a1 *kms.VerifyMacInput, _a2 ...request.Option) (*kms.VerifyMacOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.VerifyMacOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.VerifyMacInput, ...request.Option) *kms.VerifyMacOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.VerifyMacOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.VerifyMacInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// VerifyRequest provides a mock function with given fields: _a0 -func (_m *KMSAPI) VerifyRequest(_a0 *kms.VerifyInput) (*request.Request, *kms.VerifyOutput) { - ret := _m.Called(_a0) - - var r0 *request.Request - if rf, ok := ret.Get(0).(func(*kms.VerifyInput) *request.Request); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*request.Request) - } - } - - var r1 *kms.VerifyOutput - if rf, ok := ret.Get(1).(func(*kms.VerifyInput) *kms.VerifyOutput); ok { - r1 = rf(_a0) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*kms.VerifyOutput) - } - } - - return r0, r1 -} - -// VerifyWithContext provides a mock function with given fields: _a0, _a1, _a2 -func (_m *KMSAPI) VerifyWithContext(_a0 context.Context, _a1 *kms.VerifyInput, _a2 ...request.Option) (*kms.VerifyOutput, error) { - _va := make([]interface{}, len(_a2)) - for _i := range _a2 { - _va[_i] = _a2[_i] - } - var _ca []interface{} - _ca = append(_ca, _a0, _a1) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *kms.VerifyOutput - if rf, ok := ret.Get(0).(func(context.Context, *kms.VerifyInput, ...request.Option) *kms.VerifyOutput); ok { - r0 = rf(_a0, _a1, _a2...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kms.VerifyOutput) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *kms.VerifyInput, ...request.Option) error); ok { - r1 = rf(_a0, _a1, _a2...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -}