aws-sdk-s3 1.73.0 → 1.74.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6c1a392b274571b427b52d5546c1f75e0d4917bc3b0c781b41401f28011ff8f8
4
- data.tar.gz: eead948301ba2238400318c5cc7f29ea3a059977c1198e7556fe73aafbe2ce01
3
+ metadata.gz: 626495d85d0f33f1a04615e2c65aca4331f8ac04b35306d2e68668eb1cbad727
4
+ data.tar.gz: 324b43984913dedda5bd63af0608eb9ba01feab28e8ff15ee5ceb7b1cb5d5578
5
5
  SHA512:
6
- metadata.gz: ebd3b711ed8d618367fc99f8536778379cde6ecc4b5ca6d92178f9cd89b3c9023906fb4535b62b133c143b0223b70382b5069a254dac80245e15777ad32867dd
7
- data.tar.gz: 2188bf53ea2a5b094674172a84b6e46de6e7fddc234ea427074671bbb2b91fc0c81ca56ab86fd103719961072dddb670d0d50b93f70c86bd66bf29c96f77e7a2
6
+ metadata.gz: f4958752f8508e3d4ecdb0ad22bc5184f3c9e8c9c6e035bfcb5cabda3897fb8fec2b3da206499689f400c001e83e1d364daeea687bff71cbcc1b910779936058
7
+ data.tar.gz: ef54aeb2dc6373afe0b806a4e88ca85ed81eedba190da89c7370d10eea5535f6f608ba80539b7c5b31f3198ab64767afda81c8560475c9268155af373e1d23ff
@@ -68,6 +68,6 @@ require_relative 'aws-sdk-s3/event_streams'
68
68
  # @service
69
69
  module Aws::S3
70
70
 
71
- GEM_VERSION = '1.73.0'
71
+ GEM_VERSION = '1.74.0'
72
72
 
73
73
  end
@@ -335,7 +335,7 @@ module Aws::S3
335
335
  # @option options [Boolean] :use_accelerate_endpoint (false)
336
336
  # When set to `true`, accelerated bucket endpoints will be used
337
337
  # for all object operations. You must first enable accelerate for
338
- # each bucket. [Go here for more information](http://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html).
338
+ # each bucket. [Go here for more information](http://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html).
339
339
  #
340
340
  # @option options [Boolean] :use_dualstack_endpoint (false)
341
341
  # When set to `true`, IPv6-compatible bucket endpoints will be used
@@ -11672,7 +11672,7 @@ module Aws::S3
11672
11672
  params: params,
11673
11673
  config: config)
11674
11674
  context[:gem_name] = 'aws-sdk-s3'
11675
- context[:gem_version] = '1.73.0'
11675
+ context[:gem_version] = '1.74.0'
11676
11676
  Seahorse::Client::Request.new(handlers, context)
11677
11677
  end
11678
11678
 
@@ -3,36 +3,44 @@
3
3
  module Aws
4
4
  module S3
5
5
  module Plugins
6
-
7
6
  # Provides support for using `Aws::S3::Client` with Amazon S3 Transfer
8
7
  # Acceleration.
9
8
  #
10
9
  # Go here for more information about transfer acceleration:
11
10
  # [http://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html](http://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html)
12
11
  class Accelerate < Seahorse::Client::Plugin
13
-
14
- option(:use_accelerate_endpoint,
12
+ option(
13
+ :use_accelerate_endpoint,
15
14
  default: false,
16
15
  doc_type: 'Boolean',
17
16
  docstring: <<-DOCS)
18
17
  When set to `true`, accelerated bucket endpoints will be used
19
18
  for all object operations. You must first enable accelerate for
20
- each bucket. [Go here for more information](http://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html).
19
+ each bucket. [Go here for more information](http://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html).
21
20
  DOCS
22
21
 
23
22
  def add_handlers(handlers, config)
24
23
  operations = config.api.operation_names - [
25
- :create_bucket, :list_buckets, :delete_bucket,
24
+ :create_bucket, :list_buckets, :delete_bucket
26
25
  ]
27
- handlers.add(OptionHandler, step: :initialize, operations: operations)
28
- handlers.add(AccelerateHandler, step: :build, priority: 0, operations: operations)
26
+ # Need 2 handlers so that the context can be set for other plugins
27
+ # and to remove :use_accelerate_endpoint from the params.
28
+ handlers.add(
29
+ OptionHandler, step: :initialize, operations: operations
30
+ )
31
+ handlers.add(
32
+ AccelerateHandler, step: :build, priority: 0, operations: operations
33
+ )
29
34
  end
30
35
 
31
36
  # @api private
32
37
  class OptionHandler < Seahorse::Client::Handler
33
38
  def call(context)
39
+ # Support client configuration and per-operation configuration
34
40
  accelerate = context.params.delete(:use_accelerate_endpoint)
35
- accelerate = context.config.use_accelerate_endpoint if accelerate.nil?
41
+ if accelerate.nil?
42
+ accelerate = context.config.use_accelerate_endpoint
43
+ end
36
44
  context[:use_accelerate_endpoint] = accelerate
37
45
  @handler.call(context)
38
46
  end
@@ -40,39 +48,24 @@ each bucket. [Go here for more information](http://docs.aws.amazon.com/AmazonS3
40
48
 
41
49
  # @api private
42
50
  class AccelerateHandler < Seahorse::Client::Handler
43
-
44
51
  def call(context)
45
52
  if context[:use_accelerate_endpoint]
46
- if context[:use_dualstack_endpoint]
47
- use_combined_accelerate_dualstack_endpoint(context)
48
- else
49
- use_accelerate_endpoint(context)
50
- end
53
+ dualstack = !!context[:use_dualstack_endpoint]
54
+ use_accelerate_endpoint(context, dualstack)
51
55
  end
52
56
  @handler.call(context)
53
57
  end
54
58
 
55
59
  private
56
60
 
57
- def use_accelerate_endpoint(context)
58
- bucket_name = context.params[:bucket]
59
- validate_bucket_name!(bucket_name)
60
- endpoint = URI.parse(context.http_request.endpoint.to_s)
61
- endpoint.scheme = 'https'
62
- endpoint.port = 443
63
- endpoint.host = "#{bucket_name}.s3-accelerate.amazonaws.com"
64
- context.http_request.endpoint = endpoint.to_s
65
- # s3 accelerate endpoint doesn't work with 'expect' header
66
- context.http_request.headers.delete('expect')
67
- end
68
-
69
- def use_combined_accelerate_dualstack_endpoint(context)
61
+ def use_accelerate_endpoint(context, dualstack)
70
62
  bucket_name = context.params[:bucket]
71
63
  validate_bucket_name!(bucket_name)
72
64
  endpoint = URI.parse(context.http_request.endpoint.to_s)
73
65
  endpoint.scheme = 'https'
74
66
  endpoint.port = 443
75
- endpoint.host = "#{bucket_name}.s3-accelerate.dualstack.amazonaws.com"
67
+ endpoint.host = "#{bucket_name}.s3-accelerate"\
68
+ "#{'.dualstack' if dualstack}.amazonaws.com"
76
69
  context.http_request.endpoint = endpoint.to_s
77
70
  # s3 accelerate endpoint doesn't work with 'expect' header
78
71
  context.http_request.headers.delete('expect')
@@ -80,17 +73,11 @@ each bucket. [Go here for more information](http://docs.aws.amazon.com/AmazonS3
80
73
 
81
74
  def validate_bucket_name!(bucket_name)
82
75
  unless BucketDns.dns_compatible?(bucket_name, _ssl = true)
83
- msg = 'unable to use `accelerate: true` on buckets with '\
84
- 'non-DNS compatible names'
85
- raise ArgumentError, msg
86
- end
87
- if bucket_name.include?('.')
88
- msg = 'unable to use `accelerate: true` on buckets with dots'\
89
- "in their name: #{bucket_name.inspect}"
90
- raise ArgumentError, msg
76
+ raise ArgumentError,
77
+ 'Unable to use `use_accelerate_endpoint: true` on buckets '\
78
+ 'with non-DNS compatible names.'
91
79
  end
92
80
  end
93
-
94
81
  end
95
82
  end
96
83
  end
@@ -185,35 +185,58 @@ module Aws
185
185
  # the post will expire. Defaults to one hour from creation of the
186
186
  # presigned post. May not exceed one week from creation time.
187
187
  # @option options [String] :key See {PresignedPost#key}.
188
- # @option options [String] :key_starts_with See {PresignedPost#key_starts_with}.
188
+ # @option options [String] :key_starts_with
189
+ # See {PresignedPost#key_starts_with}.
189
190
  # @option options [String] :acl See {PresignedPost#acl}.
190
- # @option options [String] :acl_starts_with See {PresignedPost#acl_starts_with}.
191
- # @option options [String] :cache_control See {PresignedPost#cache_control}.
192
- # @option options [String] :cache_control_starts_with See {PresignedPost#cache_control_starts_with}.
191
+ # @option options [String] :acl_starts_with
192
+ # See {PresignedPost#acl_starts_with}.
193
+ # @option options [String] :cache_control
194
+ # See {PresignedPost#cache_control}.
195
+ # @option options [String] :cache_control_starts_with
196
+ # See {PresignedPost#cache_control_starts_with}.
193
197
  # @option options [String] :content_type See {PresignedPost#content_type}.
194
- # @option options [String] :content_type_starts_with See {PresignedPost#content_type_starts_with}.
195
- # @option options [String] :content_disposition See {PresignedPost#content_disposition}.
196
- # @option options [String] :content_disposition_starts_with See {PresignedPost#content_disposition_starts_with}.
197
- # @option options [String] :content_encoding See {PresignedPost#content_encoding}.
198
- # @option options [String] :content_encoding_starts_with See {PresignedPost#content_encoding_starts_with}.
198
+ # @option options [String] :content_type_starts_with
199
+ # See {PresignedPost#content_type_starts_with}.
200
+ # @option options [String] :content_disposition
201
+ # See {PresignedPost#content_disposition}.
202
+ # @option options [String] :content_disposition_starts_with
203
+ # See {PresignedPost#content_disposition_starts_with}.
204
+ # @option options [String] :content_encoding
205
+ # See {PresignedPost#content_encoding}.
206
+ # @option options [String] :content_encoding_starts_with
207
+ # See {PresignedPost#content_encoding_starts_with}.
199
208
  # @option options [String] :expires See {PresignedPost#expires}.
200
- # @option options [String] :expires_starts_with See {PresignedPost#expires_starts_with}.
201
- # @option options [Range<Integer>] :content_length_range See {PresignedPost#content_length_range}.
202
- # @option options [String] :success_action_redirect See {PresignedPost#success_action_redirect}.
203
- # @option options [String] :success_action_redirect_starts_with See {PresignedPost#success_action_redirect_starts_with}.
204
- # @option options [String] :success_action_status See {PresignedPost#success_action_status}.
205
- # @option options [String] :storage_class See {PresignedPost#storage_class}.
206
- # @option options [String] :website_redirect_location See {PresignedPost#website_redirect_location}.
207
- # @option options [Hash<String,String>] :metadata See {PresignedPost#metadata}.
208
- # @option options [Hash<String,String>] :metadata_starts_with See {PresignedPost#metadata_starts_with}.
209
- # @option options [String] :server_side_encryption See {PresignedPost#server_side_encryption}.
210
- # @option options [String] :server_side_encryption_aws_kms_key_id See {PresignedPost#server_side_encryption_aws_kms_key_id}.
211
- # @option options [String] :server_side_encryption_customer_algorithm See {PresignedPost#server_side_encryption_customer_algorithm}.
212
- # @option options [String] :server_side_encryption_customer_key See {PresignedPost#server_side_encryption_customer_key}.
209
+ # @option options [String] :expires_starts_with
210
+ # See {PresignedPost#expires_starts_with}.
211
+ # @option options [Range<Integer>] :content_length_range
212
+ # See {PresignedPost#content_length_range}.
213
+ # @option options [String] :success_action_redirect
214
+ # See {PresignedPost#success_action_redirect}.
215
+ # @option options [String] :success_action_redirect_starts_with
216
+ # See {PresignedPost#success_action_redirect_starts_with}.
217
+ # @option options [String] :success_action_status
218
+ # See {PresignedPost#success_action_status}.
219
+ # @option options [String] :storage_class
220
+ # See {PresignedPost#storage_class}.
221
+ # @option options [String] :website_redirect_location
222
+ # See {PresignedPost#website_redirect_location}.
223
+ # @option options [Hash<String,String>] :metadata
224
+ # See {PresignedPost#metadata}.
225
+ # @option options [Hash<String,String>] :metadata_starts_with
226
+ # See {PresignedPost#metadata_starts_with}.
227
+ # @option options [String] :server_side_encryption
228
+ # See {PresignedPost#server_side_encryption}.
229
+ # @option options [String] :server_side_encryption_aws_kms_key_id
230
+ # See {PresignedPost#server_side_encryption_aws_kms_key_id}.
231
+ # @option options [String] :server_side_encryption_customer_algorithm
232
+ # See {PresignedPost#server_side_encryption_customer_algorithm}.
233
+ # @option options [String] :server_side_encryption_customer_key
234
+ # See {PresignedPost#server_side_encryption_customer_key}.
213
235
  def initialize(credentials, bucket_region, bucket_name, options = {})
214
236
  @credentials = credentials.credentials
215
237
  @bucket_region = bucket_region
216
238
  @bucket_name = bucket_name
239
+ @accelerate = !!options.delete(:use_accelerate_endpoint)
217
240
  @url = options.delete(:url) || bucket_url
218
241
  @fields = {}
219
242
  @key_set = false
@@ -272,7 +295,7 @@ module Aws
272
295
 
273
296
  # @!group Fields
274
297
 
275
- # The key to use for the uploaded object. Use can use `${filename}`
298
+ # The key to use for the uploaded object. You can use `${filename}`
276
299
  # as a variable in the key. This will be replaced with the name
277
300
  # of the file as provided by the user.
278
301
  #
@@ -507,7 +530,10 @@ module Aws
507
530
  # (KMS) master encryption key to use for the object.
508
531
  # @param [String] value
509
532
  # @return [self]
510
- define_field(:server_side_encryption_aws_kms_key_id, 'x-amz-server-side-encryption-aws-kms-key-id')
533
+ define_field(
534
+ :server_side_encryption_aws_kms_key_id,
535
+ 'x-amz-server-side-encryption-aws-kms-key-id'
536
+ )
511
537
 
512
538
  # @!endgroup
513
539
 
@@ -520,7 +546,10 @@ module Aws
520
546
  # @param [String] value
521
547
  # @see #server_side_encryption_customer_key
522
548
  # @return [self]
523
- define_field(:server_side_encryption_customer_algorithm, 'x-amz-server-side-encryption-customer-algorithm')
549
+ define_field(
550
+ :server_side_encryption_customer_algorithm,
551
+ 'x-amz-server-side-encryption-customer-algorithm'
552
+ )
524
553
 
525
554
  # Specifies the customer-provided encryption key for Amazon S3 to use
526
555
  # in encrypting data. This value is used to store the object and then
@@ -582,10 +611,14 @@ module Aws
582
611
  def bucket_url
583
612
  url = Aws::Partitions::EndpointProvider.resolve(@bucket_region, 's3')
584
613
  url = URI.parse(url)
585
- if Plugins::BucketDns.dns_compatible?(@bucket_name, true)
586
- url.host = @bucket_name + '.' + url.host
614
+ if Plugins::BucketDns.dns_compatible?(@bucket_name, _ssl = true)
615
+ if @accelerate
616
+ url.host = "#{@bucket_name}.s3-accelerate.amazonaws.com"
617
+ else
618
+ url.host = "#{@bucket_name}.#{url.host}"
619
+ end
587
620
  else
588
- url.path = '/' + @bucket_name
621
+ url.path = "/#{@bucket_name}"
589
622
  end
590
623
  if @bucket_region == 'us-east-1'
591
624
  # keep legacy behavior by default
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk-s3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.73.0
4
+ version: 1.74.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amazon Web Services
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-02 00:00:00.000000000 Z
11
+ date: 2020-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-kms