aws-sdk-s3 1.86.1 → 1.88.2
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/lib/aws-sdk-s3.rb +1 -1
- data/lib/aws-sdk-s3/arn/access_point_arn.rb +8 -4
- data/lib/aws-sdk-s3/arn/outpost_access_point_arn.rb +7 -3
- data/lib/aws-sdk-s3/client.rb +104 -104
- data/lib/aws-sdk-s3/client_api.rb +1 -1
- data/lib/aws-sdk-s3/customizations/bucket.rb +8 -3
- data/lib/aws-sdk-s3/customizations/object.rb +9 -3
- data/lib/aws-sdk-s3/encryptionV2/default_cipher_provider.rb +3 -3
- data/lib/aws-sdk-s3/legacy_signer.rb +15 -25
- data/lib/aws-sdk-s3/plugins/accelerate.rb +7 -4
- data/lib/aws-sdk-s3/plugins/arn.rb +44 -26
- data/lib/aws-sdk-s3/plugins/dualstack.rb +10 -3
- data/lib/aws-sdk-s3/plugins/expect_100_continue.rb +2 -1
- data/lib/aws-sdk-s3/plugins/iad_regional_endpoint.rb +4 -4
- data/lib/aws-sdk-s3/plugins/md5s.rb +1 -1
- data/lib/aws-sdk-s3/plugins/s3_signer.rb +18 -26
- data/lib/aws-sdk-s3/presigner.rb +15 -27
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6e0ae9f5b3f0423324bd6e52d20f902ccf110612a2f1c96d8496700e8cb48e96
|
|
4
|
+
data.tar.gz: 99213d2888efcdf3085a7760c34f9d9d678b7bb1079b563f5d3697c4c92358cb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7a17d2fdc60536257cae9473eaaa516cf4f4393bd8bdbe9154370c76cd9fd2da3826a1e7102483ecf4514c4ab878e4a20d372e852c0c8b368bdeb146a84cfffc
|
|
7
|
+
data.tar.gz: d7f291657ba92d1d8c0eabaaa25296df9018a72531d48c9b365e79b629e5d2766cacafa7f1ab0bd6872f3cad2dfed748ab2efceacd5f885b8f7d61eb1f6114fc
|
data/lib/aws-sdk-s3.rb
CHANGED
|
@@ -52,10 +52,14 @@ module Aws
|
|
|
52
52
|
end
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
-
def host_url(region, dualstack = false)
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
def host_url(region, dualstack = false, custom_endpoint = nil)
|
|
56
|
+
pfx = "#{@access_point_name}-#{@account_id}"
|
|
57
|
+
if custom_endpoint
|
|
58
|
+
"#{pfx}.#{custom_endpoint}"
|
|
59
|
+
else
|
|
60
|
+
sfx = Aws::Partitions::EndpointProvider.dns_suffix_for(region)
|
|
61
|
+
"#{pfx}.s3-accesspoint#{'.dualstack' if dualstack}.#{region}.#{sfx}"
|
|
62
|
+
end
|
|
59
63
|
end
|
|
60
64
|
end
|
|
61
65
|
end
|
|
@@ -62,9 +62,13 @@ module Aws
|
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
# Outpost ARNs currently do not support dualstack
|
|
65
|
-
def host_url(region, _dualstack = false)
|
|
66
|
-
"#{@access_point_name}-#{@account_id}.#{@outpost_id}"
|
|
67
|
-
|
|
65
|
+
def host_url(region, _dualstack = false, custom_endpoint = nil)
|
|
66
|
+
pfx = "#{@access_point_name}-#{@account_id}.#{@outpost_id}"
|
|
67
|
+
if custom_endpoint
|
|
68
|
+
"#{pfx}.#{custom_endpoint}"
|
|
69
|
+
else
|
|
70
|
+
"#{pfx}.s3-outposts.#{region}.amazonaws.com"
|
|
71
|
+
end
|
|
68
72
|
end
|
|
69
73
|
end
|
|
70
74
|
end
|
data/lib/aws-sdk-s3/client.rb
CHANGED
|
@@ -1418,33 +1418,33 @@ module Aws::S3
|
|
|
1418
1418
|
# * {Types::CreateBucketOutput#location #location} => String
|
|
1419
1419
|
#
|
|
1420
1420
|
#
|
|
1421
|
-
# @example Example: To create a bucket
|
|
1421
|
+
# @example Example: To create a bucket
|
|
1422
1422
|
#
|
|
1423
|
-
# # The following example creates a bucket.
|
|
1423
|
+
# # The following example creates a bucket.
|
|
1424
1424
|
#
|
|
1425
1425
|
# resp = client.create_bucket({
|
|
1426
1426
|
# bucket: "examplebucket",
|
|
1427
|
-
# create_bucket_configuration: {
|
|
1428
|
-
# location_constraint: "eu-west-1",
|
|
1429
|
-
# },
|
|
1430
1427
|
# })
|
|
1431
1428
|
#
|
|
1432
1429
|
# resp.to_h outputs the following:
|
|
1433
1430
|
# {
|
|
1434
|
-
# location: "
|
|
1431
|
+
# location: "/examplebucket",
|
|
1435
1432
|
# }
|
|
1436
1433
|
#
|
|
1437
|
-
# @example Example: To create a bucket
|
|
1434
|
+
# @example Example: To create a bucket in a specific region
|
|
1438
1435
|
#
|
|
1439
|
-
# # The following example creates a bucket.
|
|
1436
|
+
# # The following example creates a bucket. The request specifies an AWS region where to create the bucket.
|
|
1440
1437
|
#
|
|
1441
1438
|
# resp = client.create_bucket({
|
|
1442
1439
|
# bucket: "examplebucket",
|
|
1440
|
+
# create_bucket_configuration: {
|
|
1441
|
+
# location_constraint: "eu-west-1",
|
|
1442
|
+
# },
|
|
1443
1443
|
# })
|
|
1444
1444
|
#
|
|
1445
1445
|
# resp.to_h outputs the following:
|
|
1446
1446
|
# {
|
|
1447
|
-
# location: "/
|
|
1447
|
+
# location: "http://examplebucket.<Region>.s3.amazonaws.com/",
|
|
1448
1448
|
# }
|
|
1449
1449
|
#
|
|
1450
1450
|
# @example Request syntax with placeholder values
|
|
@@ -2954,35 +2954,35 @@ module Aws::S3
|
|
|
2954
2954
|
# * {Types::DeleteObjectTaggingOutput#version_id #version_id} => String
|
|
2955
2955
|
#
|
|
2956
2956
|
#
|
|
2957
|
-
# @example Example: To remove tag set from an object
|
|
2957
|
+
# @example Example: To remove tag set from an object version
|
|
2958
2958
|
#
|
|
2959
|
-
# # The following example removes tag set associated with the specified object.
|
|
2960
|
-
# #
|
|
2959
|
+
# # The following example removes tag set associated with the specified object version. The request specifies both the
|
|
2960
|
+
# # object key and object version.
|
|
2961
2961
|
#
|
|
2962
2962
|
# resp = client.delete_object_tagging({
|
|
2963
2963
|
# bucket: "examplebucket",
|
|
2964
2964
|
# key: "HappyFace.jpg",
|
|
2965
|
+
# version_id: "ydlaNkwWm0SfKJR.T1b1fIdPRbldTYRI",
|
|
2965
2966
|
# })
|
|
2966
2967
|
#
|
|
2967
2968
|
# resp.to_h outputs the following:
|
|
2968
2969
|
# {
|
|
2969
|
-
# version_id: "
|
|
2970
|
+
# version_id: "ydlaNkwWm0SfKJR.T1b1fIdPRbldTYRI",
|
|
2970
2971
|
# }
|
|
2971
2972
|
#
|
|
2972
|
-
# @example Example: To remove tag set from an object
|
|
2973
|
+
# @example Example: To remove tag set from an object
|
|
2973
2974
|
#
|
|
2974
|
-
# # The following example removes tag set associated with the specified object
|
|
2975
|
-
# #
|
|
2975
|
+
# # The following example removes tag set associated with the specified object. If the bucket is versioning enabled, the
|
|
2976
|
+
# # operation removes tag set from the latest object version.
|
|
2976
2977
|
#
|
|
2977
2978
|
# resp = client.delete_object_tagging({
|
|
2978
2979
|
# bucket: "examplebucket",
|
|
2979
2980
|
# key: "HappyFace.jpg",
|
|
2980
|
-
# version_id: "ydlaNkwWm0SfKJR.T1b1fIdPRbldTYRI",
|
|
2981
2981
|
# })
|
|
2982
2982
|
#
|
|
2983
2983
|
# resp.to_h outputs the following:
|
|
2984
2984
|
# {
|
|
2985
|
-
# version_id: "
|
|
2985
|
+
# version_id: "null",
|
|
2986
2986
|
# }
|
|
2987
2987
|
#
|
|
2988
2988
|
# @example Request syntax with placeholder values
|
|
@@ -3122,20 +3122,22 @@ module Aws::S3
|
|
|
3122
3122
|
# * {Types::DeleteObjectsOutput#errors #errors} => Array<Types::Error>
|
|
3123
3123
|
#
|
|
3124
3124
|
#
|
|
3125
|
-
# @example Example: To delete multiple
|
|
3125
|
+
# @example Example: To delete multiple object versions from a versioned bucket
|
|
3126
3126
|
#
|
|
3127
|
-
# # The following example deletes objects from a bucket. The
|
|
3128
|
-
# #
|
|
3127
|
+
# # The following example deletes objects from a bucket. The request specifies object versions. S3 deletes specific object
|
|
3128
|
+
# # versions and returns the key and versions of deleted objects in the response.
|
|
3129
3129
|
#
|
|
3130
3130
|
# resp = client.delete_objects({
|
|
3131
3131
|
# bucket: "examplebucket",
|
|
3132
3132
|
# delete: {
|
|
3133
3133
|
# objects: [
|
|
3134
3134
|
# {
|
|
3135
|
-
# key: "
|
|
3135
|
+
# key: "HappyFace.jpg",
|
|
3136
|
+
# version_id: "2LWg7lQLnY41.maGB5Z6SWW.dcq0vx7b",
|
|
3136
3137
|
# },
|
|
3137
3138
|
# {
|
|
3138
|
-
# key: "
|
|
3139
|
+
# key: "HappyFace.jpg",
|
|
3140
|
+
# version_id: "yoz3HB.ZhCS_tKVEmIOr7qYyyAaZSKVd",
|
|
3139
3141
|
# },
|
|
3140
3142
|
# ],
|
|
3141
3143
|
# quiet: false,
|
|
@@ -3146,34 +3148,30 @@ module Aws::S3
|
|
|
3146
3148
|
# {
|
|
3147
3149
|
# deleted: [
|
|
3148
3150
|
# {
|
|
3149
|
-
#
|
|
3150
|
-
#
|
|
3151
|
-
# key: "objectkey1",
|
|
3151
|
+
# key: "HappyFace.jpg",
|
|
3152
|
+
# version_id: "yoz3HB.ZhCS_tKVEmIOr7qYyyAaZSKVd",
|
|
3152
3153
|
# },
|
|
3153
3154
|
# {
|
|
3154
|
-
#
|
|
3155
|
-
#
|
|
3156
|
-
# key: "objectkey2",
|
|
3155
|
+
# key: "HappyFace.jpg",
|
|
3156
|
+
# version_id: "2LWg7lQLnY41.maGB5Z6SWW.dcq0vx7b",
|
|
3157
3157
|
# },
|
|
3158
3158
|
# ],
|
|
3159
3159
|
# }
|
|
3160
3160
|
#
|
|
3161
|
-
# @example Example: To delete multiple
|
|
3161
|
+
# @example Example: To delete multiple objects from a versioned bucket
|
|
3162
3162
|
#
|
|
3163
|
-
# # The following example deletes objects from a bucket. The
|
|
3164
|
-
# #
|
|
3163
|
+
# # The following example deletes objects from a bucket. The bucket is versioned, and the request does not specify the
|
|
3164
|
+
# # object version to delete. In this case, all versions remain in the bucket and S3 adds a delete marker.
|
|
3165
3165
|
#
|
|
3166
3166
|
# resp = client.delete_objects({
|
|
3167
3167
|
# bucket: "examplebucket",
|
|
3168
3168
|
# delete: {
|
|
3169
3169
|
# objects: [
|
|
3170
3170
|
# {
|
|
3171
|
-
# key: "
|
|
3172
|
-
# version_id: "2LWg7lQLnY41.maGB5Z6SWW.dcq0vx7b",
|
|
3171
|
+
# key: "objectkey1",
|
|
3173
3172
|
# },
|
|
3174
3173
|
# {
|
|
3175
|
-
# key: "
|
|
3176
|
-
# version_id: "yoz3HB.ZhCS_tKVEmIOr7qYyyAaZSKVd",
|
|
3174
|
+
# key: "objectkey2",
|
|
3177
3175
|
# },
|
|
3178
3176
|
# ],
|
|
3179
3177
|
# quiet: false,
|
|
@@ -3184,12 +3182,14 @@ module Aws::S3
|
|
|
3184
3182
|
# {
|
|
3185
3183
|
# deleted: [
|
|
3186
3184
|
# {
|
|
3187
|
-
#
|
|
3188
|
-
#
|
|
3185
|
+
# delete_marker: true,
|
|
3186
|
+
# delete_marker_version_id: "A._w1z6EFiCF5uhtQMDal9JDkID9tQ7F",
|
|
3187
|
+
# key: "objectkey1",
|
|
3189
3188
|
# },
|
|
3190
3189
|
# {
|
|
3191
|
-
#
|
|
3192
|
-
#
|
|
3190
|
+
# delete_marker: true,
|
|
3191
|
+
# delete_marker_version_id: "iOd_ORxhkKe_e8G8_oSGxt2PjsCZKlkt",
|
|
3192
|
+
# key: "objectkey2",
|
|
3193
3193
|
# },
|
|
3194
3194
|
# ],
|
|
3195
3195
|
# }
|
|
@@ -5371,49 +5371,49 @@ module Aws::S3
|
|
|
5371
5371
|
# * {Types::GetObjectOutput#object_lock_legal_hold_status #object_lock_legal_hold_status} => String
|
|
5372
5372
|
#
|
|
5373
5373
|
#
|
|
5374
|
-
# @example Example: To retrieve an object
|
|
5374
|
+
# @example Example: To retrieve a byte range of an object
|
|
5375
5375
|
#
|
|
5376
|
-
# # The following example retrieves an object for an S3 bucket.
|
|
5376
|
+
# # The following example retrieves an object for an S3 bucket. The request specifies the range header to retrieve a
|
|
5377
|
+
# # specific byte range.
|
|
5377
5378
|
#
|
|
5378
5379
|
# resp = client.get_object({
|
|
5379
5380
|
# bucket: "examplebucket",
|
|
5380
|
-
# key: "
|
|
5381
|
+
# key: "SampleFile.txt",
|
|
5382
|
+
# range: "bytes=0-9",
|
|
5381
5383
|
# })
|
|
5382
5384
|
#
|
|
5383
5385
|
# resp.to_h outputs the following:
|
|
5384
5386
|
# {
|
|
5385
5387
|
# accept_ranges: "bytes",
|
|
5386
|
-
# content_length:
|
|
5387
|
-
#
|
|
5388
|
-
#
|
|
5389
|
-
#
|
|
5388
|
+
# content_length: 10,
|
|
5389
|
+
# content_range: "bytes 0-9/43",
|
|
5390
|
+
# content_type: "text/plain",
|
|
5391
|
+
# etag: "\"0d94420ffd0bc68cd3d152506b97a9cc\"",
|
|
5392
|
+
# last_modified: Time.parse("Thu, 09 Oct 2014 22:57:28 GMT"),
|
|
5390
5393
|
# metadata: {
|
|
5391
5394
|
# },
|
|
5392
|
-
# tag_count: 2,
|
|
5393
5395
|
# version_id: "null",
|
|
5394
5396
|
# }
|
|
5395
5397
|
#
|
|
5396
|
-
# @example Example: To retrieve
|
|
5398
|
+
# @example Example: To retrieve an object
|
|
5397
5399
|
#
|
|
5398
|
-
# # The following example retrieves an object for an S3 bucket.
|
|
5399
|
-
# # specific byte range.
|
|
5400
|
+
# # The following example retrieves an object for an S3 bucket.
|
|
5400
5401
|
#
|
|
5401
5402
|
# resp = client.get_object({
|
|
5402
5403
|
# bucket: "examplebucket",
|
|
5403
|
-
# key: "
|
|
5404
|
-
# range: "bytes=0-9",
|
|
5404
|
+
# key: "HappyFace.jpg",
|
|
5405
5405
|
# })
|
|
5406
5406
|
#
|
|
5407
5407
|
# resp.to_h outputs the following:
|
|
5408
5408
|
# {
|
|
5409
5409
|
# accept_ranges: "bytes",
|
|
5410
|
-
# content_length:
|
|
5411
|
-
#
|
|
5412
|
-
#
|
|
5413
|
-
#
|
|
5414
|
-
# last_modified: Time.parse("Thu, 09 Oct 2014 22:57:28 GMT"),
|
|
5410
|
+
# content_length: 3191,
|
|
5411
|
+
# content_type: "image/jpeg",
|
|
5412
|
+
# etag: "\"6805f2cfc46c0f04559748bb039d69ae\"",
|
|
5413
|
+
# last_modified: Time.parse("Thu, 15 Dec 2016 01:19:41 GMT"),
|
|
5415
5414
|
# metadata: {
|
|
5416
5415
|
# },
|
|
5416
|
+
# tag_count: 2,
|
|
5417
5417
|
# version_id: "null",
|
|
5418
5418
|
# }
|
|
5419
5419
|
#
|
|
@@ -11013,134 +11013,134 @@ module Aws::S3
|
|
|
11013
11013
|
# * {Types::PutObjectOutput#request_charged #request_charged} => String
|
|
11014
11014
|
#
|
|
11015
11015
|
#
|
|
11016
|
-
# @example Example: To upload an object
|
|
11016
|
+
# @example Example: To upload an object and specify server-side encryption and object tags
|
|
11017
11017
|
#
|
|
11018
|
-
# # The following example uploads
|
|
11019
|
-
# #
|
|
11018
|
+
# # The following example uploads and object. The request specifies the optional server-side encryption option. The request
|
|
11019
|
+
# # also specifies optional object tags. If the bucket is versioning enabled, S3 returns version ID in response.
|
|
11020
11020
|
#
|
|
11021
11021
|
# resp = client.put_object({
|
|
11022
|
-
# body: "
|
|
11022
|
+
# body: "filetoupload",
|
|
11023
11023
|
# bucket: "examplebucket",
|
|
11024
|
-
# key: "
|
|
11024
|
+
# key: "exampleobject",
|
|
11025
|
+
# server_side_encryption: "AES256",
|
|
11026
|
+
# tagging: "key1=value1&key2=value2",
|
|
11025
11027
|
# })
|
|
11026
11028
|
#
|
|
11027
11029
|
# resp.to_h outputs the following:
|
|
11028
11030
|
# {
|
|
11029
11031
|
# etag: "\"6805f2cfc46c0f04559748bb039d69ae\"",
|
|
11030
|
-
#
|
|
11032
|
+
# server_side_encryption: "AES256",
|
|
11033
|
+
# version_id: "Ri.vC6qVlA4dEnjgRV4ZHsHoFIjqEMNt",
|
|
11031
11034
|
# }
|
|
11032
11035
|
#
|
|
11033
|
-
# @example Example: To
|
|
11036
|
+
# @example Example: To create an object.
|
|
11034
11037
|
#
|
|
11035
|
-
# # The following example
|
|
11036
|
-
# # access to authenticated users. If the bucket is versioning enabled, S3 returns version ID in response.
|
|
11038
|
+
# # The following example creates an object. If the bucket is versioning enabled, S3 returns version ID in response.
|
|
11037
11039
|
#
|
|
11038
11040
|
# resp = client.put_object({
|
|
11039
|
-
# acl: "authenticated-read",
|
|
11040
11041
|
# body: "filetoupload",
|
|
11041
11042
|
# bucket: "examplebucket",
|
|
11042
|
-
# key: "
|
|
11043
|
+
# key: "objectkey",
|
|
11043
11044
|
# })
|
|
11044
11045
|
#
|
|
11045
11046
|
# resp.to_h outputs the following:
|
|
11046
11047
|
# {
|
|
11047
11048
|
# etag: "\"6805f2cfc46c0f04559748bb039d69ae\"",
|
|
11048
|
-
# version_id: "
|
|
11049
|
+
# version_id: "Bvq0EDKxOcXLJXNo_Lkz37eM3R4pfzyQ",
|
|
11049
11050
|
# }
|
|
11050
11051
|
#
|
|
11051
|
-
# @example Example: To upload an object
|
|
11052
|
+
# @example Example: To upload an object and specify optional tags
|
|
11052
11053
|
#
|
|
11053
|
-
# # The following example uploads an object. The request specifies optional
|
|
11054
|
-
# #
|
|
11054
|
+
# # The following example uploads an object. The request specifies optional object tags. The bucket is versioned, therefore
|
|
11055
|
+
# # S3 returns version ID of the newly created object.
|
|
11055
11056
|
#
|
|
11056
11057
|
# resp = client.put_object({
|
|
11057
|
-
# body: "HappyFace.jpg",
|
|
11058
|
+
# body: "c:\\HappyFace.jpg",
|
|
11058
11059
|
# bucket: "examplebucket",
|
|
11059
11060
|
# key: "HappyFace.jpg",
|
|
11060
|
-
#
|
|
11061
|
-
# storage_class: "STANDARD_IA",
|
|
11061
|
+
# tagging: "key1=value1&key2=value2",
|
|
11062
11062
|
# })
|
|
11063
11063
|
#
|
|
11064
11064
|
# resp.to_h outputs the following:
|
|
11065
11065
|
# {
|
|
11066
11066
|
# etag: "\"6805f2cfc46c0f04559748bb039d69ae\"",
|
|
11067
|
-
#
|
|
11068
|
-
# version_id: "CG612hodqujkf8FaaNfp8U..FIhLROcp",
|
|
11067
|
+
# version_id: "psM2sYY4.o1501dSx8wMvnkOzSBB.V4a",
|
|
11069
11068
|
# }
|
|
11070
11069
|
#
|
|
11071
|
-
# @example Example: To upload an object
|
|
11070
|
+
# @example Example: To upload an object (specify optional headers)
|
|
11072
11071
|
#
|
|
11073
|
-
# # The following example uploads
|
|
11074
|
-
# #
|
|
11072
|
+
# # The following example uploads an object. The request specifies optional request headers to directs S3 to use specific
|
|
11073
|
+
# # storage class and use server-side encryption.
|
|
11075
11074
|
#
|
|
11076
11075
|
# resp = client.put_object({
|
|
11077
|
-
# body: "
|
|
11076
|
+
# body: "HappyFace.jpg",
|
|
11078
11077
|
# bucket: "examplebucket",
|
|
11079
|
-
# key: "
|
|
11078
|
+
# key: "HappyFace.jpg",
|
|
11080
11079
|
# server_side_encryption: "AES256",
|
|
11081
|
-
#
|
|
11080
|
+
# storage_class: "STANDARD_IA",
|
|
11082
11081
|
# })
|
|
11083
11082
|
#
|
|
11084
11083
|
# resp.to_h outputs the following:
|
|
11085
11084
|
# {
|
|
11086
11085
|
# etag: "\"6805f2cfc46c0f04559748bb039d69ae\"",
|
|
11087
11086
|
# server_side_encryption: "AES256",
|
|
11088
|
-
# version_id: "
|
|
11087
|
+
# version_id: "CG612hodqujkf8FaaNfp8U..FIhLROcp",
|
|
11089
11088
|
# }
|
|
11090
11089
|
#
|
|
11091
|
-
# @example Example: To
|
|
11090
|
+
# @example Example: To upload object and specify user-defined metadata
|
|
11092
11091
|
#
|
|
11093
|
-
# # The following example creates an object.
|
|
11092
|
+
# # The following example creates an object. The request also specifies optional metadata. If the bucket is versioning
|
|
11093
|
+
# # enabled, S3 returns version ID in response.
|
|
11094
11094
|
#
|
|
11095
11095
|
# resp = client.put_object({
|
|
11096
11096
|
# body: "filetoupload",
|
|
11097
11097
|
# bucket: "examplebucket",
|
|
11098
|
-
# key: "
|
|
11098
|
+
# key: "exampleobject",
|
|
11099
|
+
# metadata: {
|
|
11100
|
+
# "metadata1" => "value1",
|
|
11101
|
+
# "metadata2" => "value2",
|
|
11102
|
+
# },
|
|
11099
11103
|
# })
|
|
11100
11104
|
#
|
|
11101
11105
|
# resp.to_h outputs the following:
|
|
11102
11106
|
# {
|
|
11103
11107
|
# etag: "\"6805f2cfc46c0f04559748bb039d69ae\"",
|
|
11104
|
-
# version_id: "
|
|
11108
|
+
# version_id: "pSKidl4pHBiNwukdbcPXAIs.sshFFOc0",
|
|
11105
11109
|
# }
|
|
11106
11110
|
#
|
|
11107
|
-
# @example Example: To upload object and specify
|
|
11111
|
+
# @example Example: To upload an object and specify canned ACL.
|
|
11108
11112
|
#
|
|
11109
|
-
# # The following example
|
|
11110
|
-
# # enabled, S3 returns version ID in response.
|
|
11113
|
+
# # The following example uploads and object. The request specifies optional canned ACL (access control list) to all READ
|
|
11114
|
+
# # access to authenticated users. If the bucket is versioning enabled, S3 returns version ID in response.
|
|
11111
11115
|
#
|
|
11112
11116
|
# resp = client.put_object({
|
|
11117
|
+
# acl: "authenticated-read",
|
|
11113
11118
|
# body: "filetoupload",
|
|
11114
11119
|
# bucket: "examplebucket",
|
|
11115
11120
|
# key: "exampleobject",
|
|
11116
|
-
# metadata: {
|
|
11117
|
-
# "metadata1" => "value1",
|
|
11118
|
-
# "metadata2" => "value2",
|
|
11119
|
-
# },
|
|
11120
11121
|
# })
|
|
11121
11122
|
#
|
|
11122
11123
|
# resp.to_h outputs the following:
|
|
11123
11124
|
# {
|
|
11124
11125
|
# etag: "\"6805f2cfc46c0f04559748bb039d69ae\"",
|
|
11125
|
-
# version_id: "
|
|
11126
|
+
# version_id: "Kirh.unyZwjQ69YxcQLA8z4F5j3kJJKr",
|
|
11126
11127
|
# }
|
|
11127
11128
|
#
|
|
11128
|
-
# @example Example: To upload an object
|
|
11129
|
+
# @example Example: To upload an object
|
|
11129
11130
|
#
|
|
11130
|
-
# # The following example uploads an object
|
|
11131
|
-
# # S3 returns
|
|
11131
|
+
# # The following example uploads an object to a versioning-enabled bucket. The source file is specified using Windows file
|
|
11132
|
+
# # syntax. S3 returns VersionId of the newly created object.
|
|
11132
11133
|
#
|
|
11133
11134
|
# resp = client.put_object({
|
|
11134
|
-
# body: "
|
|
11135
|
+
# body: "HappyFace.jpg",
|
|
11135
11136
|
# bucket: "examplebucket",
|
|
11136
11137
|
# key: "HappyFace.jpg",
|
|
11137
|
-
# tagging: "key1=value1&key2=value2",
|
|
11138
11138
|
# })
|
|
11139
11139
|
#
|
|
11140
11140
|
# resp.to_h outputs the following:
|
|
11141
11141
|
# {
|
|
11142
11142
|
# etag: "\"6805f2cfc46c0f04559748bb039d69ae\"",
|
|
11143
|
-
# version_id: "
|
|
11143
|
+
# version_id: "tpf3zF08nBplQK1XLOefGskR7mGDwcDk",
|
|
11144
11144
|
# }
|
|
11145
11145
|
#
|
|
11146
11146
|
# @example Streaming a file from disk
|
|
@@ -13566,7 +13566,7 @@ module Aws::S3
|
|
|
13566
13566
|
params: params,
|
|
13567
13567
|
config: config)
|
|
13568
13568
|
context[:gem_name] = 'aws-sdk-s3'
|
|
13569
|
-
context[:gem_version] = '1.
|
|
13569
|
+
context[:gem_version] = '1.88.2'
|
|
13570
13570
|
Seahorse::Client::Request.new(handlers, context)
|
|
13571
13571
|
end
|
|
13572
13572
|
|
|
@@ -480,7 +480,7 @@ module Aws::S3
|
|
|
480
480
|
ResponseContentEncoding = Shapes::StringShape.new(name: 'ResponseContentEncoding')
|
|
481
481
|
ResponseContentLanguage = Shapes::StringShape.new(name: 'ResponseContentLanguage')
|
|
482
482
|
ResponseContentType = Shapes::StringShape.new(name: 'ResponseContentType')
|
|
483
|
-
ResponseExpires = Shapes::TimestampShape.new(name: 'ResponseExpires')
|
|
483
|
+
ResponseExpires = Shapes::TimestampShape.new(name: 'ResponseExpires', timestampFormat: "rfc822")
|
|
484
484
|
Restore = Shapes::StringShape.new(name: 'Restore')
|
|
485
485
|
RestoreObjectOutput = Shapes::StructureShape.new(name: 'RestoreObjectOutput')
|
|
486
486
|
RestoreObjectRequest = Shapes::StructureShape.new(name: 'RestoreObjectRequest')
|
|
@@ -88,18 +88,23 @@ module Aws
|
|
|
88
88
|
# You can pass `virtual_host: true` to use the bucket name as the
|
|
89
89
|
# host name.
|
|
90
90
|
#
|
|
91
|
-
# bucket = s3.bucket('my
|
|
91
|
+
# bucket = s3.bucket('my-bucket.com')
|
|
92
92
|
# bucket.url(virtual_host: true)
|
|
93
|
-
# #=> "http://my
|
|
93
|
+
# #=> "http://my-bucket.com"
|
|
94
94
|
#
|
|
95
95
|
# @option options [Boolean] :virtual_host (false) When `true`,
|
|
96
96
|
# the bucket name will be used as the host name. This is useful
|
|
97
97
|
# when you have a CNAME configured for this bucket.
|
|
98
98
|
#
|
|
99
|
+
# @option options [Boolean] :secure (true) When `false`, http
|
|
100
|
+
# will be used with virtual_host. This is required when
|
|
101
|
+
# the bucket name has a dot (.) in it.
|
|
102
|
+
#
|
|
99
103
|
# @return [String] the URL for this bucket.
|
|
100
104
|
def url(options = {})
|
|
101
105
|
if options[:virtual_host]
|
|
102
|
-
|
|
106
|
+
scheme = options.fetch(:secure, true) ? 'https' : 'http'
|
|
107
|
+
"#{scheme}://#{name}"
|
|
103
108
|
elsif @arn
|
|
104
109
|
Plugins::ARN.resolve_url!(
|
|
105
110
|
client.config.endpoint.dup,
|
|
@@ -201,16 +201,22 @@ module Aws
|
|
|
201
201
|
# s3.bucket('bucket-name').object('obj-key').public_url
|
|
202
202
|
# #=> "https://bucket-name.s3.amazonaws.com/obj-key"
|
|
203
203
|
#
|
|
204
|
-
# To use virtual hosted bucket url
|
|
204
|
+
# To use virtual hosted bucket url.
|
|
205
|
+
# Uses https unless secure: false is set. If the bucket
|
|
206
|
+
# name contains dots (.) then you will need to set secure: false.
|
|
205
207
|
#
|
|
206
|
-
# s3.bucket('my
|
|
208
|
+
# s3.bucket('my-bucket.com').object('key')
|
|
207
209
|
# .public_url(virtual_host: true)
|
|
208
|
-
# #=> "
|
|
210
|
+
# #=> "https://my-bucket.com/key"
|
|
209
211
|
#
|
|
210
212
|
# @option options [Boolean] :virtual_host (false) When `true`, the bucket
|
|
211
213
|
# name will be used as the host name. This is useful when you have
|
|
212
214
|
# a CNAME configured for the bucket.
|
|
213
215
|
#
|
|
216
|
+
# @option options [Boolean] :secure (true) When `false`, http
|
|
217
|
+
# will be used with virtual_host. This is required when
|
|
218
|
+
# the bucket name has a dot (.) in it.
|
|
219
|
+
#
|
|
214
220
|
# @return [String]
|
|
215
221
|
def public_url(options = {})
|
|
216
222
|
url = URI.parse(bucket.url(options))
|
|
@@ -87,9 +87,9 @@ module Aws
|
|
|
87
87
|
' kms+context. Please configure the client with the' \
|
|
88
88
|
' required kms_key_id'
|
|
89
89
|
else
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
raise ArgumentError, 'Unsupported wrap-alg: ' \
|
|
91
|
+
"#{envelope['x-amz-wrap-alg']}"
|
|
92
|
+
end
|
|
93
93
|
iv = decode64(envelope['x-amz-iv'])
|
|
94
94
|
Utils.aes_decryption_cipher(:GCM, key, iv)
|
|
95
95
|
end
|
|
@@ -4,7 +4,6 @@ require 'set'
|
|
|
4
4
|
require 'time'
|
|
5
5
|
require 'openssl'
|
|
6
6
|
require 'cgi'
|
|
7
|
-
require 'webrick/httputils'
|
|
8
7
|
require 'aws-sdk-core/query'
|
|
9
8
|
|
|
10
9
|
module Aws
|
|
@@ -157,33 +156,24 @@ module Aws
|
|
|
157
156
|
end
|
|
158
157
|
|
|
159
158
|
def uri_escape(s)
|
|
160
|
-
|
|
161
159
|
#URI.escape(s)
|
|
162
160
|
|
|
163
|
-
#
|
|
164
|
-
#
|
|
165
|
-
#
|
|
166
|
-
#
|
|
167
|
-
#
|
|
168
|
-
#
|
|
169
|
-
#
|
|
170
|
-
# (
|
|
171
|
-
#
|
|
172
|
-
#
|
|
173
|
-
#
|
|
174
|
-
#
|
|
175
|
-
#
|
|
176
|
-
#
|
|
177
|
-
|
|
178
|
-
# URI.escape(s),
|
|
179
|
-
# ]
|
|
180
|
-
# next if e.uniq.length == 1
|
|
181
|
-
# puts("%5s %5s %5s %5s %5s %5s %5s" % ([s.inspect] + e))
|
|
182
|
-
# }
|
|
183
|
-
#
|
|
184
|
-
WEBrick::HTTPUtils.escape(s).gsub('%5B', '[').gsub('%5D', ']')
|
|
161
|
+
# (0..255).each {|c|
|
|
162
|
+
# s = [c].pack("C")
|
|
163
|
+
# e = [
|
|
164
|
+
# CGI.escape(s),
|
|
165
|
+
# ERB::Util.url_encode(s),
|
|
166
|
+
# URI.encode_www_form_component(s),
|
|
167
|
+
# WEBrick::HTTPUtils.escape_form(s),
|
|
168
|
+
# WEBrick::HTTPUtils.escape(s),
|
|
169
|
+
# URI.escape(s),
|
|
170
|
+
# URI::DEFAULT_PARSER.escape(s)
|
|
171
|
+
# ]
|
|
172
|
+
# next if e.uniq.length == 1
|
|
173
|
+
# puts("%5s %5s %5s %5s %5s %5s %5s %5s" % ([s.inspect] + e))
|
|
174
|
+
# }
|
|
175
|
+
URI::DEFAULT_PARSER.escape(s)
|
|
185
176
|
end
|
|
186
|
-
|
|
187
177
|
end
|
|
188
178
|
end
|
|
189
179
|
end
|
|
@@ -29,7 +29,7 @@ each bucket. [Go here for more information](http://docs.aws.amazon.com/AmazonS3/
|
|
|
29
29
|
OptionHandler, step: :initialize, operations: operations
|
|
30
30
|
)
|
|
31
31
|
handlers.add(
|
|
32
|
-
AccelerateHandler, step: :build, priority:
|
|
32
|
+
AccelerateHandler, step: :build, priority: 11, operations: operations
|
|
33
33
|
)
|
|
34
34
|
end
|
|
35
35
|
|
|
@@ -40,8 +40,11 @@ each bucket. [Go here for more information](http://docs.aws.amazon.com/AmazonS3/
|
|
|
40
40
|
if context.params.is_a?(Hash)
|
|
41
41
|
accelerate = context.params.delete(:use_accelerate_endpoint)
|
|
42
42
|
end
|
|
43
|
-
if accelerate.nil?
|
|
44
|
-
|
|
43
|
+
accelerate = context.config.use_accelerate_endpoint if accelerate.nil?
|
|
44
|
+
# Raise if :endpoint and dualstack are both provided
|
|
45
|
+
if accelerate && !context.config.regional_endpoint
|
|
46
|
+
raise ArgumentError,
|
|
47
|
+
'Cannot use both :use_accelerate_endpoint and :endpoint'
|
|
45
48
|
end
|
|
46
49
|
context[:use_accelerate_endpoint] = accelerate
|
|
47
50
|
@handler.call(context)
|
|
@@ -51,7 +54,7 @@ each bucket. [Go here for more information](http://docs.aws.amazon.com/AmazonS3/
|
|
|
51
54
|
# @api private
|
|
52
55
|
class AccelerateHandler < Seahorse::Client::Handler
|
|
53
56
|
def call(context)
|
|
54
|
-
if context[:use_accelerate_endpoint]
|
|
57
|
+
if context.config.regional_endpoint && context[:use_accelerate_endpoint]
|
|
55
58
|
dualstack = !!context[:use_dualstack_endpoint]
|
|
56
59
|
use_accelerate_endpoint(context, dualstack)
|
|
57
60
|
end
|
|
@@ -22,11 +22,35 @@ be made. Set to `false` to use the client's region instead.
|
|
|
22
22
|
resolve_s3_use_arn_region(cfg)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
+
# param validator is validate:50 (required to add account_id from arn)
|
|
26
|
+
# endpoint is build:90 (populates the URI for the first time)
|
|
27
|
+
# endpoint pattern is build:10 (prefix account id to host)
|
|
25
28
|
def add_handlers(handlers, _config)
|
|
26
|
-
handlers.add(
|
|
29
|
+
handlers.add(ARNHandler, step: :validate, priority: 75)
|
|
30
|
+
handlers.add(UrlHandler)
|
|
27
31
|
end
|
|
28
32
|
|
|
29
|
-
|
|
33
|
+
# After extracting out any ARN input, resolve a new URL with it.
|
|
34
|
+
class UrlHandler < Seahorse::Client::Handler
|
|
35
|
+
def call(context)
|
|
36
|
+
if context.metadata[:s3_arn]
|
|
37
|
+
ARN.resolve_url!(
|
|
38
|
+
context.http_request.endpoint,
|
|
39
|
+
context.metadata[:s3_arn][:arn],
|
|
40
|
+
context.metadata[:s3_arn][:resolved_region],
|
|
41
|
+
context.metadata[:s3_arn][:dualstack],
|
|
42
|
+
# if regional_endpoint is false, a custom endpoint was provided
|
|
43
|
+
# in this case, we want to prefix the endpoint using the ARN
|
|
44
|
+
!context.config.regional_endpoint
|
|
45
|
+
)
|
|
46
|
+
end
|
|
47
|
+
@handler.call(context)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# This plugin will extract out any ARN input and set context for other
|
|
52
|
+
# plugins to use without having to translate the ARN again.
|
|
53
|
+
class ARNHandler < Seahorse::Client::Handler
|
|
30
54
|
def call(context)
|
|
31
55
|
bucket_member = _bucket_member(context.operation.input.shape)
|
|
32
56
|
if bucket_member && (bucket = context.params[bucket_member])
|
|
@@ -38,12 +62,11 @@ be made. Set to `false` to use the client's region instead.
|
|
|
38
62
|
if arn
|
|
39
63
|
validate_config!(context, arn)
|
|
40
64
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
)
|
|
65
|
+
context.metadata[:s3_arn] = {
|
|
66
|
+
arn: arn,
|
|
67
|
+
resolved_region: resolved_region,
|
|
68
|
+
dualstack: extract_dualstack_config!(context)
|
|
69
|
+
}
|
|
47
70
|
end
|
|
48
71
|
end
|
|
49
72
|
@handler.call(context)
|
|
@@ -66,28 +89,22 @@ be made. Set to `false` to use the client's region instead.
|
|
|
66
89
|
end
|
|
67
90
|
|
|
68
91
|
def validate_config!(context, arn)
|
|
69
|
-
unless context.config.regional_endpoint
|
|
70
|
-
raise ArgumentError,
|
|
71
|
-
'Cannot provide both an Access Point ARN and setting '\
|
|
72
|
-
':endpoint.'
|
|
73
|
-
end
|
|
74
|
-
|
|
75
92
|
if context.config.force_path_style
|
|
76
93
|
raise ArgumentError,
|
|
77
|
-
'Cannot provide
|
|
78
|
-
'
|
|
94
|
+
'Cannot provide an Access Point ARN when '\
|
|
95
|
+
'`:force_path_style` is set to true.'
|
|
79
96
|
end
|
|
80
97
|
|
|
81
98
|
if context.config.use_accelerate_endpoint
|
|
82
99
|
raise ArgumentError,
|
|
83
|
-
'Cannot provide
|
|
84
|
-
'
|
|
100
|
+
'Cannot provide an Access Point ARN when '\
|
|
101
|
+
'`:use_accelerate_endpoint` is set to true.'
|
|
85
102
|
end
|
|
86
103
|
|
|
87
104
|
if !arn.support_dualstack? && context[:use_dualstack_endpoint]
|
|
88
105
|
raise ArgumentError,
|
|
89
|
-
'Cannot provide
|
|
90
|
-
'
|
|
106
|
+
'Cannot provide an Outpost Access Point ARN when '\
|
|
107
|
+
'`:use_dualstack_endpoint` is set to true.'
|
|
91
108
|
end
|
|
92
109
|
end
|
|
93
110
|
end
|
|
@@ -116,8 +133,9 @@ be made. Set to `false` to use the client's region instead.
|
|
|
116
133
|
end
|
|
117
134
|
|
|
118
135
|
# @api private
|
|
119
|
-
def resolve_url!(url, arn, region, dualstack = false)
|
|
120
|
-
url.host
|
|
136
|
+
def resolve_url!(url, arn, region, dualstack = false, has_custom_endpoint = false)
|
|
137
|
+
custom_endpoint = url.host if has_custom_endpoint
|
|
138
|
+
url.host = arn.host_url(region, dualstack, custom_endpoint)
|
|
121
139
|
url.path = url_path(url.path, arn)
|
|
122
140
|
url
|
|
123
141
|
end
|
|
@@ -132,9 +150,9 @@ be made. Set to `false` to use the client's region instead.
|
|
|
132
150
|
# Raise if provided value is not true or false
|
|
133
151
|
if value.nil?
|
|
134
152
|
raise ArgumentError,
|
|
135
|
-
'Must provide either `true` or `false` for '\
|
|
136
|
-
's3_use_arn_region profile option or for '\
|
|
137
|
-
"ENV['AWS_S3_USE_ARN_REGION']"
|
|
153
|
+
'Must provide either `true` or `false` for the '\
|
|
154
|
+
'`s3_use_arn_region` profile option or for '\
|
|
155
|
+
"ENV['AWS_S3_USE_ARN_REGION']."
|
|
138
156
|
end
|
|
139
157
|
value
|
|
140
158
|
end
|
|
@@ -163,7 +181,7 @@ be made. Set to `false` to use the client's region instead.
|
|
|
163
181
|
if !fips && !use_arn_region && region.include?('fips')
|
|
164
182
|
raise ArgumentError,
|
|
165
183
|
'FIPS client regions are not supported for this type of '\
|
|
166
|
-
'ARN without s3_use_arn_region
|
|
184
|
+
'ARN without `:s3_use_arn_region`.'
|
|
167
185
|
end
|
|
168
186
|
|
|
169
187
|
# if it's a fips region, attempt to normalize it
|
|
@@ -16,16 +16,22 @@ for all operations.
|
|
|
16
16
|
|
|
17
17
|
def add_handlers(handlers, config)
|
|
18
18
|
handlers.add(OptionHandler, step: :initialize)
|
|
19
|
-
handlers.add(DualstackHandler, step: :build, priority:
|
|
19
|
+
handlers.add(DualstackHandler, step: :build, priority: 11)
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
# @api private
|
|
23
23
|
class OptionHandler < Seahorse::Client::Handler
|
|
24
24
|
def call(context)
|
|
25
|
+
# Support client configuration and per-operation configuration
|
|
25
26
|
if context.params.is_a?(Hash)
|
|
26
27
|
dualstack = context.params.delete(:use_dualstack_endpoint)
|
|
27
28
|
end
|
|
28
29
|
dualstack = context.config.use_dualstack_endpoint if dualstack.nil?
|
|
30
|
+
# Raise if :endpoint and dualstack are both provided
|
|
31
|
+
if dualstack && !context.config.regional_endpoint
|
|
32
|
+
raise ArgumentError,
|
|
33
|
+
'Cannot use both :use_dualstack_endpoint and :endpoint'
|
|
34
|
+
end
|
|
29
35
|
context[:use_dualstack_endpoint] = dualstack
|
|
30
36
|
@handler.call(context)
|
|
31
37
|
end
|
|
@@ -34,7 +40,9 @@ for all operations.
|
|
|
34
40
|
# @api private
|
|
35
41
|
class DualstackHandler < Seahorse::Client::Handler
|
|
36
42
|
def call(context)
|
|
37
|
-
|
|
43
|
+
if context.config.regional_endpoint && use_dualstack_endpoint?(context)
|
|
44
|
+
apply_dualstack_endpoint(context)
|
|
45
|
+
end
|
|
38
46
|
@handler.call(context)
|
|
39
47
|
end
|
|
40
48
|
|
|
@@ -42,7 +50,6 @@ for all operations.
|
|
|
42
50
|
def apply_dualstack_endpoint(context)
|
|
43
51
|
bucket_name = context.params[:bucket]
|
|
44
52
|
region = context.config.region
|
|
45
|
-
context.config.force_path_style
|
|
46
53
|
dns_suffix = Aws::Partitions::EndpointProvider.dns_suffix_for(region)
|
|
47
54
|
|
|
48
55
|
if use_bucket_dns?(bucket_name, context)
|
|
@@ -15,7 +15,8 @@ module Aws
|
|
|
15
15
|
class Handler < Seahorse::Client::Handler
|
|
16
16
|
|
|
17
17
|
def call(context)
|
|
18
|
-
|
|
18
|
+
body = context.http_request.body
|
|
19
|
+
if body.respond_to?(:size) && body.size > 0
|
|
19
20
|
context.http_request.headers['expect'] = '100-continue'
|
|
20
21
|
end
|
|
21
22
|
@handler.call(context)
|
|
@@ -17,7 +17,8 @@ region. Defaults to `legacy` mode using global endpoint.
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def add_handlers(handlers, config)
|
|
20
|
-
|
|
20
|
+
# only modify non-custom endpoints
|
|
21
|
+
if config.regional_endpoint && config.region == 'us-east-1'
|
|
21
22
|
handlers.add(Handler)
|
|
22
23
|
end
|
|
23
24
|
end
|
|
@@ -29,9 +30,8 @@ region. Defaults to `legacy` mode using global endpoint.
|
|
|
29
30
|
# keep legacy global endpoint pattern by default
|
|
30
31
|
if context.config.s3_us_east_1_regional_endpoint == 'legacy'
|
|
31
32
|
host = context.http_request.endpoint.host
|
|
32
|
-
# if it's an ARN
|
|
33
|
-
|
|
34
|
-
unless host.include?('.s3-outposts.') || host.include?('.s3-accesspoint.')
|
|
33
|
+
# if it's an ARN then don't touch the endpoint at all
|
|
34
|
+
unless context.metadata[:s3_arn]
|
|
35
35
|
legacy_host = IADRegionalEndpoint.legacy_host(host)
|
|
36
36
|
context.http_request.endpoint.host = legacy_host
|
|
37
37
|
end
|
|
@@ -73,22 +73,14 @@ module Aws
|
|
|
73
73
|
region: context[:cached_sigv4_region],
|
|
74
74
|
credentials: context.config.credentials
|
|
75
75
|
)
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
context.config.
|
|
76
|
+
elsif (arn = context.metadata[:s3_arn])
|
|
77
|
+
S3Signer.build_v4_signer(
|
|
78
|
+
service: arn[:arn].service,
|
|
79
|
+
region: arn[:resolved_region],
|
|
80
|
+
credentials: context.config.credentials
|
|
81
81
|
)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
S3Signer.build_v4_signer(
|
|
85
|
-
service: arn.service,
|
|
86
|
-
region: resolved_region,
|
|
87
|
-
credentials: context.config.credentials
|
|
88
|
-
)
|
|
89
|
-
else
|
|
90
|
-
context.config.sigv4_signer
|
|
91
|
-
end
|
|
82
|
+
else
|
|
83
|
+
context.config.sigv4_signer
|
|
92
84
|
end
|
|
93
85
|
end
|
|
94
86
|
end
|
|
@@ -173,10 +165,14 @@ module Aws
|
|
|
173
165
|
context, actual_region
|
|
174
166
|
)
|
|
175
167
|
context.metadata[:redirect_region] = actual_region
|
|
168
|
+
# if it's an ARN, use the service in the ARN
|
|
169
|
+
if (arn = context.metadata[:s3_arn])
|
|
170
|
+
service = arn[:arn].service
|
|
171
|
+
end
|
|
176
172
|
Aws::Plugins::SignatureV4.apply_signature(
|
|
177
173
|
context: context,
|
|
178
174
|
signer: S3Signer.build_v4_signer(
|
|
179
|
-
service: 's3',
|
|
175
|
+
service: service || 's3',
|
|
180
176
|
region: actual_region,
|
|
181
177
|
credentials: context.config.credentials
|
|
182
178
|
)
|
|
@@ -219,20 +215,16 @@ module Aws
|
|
|
219
215
|
)
|
|
220
216
|
end
|
|
221
217
|
|
|
218
|
+
# Check to see if the bucket is actually an ARN
|
|
219
|
+
# Otherwise it will retry with the ARN as the bucket name.
|
|
222
220
|
def new_hostname(context, region)
|
|
223
|
-
# Check to see if the bucket is actually an ARN and resolve it
|
|
224
|
-
# Otherwise it will retry with the ARN as the bucket name.
|
|
225
|
-
resolved_region, arn = ARN.resolve_arn!(
|
|
226
|
-
context.params[:bucket],
|
|
227
|
-
region,
|
|
228
|
-
context.config.s3_use_arn_region
|
|
229
|
-
)
|
|
230
221
|
uri = URI.parse(
|
|
231
|
-
Aws::Partitions::EndpointProvider.resolve(
|
|
222
|
+
Aws::Partitions::EndpointProvider.resolve(region, 's3')
|
|
232
223
|
)
|
|
233
224
|
|
|
234
|
-
if arn
|
|
235
|
-
ARN
|
|
225
|
+
if (arn = context.metadata[:s3_arn])
|
|
226
|
+
# Retry with the response region and not the ARN resolved one
|
|
227
|
+
ARN.resolve_url!(uri, arn[:arn], region).host
|
|
236
228
|
else
|
|
237
229
|
"#{context.params[:bucket]}.#{uri.host}"
|
|
238
230
|
end
|
data/lib/aws-sdk-s3/presigner.rb
CHANGED
|
@@ -58,8 +58,7 @@ module Aws
|
|
|
58
58
|
# is returned instead of the default HTTPS URL.
|
|
59
59
|
#
|
|
60
60
|
# @option params [Boolean] :virtual_host (false) When `true`, the
|
|
61
|
-
# bucket name will be used as the hostname.
|
|
62
|
-
# the returned URL to be 'http' and not 'https'.
|
|
61
|
+
# bucket name will be used as the hostname.
|
|
63
62
|
#
|
|
64
63
|
# @option params [Boolean] :use_accelerate_endpoint (false) When `true`,
|
|
65
64
|
# Presigner will attempt to use accelerated endpoint.
|
|
@@ -196,8 +195,6 @@ module Aws
|
|
|
196
195
|
req.handlers.remove(Aws::S3::Plugins::S3Signer::V4Handler)
|
|
197
196
|
req.handlers.remove(Seahorse::Client::Plugins::ContentLength::Handler)
|
|
198
197
|
|
|
199
|
-
signer = build_signer(req.context, unsigned_headers)
|
|
200
|
-
|
|
201
198
|
req.handle(step: :send) do |context|
|
|
202
199
|
if scheme != http_req.endpoint.scheme
|
|
203
200
|
endpoint = http_req.endpoint.dup
|
|
@@ -222,6 +219,20 @@ module Aws
|
|
|
222
219
|
end
|
|
223
220
|
http_req.endpoint.query = query.join('&') unless query.empty?
|
|
224
221
|
|
|
222
|
+
# If it's an ARN, get the resolved region and service
|
|
223
|
+
if (arn = context.metadata[:s3_arn])
|
|
224
|
+
region = arn[:resolved_region]
|
|
225
|
+
service = arn[:arn].service
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
signer = Aws::Sigv4::Signer.new(
|
|
229
|
+
service: service || 's3',
|
|
230
|
+
region: region || context.config.region,
|
|
231
|
+
credentials_provider: context.config.credentials,
|
|
232
|
+
unsigned_headers: unsigned_headers,
|
|
233
|
+
uri_escape_path: false
|
|
234
|
+
)
|
|
235
|
+
|
|
225
236
|
url = signer.presign_url(
|
|
226
237
|
http_method: http_req.http_method,
|
|
227
238
|
url: http_req.endpoint,
|
|
@@ -239,29 +250,6 @@ module Aws
|
|
|
239
250
|
# Return the headers
|
|
240
251
|
x_amz_headers
|
|
241
252
|
end
|
|
242
|
-
|
|
243
|
-
def build_signer(context, unsigned_headers)
|
|
244
|
-
signer_opts = {
|
|
245
|
-
service: 's3',
|
|
246
|
-
region: context.config.region,
|
|
247
|
-
credentials_provider: context.config.credentials,
|
|
248
|
-
unsigned_headers: unsigned_headers,
|
|
249
|
-
uri_escape_path: false
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
resolved_region, arn = Aws::S3::Plugins::ARN.resolve_arn!(
|
|
253
|
-
context.params[:bucket],
|
|
254
|
-
context.config.sigv4_signer.region,
|
|
255
|
-
context.config.s3_use_arn_region
|
|
256
|
-
)
|
|
257
|
-
|
|
258
|
-
if arn
|
|
259
|
-
signer_opts[:region] = resolved_region
|
|
260
|
-
signer_opts[:service] = arn.service
|
|
261
|
-
end
|
|
262
|
-
|
|
263
|
-
Aws::Sigv4::Signer.new(signer_opts)
|
|
264
|
-
end
|
|
265
253
|
end
|
|
266
254
|
end
|
|
267
255
|
end
|
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.88.2
|
|
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:
|
|
11
|
+
date: 2021-02-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: aws-sdk-kms
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '1
|
|
19
|
+
version: '1'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '1
|
|
26
|
+
version: '1'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: aws-sigv4
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -47,7 +47,7 @@ dependencies:
|
|
|
47
47
|
version: '3'
|
|
48
48
|
- - ">="
|
|
49
49
|
- !ruby/object:Gem::Version
|
|
50
|
-
version: 3.
|
|
50
|
+
version: 3.112.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.112.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:
|