aws-sdk-s3 1.229.0 → 1.243.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +111 -0
- data/VERSION +1 -1
- data/lib/aws-sdk-s3/bucket.rb +24 -0
- data/lib/aws-sdk-s3/bucket_notification.rb +3 -3
- data/lib/aws-sdk-s3/client.rb +144 -29
- data/lib/aws-sdk-s3/client_api.rb +26 -0
- data/lib/aws-sdk-s3/customizations/object.rb +40 -28
- data/lib/aws-sdk-s3/default_executor.rb +65 -19
- data/lib/aws-sdk-s3/directory_downloader.rb +9 -3
- data/lib/aws-sdk-s3/directory_uploader.rb +4 -0
- data/lib/aws-sdk-s3/express_credentials.rb +4 -1
- data/lib/aws-sdk-s3/express_credentials_provider.rb +23 -12
- data/lib/aws-sdk-s3/file_downloader.rb +21 -14
- data/lib/aws-sdk-s3/multipart_file_uploader.rb +22 -15
- data/lib/aws-sdk-s3/multipart_stream_uploader.rb +32 -17
- data/lib/aws-sdk-s3/multipart_upload_error.rb +1 -1
- data/lib/aws-sdk-s3/object.rb +105 -0
- data/lib/aws-sdk-s3/object_multipart_copier.rb +1 -0
- data/lib/aws-sdk-s3/object_summary.rb +72 -0
- data/lib/aws-sdk-s3/plugins/express_session_auth.rb +10 -2
- data/lib/aws-sdk-s3/presigned_post.rb +50 -1
- data/lib/aws-sdk-s3/presigner.rb +1 -1
- data/lib/aws-sdk-s3/transfer_manager.rb +57 -37
- data/lib/aws-sdk-s3/types.rb +211 -15
- data/lib/aws-sdk-s3.rb +1 -1
- data/sig/bucket.rbs +3 -0
- data/sig/bucket_notification.rbs +3 -3
- data/sig/client.rbs +37 -12
- data/sig/customizations/errors.rbs +17 -0
- data/sig/errors.rbs +20 -20
- data/sig/multipart_upload_error.rbs +9 -0
- data/sig/object.rbs +18 -0
- data/sig/object_summary.rbs +9 -0
- data/sig/resource.rbs +1 -0
- data/sig/transfer_manager.rbs +31 -0
- data/sig/types.rbs +34 -10
- metadata +6 -3
data/lib/aws-sdk-s3/object.rb
CHANGED
|
@@ -600,6 +600,39 @@ module Aws::S3
|
|
|
600
600
|
data[:object_lock_legal_hold_status]
|
|
601
601
|
end
|
|
602
602
|
|
|
603
|
+
# The event hold status for this object. This header is only returned if
|
|
604
|
+
# the requester has the `s3:GetObjectRetention` permission.
|
|
605
|
+
#
|
|
606
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
|
607
|
+
#
|
|
608
|
+
# </note>
|
|
609
|
+
# @return [String]
|
|
610
|
+
def object_lock_event_hold
|
|
611
|
+
data[:object_lock_event_hold]
|
|
612
|
+
end
|
|
613
|
+
|
|
614
|
+
# The event hold duration in days for this object. Only returned when
|
|
615
|
+
# the event hold is enabled.
|
|
616
|
+
#
|
|
617
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
|
618
|
+
#
|
|
619
|
+
# </note>
|
|
620
|
+
# @return [Integer]
|
|
621
|
+
def object_lock_event_hold_duration_days
|
|
622
|
+
data[:object_lock_event_hold_duration_days]
|
|
623
|
+
end
|
|
624
|
+
|
|
625
|
+
# The event hold duration in years for this object. Only returned when
|
|
626
|
+
# the event hold is enabled.
|
|
627
|
+
#
|
|
628
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
|
629
|
+
#
|
|
630
|
+
# </note>
|
|
631
|
+
# @return [Integer]
|
|
632
|
+
def object_lock_event_hold_duration_years
|
|
633
|
+
data[:object_lock_event_hold_duration_years]
|
|
634
|
+
end
|
|
635
|
+
|
|
603
636
|
# @!endgroup
|
|
604
637
|
|
|
605
638
|
# @return [Client]
|
|
@@ -842,6 +875,9 @@ module Aws::S3
|
|
|
842
875
|
# object_lock_mode: "GOVERNANCE", # accepts GOVERNANCE, COMPLIANCE
|
|
843
876
|
# object_lock_retain_until_date: Time.now,
|
|
844
877
|
# object_lock_legal_hold_status: "ON", # accepts ON, OFF
|
|
878
|
+
# object_lock_event_hold: "ON", # accepts ON, OFF
|
|
879
|
+
# object_lock_event_hold_duration_days: 1,
|
|
880
|
+
# object_lock_event_hold_duration_years: 1,
|
|
845
881
|
# expected_bucket_owner: "AccountId",
|
|
846
882
|
# expected_source_bucket_owner: "AccountId",
|
|
847
883
|
# })
|
|
@@ -1583,6 +1619,27 @@ module Aws::S3
|
|
|
1583
1619
|
# <note markdown="1"> This functionality is not supported for directory buckets.
|
|
1584
1620
|
#
|
|
1585
1621
|
# </note>
|
|
1622
|
+
# @option options [String] :object_lock_event_hold
|
|
1623
|
+
# The event hold status to apply to the object copy. Set to `ON` to
|
|
1624
|
+
# enable or `OFF` to disable.
|
|
1625
|
+
#
|
|
1626
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
|
1627
|
+
#
|
|
1628
|
+
# </note>
|
|
1629
|
+
# @option options [Integer] :object_lock_event_hold_duration_days
|
|
1630
|
+
# The event hold duration in days to apply to the object copy. You
|
|
1631
|
+
# cannot specify a duration in both days and years.
|
|
1632
|
+
#
|
|
1633
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
|
1634
|
+
#
|
|
1635
|
+
# </note>
|
|
1636
|
+
# @option options [Integer] :object_lock_event_hold_duration_years
|
|
1637
|
+
# The event hold duration in years to apply to the object copy. You
|
|
1638
|
+
# cannot specify a duration in both days and years.
|
|
1639
|
+
#
|
|
1640
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
|
1641
|
+
#
|
|
1642
|
+
# </note>
|
|
1586
1643
|
# @option options [String] :expected_bucket_owner
|
|
1587
1644
|
# The account ID of the expected destination bucket owner. If the
|
|
1588
1645
|
# account ID that you provide does not match the actual owner of the
|
|
@@ -1999,6 +2056,9 @@ module Aws::S3
|
|
|
1999
2056
|
# object_lock_mode: "GOVERNANCE", # accepts GOVERNANCE, COMPLIANCE
|
|
2000
2057
|
# object_lock_retain_until_date: Time.now,
|
|
2001
2058
|
# object_lock_legal_hold_status: "ON", # accepts ON, OFF
|
|
2059
|
+
# object_lock_event_hold: "ON", # accepts ON, OFF
|
|
2060
|
+
# object_lock_event_hold_duration_days: 1,
|
|
2061
|
+
# object_lock_event_hold_duration_years: 1,
|
|
2002
2062
|
# expected_bucket_owner: "AccountId",
|
|
2003
2063
|
# checksum_algorithm: "CRC32", # accepts CRC32, CRC32C, SHA1, SHA256, CRC64NVME, SHA512, MD5, XXHASH64, XXHASH3, XXHASH128
|
|
2004
2064
|
# checksum_type: "COMPOSITE", # accepts COMPOSITE, FULL_OBJECT
|
|
@@ -2520,6 +2580,27 @@ module Aws::S3
|
|
|
2520
2580
|
# <note markdown="1"> This functionality is not supported for directory buckets.
|
|
2521
2581
|
#
|
|
2522
2582
|
# </note>
|
|
2583
|
+
# @option options [String] :object_lock_event_hold
|
|
2584
|
+
# Specifies the event hold status to apply to the uploaded object. Set
|
|
2585
|
+
# to `ON` to enable or `OFF` to disable.
|
|
2586
|
+
#
|
|
2587
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
|
2588
|
+
#
|
|
2589
|
+
# </note>
|
|
2590
|
+
# @option options [Integer] :object_lock_event_hold_duration_days
|
|
2591
|
+
# Specifies the event hold duration in days to apply to the uploaded
|
|
2592
|
+
# object. You cannot specify a duration in both days and years.
|
|
2593
|
+
#
|
|
2594
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
|
2595
|
+
#
|
|
2596
|
+
# </note>
|
|
2597
|
+
# @option options [Integer] :object_lock_event_hold_duration_years
|
|
2598
|
+
# Specifies the event hold duration in years to apply to the uploaded
|
|
2599
|
+
# object. You cannot specify a duration in both days and years.
|
|
2600
|
+
#
|
|
2601
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
|
2602
|
+
#
|
|
2603
|
+
# </note>
|
|
2523
2604
|
# @option options [String] :expected_bucket_owner
|
|
2524
2605
|
# The account ID of the expected bucket owner. If the account ID that
|
|
2525
2606
|
# you provide does not match the actual owner of the bucket, the request
|
|
@@ -2605,6 +2686,9 @@ module Aws::S3
|
|
|
2605
2686
|
# object_lock_mode: "GOVERNANCE", # accepts GOVERNANCE, COMPLIANCE
|
|
2606
2687
|
# object_lock_retain_until_date: Time.now,
|
|
2607
2688
|
# object_lock_legal_hold_status: "ON", # accepts ON, OFF
|
|
2689
|
+
# object_lock_event_hold: "ON", # accepts ON, OFF
|
|
2690
|
+
# object_lock_event_hold_duration_days: 1,
|
|
2691
|
+
# object_lock_event_hold_duration_years: 1,
|
|
2608
2692
|
# expected_bucket_owner: "AccountId",
|
|
2609
2693
|
# })
|
|
2610
2694
|
# @param [Hash] options ({})
|
|
@@ -3230,6 +3314,27 @@ module Aws::S3
|
|
|
3230
3314
|
#
|
|
3231
3315
|
#
|
|
3232
3316
|
# [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html
|
|
3317
|
+
# @option options [String] :object_lock_event_hold
|
|
3318
|
+
# Specifies the event hold status to apply to this object. Set to `ON`
|
|
3319
|
+
# to enable or `OFF` to disable.
|
|
3320
|
+
#
|
|
3321
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
|
3322
|
+
#
|
|
3323
|
+
# </note>
|
|
3324
|
+
# @option options [Integer] :object_lock_event_hold_duration_days
|
|
3325
|
+
# Specifies the event hold duration in days to apply to this object. You
|
|
3326
|
+
# cannot specify a duration in both days and years.
|
|
3327
|
+
#
|
|
3328
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
|
3329
|
+
#
|
|
3330
|
+
# </note>
|
|
3331
|
+
# @option options [Integer] :object_lock_event_hold_duration_years
|
|
3332
|
+
# Specifies the event hold duration in years to apply to this object.
|
|
3333
|
+
# You cannot specify a duration in both days and years.
|
|
3334
|
+
#
|
|
3335
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
|
3336
|
+
#
|
|
3337
|
+
# </note>
|
|
3233
3338
|
# @option options [String] :expected_bucket_owner
|
|
3234
3339
|
# The account ID of the expected bucket owner. If the account ID that
|
|
3235
3340
|
# you provide does not match the actual owner of the bucket, the request
|
|
@@ -379,6 +379,9 @@ module Aws::S3
|
|
|
379
379
|
# object_lock_mode: "GOVERNANCE", # accepts GOVERNANCE, COMPLIANCE
|
|
380
380
|
# object_lock_retain_until_date: Time.now,
|
|
381
381
|
# object_lock_legal_hold_status: "ON", # accepts ON, OFF
|
|
382
|
+
# object_lock_event_hold: "ON", # accepts ON, OFF
|
|
383
|
+
# object_lock_event_hold_duration_days: 1,
|
|
384
|
+
# object_lock_event_hold_duration_years: 1,
|
|
382
385
|
# expected_bucket_owner: "AccountId",
|
|
383
386
|
# expected_source_bucket_owner: "AccountId",
|
|
384
387
|
# })
|
|
@@ -1120,6 +1123,27 @@ module Aws::S3
|
|
|
1120
1123
|
# <note markdown="1"> This functionality is not supported for directory buckets.
|
|
1121
1124
|
#
|
|
1122
1125
|
# </note>
|
|
1126
|
+
# @option options [String] :object_lock_event_hold
|
|
1127
|
+
# The event hold status to apply to the object copy. Set to `ON` to
|
|
1128
|
+
# enable or `OFF` to disable.
|
|
1129
|
+
#
|
|
1130
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
|
1131
|
+
#
|
|
1132
|
+
# </note>
|
|
1133
|
+
# @option options [Integer] :object_lock_event_hold_duration_days
|
|
1134
|
+
# The event hold duration in days to apply to the object copy. You
|
|
1135
|
+
# cannot specify a duration in both days and years.
|
|
1136
|
+
#
|
|
1137
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
|
1138
|
+
#
|
|
1139
|
+
# </note>
|
|
1140
|
+
# @option options [Integer] :object_lock_event_hold_duration_years
|
|
1141
|
+
# The event hold duration in years to apply to the object copy. You
|
|
1142
|
+
# cannot specify a duration in both days and years.
|
|
1143
|
+
#
|
|
1144
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
|
1145
|
+
#
|
|
1146
|
+
# </note>
|
|
1123
1147
|
# @option options [String] :expected_bucket_owner
|
|
1124
1148
|
# The account ID of the expected destination bucket owner. If the
|
|
1125
1149
|
# account ID that you provide does not match the actual owner of the
|
|
@@ -1536,6 +1560,9 @@ module Aws::S3
|
|
|
1536
1560
|
# object_lock_mode: "GOVERNANCE", # accepts GOVERNANCE, COMPLIANCE
|
|
1537
1561
|
# object_lock_retain_until_date: Time.now,
|
|
1538
1562
|
# object_lock_legal_hold_status: "ON", # accepts ON, OFF
|
|
1563
|
+
# object_lock_event_hold: "ON", # accepts ON, OFF
|
|
1564
|
+
# object_lock_event_hold_duration_days: 1,
|
|
1565
|
+
# object_lock_event_hold_duration_years: 1,
|
|
1539
1566
|
# expected_bucket_owner: "AccountId",
|
|
1540
1567
|
# checksum_algorithm: "CRC32", # accepts CRC32, CRC32C, SHA1, SHA256, CRC64NVME, SHA512, MD5, XXHASH64, XXHASH3, XXHASH128
|
|
1541
1568
|
# checksum_type: "COMPOSITE", # accepts COMPOSITE, FULL_OBJECT
|
|
@@ -2057,6 +2084,27 @@ module Aws::S3
|
|
|
2057
2084
|
# <note markdown="1"> This functionality is not supported for directory buckets.
|
|
2058
2085
|
#
|
|
2059
2086
|
# </note>
|
|
2087
|
+
# @option options [String] :object_lock_event_hold
|
|
2088
|
+
# Specifies the event hold status to apply to the uploaded object. Set
|
|
2089
|
+
# to `ON` to enable or `OFF` to disable.
|
|
2090
|
+
#
|
|
2091
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
|
2092
|
+
#
|
|
2093
|
+
# </note>
|
|
2094
|
+
# @option options [Integer] :object_lock_event_hold_duration_days
|
|
2095
|
+
# Specifies the event hold duration in days to apply to the uploaded
|
|
2096
|
+
# object. You cannot specify a duration in both days and years.
|
|
2097
|
+
#
|
|
2098
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
|
2099
|
+
#
|
|
2100
|
+
# </note>
|
|
2101
|
+
# @option options [Integer] :object_lock_event_hold_duration_years
|
|
2102
|
+
# Specifies the event hold duration in years to apply to the uploaded
|
|
2103
|
+
# object. You cannot specify a duration in both days and years.
|
|
2104
|
+
#
|
|
2105
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
|
2106
|
+
#
|
|
2107
|
+
# </note>
|
|
2060
2108
|
# @option options [String] :expected_bucket_owner
|
|
2061
2109
|
# The account ID of the expected bucket owner. If the account ID that
|
|
2062
2110
|
# you provide does not match the actual owner of the bucket, the request
|
|
@@ -2142,6 +2190,9 @@ module Aws::S3
|
|
|
2142
2190
|
# object_lock_mode: "GOVERNANCE", # accepts GOVERNANCE, COMPLIANCE
|
|
2143
2191
|
# object_lock_retain_until_date: Time.now,
|
|
2144
2192
|
# object_lock_legal_hold_status: "ON", # accepts ON, OFF
|
|
2193
|
+
# object_lock_event_hold: "ON", # accepts ON, OFF
|
|
2194
|
+
# object_lock_event_hold_duration_days: 1,
|
|
2195
|
+
# object_lock_event_hold_duration_years: 1,
|
|
2145
2196
|
# expected_bucket_owner: "AccountId",
|
|
2146
2197
|
# })
|
|
2147
2198
|
# @param [Hash] options ({})
|
|
@@ -2767,6 +2818,27 @@ module Aws::S3
|
|
|
2767
2818
|
#
|
|
2768
2819
|
#
|
|
2769
2820
|
# [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html
|
|
2821
|
+
# @option options [String] :object_lock_event_hold
|
|
2822
|
+
# Specifies the event hold status to apply to this object. Set to `ON`
|
|
2823
|
+
# to enable or `OFF` to disable.
|
|
2824
|
+
#
|
|
2825
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
|
2826
|
+
#
|
|
2827
|
+
# </note>
|
|
2828
|
+
# @option options [Integer] :object_lock_event_hold_duration_days
|
|
2829
|
+
# Specifies the event hold duration in days to apply to this object. You
|
|
2830
|
+
# cannot specify a duration in both days and years.
|
|
2831
|
+
#
|
|
2832
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
|
2833
|
+
#
|
|
2834
|
+
# </note>
|
|
2835
|
+
# @option options [Integer] :object_lock_event_hold_duration_years
|
|
2836
|
+
# Specifies the event hold duration in years to apply to this object.
|
|
2837
|
+
# You cannot specify a duration in both days and years.
|
|
2838
|
+
#
|
|
2839
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
|
2840
|
+
#
|
|
2841
|
+
# </note>
|
|
2770
2842
|
# @option options [String] :expected_bucket_owner
|
|
2771
2843
|
# The account ID of the expected bucket owner. If the account ID that
|
|
2772
2844
|
# you provide does not match the actual owner of the bucket, the request
|
|
@@ -35,8 +35,7 @@ for different buckets.
|
|
|
35
35
|
if context[:auth_scheme]['name'] == 'sigv4-s3express' &&
|
|
36
36
|
!context.config.disable_s3_express_session_auth
|
|
37
37
|
bucket = context.params[:bucket]
|
|
38
|
-
|
|
39
|
-
credentials = credentials_provider.express_credentials_for(bucket)
|
|
38
|
+
credentials = express_credentials_for(context, bucket)
|
|
40
39
|
context[:sigv4_credentials] = credentials # Sign will use this
|
|
41
40
|
end
|
|
42
41
|
|
|
@@ -45,6 +44,15 @@ for different buckets.
|
|
|
45
44
|
|
|
46
45
|
private
|
|
47
46
|
|
|
47
|
+
def express_credentials_for(context, bucket)
|
|
48
|
+
provider = context.config.express_credentials_provider
|
|
49
|
+
if provider.is_a?(ExpressCredentialsProvider)
|
|
50
|
+
provider.express_credentials_for(bucket, context.client)
|
|
51
|
+
else
|
|
52
|
+
provider.express_credentials_for(bucket)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
48
56
|
def with_metric(credentials, &block)
|
|
49
57
|
return block.call unless credentials
|
|
50
58
|
|
|
@@ -155,7 +155,7 @@ module Aws
|
|
|
155
155
|
#
|
|
156
156
|
# The string `${filename}` is automatically replaced with the name of the
|
|
157
157
|
# file provided by the user and is recognized by all form fields. It is
|
|
158
|
-
# not supported with `starts_with` conditions.
|
|
158
|
+
# not supported with `starts_with` conditions or {#tagging}.
|
|
159
159
|
#
|
|
160
160
|
# If the browser or client provides a full or partial path to the file,
|
|
161
161
|
# only the text following the last slash (/) or backslash (\) will be used
|
|
@@ -175,6 +175,28 @@ module Aws
|
|
|
175
175
|
# })
|
|
176
176
|
# ```
|
|
177
177
|
#
|
|
178
|
+
# ### Object Tags
|
|
179
|
+
#
|
|
180
|
+
# Use `:tagging` or {#tagging} to add tags to the uploaded object. Pass
|
|
181
|
+
# the same structure as the `:tagging` parameter of
|
|
182
|
+
# {Client#put_object_tagging}. The SDK serializes it to XML and adds
|
|
183
|
+
# an exact-match condition to the POST policy.
|
|
184
|
+
#
|
|
185
|
+
# ```ruby
|
|
186
|
+
# post = bucket.presigned_post(
|
|
187
|
+
# key: 'object-key',
|
|
188
|
+
# tagging: { tag_set: [{ key: 'project', value: 'example' }] }
|
|
189
|
+
# )
|
|
190
|
+
#
|
|
191
|
+
# # Or set tags on an existing presigned post:
|
|
192
|
+
# post = bucket.presigned_post(key: 'object-key')
|
|
193
|
+
# post.tagging(tag_set: [{ key: 'project', value: 'example' }])
|
|
194
|
+
# ```
|
|
195
|
+
#
|
|
196
|
+
# Include `post.fields['tagging']` unchanged in the submitted form.
|
|
197
|
+
# When rendering it as an HTML input value, HTML-escape it just like
|
|
198
|
+
# the other form fields.
|
|
199
|
+
#
|
|
178
200
|
class PresignedPost
|
|
179
201
|
@@allowed_fields = []
|
|
180
202
|
|
|
@@ -240,6 +262,8 @@ module Aws
|
|
|
240
262
|
# See {PresignedPost#server_side_encryption_customer_key}.
|
|
241
263
|
# @option options [String] :server_side_encryption_customer_key_starts_with
|
|
242
264
|
# See {PresignedPost#server_side_encryption_customer_key_starts_with}.
|
|
265
|
+
# @option options [Hash, Types::Tagging] :tagging
|
|
266
|
+
# See {PresignedPost#tagging}.
|
|
243
267
|
def initialize(credentials, bucket_region, bucket_name, options = {})
|
|
244
268
|
@credentials = credentials.credentials
|
|
245
269
|
@bucket_region = bucket_region
|
|
@@ -605,6 +629,31 @@ module Aws
|
|
|
605
629
|
|
|
606
630
|
# @!endgroup
|
|
607
631
|
|
|
632
|
+
# @!group Object Tagging
|
|
633
|
+
|
|
634
|
+
# @!method tagging(value)
|
|
635
|
+
# Tags to store with the uploaded object. Accepts the same structure
|
|
636
|
+
# as the `:tagging` parameter of {Client#put_object_tagging}, containing
|
|
637
|
+
# a required `:tag_set` array of tags with `:key` and `:value` strings.
|
|
638
|
+
# Serializes the tags to XML and requires an exact match in the POST
|
|
639
|
+
# policy. The `${filename}` variable is not supported in tags.
|
|
640
|
+
#
|
|
641
|
+
# @example
|
|
642
|
+
# post.tagging(tag_set: [{ key: 'project', value: 'example' }])
|
|
643
|
+
#
|
|
644
|
+
# @param [Hash, Types::Tagging] value
|
|
645
|
+
# @raise [ArgumentError] If the tagging parameters are invalid.
|
|
646
|
+
# @see Client#put_object_tagging
|
|
647
|
+
# @return [self]
|
|
648
|
+
define_field(:tagging) do |value|
|
|
649
|
+
rules = Client.api.operation(:put_object_tagging).input.shape.member(:tagging)
|
|
650
|
+
value = Aws::ParamConverter.convert(rules, value)
|
|
651
|
+
Aws::ParamValidator.validate!(rules, value)
|
|
652
|
+
with('tagging', Aws::Xml::Builder.new(rules).serialize(value))
|
|
653
|
+
end
|
|
654
|
+
|
|
655
|
+
# @!endgroup
|
|
656
|
+
|
|
608
657
|
private
|
|
609
658
|
|
|
610
659
|
def with(field_name, value)
|
data/lib/aws-sdk-s3/presigner.rb
CHANGED
|
@@ -160,11 +160,14 @@ module Aws
|
|
|
160
160
|
# * `:errors` - Array of errors for failed downloads (only present when failures occur)
|
|
161
161
|
def download_directory(destination, bucket:, **options)
|
|
162
162
|
Aws::Plugins::UserAgent.metric('S3_TRANSFER', 'S3_TRANSFER_DOWNLOAD_DIRECTORY') do
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
163
|
+
thread_count = options.delete(:thread_count)
|
|
164
|
+
executor = @executor || DefaultExecutor.new(max_threads: thread_count)
|
|
165
|
+
begin
|
|
166
|
+
downloader = DirectoryDownloader.new(client: @client, executor: executor, logger: @logger)
|
|
167
|
+
downloader.download(destination, bucket: bucket, **options)
|
|
168
|
+
ensure
|
|
169
|
+
executor.shutdown unless @executor
|
|
170
|
+
end
|
|
168
171
|
end
|
|
169
172
|
end
|
|
170
173
|
|
|
@@ -245,11 +248,15 @@ module Aws
|
|
|
245
248
|
# @see Client#head_object
|
|
246
249
|
def download_file(destination, bucket:, key:, **options)
|
|
247
250
|
download_opts = options.merge(bucket: bucket, key: key)
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
251
|
+
thread_count = download_opts.delete(:thread_count)
|
|
252
|
+
executor = @executor || DefaultExecutor.new(max_threads: thread_count)
|
|
253
|
+
begin
|
|
254
|
+
downloader = FileDownloader.new(client: @client, executor: executor)
|
|
255
|
+
downloader.download(destination, download_opts)
|
|
256
|
+
true
|
|
257
|
+
ensure
|
|
258
|
+
executor.shutdown unless @executor
|
|
259
|
+
end
|
|
253
260
|
end
|
|
254
261
|
|
|
255
262
|
# Uploads all files under the given directory to the provided S3 bucket.
|
|
@@ -360,11 +367,14 @@ module Aws
|
|
|
360
367
|
# * `:errors` - Array of error objects for failed uploads (only present when failures occur)
|
|
361
368
|
def upload_directory(source, bucket:, **options)
|
|
362
369
|
Aws::Plugins::UserAgent.metric('S3_TRANSFER', 'S3_TRANSFER_UPLOAD_DIRECTORY') do
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
370
|
+
thread_count = options.delete(:thread_count)
|
|
371
|
+
executor = @executor || DefaultExecutor.new(max_threads: thread_count)
|
|
372
|
+
begin
|
|
373
|
+
uploader = DirectoryUploader.new(client: @client, executor: executor, logger: @logger)
|
|
374
|
+
uploader.upload(source, bucket, **options.merge(http_chunk_size: resolve_http_chunk_size(options)))
|
|
375
|
+
ensure
|
|
376
|
+
executor.shutdown unless @executor
|
|
377
|
+
end
|
|
368
378
|
end
|
|
369
379
|
end
|
|
370
380
|
|
|
@@ -443,18 +453,21 @@ module Aws
|
|
|
443
453
|
def upload_file(source, bucket:, key:, **options)
|
|
444
454
|
upload_opts = options.merge(bucket: bucket, key: key)
|
|
445
455
|
http_chunk_size = resolve_http_chunk_size(upload_opts)
|
|
446
|
-
|
|
447
|
-
executor = @executor || DefaultExecutor.new(max_threads:
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
456
|
+
thread_count = upload_opts.delete(:thread_count)
|
|
457
|
+
executor = @executor || DefaultExecutor.new(max_threads: thread_count)
|
|
458
|
+
begin
|
|
459
|
+
uploader = FileUploader.new(
|
|
460
|
+
multipart_threshold: upload_opts.delete(:multipart_threshold),
|
|
461
|
+
http_chunk_size: http_chunk_size,
|
|
462
|
+
client: @client,
|
|
463
|
+
executor: executor
|
|
464
|
+
)
|
|
465
|
+
response = uploader.upload(source, upload_opts)
|
|
466
|
+
yield response if block_given?
|
|
467
|
+
true
|
|
468
|
+
ensure
|
|
469
|
+
executor.shutdown unless @executor
|
|
470
|
+
end
|
|
458
471
|
end
|
|
459
472
|
|
|
460
473
|
# Uploads a stream in a streaming fashion to S3.
|
|
@@ -491,6 +504,9 @@ module Aws
|
|
|
491
504
|
# @option options [Integer] :thread_count (10)
|
|
492
505
|
# The number of parallel multipart uploads. Only used when no custom executor is provided (creates
|
|
493
506
|
# {DefaultExecutor} with the given thread count). An additional thread is used internally for task coordination.
|
|
507
|
+
# This also bounds how many parts are buffered ahead of the upload, limiting memory usage to roughly
|
|
508
|
+
# `2 * :thread_count * :part_size`. When a custom `:executor` is provided, it is responsible for applying
|
|
509
|
+
# its own backpressure.
|
|
494
510
|
#
|
|
495
511
|
# @option options [Boolean] :tempfile (false)
|
|
496
512
|
# Normally read data is stored in memory when building the parts in order to complete the underlying
|
|
@@ -511,16 +527,20 @@ module Aws
|
|
|
511
527
|
# @see Client#upload_part
|
|
512
528
|
def upload_stream(bucket:, key:, **options, &block)
|
|
513
529
|
upload_opts = options.merge(bucket: bucket, key: key)
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
530
|
+
thread_count = upload_opts.delete(:thread_count) || DefaultExecutor::DEFAULT_MAX_THREADS
|
|
531
|
+
executor = @executor || DefaultExecutor.new(max_threads: thread_count, max_queue: thread_count)
|
|
532
|
+
begin
|
|
533
|
+
uploader = MultipartStreamUploader.new(
|
|
534
|
+
client: @client,
|
|
535
|
+
executor: executor,
|
|
536
|
+
tempfile: upload_opts.delete(:tempfile),
|
|
537
|
+
part_size: upload_opts.delete(:part_size)
|
|
538
|
+
)
|
|
539
|
+
uploader.upload(upload_opts, &block)
|
|
540
|
+
true
|
|
541
|
+
ensure
|
|
542
|
+
executor.shutdown unless @executor
|
|
543
|
+
end
|
|
524
544
|
end
|
|
525
545
|
|
|
526
546
|
private
|