MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / createClient

Function createClient

storage/s3/storage.go:152–170  ·  view source on GitHub ↗
(conf aws.Config, opts []func(*s3.Options), config *Config)

Source from the content-addressed store, hash-verified

150}
151
152func 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
172func regionFromError(err error) string {
173 var rerr *awsHttp.ResponseError

Callers 2

NewFunction · 0.85
createBucketClientMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected