aws-sdk-s3 1.151.0 → 1.156.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +40 -0
  3. data/VERSION +1 -1
  4. data/lib/aws-sdk-s3/bucket.rb +12 -12
  5. data/lib/aws-sdk-s3/bucket_acl.rb +3 -3
  6. data/lib/aws-sdk-s3/bucket_cors.rb +4 -4
  7. data/lib/aws-sdk-s3/bucket_lifecycle.rb +4 -4
  8. data/lib/aws-sdk-s3/bucket_lifecycle_configuration.rb +4 -4
  9. data/lib/aws-sdk-s3/bucket_logging.rb +3 -3
  10. data/lib/aws-sdk-s3/bucket_notification.rb +3 -3
  11. data/lib/aws-sdk-s3/bucket_policy.rb +4 -4
  12. data/lib/aws-sdk-s3/bucket_request_payment.rb +3 -3
  13. data/lib/aws-sdk-s3/bucket_tagging.rb +4 -4
  14. data/lib/aws-sdk-s3/bucket_versioning.rb +5 -5
  15. data/lib/aws-sdk-s3/bucket_website.rb +4 -4
  16. data/lib/aws-sdk-s3/client.rb +123 -88
  17. data/lib/aws-sdk-s3/client_api.rb +10 -2
  18. data/lib/aws-sdk-s3/customizations/bucket.rb +1 -1
  19. data/lib/aws-sdk-s3/customizations/object.rb +5 -5
  20. data/lib/aws-sdk-s3/encryption/client.rb +2 -2
  21. data/lib/aws-sdk-s3/encryption/kms_cipher_provider.rb +2 -2
  22. data/lib/aws-sdk-s3/encryptionV2/client.rb +2 -2
  23. data/lib/aws-sdk-s3/encryptionV2/kms_cipher_provider.rb +2 -2
  24. data/lib/aws-sdk-s3/endpoint_parameters.rb +8 -0
  25. data/lib/aws-sdk-s3/endpoint_provider.rb +1 -0
  26. data/lib/aws-sdk-s3/endpoints.rb +100 -1
  27. data/lib/aws-sdk-s3/file_downloader.rb +1 -1
  28. data/lib/aws-sdk-s3/file_uploader.rb +1 -1
  29. data/lib/aws-sdk-s3/multipart_stream_uploader.rb +1 -1
  30. data/lib/aws-sdk-s3/multipart_upload.rb +4 -4
  31. data/lib/aws-sdk-s3/multipart_upload_part.rb +3 -3
  32. data/lib/aws-sdk-s3/object.rb +30 -12
  33. data/lib/aws-sdk-s3/object_acl.rb +3 -3
  34. data/lib/aws-sdk-s3/object_copier.rb +1 -1
  35. data/lib/aws-sdk-s3/object_summary.rb +10 -10
  36. data/lib/aws-sdk-s3/object_version.rb +23 -5
  37. data/lib/aws-sdk-s3/plugins/access_grants.rb +7 -1
  38. data/lib/aws-sdk-s3/plugins/express_session_auth.rb +7 -1
  39. data/lib/aws-sdk-s3/plugins/http_200_errors.rb +53 -16
  40. data/lib/aws-sdk-s3/resource.rb +2 -2
  41. data/lib/aws-sdk-s3/types.rb +48 -17
  42. data/lib/aws-sdk-s3.rb +1 -1
  43. data/sig/client.rbs +19 -0
  44. data/sig/object.rbs +6 -0
  45. data/sig/object_version.rbs +6 -0
  46. data/sig/resource.rbs +1 -0
  47. data/sig/types.rbs +6 -0
  48. data/sig/waiters.rbs +12 -0
  49. metadata +6 -6
@@ -44,7 +44,7 @@ module Aws
44
44
 
45
45
  validate!
46
46
 
47
- Aws::Plugins::UserAgent.feature('s3-transfer') do
47
+ Aws::Plugins::UserAgent.metric('S3_TRANSFER') do
48
48
  case @mode
49
49
  when 'auto' then multipart_download
50
50
  when 'single_request' then single_request
@@ -37,7 +37,7 @@ module Aws
37
37
  # objects smaller than the multipart threshold.
38
38
  # @return [void]
39
39
  def upload(source, options = {})
40
- Aws::Plugins::UserAgent.feature('s3-transfer') do
40
+ Aws::Plugins::UserAgent.metric('S3_TRANSFER') do
41
41
  if File.size(source) >= multipart_threshold
42
42
  MultipartFileUploader.new(@options).upload(source, options)
43
43
  else
@@ -46,7 +46,7 @@ module Aws
46
46
  # @option options [Integer] :thread_count (THREAD_COUNT)
47
47
  # @return [Seahorse::Client::Response] - the CompleteMultipartUploadResponse
48
48
  def upload(options = {}, &block)
49
- Aws::Plugins::UserAgent.feature('s3-transfer') do
49
+ Aws::Plugins::UserAgent.metric('S3_TRANSFER') do
50
50
  upload_id = initiate_upload(options)
51
51
  parts = upload_parts(upload_id, options, &block)
52
52
  complete_upload(upload_id, parts, options)
@@ -227,7 +227,7 @@ module Aws::S3
227
227
  :retry
228
228
  end
229
229
  end
230
- Aws::Plugins::UserAgent.feature('resource') do
230
+ Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
231
231
  Aws::Waiters::Waiter.new(options).wait({})
232
232
  end
233
233
  end
@@ -268,7 +268,7 @@ module Aws::S3
268
268
  key: @object_key,
269
269
  upload_id: @id
270
270
  )
271
- resp = Aws::Plugins::UserAgent.feature('resource') do
271
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
272
272
  @client.abort_multipart_upload(options)
273
273
  end
274
274
  resp.data
@@ -409,7 +409,7 @@ module Aws::S3
409
409
  key: @object_key,
410
410
  upload_id: @id
411
411
  )
412
- Aws::Plugins::UserAgent.feature('resource') do
412
+ Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
413
413
  @client.complete_multipart_upload(options)
414
414
  end
415
415
  Object.new(
@@ -519,7 +519,7 @@ module Aws::S3
519
519
  key: @object_key,
520
520
  upload_id: @id
521
521
  )
522
- resp = Aws::Plugins::UserAgent.feature('resource') do
522
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
523
523
  @client.list_parts(options)
524
524
  end
525
525
  resp.each_page do |page|
@@ -262,7 +262,7 @@ module Aws::S3
262
262
  :retry
263
263
  end
264
264
  end
265
- Aws::Plugins::UserAgent.feature('resource') do
265
+ Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
266
266
  Aws::Waiters::Waiter.new(options).wait({})
267
267
  end
268
268
  end
@@ -500,7 +500,7 @@ module Aws::S3
500
500
  upload_id: @multipart_upload_id,
501
501
  part_number: @part_number
502
502
  )
503
- resp = Aws::Plugins::UserAgent.feature('resource') do
503
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
504
504
  @client.upload_part_copy(options)
505
505
  end
506
506
  resp.data
@@ -650,7 +650,7 @@ module Aws::S3
650
650
  upload_id: @multipart_upload_id,
651
651
  part_number: @part_number
652
652
  )
653
- resp = Aws::Plugins::UserAgent.feature('resource') do
653
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
654
654
  @client.upload_part(options)
655
655
  end
656
656
  resp.data
@@ -500,7 +500,7 @@ module Aws::S3
500
500
  #
501
501
  # @return [self]
502
502
  def load
503
- resp = Aws::Plugins::UserAgent.feature('resource') do
503
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
504
504
  @client.head_object(
505
505
  bucket: @bucket_name,
506
506
  key: @key
@@ -550,7 +550,7 @@ module Aws::S3
550
550
  options, params = separate_params_and_options(options)
551
551
  waiter = Waiters::ObjectExists.new(options)
552
552
  yield_waiter_and_warn(waiter, &block) if block_given?
553
- Aws::Plugins::UserAgent.feature('resource') do
553
+ Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
554
554
  waiter.wait(params.merge(bucket: @bucket_name,
555
555
  key: @key))
556
556
  end
@@ -571,7 +571,7 @@ module Aws::S3
571
571
  options, params = separate_params_and_options(options)
572
572
  waiter = Waiters::ObjectNotExists.new(options)
573
573
  yield_waiter_and_warn(waiter, &block) if block_given?
574
- Aws::Plugins::UserAgent.feature('resource') do
574
+ Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
575
575
  waiter.wait(params.merge(bucket: @bucket_name,
576
576
  key: @key))
577
577
  end
@@ -676,7 +676,7 @@ module Aws::S3
676
676
  :retry
677
677
  end
678
678
  end
679
- Aws::Plugins::UserAgent.feature('resource') do
679
+ Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
680
680
  Aws::Waiters::Waiter.new(options).wait({})
681
681
  end
682
682
  end
@@ -1346,7 +1346,7 @@ module Aws::S3
1346
1346
  bucket: @bucket_name,
1347
1347
  key: @key
1348
1348
  )
1349
- resp = Aws::Plugins::UserAgent.feature('resource') do
1349
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
1350
1350
  @client.copy_object(options)
1351
1351
  end
1352
1352
  resp.data
@@ -1412,7 +1412,7 @@ module Aws::S3
1412
1412
  bucket: @bucket_name,
1413
1413
  key: @key
1414
1414
  )
1415
- resp = Aws::Plugins::UserAgent.feature('resource') do
1415
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
1416
1416
  @client.delete_object(options)
1417
1417
  end
1418
1418
  resp.data
@@ -1668,7 +1668,7 @@ module Aws::S3
1668
1668
  bucket: @bucket_name,
1669
1669
  key: @key
1670
1670
  )
1671
- resp = Aws::Plugins::UserAgent.feature('resource') do
1671
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
1672
1672
  @client.get_object(options, &block)
1673
1673
  end
1674
1674
  resp.data
@@ -2153,7 +2153,7 @@ module Aws::S3
2153
2153
  bucket: @bucket_name,
2154
2154
  key: @key
2155
2155
  )
2156
- resp = Aws::Plugins::UserAgent.feature('resource') do
2156
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
2157
2157
  @client.create_multipart_upload(options)
2158
2158
  end
2159
2159
  MultipartUpload.new(
@@ -2624,7 +2624,7 @@ module Aws::S3
2624
2624
  bucket: @bucket_name,
2625
2625
  key: @key
2626
2626
  )
2627
- resp = Aws::Plugins::UserAgent.feature('resource') do
2627
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
2628
2628
  @client.put_object(options)
2629
2629
  end
2630
2630
  resp.data
@@ -2765,7 +2765,7 @@ module Aws::S3
2765
2765
  bucket: @bucket_name,
2766
2766
  key: @key
2767
2767
  )
2768
- resp = Aws::Plugins::UserAgent.feature('resource') do
2768
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
2769
2769
  @client.restore_object(options)
2770
2770
  end
2771
2771
  resp.data
@@ -2779,6 +2779,12 @@ module Aws::S3
2779
2779
  # if_none_match: "IfNoneMatch",
2780
2780
  # if_unmodified_since: Time.now,
2781
2781
  # range: "Range",
2782
+ # response_cache_control: "ResponseCacheControl",
2783
+ # response_content_disposition: "ResponseContentDisposition",
2784
+ # response_content_encoding: "ResponseContentEncoding",
2785
+ # response_content_language: "ResponseContentLanguage",
2786
+ # response_content_type: "ResponseContentType",
2787
+ # response_expires: Time.now,
2782
2788
  # version_id: "ObjectVersionId",
2783
2789
  # sse_customer_algorithm: "SSECustomerAlgorithm",
2784
2790
  # sse_customer_key: "SSECustomerKey",
@@ -2866,6 +2872,18 @@ module Aws::S3
2866
2872
  # satisfiable, only the `ContentLength` is affected in the response. If
2867
2873
  # the Range is not satisfiable, S3 returns a `416 - Requested Range Not
2868
2874
  # Satisfiable` error.
2875
+ # @option options [String] :response_cache_control
2876
+ # Sets the `Cache-Control` header of the response.
2877
+ # @option options [String] :response_content_disposition
2878
+ # Sets the `Content-Disposition` header of the response.
2879
+ # @option options [String] :response_content_encoding
2880
+ # Sets the `Content-Encoding` header of the response.
2881
+ # @option options [String] :response_content_language
2882
+ # Sets the `Content-Language` header of the response.
2883
+ # @option options [String] :response_content_type
2884
+ # Sets the `Content-Type` header of the response.
2885
+ # @option options [Time,DateTime,Date,Integer,String] :response_expires
2886
+ # Sets the `Expires` header of the response.
2869
2887
  # @option options [String] :version_id
2870
2888
  # Version ID used to reference a specific version of the object.
2871
2889
  #
@@ -2936,7 +2954,7 @@ module Aws::S3
2936
2954
  bucket: @bucket_name,
2937
2955
  key: @key
2938
2956
  )
2939
- resp = Aws::Plugins::UserAgent.feature('resource') do
2957
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
2940
2958
  @client.head_object(options)
2941
2959
  end
2942
2960
  resp.data
@@ -3154,7 +3172,7 @@ module Aws::S3
3154
3172
  key: item.key
3155
3173
  }
3156
3174
  end
3157
- Aws::Plugins::UserAgent.feature('resource') do
3175
+ Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
3158
3176
  batch[0].client.delete_objects(params)
3159
3177
  end
3160
3178
  end
@@ -79,7 +79,7 @@ module Aws::S3
79
79
  #
80
80
  # @return [self]
81
81
  def load
82
- resp = Aws::Plugins::UserAgent.feature('resource') do
82
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
83
83
  @client.get_object_acl(
84
84
  bucket: @bucket_name,
85
85
  key: @object_key
@@ -199,7 +199,7 @@ module Aws::S3
199
199
  :retry
200
200
  end
201
201
  end
202
- Aws::Plugins::UserAgent.feature('resource') do
202
+ Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
203
203
  Aws::Waiters::Waiter.new(options).wait({})
204
204
  end
205
205
  end
@@ -332,7 +332,7 @@ module Aws::S3
332
332
  bucket: @bucket_name,
333
333
  key: @object_key
334
334
  )
335
- resp = Aws::Plugins::UserAgent.feature('resource') do
335
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
336
336
  @client.put_object_acl(options)
337
337
  end
338
338
  resp.data
@@ -28,7 +28,7 @@ module Aws
28
28
  options[:bucket] = target_bucket
29
29
  options[:key] = target_key
30
30
  options[:copy_source] = copy_source(source)
31
- Aws::Plugins::UserAgent.feature('s3-transfer') do
31
+ Aws::Plugins::UserAgent.metric('S3_TRANSFER') do
32
32
  if options.delete(:multipart_copy)
33
33
  apply_source_client(source, options)
34
34
  ObjectMultipartCopier.new(@options).copy(options)
@@ -186,7 +186,7 @@ module Aws::S3
186
186
  options, params = separate_params_and_options(options)
187
187
  waiter = Waiters::ObjectExists.new(options)
188
188
  yield_waiter_and_warn(waiter, &block) if block_given?
189
- Aws::Plugins::UserAgent.feature('resource') do
189
+ Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
190
190
  waiter.wait(params.merge(bucket: @bucket_name,
191
191
  key: @key))
192
192
  end
@@ -207,7 +207,7 @@ module Aws::S3
207
207
  options, params = separate_params_and_options(options)
208
208
  waiter = Waiters::ObjectNotExists.new(options)
209
209
  yield_waiter_and_warn(waiter, &block) if block_given?
210
- Aws::Plugins::UserAgent.feature('resource') do
210
+ Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
211
211
  waiter.wait(params.merge(bucket: @bucket_name,
212
212
  key: @key))
213
213
  end
@@ -312,7 +312,7 @@ module Aws::S3
312
312
  :retry
313
313
  end
314
314
  end
315
- Aws::Plugins::UserAgent.feature('resource') do
315
+ Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
316
316
  Aws::Waiters::Waiter.new(options).wait({})
317
317
  end
318
318
  end
@@ -982,7 +982,7 @@ module Aws::S3
982
982
  bucket: @bucket_name,
983
983
  key: @key
984
984
  )
985
- resp = Aws::Plugins::UserAgent.feature('resource') do
985
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
986
986
  @client.copy_object(options)
987
987
  end
988
988
  resp.data
@@ -1048,7 +1048,7 @@ module Aws::S3
1048
1048
  bucket: @bucket_name,
1049
1049
  key: @key
1050
1050
  )
1051
- resp = Aws::Plugins::UserAgent.feature('resource') do
1051
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
1052
1052
  @client.delete_object(options)
1053
1053
  end
1054
1054
  resp.data
@@ -1304,7 +1304,7 @@ module Aws::S3
1304
1304
  bucket: @bucket_name,
1305
1305
  key: @key
1306
1306
  )
1307
- resp = Aws::Plugins::UserAgent.feature('resource') do
1307
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
1308
1308
  @client.get_object(options, &block)
1309
1309
  end
1310
1310
  resp.data
@@ -1789,7 +1789,7 @@ module Aws::S3
1789
1789
  bucket: @bucket_name,
1790
1790
  key: @key
1791
1791
  )
1792
- resp = Aws::Plugins::UserAgent.feature('resource') do
1792
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
1793
1793
  @client.create_multipart_upload(options)
1794
1794
  end
1795
1795
  MultipartUpload.new(
@@ -2260,7 +2260,7 @@ module Aws::S3
2260
2260
  bucket: @bucket_name,
2261
2261
  key: @key
2262
2262
  )
2263
- resp = Aws::Plugins::UserAgent.feature('resource') do
2263
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
2264
2264
  @client.put_object(options)
2265
2265
  end
2266
2266
  resp.data
@@ -2401,7 +2401,7 @@ module Aws::S3
2401
2401
  bucket: @bucket_name,
2402
2402
  key: @key
2403
2403
  )
2404
- resp = Aws::Plugins::UserAgent.feature('resource') do
2404
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
2405
2405
  @client.restore_object(options)
2406
2406
  end
2407
2407
  resp.data
@@ -2628,7 +2628,7 @@ module Aws::S3
2628
2628
  key: item.key
2629
2629
  }
2630
2630
  end
2631
- Aws::Plugins::UserAgent.feature('resource') do
2631
+ Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
2632
2632
  batch[0].client.delete_objects(params)
2633
2633
  end
2634
2634
  end
@@ -243,7 +243,7 @@ module Aws::S3
243
243
  :retry
244
244
  end
245
245
  end
246
- Aws::Plugins::UserAgent.feature('resource') do
246
+ Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
247
247
  Aws::Waiters::Waiter.new(options).wait({})
248
248
  end
249
249
  end
@@ -303,7 +303,7 @@ module Aws::S3
303
303
  key: @object_key,
304
304
  version_id: @id
305
305
  )
306
- resp = Aws::Plugins::UserAgent.feature('resource') do
306
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
307
307
  @client.delete_object(options)
308
308
  end
309
309
  resp.data
@@ -530,7 +530,7 @@ module Aws::S3
530
530
  key: @object_key,
531
531
  version_id: @id
532
532
  )
533
- resp = Aws::Plugins::UserAgent.feature('resource') do
533
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
534
534
  @client.get_object(options, &block)
535
535
  end
536
536
  resp.data
@@ -544,6 +544,12 @@ module Aws::S3
544
544
  # if_none_match: "IfNoneMatch",
545
545
  # if_unmodified_since: Time.now,
546
546
  # range: "Range",
547
+ # response_cache_control: "ResponseCacheControl",
548
+ # response_content_disposition: "ResponseContentDisposition",
549
+ # response_content_encoding: "ResponseContentEncoding",
550
+ # response_content_language: "ResponseContentLanguage",
551
+ # response_content_type: "ResponseContentType",
552
+ # response_expires: Time.now,
547
553
  # sse_customer_algorithm: "SSECustomerAlgorithm",
548
554
  # sse_customer_key: "SSECustomerKey",
549
555
  # sse_customer_key_md5: "SSECustomerKeyMD5",
@@ -630,6 +636,18 @@ module Aws::S3
630
636
  # satisfiable, only the `ContentLength` is affected in the response. If
631
637
  # the Range is not satisfiable, S3 returns a `416 - Requested Range Not
632
638
  # Satisfiable` error.
639
+ # @option options [String] :response_cache_control
640
+ # Sets the `Cache-Control` header of the response.
641
+ # @option options [String] :response_content_disposition
642
+ # Sets the `Content-Disposition` header of the response.
643
+ # @option options [String] :response_content_encoding
644
+ # Sets the `Content-Encoding` header of the response.
645
+ # @option options [String] :response_content_language
646
+ # Sets the `Content-Language` header of the response.
647
+ # @option options [String] :response_content_type
648
+ # Sets the `Content-Type` header of the response.
649
+ # @option options [Time,DateTime,Date,Integer,String] :response_expires
650
+ # Sets the `Expires` header of the response.
633
651
  # @option options [String] :sse_customer_algorithm
634
652
  # Specifies the algorithm to use when encrypting the object (for
635
653
  # example, AES256).
@@ -694,7 +712,7 @@ module Aws::S3
694
712
  key: @object_key,
695
713
  version_id: @id
696
714
  )
697
- resp = Aws::Plugins::UserAgent.feature('resource') do
715
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
698
716
  @client.head_object(options)
699
717
  end
700
718
  resp.data
@@ -868,7 +886,7 @@ module Aws::S3
868
886
  version_id: item.id
869
887
  }
870
888
  end
871
- Aws::Plugins::UserAgent.feature('resource') do
889
+ Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
872
890
  batch[0].client.delete_objects(params)
873
891
  end
874
892
  end
@@ -69,11 +69,17 @@ setting, caching, and fallback behavior.
69
69
  context[:sigv4_credentials] = credentials # Sign will use this
70
70
  end
71
71
 
72
- @handler.call(context)
72
+ with_metric(credentials) { @handler.call(context) }
73
73
  end
74
74
 
75
75
  private
76
76
 
77
+ def with_metric(credentials, &block)
78
+ return block.call unless credentials
79
+
80
+ Aws::Plugins::UserAgent.metric('S3_ACCESS_GRANTS', &block)
81
+ end
82
+
77
83
  def access_grants_operation?(context)
78
84
  params = context[:endpoint_params]
79
85
  params[:bucket] && PERMISSION_MAP[context.operation_name]
@@ -47,11 +47,17 @@ for different buckets.
47
47
  context[:sigv4_credentials] = credentials # Sign will use this
48
48
  end
49
49
  end
50
- @handler.call(context)
50
+ with_metric(credentials) { @handler.call(context) }
51
51
  end
52
52
 
53
53
  private
54
54
 
55
+ def with_metric(credentials, &block)
56
+ return block.call unless credentials
57
+
58
+ Aws::Plugins::UserAgent.metric('S3_EXPRESS_BUCKET', &block)
59
+ end
60
+
55
61
  def checksum_required?(context)
56
62
  context.operation.http_checksum_required ||
57
63
  (context.operation.http_checksum &&
@@ -15,22 +15,67 @@ module Aws
15
15
 
16
16
  def call(context)
17
17
  @handler.call(context).on(200) do |response|
18
- if error = check_for_error(context)
19
- context.http_response.status_code = 500
20
- response.data = nil
21
- response.error = error
18
+ return response if streaming_output?(context.operation.output)
19
+
20
+ error = check_for_error(context)
21
+ return response unless error
22
+
23
+ context.http_response.status_code = 500
24
+ response.data = nil
25
+ response.error = error
26
+ end
27
+ end
28
+
29
+ private
30
+
31
+ # Streaming outputs are not subject to 200 errors.
32
+ def streaming_output?(output)
33
+ if (payload = output[:payload_member])
34
+ # checking ref and shape
35
+ payload['streaming'] || payload.shape['streaming'] ||
36
+ payload.eventstream
37
+ else
38
+ false
39
+ end
40
+ end
41
+
42
+ # Checks if the output shape is a structure shape and has members that
43
+ # are in the body for the case of a payload and a normal structure. A
44
+ # non-structure shape will not have members in the body. In the case
45
+ # of a string or blob, the body contents would have been checked first
46
+ # before this method is called in incomplete_xml_body?.
47
+ def members_in_body?(output)
48
+ shape =
49
+ if output[:payload_member]
50
+ output[:payload_member].shape
51
+ else
52
+ output.shape
22
53
  end
54
+
55
+ if structure_shape?(shape)
56
+ shape.members.any? { |_, k| k.location.nil? }
57
+ else
58
+ false
23
59
  end
24
60
  end
25
61
 
62
+ def structure_shape?(shape)
63
+ shape.is_a?(Seahorse::Model::Shapes::StructureShape)
64
+ end
65
+
66
+ # Must have a member in the body and have the start of an XML Tag.
67
+ # Other incomplete xml bodies will result in an XML ParsingError.
68
+ def incomplete_xml_body?(xml, output)
69
+ members_in_body?(output) && !xml.match(/<\w/)
70
+ end
71
+
26
72
  def check_for_error(context)
27
73
  xml = context.http_response.body_contents
28
- if xml.match(/<Error>/)
74
+ if xml.match(/\?>\s*<Error>/)
29
75
  error_code = xml.match(/<Code>(.+?)<\/Code>/)[1]
30
76
  error_message = xml.match(/<Message>(.+?)<\/Message>/)[1]
31
77
  S3::Errors.error_class(error_code).new(context, error_message)
32
- elsif !xml.match(/<\w/) # Must have the start of an XML Tag
33
- # Other incomplete xml bodies will result in XML ParsingError
78
+ elsif incomplete_xml_body?(xml, context.operation.output)
34
79
  Seahorse::Client::NetworkingError.new(
35
80
  S3::Errors
36
81
  .error_class('InternalError')
@@ -40,15 +85,7 @@ module Aws
40
85
  end
41
86
  end
42
87
 
43
- handler(
44
- Handler,
45
- step: :sign,
46
- operations: [
47
- :complete_multipart_upload,
48
- :copy_object,
49
- :upload_part_copy,
50
- ]
51
- )
88
+ handler(Handler, step: :sign)
52
89
  end
53
90
  end
54
91
  end
@@ -166,7 +166,7 @@ module Aws::S3
166
166
  # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/about-object-ownership.html
167
167
  # @return [Bucket]
168
168
  def create_bucket(options = {})
169
- Aws::Plugins::UserAgent.feature('resource') do
169
+ Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
170
170
  @client.create_bucket(options)
171
171
  end
172
172
  Bucket.new(
@@ -194,7 +194,7 @@ module Aws::S3
194
194
  def buckets(options = {})
195
195
  batches = Enumerator.new do |y|
196
196
  batch = []
197
- resp = Aws::Plugins::UserAgent.feature('resource') do
197
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
198
198
  @client.list_buckets(options)
199
199
  end
200
200
  resp.data.buckets.each do |b|