aws-sdk-s3 1.132.1 → 1.134.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/VERSION +1 -1
- data/lib/aws-sdk-s3/client.rb +117 -117
- data/lib/aws-sdk-s3/customizations/object.rb +42 -0
- data/lib/aws-sdk-s3/file_downloader.rb +113 -23
- data/lib/aws-sdk-s3.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4dabfe3971a40ef24074bc1a9597c0e12306eb0e28f2af29e7040e70db38eed3
|
4
|
+
data.tar.gz: 9faa89158a73a21aa8918581b110791b1c897be0f6598bee61e1848b7a3d1d42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0486d1ec2aa3211bd9d6c31ae42c3421be4fdd10d78136f0e76bda94efd7d8f93f52a93670f466629ea7f236ac2267895a78de5ac2a05cb4932de0c562cddfaf'
|
7
|
+
data.tar.gz: 0a5d34bfda22ee9f2ba916f104303c8ccba03c2b019a020f74b77d2d207814ab95b3a2d5c216f34107bb82f1b705d87d67cbfeb83cb9d0c2a3e69f4b9109d849
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,18 @@
|
|
1
1
|
Unreleased Changes
|
2
2
|
------------------
|
3
3
|
|
4
|
+
1.134.0 (2023-08-24)
|
5
|
+
------------------
|
6
|
+
|
7
|
+
* Feature - Updates to endpoint ruleset tests to address Smithy validation issues.
|
8
|
+
|
9
|
+
1.133.0 (2023-08-22)
|
10
|
+
------------------
|
11
|
+
|
12
|
+
* Feature - Code Generated Changes, see `./build_tools` or `aws-sdk-core`'s CHANGELOG.md for details.
|
13
|
+
|
14
|
+
* Feature - Add support for `progress_callback` in `Object#download_file` and improve multi-threaded performance #(2901).
|
15
|
+
|
4
16
|
1.132.1 (2023-08-09)
|
5
17
|
------------------
|
6
18
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.134.0
|
data/lib/aws-sdk-s3/client.rb
CHANGED
@@ -1697,33 +1697,33 @@ module Aws::S3
|
|
1697
1697
|
# * {Types::CreateBucketOutput#location #location} => String
|
1698
1698
|
#
|
1699
1699
|
#
|
1700
|
-
# @example Example: To create a bucket
|
1700
|
+
# @example Example: To create a bucket
|
1701
1701
|
#
|
1702
|
-
# # The following example creates a bucket.
|
1702
|
+
# # The following example creates a bucket.
|
1703
1703
|
#
|
1704
1704
|
# resp = client.create_bucket({
|
1705
1705
|
# bucket: "examplebucket",
|
1706
|
-
# create_bucket_configuration: {
|
1707
|
-
# location_constraint: "eu-west-1",
|
1708
|
-
# },
|
1709
1706
|
# })
|
1710
1707
|
#
|
1711
1708
|
# resp.to_h outputs the following:
|
1712
1709
|
# {
|
1713
|
-
# location: "
|
1710
|
+
# location: "/examplebucket",
|
1714
1711
|
# }
|
1715
1712
|
#
|
1716
|
-
# @example Example: To create a bucket
|
1713
|
+
# @example Example: To create a bucket in a specific region
|
1717
1714
|
#
|
1718
|
-
# # The following example creates a bucket.
|
1715
|
+
# # The following example creates a bucket. The request specifies an AWS region where to create the bucket.
|
1719
1716
|
#
|
1720
1717
|
# resp = client.create_bucket({
|
1721
1718
|
# bucket: "examplebucket",
|
1719
|
+
# create_bucket_configuration: {
|
1720
|
+
# location_constraint: "eu-west-1",
|
1721
|
+
# },
|
1722
1722
|
# })
|
1723
1723
|
#
|
1724
1724
|
# resp.to_h outputs the following:
|
1725
1725
|
# {
|
1726
|
-
# location: "/
|
1726
|
+
# location: "http://examplebucket.<Region>.s3.amazonaws.com/",
|
1727
1727
|
# }
|
1728
1728
|
#
|
1729
1729
|
# @example Request syntax with placeholder values
|
@@ -3175,15 +3175,6 @@ module Aws::S3
|
|
3175
3175
|
# * {Types::DeleteObjectOutput#request_charged #request_charged} => String
|
3176
3176
|
#
|
3177
3177
|
#
|
3178
|
-
# @example Example: To delete an object (from a non-versioned bucket)
|
3179
|
-
#
|
3180
|
-
# # The following example deletes an object from a non-versioned bucket.
|
3181
|
-
#
|
3182
|
-
# resp = client.delete_object({
|
3183
|
-
# bucket: "ExampleBucket",
|
3184
|
-
# key: "HappyFace.jpg",
|
3185
|
-
# })
|
3186
|
-
#
|
3187
3178
|
# @example Example: To delete an object
|
3188
3179
|
#
|
3189
3180
|
# # The following example deletes an object from an S3 bucket.
|
@@ -3197,6 +3188,15 @@ module Aws::S3
|
|
3197
3188
|
# {
|
3198
3189
|
# }
|
3199
3190
|
#
|
3191
|
+
# @example Example: To delete an object (from a non-versioned bucket)
|
3192
|
+
#
|
3193
|
+
# # The following example deletes an object from a non-versioned bucket.
|
3194
|
+
#
|
3195
|
+
# resp = client.delete_object({
|
3196
|
+
# bucket: "ExampleBucket",
|
3197
|
+
# key: "HappyFace.jpg",
|
3198
|
+
# })
|
3199
|
+
#
|
3200
3200
|
# @example Request syntax with placeholder values
|
3201
3201
|
#
|
3202
3202
|
# resp = client.delete_object({
|
@@ -3288,35 +3288,35 @@ module Aws::S3
|
|
3288
3288
|
# * {Types::DeleteObjectTaggingOutput#version_id #version_id} => String
|
3289
3289
|
#
|
3290
3290
|
#
|
3291
|
-
# @example Example: To remove tag set from an object
|
3291
|
+
# @example Example: To remove tag set from an object version
|
3292
3292
|
#
|
3293
|
-
# # The following example removes tag set associated with the specified object.
|
3294
|
-
# #
|
3293
|
+
# # The following example removes tag set associated with the specified object version. The request specifies both the
|
3294
|
+
# # object key and object version.
|
3295
3295
|
#
|
3296
3296
|
# resp = client.delete_object_tagging({
|
3297
3297
|
# bucket: "examplebucket",
|
3298
3298
|
# key: "HappyFace.jpg",
|
3299
|
+
# version_id: "ydlaNkwWm0SfKJR.T1b1fIdPRbldTYRI",
|
3299
3300
|
# })
|
3300
3301
|
#
|
3301
3302
|
# resp.to_h outputs the following:
|
3302
3303
|
# {
|
3303
|
-
# version_id: "
|
3304
|
+
# version_id: "ydlaNkwWm0SfKJR.T1b1fIdPRbldTYRI",
|
3304
3305
|
# }
|
3305
3306
|
#
|
3306
|
-
# @example Example: To remove tag set from an object
|
3307
|
+
# @example Example: To remove tag set from an object
|
3307
3308
|
#
|
3308
|
-
# # The following example removes tag set associated with the specified object
|
3309
|
-
# #
|
3309
|
+
# # The following example removes tag set associated with the specified object. If the bucket is versioning enabled, the
|
3310
|
+
# # operation removes tag set from the latest object version.
|
3310
3311
|
#
|
3311
3312
|
# resp = client.delete_object_tagging({
|
3312
3313
|
# bucket: "examplebucket",
|
3313
3314
|
# key: "HappyFace.jpg",
|
3314
|
-
# version_id: "ydlaNkwWm0SfKJR.T1b1fIdPRbldTYRI",
|
3315
3315
|
# })
|
3316
3316
|
#
|
3317
3317
|
# resp.to_h outputs the following:
|
3318
3318
|
# {
|
3319
|
-
# version_id: "
|
3319
|
+
# version_id: "null",
|
3320
3320
|
# }
|
3321
3321
|
#
|
3322
3322
|
# @example Request syntax with placeholder values
|
@@ -5930,49 +5930,49 @@ module Aws::S3
|
|
5930
5930
|
# * {Types::GetObjectOutput#object_lock_legal_hold_status #object_lock_legal_hold_status} => String
|
5931
5931
|
#
|
5932
5932
|
#
|
5933
|
-
# @example Example: To retrieve
|
5933
|
+
# @example Example: To retrieve an object
|
5934
5934
|
#
|
5935
|
-
# # The following example retrieves an object for an S3 bucket.
|
5936
|
-
# # specific byte range.
|
5935
|
+
# # The following example retrieves an object for an S3 bucket.
|
5937
5936
|
#
|
5938
5937
|
# resp = client.get_object({
|
5939
5938
|
# bucket: "examplebucket",
|
5940
|
-
# key: "
|
5941
|
-
# range: "bytes=0-9",
|
5939
|
+
# key: "HappyFace.jpg",
|
5942
5940
|
# })
|
5943
5941
|
#
|
5944
5942
|
# resp.to_h outputs the following:
|
5945
5943
|
# {
|
5946
5944
|
# accept_ranges: "bytes",
|
5947
|
-
# content_length:
|
5948
|
-
#
|
5949
|
-
#
|
5950
|
-
#
|
5951
|
-
# last_modified: Time.parse("Thu, 09 Oct 2014 22:57:28 GMT"),
|
5945
|
+
# content_length: 3191,
|
5946
|
+
# content_type: "image/jpeg",
|
5947
|
+
# etag: "\"6805f2cfc46c0f04559748bb039d69ae\"",
|
5948
|
+
# last_modified: Time.parse("Thu, 15 Dec 2016 01:19:41 GMT"),
|
5952
5949
|
# metadata: {
|
5953
5950
|
# },
|
5951
|
+
# tag_count: 2,
|
5954
5952
|
# version_id: "null",
|
5955
5953
|
# }
|
5956
5954
|
#
|
5957
|
-
# @example Example: To retrieve an object
|
5955
|
+
# @example Example: To retrieve a byte range of an object
|
5958
5956
|
#
|
5959
|
-
# # The following example retrieves an object for an S3 bucket.
|
5957
|
+
# # The following example retrieves an object for an S3 bucket. The request specifies the range header to retrieve a
|
5958
|
+
# # specific byte range.
|
5960
5959
|
#
|
5961
5960
|
# resp = client.get_object({
|
5962
5961
|
# bucket: "examplebucket",
|
5963
|
-
# key: "
|
5962
|
+
# key: "SampleFile.txt",
|
5963
|
+
# range: "bytes=0-9",
|
5964
5964
|
# })
|
5965
5965
|
#
|
5966
5966
|
# resp.to_h outputs the following:
|
5967
5967
|
# {
|
5968
5968
|
# accept_ranges: "bytes",
|
5969
|
-
# content_length:
|
5970
|
-
#
|
5971
|
-
#
|
5972
|
-
#
|
5969
|
+
# content_length: 10,
|
5970
|
+
# content_range: "bytes 0-9/43",
|
5971
|
+
# content_type: "text/plain",
|
5972
|
+
# etag: "\"0d94420ffd0bc68cd3d152506b97a9cc\"",
|
5973
|
+
# last_modified: Time.parse("Thu, 09 Oct 2014 22:57:28 GMT"),
|
5973
5974
|
# metadata: {
|
5974
5975
|
# },
|
5975
|
-
# tag_count: 2,
|
5976
5976
|
# version_id: "null",
|
5977
5977
|
# }
|
5978
5978
|
#
|
@@ -8080,97 +8080,97 @@ module Aws::S3
|
|
8080
8080
|
# The returned {Seahorse::Client::Response response} is a pageable response and is Enumerable. For details on usage see {Aws::PageableResponse PageableResponse}.
|
8081
8081
|
#
|
8082
8082
|
#
|
8083
|
-
# @example Example:
|
8083
|
+
# @example Example: List next set of multipart uploads when previous result is truncated
|
8084
8084
|
#
|
8085
|
-
# # The following example
|
8085
|
+
# # The following example specifies the upload-id-marker and key-marker from previous truncated response to retrieve next
|
8086
|
+
# # setup of multipart uploads.
|
8086
8087
|
#
|
8087
8088
|
# resp = client.list_multipart_uploads({
|
8088
8089
|
# bucket: "examplebucket",
|
8090
|
+
# key_marker: "nextkeyfrompreviousresponse",
|
8091
|
+
# max_uploads: 2,
|
8092
|
+
# upload_id_marker: "valuefrompreviousresponse",
|
8089
8093
|
# })
|
8090
8094
|
#
|
8091
8095
|
# resp.to_h outputs the following:
|
8092
8096
|
# {
|
8097
|
+
# bucket: "acl1",
|
8098
|
+
# is_truncated: true,
|
8099
|
+
# key_marker: "",
|
8100
|
+
# max_uploads: 2,
|
8101
|
+
# next_key_marker: "someobjectkey",
|
8102
|
+
# next_upload_id_marker: "examplelo91lv1iwvWpvCiJWugw2xXLPAD7Z8cJyX9.WiIRgNrdG6Ldsn.9FtS63TCl1Uf5faTB.1U5Ckcbmdw--",
|
8103
|
+
# upload_id_marker: "",
|
8093
8104
|
# uploads: [
|
8094
8105
|
# {
|
8095
8106
|
# initiated: Time.parse("2014-05-01T05:40:58.000Z"),
|
8096
8107
|
# initiator: {
|
8097
|
-
# display_name: "display-name",
|
8108
|
+
# display_name: "ownder-display-name",
|
8098
8109
|
# id: "examplee7a2f25102679df27bb0ae12b3f85be6f290b936c4393484be31bebcc",
|
8099
8110
|
# },
|
8100
8111
|
# key: "JavaFile",
|
8101
8112
|
# owner: {
|
8102
|
-
# display_name: "
|
8103
|
-
# id: "
|
8113
|
+
# display_name: "mohanataws",
|
8114
|
+
# id: "852b113e7a2f25102679df27bb0ae12b3f85be6f290b936c4393484be31bebcc",
|
8104
8115
|
# },
|
8105
8116
|
# storage_class: "STANDARD",
|
8106
|
-
# upload_id: "
|
8117
|
+
# upload_id: "gZ30jIqlUa.CInXklLQtSMJITdUnoZ1Y5GACB5UckOtspm5zbDMCkPF_qkfZzMiFZ6dksmcnqxJyIBvQMG9X9Q--",
|
8107
8118
|
# },
|
8108
8119
|
# {
|
8109
8120
|
# initiated: Time.parse("2014-05-01T05:41:27.000Z"),
|
8110
8121
|
# initiator: {
|
8111
|
-
# display_name: "display-name",
|
8122
|
+
# display_name: "ownder-display-name",
|
8112
8123
|
# id: "examplee7a2f25102679df27bb0ae12b3f85be6f290b936c4393484be31bebcc",
|
8113
8124
|
# },
|
8114
8125
|
# key: "JavaFile",
|
8115
8126
|
# owner: {
|
8116
|
-
# display_name: "display-name",
|
8127
|
+
# display_name: "ownder-display-name",
|
8117
8128
|
# id: "examplee7a2f25102679df27bb0ae12b3f85be6f290b936c4393484be31bebcc",
|
8118
8129
|
# },
|
8119
8130
|
# storage_class: "STANDARD",
|
8120
|
-
# upload_id: "
|
8131
|
+
# upload_id: "b7tZSqIlo91lv1iwvWpvCiJWugw2xXLPAD7Z8cJyX9.WiIRgNrdG6Ldsn.9FtS63TCl1Uf5faTB.1U5Ckcbmdw--",
|
8121
8132
|
# },
|
8122
8133
|
# ],
|
8123
8134
|
# }
|
8124
8135
|
#
|
8125
|
-
# @example Example:
|
8136
|
+
# @example Example: To list in-progress multipart uploads on a bucket
|
8126
8137
|
#
|
8127
|
-
# # The following example
|
8128
|
-
# # setup of multipart uploads.
|
8138
|
+
# # The following example lists in-progress multipart uploads on a specific bucket.
|
8129
8139
|
#
|
8130
8140
|
# resp = client.list_multipart_uploads({
|
8131
8141
|
# bucket: "examplebucket",
|
8132
|
-
# key_marker: "nextkeyfrompreviousresponse",
|
8133
|
-
# max_uploads: 2,
|
8134
|
-
# upload_id_marker: "valuefrompreviousresponse",
|
8135
8142
|
# })
|
8136
8143
|
#
|
8137
8144
|
# resp.to_h outputs the following:
|
8138
8145
|
# {
|
8139
|
-
# bucket: "acl1",
|
8140
|
-
# is_truncated: true,
|
8141
|
-
# key_marker: "",
|
8142
|
-
# max_uploads: 2,
|
8143
|
-
# next_key_marker: "someobjectkey",
|
8144
|
-
# next_upload_id_marker: "examplelo91lv1iwvWpvCiJWugw2xXLPAD7Z8cJyX9.WiIRgNrdG6Ldsn.9FtS63TCl1Uf5faTB.1U5Ckcbmdw--",
|
8145
|
-
# upload_id_marker: "",
|
8146
8146
|
# uploads: [
|
8147
8147
|
# {
|
8148
8148
|
# initiated: Time.parse("2014-05-01T05:40:58.000Z"),
|
8149
8149
|
# initiator: {
|
8150
|
-
# display_name: "
|
8150
|
+
# display_name: "display-name",
|
8151
8151
|
# id: "examplee7a2f25102679df27bb0ae12b3f85be6f290b936c4393484be31bebcc",
|
8152
8152
|
# },
|
8153
8153
|
# key: "JavaFile",
|
8154
8154
|
# owner: {
|
8155
|
-
# display_name: "
|
8156
|
-
# id: "
|
8155
|
+
# display_name: "display-name",
|
8156
|
+
# id: "examplee7a2f25102679df27bb0ae12b3f85be6f290b936c4393484be31bebcc",
|
8157
8157
|
# },
|
8158
8158
|
# storage_class: "STANDARD",
|
8159
|
-
# upload_id: "
|
8159
|
+
# upload_id: "examplelUa.CInXklLQtSMJITdUnoZ1Y5GACB5UckOtspm5zbDMCkPF_qkfZzMiFZ6dksmcnqxJyIBvQMG9X9Q--",
|
8160
8160
|
# },
|
8161
8161
|
# {
|
8162
8162
|
# initiated: Time.parse("2014-05-01T05:41:27.000Z"),
|
8163
8163
|
# initiator: {
|
8164
|
-
# display_name: "
|
8164
|
+
# display_name: "display-name",
|
8165
8165
|
# id: "examplee7a2f25102679df27bb0ae12b3f85be6f290b936c4393484be31bebcc",
|
8166
8166
|
# },
|
8167
8167
|
# key: "JavaFile",
|
8168
8168
|
# owner: {
|
8169
|
-
# display_name: "
|
8169
|
+
# display_name: "display-name",
|
8170
8170
|
# id: "examplee7a2f25102679df27bb0ae12b3f85be6f290b936c4393484be31bebcc",
|
8171
8171
|
# },
|
8172
8172
|
# storage_class: "STANDARD",
|
8173
|
-
# upload_id: "
|
8173
|
+
# upload_id: "examplelo91lv1iwvWpvCiJWugw2xXLPAD7Z8cJyX9.WiIRgNrdG6Ldsn.9FtS63TCl1Uf5faTB.1U5Ckcbmdw--",
|
8174
8174
|
# },
|
8175
8175
|
# ],
|
8176
8176
|
# }
|
@@ -12495,62 +12495,62 @@ module Aws::S3
|
|
12495
12495
|
# * {Types::PutObjectOutput#request_charged #request_charged} => String
|
12496
12496
|
#
|
12497
12497
|
#
|
12498
|
-
# @example Example: To upload an object
|
12498
|
+
# @example Example: To upload an object (specify optional headers)
|
12499
12499
|
#
|
12500
|
-
# # The following example uploads an object
|
12501
|
-
# #
|
12500
|
+
# # The following example uploads an object. The request specifies optional request headers to directs S3 to use specific
|
12501
|
+
# # storage class and use server-side encryption.
|
12502
12502
|
#
|
12503
12503
|
# resp = client.put_object({
|
12504
12504
|
# body: "HappyFace.jpg",
|
12505
12505
|
# bucket: "examplebucket",
|
12506
12506
|
# key: "HappyFace.jpg",
|
12507
|
+
# server_side_encryption: "AES256",
|
12508
|
+
# storage_class: "STANDARD_IA",
|
12507
12509
|
# })
|
12508
12510
|
#
|
12509
12511
|
# resp.to_h outputs the following:
|
12510
12512
|
# {
|
12511
12513
|
# etag: "\"6805f2cfc46c0f04559748bb039d69ae\"",
|
12512
|
-
#
|
12514
|
+
# server_side_encryption: "AES256",
|
12515
|
+
# version_id: "CG612hodqujkf8FaaNfp8U..FIhLROcp",
|
12513
12516
|
# }
|
12514
12517
|
#
|
12515
|
-
# @example Example: To upload object and specify
|
12518
|
+
# @example Example: To upload an object and specify optional tags
|
12516
12519
|
#
|
12517
|
-
# # The following example
|
12518
|
-
# #
|
12520
|
+
# # The following example uploads an object. The request specifies optional object tags. The bucket is versioned, therefore
|
12521
|
+
# # S3 returns version ID of the newly created object.
|
12519
12522
|
#
|
12520
12523
|
# resp = client.put_object({
|
12521
|
-
# body: "
|
12524
|
+
# body: "c:\\HappyFace.jpg",
|
12522
12525
|
# bucket: "examplebucket",
|
12523
|
-
# key: "
|
12524
|
-
#
|
12525
|
-
# "metadata1" => "value1",
|
12526
|
-
# "metadata2" => "value2",
|
12527
|
-
# },
|
12526
|
+
# key: "HappyFace.jpg",
|
12527
|
+
# tagging: "key1=value1&key2=value2",
|
12528
12528
|
# })
|
12529
12529
|
#
|
12530
12530
|
# resp.to_h outputs the following:
|
12531
12531
|
# {
|
12532
12532
|
# etag: "\"6805f2cfc46c0f04559748bb039d69ae\"",
|
12533
|
-
# version_id: "
|
12533
|
+
# version_id: "psM2sYY4.o1501dSx8wMvnkOzSBB.V4a",
|
12534
12534
|
# }
|
12535
12535
|
#
|
12536
|
-
# @example Example: To upload an object
|
12536
|
+
# @example Example: To upload an object and specify server-side encryption and object tags
|
12537
12537
|
#
|
12538
|
-
# # The following example uploads an object. The request specifies optional
|
12539
|
-
# #
|
12538
|
+
# # The following example uploads an object. The request specifies the optional server-side encryption option. The request
|
12539
|
+
# # also specifies optional object tags. If the bucket is versioning enabled, S3 returns version ID in response.
|
12540
12540
|
#
|
12541
12541
|
# resp = client.put_object({
|
12542
|
-
# body: "
|
12542
|
+
# body: "filetoupload",
|
12543
12543
|
# bucket: "examplebucket",
|
12544
|
-
# key: "
|
12544
|
+
# key: "exampleobject",
|
12545
12545
|
# server_side_encryption: "AES256",
|
12546
|
-
#
|
12546
|
+
# tagging: "key1=value1&key2=value2",
|
12547
12547
|
# })
|
12548
12548
|
#
|
12549
12549
|
# resp.to_h outputs the following:
|
12550
12550
|
# {
|
12551
12551
|
# etag: "\"6805f2cfc46c0f04559748bb039d69ae\"",
|
12552
12552
|
# server_side_encryption: "AES256",
|
12553
|
-
# version_id: "
|
12553
|
+
# version_id: "Ri.vC6qVlA4dEnjgRV4ZHsHoFIjqEMNt",
|
12554
12554
|
# }
|
12555
12555
|
#
|
12556
12556
|
# @example Example: To create an object.
|
@@ -12569,60 +12569,60 @@ module Aws::S3
|
|
12569
12569
|
# version_id: "Bvq0EDKxOcXLJXNo_Lkz37eM3R4pfzyQ",
|
12570
12570
|
# }
|
12571
12571
|
#
|
12572
|
-
# @example Example: To upload an object
|
12572
|
+
# @example Example: To upload an object
|
12573
12573
|
#
|
12574
|
-
# # The following example uploads an object. The
|
12575
|
-
# #
|
12574
|
+
# # The following example uploads an object to a versioning-enabled bucket. The source file is specified using Windows file
|
12575
|
+
# # syntax. S3 returns VersionId of the newly created object.
|
12576
12576
|
#
|
12577
12577
|
# resp = client.put_object({
|
12578
|
-
# body: "
|
12578
|
+
# body: "HappyFace.jpg",
|
12579
12579
|
# bucket: "examplebucket",
|
12580
|
-
# key: "
|
12581
|
-
# server_side_encryption: "AES256",
|
12582
|
-
# tagging: "key1=value1&key2=value2",
|
12580
|
+
# key: "HappyFace.jpg",
|
12583
12581
|
# })
|
12584
12582
|
#
|
12585
12583
|
# resp.to_h outputs the following:
|
12586
12584
|
# {
|
12587
12585
|
# etag: "\"6805f2cfc46c0f04559748bb039d69ae\"",
|
12588
|
-
#
|
12589
|
-
# version_id: "Ri.vC6qVlA4dEnjgRV4ZHsHoFIjqEMNt",
|
12586
|
+
# version_id: "tpf3zF08nBplQK1XLOefGskR7mGDwcDk",
|
12590
12587
|
# }
|
12591
12588
|
#
|
12592
|
-
# @example Example: To upload an object and specify
|
12589
|
+
# @example Example: To upload an object and specify canned ACL.
|
12593
12590
|
#
|
12594
|
-
# # The following example uploads
|
12595
|
-
# # S3 returns version ID
|
12591
|
+
# # The following example uploads and object. The request specifies optional canned ACL (access control list) to all READ
|
12592
|
+
# # access to authenticated users. If the bucket is versioning enabled, S3 returns version ID in response.
|
12596
12593
|
#
|
12597
12594
|
# resp = client.put_object({
|
12598
|
-
#
|
12595
|
+
# acl: "authenticated-read",
|
12596
|
+
# body: "filetoupload",
|
12599
12597
|
# bucket: "examplebucket",
|
12600
|
-
# key: "
|
12601
|
-
# tagging: "key1=value1&key2=value2",
|
12598
|
+
# key: "exampleobject",
|
12602
12599
|
# })
|
12603
12600
|
#
|
12604
12601
|
# resp.to_h outputs the following:
|
12605
12602
|
# {
|
12606
12603
|
# etag: "\"6805f2cfc46c0f04559748bb039d69ae\"",
|
12607
|
-
# version_id: "
|
12604
|
+
# version_id: "Kirh.unyZwjQ69YxcQLA8z4F5j3kJJKr",
|
12608
12605
|
# }
|
12609
12606
|
#
|
12610
|
-
# @example Example: To upload
|
12607
|
+
# @example Example: To upload object and specify user-defined metadata
|
12611
12608
|
#
|
12612
|
-
# # The following example
|
12613
|
-
# #
|
12609
|
+
# # The following example creates an object. The request also specifies optional metadata. If the bucket is versioning
|
12610
|
+
# # enabled, S3 returns version ID in response.
|
12614
12611
|
#
|
12615
12612
|
# resp = client.put_object({
|
12616
|
-
# acl: "authenticated-read",
|
12617
12613
|
# body: "filetoupload",
|
12618
12614
|
# bucket: "examplebucket",
|
12619
12615
|
# key: "exampleobject",
|
12616
|
+
# metadata: {
|
12617
|
+
# "metadata1" => "value1",
|
12618
|
+
# "metadata2" => "value2",
|
12619
|
+
# },
|
12620
12620
|
# })
|
12621
12621
|
#
|
12622
12622
|
# resp.to_h outputs the following:
|
12623
12623
|
# {
|
12624
12624
|
# etag: "\"6805f2cfc46c0f04559748bb039d69ae\"",
|
12625
|
-
# version_id: "
|
12625
|
+
# version_id: "pSKidl4pHBiNwukdbcPXAIs.sshFFOc0",
|
12626
12626
|
# }
|
12627
12627
|
#
|
12628
12628
|
# @example Streaming a file from disk
|
@@ -15653,7 +15653,7 @@ module Aws::S3
|
|
15653
15653
|
params: params,
|
15654
15654
|
config: config)
|
15655
15655
|
context[:gem_name] = 'aws-sdk-s3'
|
15656
|
-
context[:gem_version] = '1.
|
15656
|
+
context[:gem_version] = '1.134.0'
|
15657
15657
|
Seahorse::Client::Request.new(handlers, context)
|
15658
15658
|
end
|
15659
15659
|
|
@@ -353,6 +353,10 @@ module Aws
|
|
353
353
|
# obj.upload_stream do |write_stream|
|
354
354
|
# IO.copy_stream(STDIN, write_stream)
|
355
355
|
# end
|
356
|
+
# @param [Hash] options
|
357
|
+
# Additional options for {Client#create_multipart_upload},
|
358
|
+
# {Client#complete_multipart_upload},
|
359
|
+
# and {Client#upload_part} can be provided.
|
356
360
|
#
|
357
361
|
# @option options [Integer] :thread_count (10) The number of parallel
|
358
362
|
# multipart uploads
|
@@ -375,6 +379,9 @@ module Aws
|
|
375
379
|
# @return [Boolean] Returns `true` when the object is uploaded
|
376
380
|
# without any errors.
|
377
381
|
#
|
382
|
+
# @see Client#create_multipart_upload
|
383
|
+
# @see Client#complete_multipart_upload
|
384
|
+
# @see Client#upload_part
|
378
385
|
def upload_stream(options = {}, &block)
|
379
386
|
uploading_options = options.dup
|
380
387
|
uploader = MultipartStreamUploader.new(
|
@@ -427,6 +434,13 @@ module Aws
|
|
427
434
|
# using an open Tempfile, rewind it before uploading or else the object
|
428
435
|
# will be empty.
|
429
436
|
#
|
437
|
+
# @param [Hash] options
|
438
|
+
# Additional options for {Client#put_object}
|
439
|
+
# when file sizes below the multipart threshold. For files larger than
|
440
|
+
# the multipart threshold, options for {Client#create_multipart_upload},
|
441
|
+
# {Client#complete_multipart_upload},
|
442
|
+
# and {Client#upload_part} can be provided.
|
443
|
+
#
|
430
444
|
# @option options [Integer] :multipart_threshold (104857600) Files larger
|
431
445
|
# than or equal to `:multipart_threshold` are uploaded using the S3
|
432
446
|
# multipart APIs.
|
@@ -448,6 +462,11 @@ module Aws
|
|
448
462
|
#
|
449
463
|
# @return [Boolean] Returns `true` when the object is uploaded
|
450
464
|
# without any errors.
|
465
|
+
#
|
466
|
+
# @see Client#put_object
|
467
|
+
# @see Client#create_multipart_upload
|
468
|
+
# @see Client#complete_multipart_upload
|
469
|
+
# @see Client#upload_part
|
451
470
|
def upload_file(source, options = {})
|
452
471
|
uploading_options = options.dup
|
453
472
|
uploader = FileUploader.new(
|
@@ -475,8 +494,21 @@ module Aws
|
|
475
494
|
# # and the parts are downloaded in parallel
|
476
495
|
# obj.download_file('/path/to/very_large_file')
|
477
496
|
#
|
497
|
+
# You can provide a callback to monitor progress of the download:
|
498
|
+
#
|
499
|
+
# # bytes and part_sizes are each an array with 1 entry per part
|
500
|
+
# # part_sizes may not be known until the first bytes are retrieved
|
501
|
+
# progress = Proc.new do |bytes, part_sizes, file_size|
|
502
|
+
# puts bytes.map.with_index { |b, i| "Part #{i+1}: #{b} / #{part_sizes[i]}"}.join(' ') + "Total: #{100.0 * bytes.sum / file_size}%" }
|
503
|
+
# end
|
504
|
+
# obj.download_file('/path/to/file', progress_callback: progress)
|
505
|
+
#
|
478
506
|
# @param [String] destination Where to download the file to.
|
479
507
|
#
|
508
|
+
# @param [Hash] options
|
509
|
+
# Additional options for {Client#get_object} and #{Client#head_object}
|
510
|
+
# may be provided.
|
511
|
+
#
|
480
512
|
# @option options [String] mode `auto`, `single_request`, `get_range`
|
481
513
|
# `single_request` mode forces only 1 GET request is made in download,
|
482
514
|
# `get_range` mode allows `chunk_size` parameter to configured in
|
@@ -505,8 +537,18 @@ module Aws
|
|
505
537
|
# response. For multipart downloads, this will be called for each
|
506
538
|
# part that is downloaded and validated.
|
507
539
|
#
|
540
|
+
# @option options [Proc] :progress_callback
|
541
|
+
# A Proc that will be called when each chunk of the download is received.
|
542
|
+
# It will be invoked with [bytes_read], [part_sizes], file_size.
|
543
|
+
# When the object is downloaded as parts (rather than by ranges), the
|
544
|
+
# part_sizes will not be known ahead of time and will be nil in the
|
545
|
+
# callback until the first bytes in the part are received.
|
546
|
+
#
|
508
547
|
# @return [Boolean] Returns `true` when the file is downloaded without
|
509
548
|
# any errors.
|
549
|
+
#
|
550
|
+
# @see Client#get_object
|
551
|
+
# @see Client#head_object
|
510
552
|
def download_file(destination, options = {})
|
511
553
|
downloader = FileDownloader.new(client: client)
|
512
554
|
Aws::Plugins::UserAgent.feature('resource') do
|
@@ -40,6 +40,8 @@ module Aws
|
|
40
40
|
end
|
41
41
|
@on_checksum_validated = options[:on_checksum_validated]
|
42
42
|
|
43
|
+
@progress_callback = options[:progress_callback]
|
44
|
+
|
43
45
|
validate!
|
44
46
|
|
45
47
|
Aws::Plugins::UserAgent.feature('s3-transfer') do
|
@@ -49,7 +51,7 @@ module Aws
|
|
49
51
|
when 'get_range'
|
50
52
|
if @chunk_size
|
51
53
|
resp = @client.head_object(@params)
|
52
|
-
multithreaded_get_by_ranges(
|
54
|
+
multithreaded_get_by_ranges(resp.content_length)
|
53
55
|
else
|
54
56
|
msg = 'In :get_range mode, :chunk_size must be provided'
|
55
57
|
raise ArgumentError, msg
|
@@ -82,7 +84,7 @@ module Aws
|
|
82
84
|
if resp.content_length <= MIN_CHUNK_SIZE
|
83
85
|
single_request
|
84
86
|
else
|
85
|
-
multithreaded_get_by_ranges(
|
87
|
+
multithreaded_get_by_ranges(resp.content_length)
|
86
88
|
end
|
87
89
|
else
|
88
90
|
# partNumber is an option
|
@@ -99,9 +101,9 @@ module Aws
|
|
99
101
|
chunk_size = compute_chunk(file_size)
|
100
102
|
part_size = (file_size.to_f / count.to_f).ceil
|
101
103
|
if chunk_size < part_size
|
102
|
-
multithreaded_get_by_ranges(
|
104
|
+
multithreaded_get_by_ranges(file_size)
|
103
105
|
else
|
104
|
-
multithreaded_get_by_parts(count)
|
106
|
+
multithreaded_get_by_parts(count, file_size)
|
105
107
|
end
|
106
108
|
end
|
107
109
|
|
@@ -133,30 +135,65 @@ module Aws
|
|
133
135
|
chunks.each_slice(@thread_count).to_a
|
134
136
|
end
|
135
137
|
|
136
|
-
def multithreaded_get_by_ranges(
|
137
|
-
|
138
|
+
def multithreaded_get_by_ranges(file_size)
|
139
|
+
offset = 0
|
140
|
+
default_chunk_size = compute_chunk(file_size)
|
141
|
+
chunks = []
|
142
|
+
part_number = 1 # parts start at 1
|
143
|
+
while offset < file_size
|
144
|
+
progress = offset + default_chunk_size
|
145
|
+
progress = file_size if progress > file_size
|
146
|
+
range = "bytes=#{offset}-#{progress - 1}"
|
147
|
+
chunks << Part.new(
|
148
|
+
part_number: part_number,
|
149
|
+
size: (progress-offset),
|
150
|
+
params: @params.merge(range: range)
|
151
|
+
)
|
152
|
+
part_number += 1
|
153
|
+
offset = progress
|
154
|
+
end
|
155
|
+
download_in_threads(PartList.new(chunks), file_size)
|
138
156
|
end
|
139
157
|
|
140
|
-
def multithreaded_get_by_parts(
|
141
|
-
|
158
|
+
def multithreaded_get_by_parts(n_parts, total_size)
|
159
|
+
parts = (1..n_parts).map do |part|
|
160
|
+
Part.new(part_number: part, params: @params.merge(part_number: part))
|
161
|
+
end
|
162
|
+
download_in_threads(PartList.new(parts), total_size)
|
142
163
|
end
|
143
164
|
|
144
|
-
def
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
165
|
+
def download_in_threads(pending, total_size)
|
166
|
+
threads = []
|
167
|
+
if @progress_callback
|
168
|
+
progress = MultipartProgress.new(pending, total_size, @progress_callback)
|
169
|
+
end
|
170
|
+
@thread_count.times do
|
171
|
+
thread = Thread.new do
|
172
|
+
begin
|
173
|
+
while part = pending.shift
|
174
|
+
if progress
|
175
|
+
part.params[:on_chunk_received] =
|
176
|
+
proc do |_chunk, bytes, total|
|
177
|
+
progress.call(part.part_number, bytes, total)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
resp = @client.get_object(part.params)
|
181
|
+
write(resp)
|
182
|
+
if @on_checksum_validated && resp.checksum_validated
|
183
|
+
@on_checksum_validated.call(resp.checksum_validated, resp)
|
184
|
+
end
|
155
185
|
end
|
186
|
+
nil
|
187
|
+
rescue => error
|
188
|
+
# keep other threads from downloading other parts
|
189
|
+
pending.clear!
|
190
|
+
raise error
|
156
191
|
end
|
157
192
|
end
|
158
|
-
|
193
|
+
thread.abort_on_exception = true
|
194
|
+
threads << thread
|
159
195
|
end
|
196
|
+
threads.map(&:value).compact
|
160
197
|
end
|
161
198
|
|
162
199
|
def write(resp)
|
@@ -166,9 +203,9 @@ module Aws
|
|
166
203
|
end
|
167
204
|
|
168
205
|
def single_request
|
169
|
-
|
170
|
-
|
171
|
-
)
|
206
|
+
params = @params.merge(response_target: @path)
|
207
|
+
params[:on_chunk_received] = single_part_progress if @progress_callback
|
208
|
+
resp = @client.get_object(params)
|
172
209
|
|
173
210
|
return resp unless @on_checksum_validated
|
174
211
|
|
@@ -178,6 +215,59 @@ module Aws
|
|
178
215
|
|
179
216
|
resp
|
180
217
|
end
|
218
|
+
|
219
|
+
def single_part_progress
|
220
|
+
proc do |_chunk, bytes_read, total_size|
|
221
|
+
@progress_callback.call([bytes_read], [total_size], total_size)
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
class Part < Struct.new(:part_number, :size, :params)
|
226
|
+
include Aws::Structure
|
227
|
+
end
|
228
|
+
|
229
|
+
# @api private
|
230
|
+
class PartList
|
231
|
+
include Enumerable
|
232
|
+
def initialize(parts = [])
|
233
|
+
@parts = parts
|
234
|
+
@mutex = Mutex.new
|
235
|
+
end
|
236
|
+
|
237
|
+
def shift
|
238
|
+
@mutex.synchronize { @parts.shift }
|
239
|
+
end
|
240
|
+
|
241
|
+
def size
|
242
|
+
@mutex.synchronize { @parts.size }
|
243
|
+
end
|
244
|
+
|
245
|
+
def clear!
|
246
|
+
@mutex.synchronize { @parts.clear }
|
247
|
+
end
|
248
|
+
|
249
|
+
def each(&block)
|
250
|
+
@mutex.synchronize { @parts.each(&block) }
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
# @api private
|
255
|
+
class MultipartProgress
|
256
|
+
def initialize(parts, total_size, progress_callback)
|
257
|
+
@bytes_received = Array.new(parts.size, 0)
|
258
|
+
@part_sizes = parts.map(&:size)
|
259
|
+
@total_size = total_size
|
260
|
+
@progress_callback = progress_callback
|
261
|
+
end
|
262
|
+
|
263
|
+
def call(part_number, bytes_received, total)
|
264
|
+
# part numbers start at 1
|
265
|
+
@bytes_received[part_number - 1] = bytes_received
|
266
|
+
# part size may not be known until we get the first response
|
267
|
+
@part_sizes[part_number - 1] ||= total
|
268
|
+
@progress_callback.call(@bytes_received, @part_sizes, @total_size)
|
269
|
+
end
|
270
|
+
end
|
181
271
|
end
|
182
272
|
end
|
183
273
|
end
|
data/lib/aws-sdk-s3.rb
CHANGED
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.
|
4
|
+
version: 1.134.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: 2023-08-
|
11
|
+
date: 2023-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-kms
|
@@ -47,7 +47,7 @@ dependencies:
|
|
47
47
|
version: '3'
|
48
48
|
- - ">="
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version: 3.
|
50
|
+
version: 3.181.0
|
51
51
|
type: :runtime
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -57,7 +57,7 @@ dependencies:
|
|
57
57
|
version: '3'
|
58
58
|
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: 3.
|
60
|
+
version: 3.181.0
|
61
61
|
description: Official AWS Ruby gem for Amazon Simple Storage Service (Amazon S3).
|
62
62
|
This gem is part of the AWS SDK for Ruby.
|
63
63
|
email:
|