aws-sdk-s3 1.102.0 → 1.105.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,6 +22,7 @@ module Aws::S3
22
22
  AcceptRanges = Shapes::StringShape.new(name: 'AcceptRanges')
23
23
  AccessControlPolicy = Shapes::StructureShape.new(name: 'AccessControlPolicy')
24
24
  AccessControlTranslation = Shapes::StructureShape.new(name: 'AccessControlTranslation')
25
+ AccessPointArn = Shapes::StringShape.new(name: 'AccessPointArn')
25
26
  AccountId = Shapes::StringShape.new(name: 'AccountId')
26
27
  AllowQuotedRecordDelimiter = Shapes::BooleanShape.new(name: 'AllowQuotedRecordDelimiter')
27
28
  AllowedHeader = Shapes::StringShape.new(name: 'AllowedHeader')
@@ -1686,6 +1687,7 @@ module Aws::S3
1686
1687
 
1687
1688
  MetricsAndOperator.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, location_name: "Prefix"))
1688
1689
  MetricsAndOperator.add_member(:tags, Shapes::ShapeRef.new(shape: TagSet, location_name: "Tag", metadata: {"flattened"=>true}))
1690
+ MetricsAndOperator.add_member(:access_point_arn, Shapes::ShapeRef.new(shape: AccessPointArn, location_name: "AccessPointArn"))
1689
1691
  MetricsAndOperator.struct_class = Types::MetricsAndOperator
1690
1692
 
1691
1693
  MetricsConfiguration.add_member(:id, Shapes::ShapeRef.new(shape: MetricsId, required: true, location_name: "Id"))
@@ -1696,6 +1698,7 @@ module Aws::S3
1696
1698
 
1697
1699
  MetricsFilter.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, location_name: "Prefix"))
1698
1700
  MetricsFilter.add_member(:tag, Shapes::ShapeRef.new(shape: Tag, location_name: "Tag"))
1701
+ MetricsFilter.add_member(:access_point_arn, Shapes::ShapeRef.new(shape: AccessPointArn, location_name: "AccessPointArn"))
1699
1702
  MetricsFilter.add_member(:and, Shapes::ShapeRef.new(shape: MetricsAndOperator, location_name: "And"))
1700
1703
  MetricsFilter.struct_class = Types::MetricsFilter
1701
1704
 
@@ -184,10 +184,10 @@ module Aws::S3
184
184
  end
185
185
 
186
186
  # If the object is stored using server-side encryption either with an
187
- # Amazon Web Services KMS customer master key (CMK) or an Amazon
188
- # S3-managed encryption key, the response includes this header with the
189
- # value of the server-side encryption algorithm used when storing this
190
- # object in Amazon S3 (for example, AES256, aws:kms).
187
+ # Amazon Web Services KMS key or an Amazon S3-managed encryption key,
188
+ # the response includes this header with the value of the server-side
189
+ # encryption algorithm used when storing this object in Amazon S3 (for
190
+ # example, AES256, aws:kms).
191
191
  # @return [String]
192
192
  def server_side_encryption
193
193
  data[:server_side_encryption]
@@ -217,8 +217,8 @@ module Aws::S3
217
217
  end
218
218
 
219
219
  # If present, specifies the ID of the Amazon Web Services Key Management
220
- # Service (Amazon Web Services KMS) symmetric customer managed customer
221
- # master key (CMK) that was used for the object.
220
+ # Service (Amazon Web Services KMS) symmetric customer managed key that
221
+ # was used for the object.
222
222
  # @return [String]
223
223
  def ssekms_key_id
224
224
  data[:ssekms_key_id]
@@ -1028,13 +1028,13 @@ module Aws::S3
1028
1028
  # RFC 1321. Amazon S3 uses this header for a message integrity check to
1029
1029
  # ensure that the encryption key was transmitted without error.
1030
1030
  # @option options [String] :ssekms_key_id
1031
- # Specifies the ID of the symmetric customer managed Amazon Web Services
1032
- # KMS CMK to use for object encryption. All GET and PUT requests for an
1033
- # object protected by Amazon Web Services KMS will fail if not made via
1034
- # SSL or using SigV4. For information about configuring using any of the
1035
- # officially supported Amazon Web Services SDKs and Amazon Web Services
1036
- # CLI, see [Specifying the Signature Version in Request
1037
- # Authentication][1] in the *Amazon S3 User Guide*.
1031
+ # Specifies the ID of the symmetric customer managed key to use for
1032
+ # object encryption. All GET and PUT requests for an object protected by
1033
+ # Amazon Web Services KMS will fail if not made via SSL or using SigV4.
1034
+ # For information about configuring using any of the officially
1035
+ # supported Amazon Web Services SDKs and Amazon Web Services CLI, see
1036
+ # [Specifying the Signature Version in Request Authentication][1] in the
1037
+ # *Amazon S3 User Guide*.
1038
1038
  #
1039
1039
  #
1040
1040
  #
@@ -1277,12 +1277,12 @@ module Aws::S3
1277
1277
  # If `x-amz-server-side-encryption` is present and has the value of
1278
1278
  # `aws:kms`, this header specifies the ID of the Amazon Web Services Key
1279
1279
  # Management Service (Amazon Web Services KMS) symmetrical customer
1280
- # managed customer master key (CMK) that was used for the object. If you
1281
- # specify `x-amz-server-side-encryption:aws:kms`, but do not provide`
1280
+ # managed key that was used for the object. If you specify
1281
+ # `x-amz-server-side-encryption:aws:kms`, but do not provide`
1282
1282
  # x-amz-server-side-encryption-aws-kms-key-id`, Amazon S3 uses the
1283
- # Amazon Web Services managed CMK in Amazon Web Services to protect the
1284
- # data. If the KMS key does not exist in the same account issuing the
1285
- # command, you must use the full ARN and not just the ID.
1283
+ # Amazon Web Services managed key to protect the data. If the KMS key
1284
+ # does not exist in the same account issuing the command, you must use
1285
+ # the full ARN and not just the ID.
1286
1286
  # @option options [String] :ssekms_encryption_context
1287
1287
  # Specifies the Amazon Web Services KMS Encryption Context to use for
1288
1288
  # object encryption. The value of this header is a base64-encoded UTF-8
@@ -772,13 +772,13 @@ module Aws::S3
772
772
  # RFC 1321. Amazon S3 uses this header for a message integrity check to
773
773
  # ensure that the encryption key was transmitted without error.
774
774
  # @option options [String] :ssekms_key_id
775
- # Specifies the ID of the symmetric customer managed Amazon Web Services
776
- # KMS CMK to use for object encryption. All GET and PUT requests for an
777
- # object protected by Amazon Web Services KMS will fail if not made via
778
- # SSL or using SigV4. For information about configuring using any of the
779
- # officially supported Amazon Web Services SDKs and Amazon Web Services
780
- # CLI, see [Specifying the Signature Version in Request
781
- # Authentication][1] in the *Amazon S3 User Guide*.
775
+ # Specifies the ID of the symmetric customer managed key to use for
776
+ # object encryption. All GET and PUT requests for an object protected by
777
+ # Amazon Web Services KMS will fail if not made via SSL or using SigV4.
778
+ # For information about configuring using any of the officially
779
+ # supported Amazon Web Services SDKs and Amazon Web Services CLI, see
780
+ # [Specifying the Signature Version in Request Authentication][1] in the
781
+ # *Amazon S3 User Guide*.
782
782
  #
783
783
  #
784
784
  #
@@ -1021,12 +1021,12 @@ module Aws::S3
1021
1021
  # If `x-amz-server-side-encryption` is present and has the value of
1022
1022
  # `aws:kms`, this header specifies the ID of the Amazon Web Services Key
1023
1023
  # Management Service (Amazon Web Services KMS) symmetrical customer
1024
- # managed customer master key (CMK) that was used for the object. If you
1025
- # specify `x-amz-server-side-encryption:aws:kms`, but do not provide`
1024
+ # managed key that was used for the object. If you specify
1025
+ # `x-amz-server-side-encryption:aws:kms`, but do not provide`
1026
1026
  # x-amz-server-side-encryption-aws-kms-key-id`, Amazon S3 uses the
1027
- # Amazon Web Services managed CMK in Amazon Web Services to protect the
1028
- # data. If the KMS key does not exist in the same account issuing the
1029
- # command, you must use the full ARN and not just the ID.
1027
+ # Amazon Web Services managed key to protect the data. If the KMS key
1028
+ # does not exist in the same account issuing the command, you must use
1029
+ # the full ARN and not just the ID.
1030
1030
  # @option options [String] :ssekms_encryption_context
1031
1031
  # Specifies the Amazon Web Services KMS Encryption Context to use for
1032
1032
  # object encryption. The value of this header is a base64-encoded UTF-8
@@ -41,11 +41,17 @@ each bucket. [Go here for more information](http://docs.aws.amazon.com/AmazonS3/
41
41
  accelerate = context.params.delete(:use_accelerate_endpoint)
42
42
  end
43
43
  accelerate = context.config.use_accelerate_endpoint if accelerate.nil?
44
- # Raise if :endpoint and dualstack are both provided
44
+ # Raise if :endpoint and accelerate are both provided
45
45
  if accelerate && !context.config.regional_endpoint
46
46
  raise ArgumentError,
47
47
  'Cannot use both :use_accelerate_endpoint and :endpoint'
48
48
  end
49
+ # Raise if :use_fips_endpoint and accelerate are both provided
50
+ if accelerate && context.config.use_fips_endpoint
51
+ raise ArgumentError,
52
+ 'Cannot use both :use_accelerate_endpoint and '\
53
+ ':use_fips_endpoint'
54
+ end
49
55
  context[:use_accelerate_endpoint] = accelerate
50
56
  @handler.call(context)
51
57
  end
@@ -77,17 +77,10 @@ result in cross region requests.
77
77
  if arn
78
78
  validate_config!(context, arn)
79
79
 
80
- fips = false
81
- if resolved_region.include?('fips')
82
- fips = true
83
- resolved_region = resolved_region.gsub('fips-', '')
84
- .gsub('-fips', '')
85
- end
86
-
87
80
  context.metadata[:s3_arn] = {
88
81
  arn: arn,
89
82
  resolved_region: resolved_region,
90
- fips: fips,
83
+ fips: context.config.use_fips_endpoint,
91
84
  dualstack: extract_dualstack_config!(context)
92
85
  }
93
86
  end
@@ -126,7 +119,8 @@ result in cross region requests.
126
119
 
127
120
  if !arn.support_dualstack? && context[:use_dualstack_endpoint]
128
121
  raise ArgumentError,
129
- 'Cannot provide an Outpost Access Point or Multi-region Access Point ARN'\
122
+ 'Cannot provide an Outpost Access Point, Object Lambda, '\
123
+ 'or Multi-region Access Point ARN'\
130
124
  ' when `:use_dualstack_endpoint` is set to true.'
131
125
  end
132
126
 
@@ -135,6 +129,12 @@ result in cross region requests.
135
129
  'Cannot provide a Multi-region Access Point ARN with '\
136
130
  '`:s3_disable_multiregion_access_points` set to true'
137
131
  end
132
+
133
+ if context.config.use_fips_endpoint && !arn.support_fips?
134
+ raise ArgumentError,
135
+ 'FIPS client regions are not supported for this type '\
136
+ 'of ARN.'
137
+ end
138
138
  end
139
139
  end
140
140
 
@@ -146,7 +146,7 @@ result in cross region requests.
146
146
  s3_arn = resolve_arn_type!(arn)
147
147
  s3_arn.validate_arn!
148
148
  validate_region_config!(s3_arn, region, use_arn_region)
149
- region = s3_arn.region if use_arn_region && !region.include?('fips')
149
+ region = s3_arn.region if use_arn_region
150
150
  [region, s3_arn]
151
151
  else
152
152
  [region]
@@ -231,19 +231,6 @@ result in cross region requests.
231
231
  raise Aws::Errors::InvalidARNPartitionError
232
232
  end
233
233
  else
234
- if region.include?('fips')
235
- # If ARN type doesn't support FIPS but the client region is FIPS
236
- unless arn.support_fips?
237
- raise ArgumentError,
238
- 'FIPS client regions are not supported for this type '\
239
- 'of ARN.'
240
- end
241
-
242
- fips = true
243
- # Normalize the region so we can compare partition and regions
244
- region = region.gsub('fips-', '').gsub('-fips', '')
245
- end
246
-
247
234
  # use_arn_region does not apply to MRAP (global) arns
248
235
  unless arn.region.empty?
249
236
  # Raise if the ARN and client regions are in different partitions
@@ -254,7 +241,7 @@ result in cross region requests.
254
241
 
255
242
  # Raise if regions mismatch
256
243
  # Either when it's a fips client or not using the ARN region
257
- if (!use_arn_region || fips) && region != arn.region
244
+ if !use_arn_region && region != arn.region
258
245
  raise Aws::Errors::InvalidARNRegionError
259
246
  end
260
247
  end
@@ -24,7 +24,7 @@ request URI and never moved to the host as a sub-domain.
24
24
  DOCS
25
25
 
26
26
  def add_handlers(handlers, config)
27
- handlers.add(Handler) unless config.force_path_style
27
+ handlers.add(Handler, priority: 48) unless config.force_path_style
28
28
  end
29
29
 
30
30
  # @api private
@@ -5,18 +5,9 @@ module Aws
5
5
  module Plugins
6
6
  # @api private
7
7
  class Dualstack < Seahorse::Client::Plugin
8
-
9
- option(:use_dualstack_endpoint,
10
- default: false,
11
- doc_type: 'Boolean',
12
- docstring: <<-DOCS)
13
- When set to `true`, IPv6-compatible bucket endpoints will be used
14
- for all operations.
15
- DOCS
16
-
17
8
  def add_handlers(handlers, config)
18
9
  handlers.add(OptionHandler, step: :initialize)
19
- handlers.add(DualstackHandler, step: :build, priority: 11)
10
+ handlers.add(DualstackHandler, step: :build, priority: 49)
20
11
  end
21
12
 
22
13
  # @api private
@@ -40,38 +31,41 @@ for all operations.
40
31
  # @api private
41
32
  class DualstackHandler < Seahorse::Client::Handler
42
33
  def call(context)
43
- if context.config.regional_endpoint && use_dualstack_endpoint?(context)
34
+ # only rewrite the endpoint if it's not a custom endpoint
35
+ # accelerate/ARN already handle dualstack cases, so ignore these
36
+ # check to see if dualstack is on but configured off via operation
37
+ if context.config.regional_endpoint &&
38
+ use_dualstack_endpoint?(context)
44
39
  apply_dualstack_endpoint(context)
45
40
  end
46
41
  @handler.call(context)
47
42
  end
48
43
 
49
44
  private
50
- def apply_dualstack_endpoint(context)
51
- bucket_name = context.params[:bucket]
52
- region = context.config.region
53
- dns_suffix = Aws::Partitions::EndpointProvider.dns_suffix_for(region)
54
45
 
55
- if use_bucket_dns?(bucket_name, context)
56
- host = "#{bucket_name}.s3.dualstack.#{region}.#{dns_suffix}"
57
- else
58
- host = "s3.dualstack.#{region}.#{dns_suffix}"
59
- end
46
+ def apply_dualstack_endpoint(context)
47
+ new_endpoint = Aws::Partitions::EndpointProvider.resolve(
48
+ context.config.region,
49
+ 's3',
50
+ 'regional',
51
+ {
52
+ dualstack: context[:use_dualstack_endpoint],
53
+ fips: context.config.use_fips_endpoint
54
+ }
55
+ )
60
56
  endpoint = URI.parse(context.http_request.endpoint.to_s)
61
- endpoint.scheme = context.http_request.endpoint.scheme
62
- endpoint.port = context.http_request.endpoint.port
63
- endpoint.host = host
64
- context.http_request.endpoint = endpoint.to_s
65
- end
66
-
67
- def use_bucket_dns?(bucket_name, context)
68
- ssl = context.http_request.endpoint.scheme == "https"
69
- bucket_name && BucketDns.dns_compatible?(bucket_name, ssl) &&
70
- !context.config.force_path_style
57
+ endpoint.host = URI.parse(new_endpoint).host
58
+ context.http_request.endpoint = endpoint
71
59
  end
72
60
 
73
61
  def use_dualstack_endpoint?(context)
74
- context[:use_dualstack_endpoint] && !context[:use_accelerate_endpoint]
62
+ # case when dualstack is turned off via operation
63
+ (context[:use_dualstack_endpoint] ||
64
+ context.config.use_dualstack_endpoint) &&
65
+ # accelerate plugin already applies dualstack
66
+ !context[:use_accelerate_endpoint] &&
67
+ # arns handle dualstack
68
+ !context.metadata[:s3_arn]
75
69
  end
76
70
  end
77
71
 
@@ -22,7 +22,9 @@ module Aws
22
22
  # S3 removes core's signature_v4 plugin that checks for this
23
23
  raise Aws::Errors::MissingRegionError if cfg.region.nil?
24
24
 
25
- Aws::Partitions::EndpointProvider.signing_region(cfg.region, 's3')
25
+ Aws::Partitions::EndpointProvider.signing_region(
26
+ cfg.region, 's3'
27
+ )
26
28
  end
27
29
 
28
30
  def add_handlers(handlers, cfg)
@@ -162,7 +164,12 @@ module Aws
162
164
 
163
165
  def custom_endpoint?(resp)
164
166
  resolved_suffix = Aws::Partitions::EndpointProvider.dns_suffix_for(
165
- resp.context.config.region
167
+ resp.context.config.region,
168
+ 's3',
169
+ {
170
+ dualstack: resp.context[:use_dualstack_endpoint],
171
+ fips: resp.context.config.use_fips_endpoint
172
+ }
166
173
  )
167
174
  !resp.context.http_request.endpoint.hostname.include?(resolved_suffix)
168
175
  end
@@ -234,12 +241,20 @@ module Aws
234
241
  # Otherwise it will retry with the ARN as the bucket name.
235
242
  def new_hostname(context, region)
236
243
  uri = URI.parse(
237
- Aws::Partitions::EndpointProvider.resolve(region, 's3')
244
+ Aws::Partitions::EndpointProvider.resolve(
245
+ region, 's3', 'regional',
246
+ {
247
+ dualstack: context[:use_dualstack_endpoint],
248
+ fips: context.config.use_fips_endpoint
249
+ }
250
+ )
238
251
  )
239
252
 
240
253
  if (arn = context.metadata[:s3_arn])
241
254
  # Retry with the response region and not the ARN resolved one
242
- ARN.resolve_url!(uri, arn[:arn], region).host
255
+ ARN.resolve_url!(
256
+ uri, arn[:arn], region, arn[:fips], arn[:dualstack]
257
+ ).host
243
258
  else
244
259
  "#{context.params[:bucket]}.#{uri.host}"
245
260
  end