(conf aws.Config, opts []func(*s3.Options), config *Config)
| 150 | } |
| 151 | |
| 152 | func createClient(conf aws.Config, opts []func(*s3.Options), config *Config) (s3Client, error) { |
| 153 | client := s3.NewFromConfig(conf, opts...) |
| 154 | |
| 155 | if config.DecryptionClientEnabled { |
| 156 | kmsClient := kms.NewFromConfig(conf) |
| 157 | keyring := s3CryptoMaterials.NewKmsDecryptOnlyAnyKeyKeyring(kmsClient) |
| 158 | |
| 159 | cmm, err := s3CryptoMaterials.NewCryptographicMaterialsManager(keyring) |
| 160 | if err != nil { |
| 161 | return nil, err |
| 162 | } |
| 163 | |
| 164 | return s3Crypto.New(client, cmm, func(options *s3Crypto.EncryptionClientOptions) { |
| 165 | options.CommitmentPolicy = s3CryptoCommitment.FORBID_ENCRYPT_ALLOW_DECRYPT |
| 166 | }) |
| 167 | } else { |
| 168 | return client, nil |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | func regionFromError(err error) string { |
| 173 | var rerr *awsHttp.ResponseError |
no outgoing calls
no test coverage detected