aws-sdk-s3 1.21.0 → 1.117.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +930 -0
- data/LICENSE.txt +202 -0
- data/VERSION +1 -0
- data/lib/aws-sdk-s3/bucket.rb +393 -75
- data/lib/aws-sdk-s3/bucket_acl.rb +57 -14
- data/lib/aws-sdk-s3/bucket_cors.rb +67 -13
- data/lib/aws-sdk-s3/bucket_lifecycle.rb +54 -15
- data/lib/aws-sdk-s3/bucket_lifecycle_configuration.rb +56 -15
- data/lib/aws-sdk-s3/bucket_logging.rb +52 -15
- data/lib/aws-sdk-s3/bucket_notification.rb +47 -17
- data/lib/aws-sdk-s3/bucket_policy.rb +51 -13
- data/lib/aws-sdk-s3/bucket_region_cache.rb +2 -0
- data/lib/aws-sdk-s3/bucket_request_payment.rb +51 -12
- data/lib/aws-sdk-s3/bucket_tagging.rb +59 -13
- data/lib/aws-sdk-s3/bucket_versioning.rb +118 -12
- data/lib/aws-sdk-s3/bucket_website.rb +66 -13
- data/lib/aws-sdk-s3/client.rb +11422 -2518
- data/lib/aws-sdk-s3/client_api.rb +1196 -155
- data/lib/aws-sdk-s3/customizations/bucket.rb +53 -36
- data/lib/aws-sdk-s3/customizations/multipart_upload.rb +2 -0
- data/lib/aws-sdk-s3/customizations/object.rb +200 -62
- data/lib/aws-sdk-s3/customizations/object_summary.rb +5 -0
- data/lib/aws-sdk-s3/customizations/types/list_object_versions_output.rb +2 -0
- data/lib/aws-sdk-s3/customizations.rb +4 -1
- data/lib/aws-sdk-s3/encryption/client.rb +23 -6
- data/lib/aws-sdk-s3/encryption/decrypt_handler.rb +71 -29
- data/lib/aws-sdk-s3/encryption/default_cipher_provider.rb +43 -5
- data/lib/aws-sdk-s3/encryption/default_key_provider.rb +2 -0
- data/lib/aws-sdk-s3/encryption/encrypt_handler.rb +13 -2
- data/lib/aws-sdk-s3/encryption/errors.rb +2 -0
- data/lib/aws-sdk-s3/encryption/io_auth_decrypter.rb +11 -3
- data/lib/aws-sdk-s3/encryption/io_decrypter.rb +11 -3
- data/lib/aws-sdk-s3/encryption/io_encrypter.rb +2 -0
- data/lib/aws-sdk-s3/encryption/key_provider.rb +2 -0
- data/lib/aws-sdk-s3/encryption/kms_cipher_provider.rb +34 -3
- data/lib/aws-sdk-s3/encryption/materials.rb +8 -6
- data/lib/aws-sdk-s3/encryption/utils.rb +25 -0
- data/lib/aws-sdk-s3/encryption.rb +4 -0
- data/lib/aws-sdk-s3/encryptionV2/client.rb +566 -0
- data/lib/aws-sdk-s3/encryptionV2/decrypt_handler.rb +222 -0
- data/lib/aws-sdk-s3/encryptionV2/default_cipher_provider.rb +170 -0
- data/lib/aws-sdk-s3/encryptionV2/default_key_provider.rb +40 -0
- data/lib/aws-sdk-s3/encryptionV2/encrypt_handler.rb +65 -0
- data/lib/aws-sdk-s3/encryptionV2/errors.rb +37 -0
- data/lib/aws-sdk-s3/encryptionV2/io_auth_decrypter.rb +58 -0
- data/lib/aws-sdk-s3/encryptionV2/io_decrypter.rb +37 -0
- data/lib/aws-sdk-s3/encryptionV2/io_encrypter.rb +73 -0
- data/lib/aws-sdk-s3/encryptionV2/key_provider.rb +31 -0
- data/lib/aws-sdk-s3/encryptionV2/kms_cipher_provider.rb +169 -0
- data/lib/aws-sdk-s3/encryptionV2/materials.rb +60 -0
- data/lib/aws-sdk-s3/encryptionV2/utils.rb +103 -0
- data/lib/aws-sdk-s3/encryption_v2.rb +23 -0
- data/lib/aws-sdk-s3/endpoint_parameters.rb +142 -0
- data/lib/aws-sdk-s3/endpoint_provider.rb +2020 -0
- data/lib/aws-sdk-s3/endpoints.rb +2149 -0
- data/lib/aws-sdk-s3/errors.rb +123 -1
- data/lib/aws-sdk-s3/event_streams.rb +20 -7
- data/lib/aws-sdk-s3/file_downloader.rb +17 -10
- data/lib/aws-sdk-s3/file_part.rb +11 -6
- data/lib/aws-sdk-s3/file_uploader.rb +33 -14
- data/lib/aws-sdk-s3/legacy_signer.rb +17 -25
- data/lib/aws-sdk-s3/multipart_file_uploader.rb +78 -19
- data/lib/aws-sdk-s3/multipart_stream_uploader.rb +54 -15
- data/lib/aws-sdk-s3/multipart_upload.rb +178 -28
- data/lib/aws-sdk-s3/multipart_upload_error.rb +2 -0
- data/lib/aws-sdk-s3/multipart_upload_part.rb +237 -44
- data/lib/aws-sdk-s3/object.rb +897 -154
- data/lib/aws-sdk-s3/object_acl.rb +81 -20
- data/lib/aws-sdk-s3/object_copier.rb +2 -0
- data/lib/aws-sdk-s3/object_multipart_copier.rb +2 -0
- data/lib/aws-sdk-s3/object_summary.rb +649 -139
- data/lib/aws-sdk-s3/object_version.rb +167 -65
- data/lib/aws-sdk-s3/plugins/accelerate.rb +17 -64
- data/lib/aws-sdk-s3/plugins/arn.rb +70 -0
- data/lib/aws-sdk-s3/plugins/bucket_dns.rb +7 -43
- data/lib/aws-sdk-s3/plugins/bucket_name_restrictions.rb +20 -3
- data/lib/aws-sdk-s3/plugins/dualstack.rb +7 -50
- data/lib/aws-sdk-s3/plugins/endpoints.rb +262 -0
- data/lib/aws-sdk-s3/plugins/expect_100_continue.rb +5 -4
- data/lib/aws-sdk-s3/plugins/get_bucket_location_fix.rb +3 -1
- data/lib/aws-sdk-s3/plugins/http_200_errors.rb +11 -3
- data/lib/aws-sdk-s3/plugins/iad_regional_endpoint.rb +44 -0
- data/lib/aws-sdk-s3/plugins/location_constraint.rb +2 -0
- data/lib/aws-sdk-s3/plugins/md5s.rb +34 -27
- data/lib/aws-sdk-s3/plugins/redirects.rb +2 -0
- data/lib/aws-sdk-s3/plugins/s3_host_id.rb +2 -0
- data/lib/aws-sdk-s3/plugins/s3_signer.rb +55 -92
- data/lib/aws-sdk-s3/plugins/skip_whole_multipart_get_checksums.rb +31 -0
- data/lib/aws-sdk-s3/plugins/sse_cpk.rb +3 -1
- data/lib/aws-sdk-s3/plugins/streaming_retry.rb +139 -0
- data/lib/aws-sdk-s3/plugins/url_encoded_keys.rb +2 -0
- data/lib/aws-sdk-s3/presigned_post.rb +108 -56
- data/lib/aws-sdk-s3/presigner.rb +169 -77
- data/lib/aws-sdk-s3/resource.rb +45 -5
- data/lib/aws-sdk-s3/types.rb +8564 -3891
- data/lib/aws-sdk-s3/waiters.rb +67 -1
- data/lib/aws-sdk-s3.rb +16 -6
- metadata +37 -13
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Aws
|
2
4
|
module S3
|
3
5
|
module Plugins
|
@@ -5,14 +7,29 @@ module Aws
|
|
5
7
|
class BucketNameRestrictions < Seahorse::Client::Plugin
|
6
8
|
class Handler < Seahorse::Client::Handler
|
7
9
|
|
10
|
+
# Useful because Aws::S3::Errors::SignatureDoesNotMatch is thrown
|
11
|
+
# when passed a bucket with a forward slash. Instead provide a more
|
12
|
+
# helpful error. Ideally should not be a plugin?
|
8
13
|
def call(context)
|
9
|
-
|
10
|
-
|
11
|
-
|
14
|
+
bucket_member = _bucket_member(context.operation.input.shape)
|
15
|
+
if bucket_member && (bucket = context.params[bucket_member])
|
16
|
+
if !Aws::ARNParser.arn?(bucket) && bucket.include?('/')
|
17
|
+
raise ArgumentError,
|
18
|
+
'bucket name must not contain a forward-slash (/)'
|
19
|
+
end
|
12
20
|
end
|
13
21
|
@handler.call(context)
|
14
22
|
end
|
15
23
|
|
24
|
+
private
|
25
|
+
|
26
|
+
def _bucket_member(input)
|
27
|
+
input.members.each do |member, ref|
|
28
|
+
return member if ref.shape.name == 'BucketName'
|
29
|
+
end
|
30
|
+
nil
|
31
|
+
end
|
32
|
+
|
16
33
|
end
|
17
34
|
|
18
35
|
handler(Handler)
|
@@ -1,69 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Aws
|
2
4
|
module S3
|
3
5
|
module Plugins
|
4
6
|
# @api private
|
5
7
|
class Dualstack < Seahorse::Client::Plugin
|
6
|
-
|
7
|
-
option(:use_dualstack_endpoint,
|
8
|
-
default: false,
|
9
|
-
doc_type: 'Boolean',
|
10
|
-
docstring: <<-DOCS)
|
11
|
-
When set to `true`, IPv6-compatible bucket endpoints will be used
|
12
|
-
for all operations.
|
13
|
-
DOCS
|
14
|
-
|
15
|
-
def add_handlers(handlers, config)
|
8
|
+
def add_handlers(handlers, _config)
|
16
9
|
handlers.add(OptionHandler, step: :initialize)
|
17
|
-
handlers.add(DualstackHandler, step: :build, priority: 0)
|
18
10
|
end
|
19
11
|
|
20
12
|
# @api private
|
21
13
|
class OptionHandler < Seahorse::Client::Handler
|
22
14
|
def call(context)
|
23
|
-
|
15
|
+
# Support client configuration and per-operation configuration
|
16
|
+
if context.params.is_a?(Hash)
|
17
|
+
dualstack = context.params.delete(:use_dualstack_endpoint)
|
18
|
+
end
|
24
19
|
dualstack = context.config.use_dualstack_endpoint if dualstack.nil?
|
25
20
|
context[:use_dualstack_endpoint] = dualstack
|
26
21
|
@handler.call(context)
|
27
22
|
end
|
28
23
|
end
|
29
|
-
|
30
|
-
# @api private
|
31
|
-
class DualstackHandler < Seahorse::Client::Handler
|
32
|
-
def call(context)
|
33
|
-
apply_dualstack_endpoint(context) if use_dualstack_endpoint?(context)
|
34
|
-
@handler.call(context)
|
35
|
-
end
|
36
|
-
|
37
|
-
private
|
38
|
-
def apply_dualstack_endpoint(context)
|
39
|
-
bucket_name = context.params[:bucket]
|
40
|
-
region = context.config.region
|
41
|
-
context.config.force_path_style
|
42
|
-
dns_suffix = Aws::Partitions::EndpointProvider.dns_suffix_for(region)
|
43
|
-
|
44
|
-
if use_bucket_dns?(bucket_name, context)
|
45
|
-
host = "#{bucket_name}.s3.dualstack.#{region}.#{dns_suffix}"
|
46
|
-
else
|
47
|
-
host = "s3.dualstack.#{region}.#{dns_suffix}"
|
48
|
-
end
|
49
|
-
endpoint = URI.parse(context.http_request.endpoint.to_s)
|
50
|
-
endpoint.scheme = context.http_request.endpoint.scheme
|
51
|
-
endpoint.port = context.http_request.endpoint.port
|
52
|
-
endpoint.host = host
|
53
|
-
context.http_request.endpoint = endpoint.to_s
|
54
|
-
end
|
55
|
-
|
56
|
-
def use_bucket_dns?(bucket_name, context)
|
57
|
-
ssl = context.http_request.endpoint.scheme == "https"
|
58
|
-
bucket_name && BucketDns.dns_compatible?(bucket_name, ssl) &&
|
59
|
-
!context.config.force_path_style
|
60
|
-
end
|
61
|
-
|
62
|
-
def use_dualstack_endpoint?(context)
|
63
|
-
context[:use_dualstack_endpoint] && !context[:use_accelerate_endpoint]
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
24
|
end
|
68
25
|
end
|
69
26
|
end
|
@@ -0,0 +1,262 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# WARNING ABOUT GENERATED CODE
|
4
|
+
#
|
5
|
+
# This file is generated. See the contributing guide for more information:
|
6
|
+
# https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
|
7
|
+
#
|
8
|
+
# WARNING ABOUT GENERATED CODE
|
9
|
+
|
10
|
+
|
11
|
+
module Aws::S3
|
12
|
+
module Plugins
|
13
|
+
class Endpoints < Seahorse::Client::Plugin
|
14
|
+
option(
|
15
|
+
:endpoint_provider,
|
16
|
+
doc_type: 'Aws::S3::EndpointProvider',
|
17
|
+
docstring: 'The endpoint provider used to resolve endpoints. Any '\
|
18
|
+
'object that responds to `#resolve_endpoint(parameters)` '\
|
19
|
+
'where `parameters` is a Struct similar to '\
|
20
|
+
'`Aws::S3::EndpointParameters`'
|
21
|
+
) do |cfg|
|
22
|
+
Aws::S3::EndpointProvider.new
|
23
|
+
end
|
24
|
+
|
25
|
+
# @api private
|
26
|
+
class Handler < Seahorse::Client::Handler
|
27
|
+
def call(context)
|
28
|
+
# If endpoint was discovered, do not resolve or apply the endpoint.
|
29
|
+
unless context[:discovered_endpoint]
|
30
|
+
params = parameters_for_operation(context)
|
31
|
+
endpoint = context.config.endpoint_provider.resolve_endpoint(params)
|
32
|
+
|
33
|
+
context.http_request.endpoint = endpoint.url
|
34
|
+
apply_endpoint_headers(context, endpoint.headers)
|
35
|
+
end
|
36
|
+
|
37
|
+
context[:endpoint_params] = params
|
38
|
+
context[:auth_scheme] =
|
39
|
+
Aws::Endpoints.resolve_auth_scheme(context, endpoint)
|
40
|
+
|
41
|
+
@handler.call(context)
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def apply_endpoint_headers(context, headers)
|
47
|
+
headers.each do |key, values|
|
48
|
+
value = values
|
49
|
+
.compact
|
50
|
+
.map { |s| Seahorse::Util.escape_header_list_string(s.to_s) }
|
51
|
+
.join(',')
|
52
|
+
|
53
|
+
context.http_request.headers[key] = value
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def parameters_for_operation(context)
|
58
|
+
case context.operation_name
|
59
|
+
when :abort_multipart_upload
|
60
|
+
Aws::S3::Endpoints::AbortMultipartUpload.build(context)
|
61
|
+
when :complete_multipart_upload
|
62
|
+
Aws::S3::Endpoints::CompleteMultipartUpload.build(context)
|
63
|
+
when :copy_object
|
64
|
+
Aws::S3::Endpoints::CopyObject.build(context)
|
65
|
+
when :create_bucket
|
66
|
+
Aws::S3::Endpoints::CreateBucket.build(context)
|
67
|
+
when :create_multipart_upload
|
68
|
+
Aws::S3::Endpoints::CreateMultipartUpload.build(context)
|
69
|
+
when :delete_bucket
|
70
|
+
Aws::S3::Endpoints::DeleteBucket.build(context)
|
71
|
+
when :delete_bucket_analytics_configuration
|
72
|
+
Aws::S3::Endpoints::DeleteBucketAnalyticsConfiguration.build(context)
|
73
|
+
when :delete_bucket_cors
|
74
|
+
Aws::S3::Endpoints::DeleteBucketCors.build(context)
|
75
|
+
when :delete_bucket_encryption
|
76
|
+
Aws::S3::Endpoints::DeleteBucketEncryption.build(context)
|
77
|
+
when :delete_bucket_intelligent_tiering_configuration
|
78
|
+
Aws::S3::Endpoints::DeleteBucketIntelligentTieringConfiguration.build(context)
|
79
|
+
when :delete_bucket_inventory_configuration
|
80
|
+
Aws::S3::Endpoints::DeleteBucketInventoryConfiguration.build(context)
|
81
|
+
when :delete_bucket_lifecycle
|
82
|
+
Aws::S3::Endpoints::DeleteBucketLifecycle.build(context)
|
83
|
+
when :delete_bucket_metrics_configuration
|
84
|
+
Aws::S3::Endpoints::DeleteBucketMetricsConfiguration.build(context)
|
85
|
+
when :delete_bucket_ownership_controls
|
86
|
+
Aws::S3::Endpoints::DeleteBucketOwnershipControls.build(context)
|
87
|
+
when :delete_bucket_policy
|
88
|
+
Aws::S3::Endpoints::DeleteBucketPolicy.build(context)
|
89
|
+
when :delete_bucket_replication
|
90
|
+
Aws::S3::Endpoints::DeleteBucketReplication.build(context)
|
91
|
+
when :delete_bucket_tagging
|
92
|
+
Aws::S3::Endpoints::DeleteBucketTagging.build(context)
|
93
|
+
when :delete_bucket_website
|
94
|
+
Aws::S3::Endpoints::DeleteBucketWebsite.build(context)
|
95
|
+
when :delete_object
|
96
|
+
Aws::S3::Endpoints::DeleteObject.build(context)
|
97
|
+
when :delete_object_tagging
|
98
|
+
Aws::S3::Endpoints::DeleteObjectTagging.build(context)
|
99
|
+
when :delete_objects
|
100
|
+
Aws::S3::Endpoints::DeleteObjects.build(context)
|
101
|
+
when :delete_public_access_block
|
102
|
+
Aws::S3::Endpoints::DeletePublicAccessBlock.build(context)
|
103
|
+
when :get_bucket_accelerate_configuration
|
104
|
+
Aws::S3::Endpoints::GetBucketAccelerateConfiguration.build(context)
|
105
|
+
when :get_bucket_acl
|
106
|
+
Aws::S3::Endpoints::GetBucketAcl.build(context)
|
107
|
+
when :get_bucket_analytics_configuration
|
108
|
+
Aws::S3::Endpoints::GetBucketAnalyticsConfiguration.build(context)
|
109
|
+
when :get_bucket_cors
|
110
|
+
Aws::S3::Endpoints::GetBucketCors.build(context)
|
111
|
+
when :get_bucket_encryption
|
112
|
+
Aws::S3::Endpoints::GetBucketEncryption.build(context)
|
113
|
+
when :get_bucket_intelligent_tiering_configuration
|
114
|
+
Aws::S3::Endpoints::GetBucketIntelligentTieringConfiguration.build(context)
|
115
|
+
when :get_bucket_inventory_configuration
|
116
|
+
Aws::S3::Endpoints::GetBucketInventoryConfiguration.build(context)
|
117
|
+
when :get_bucket_lifecycle
|
118
|
+
Aws::S3::Endpoints::GetBucketLifecycle.build(context)
|
119
|
+
when :get_bucket_lifecycle_configuration
|
120
|
+
Aws::S3::Endpoints::GetBucketLifecycleConfiguration.build(context)
|
121
|
+
when :get_bucket_location
|
122
|
+
Aws::S3::Endpoints::GetBucketLocation.build(context)
|
123
|
+
when :get_bucket_logging
|
124
|
+
Aws::S3::Endpoints::GetBucketLogging.build(context)
|
125
|
+
when :get_bucket_metrics_configuration
|
126
|
+
Aws::S3::Endpoints::GetBucketMetricsConfiguration.build(context)
|
127
|
+
when :get_bucket_notification
|
128
|
+
Aws::S3::Endpoints::GetBucketNotification.build(context)
|
129
|
+
when :get_bucket_notification_configuration
|
130
|
+
Aws::S3::Endpoints::GetBucketNotificationConfiguration.build(context)
|
131
|
+
when :get_bucket_ownership_controls
|
132
|
+
Aws::S3::Endpoints::GetBucketOwnershipControls.build(context)
|
133
|
+
when :get_bucket_policy
|
134
|
+
Aws::S3::Endpoints::GetBucketPolicy.build(context)
|
135
|
+
when :get_bucket_policy_status
|
136
|
+
Aws::S3::Endpoints::GetBucketPolicyStatus.build(context)
|
137
|
+
when :get_bucket_replication
|
138
|
+
Aws::S3::Endpoints::GetBucketReplication.build(context)
|
139
|
+
when :get_bucket_request_payment
|
140
|
+
Aws::S3::Endpoints::GetBucketRequestPayment.build(context)
|
141
|
+
when :get_bucket_tagging
|
142
|
+
Aws::S3::Endpoints::GetBucketTagging.build(context)
|
143
|
+
when :get_bucket_versioning
|
144
|
+
Aws::S3::Endpoints::GetBucketVersioning.build(context)
|
145
|
+
when :get_bucket_website
|
146
|
+
Aws::S3::Endpoints::GetBucketWebsite.build(context)
|
147
|
+
when :get_object
|
148
|
+
Aws::S3::Endpoints::GetObject.build(context)
|
149
|
+
when :get_object_acl
|
150
|
+
Aws::S3::Endpoints::GetObjectAcl.build(context)
|
151
|
+
when :get_object_attributes
|
152
|
+
Aws::S3::Endpoints::GetObjectAttributes.build(context)
|
153
|
+
when :get_object_legal_hold
|
154
|
+
Aws::S3::Endpoints::GetObjectLegalHold.build(context)
|
155
|
+
when :get_object_lock_configuration
|
156
|
+
Aws::S3::Endpoints::GetObjectLockConfiguration.build(context)
|
157
|
+
when :get_object_retention
|
158
|
+
Aws::S3::Endpoints::GetObjectRetention.build(context)
|
159
|
+
when :get_object_tagging
|
160
|
+
Aws::S3::Endpoints::GetObjectTagging.build(context)
|
161
|
+
when :get_object_torrent
|
162
|
+
Aws::S3::Endpoints::GetObjectTorrent.build(context)
|
163
|
+
when :get_public_access_block
|
164
|
+
Aws::S3::Endpoints::GetPublicAccessBlock.build(context)
|
165
|
+
when :head_bucket
|
166
|
+
Aws::S3::Endpoints::HeadBucket.build(context)
|
167
|
+
when :head_object
|
168
|
+
Aws::S3::Endpoints::HeadObject.build(context)
|
169
|
+
when :list_bucket_analytics_configurations
|
170
|
+
Aws::S3::Endpoints::ListBucketAnalyticsConfigurations.build(context)
|
171
|
+
when :list_bucket_intelligent_tiering_configurations
|
172
|
+
Aws::S3::Endpoints::ListBucketIntelligentTieringConfigurations.build(context)
|
173
|
+
when :list_bucket_inventory_configurations
|
174
|
+
Aws::S3::Endpoints::ListBucketInventoryConfigurations.build(context)
|
175
|
+
when :list_bucket_metrics_configurations
|
176
|
+
Aws::S3::Endpoints::ListBucketMetricsConfigurations.build(context)
|
177
|
+
when :list_buckets
|
178
|
+
Aws::S3::Endpoints::ListBuckets.build(context)
|
179
|
+
when :list_multipart_uploads
|
180
|
+
Aws::S3::Endpoints::ListMultipartUploads.build(context)
|
181
|
+
when :list_object_versions
|
182
|
+
Aws::S3::Endpoints::ListObjectVersions.build(context)
|
183
|
+
when :list_objects
|
184
|
+
Aws::S3::Endpoints::ListObjects.build(context)
|
185
|
+
when :list_objects_v2
|
186
|
+
Aws::S3::Endpoints::ListObjectsV2.build(context)
|
187
|
+
when :list_parts
|
188
|
+
Aws::S3::Endpoints::ListParts.build(context)
|
189
|
+
when :put_bucket_accelerate_configuration
|
190
|
+
Aws::S3::Endpoints::PutBucketAccelerateConfiguration.build(context)
|
191
|
+
when :put_bucket_acl
|
192
|
+
Aws::S3::Endpoints::PutBucketAcl.build(context)
|
193
|
+
when :put_bucket_analytics_configuration
|
194
|
+
Aws::S3::Endpoints::PutBucketAnalyticsConfiguration.build(context)
|
195
|
+
when :put_bucket_cors
|
196
|
+
Aws::S3::Endpoints::PutBucketCors.build(context)
|
197
|
+
when :put_bucket_encryption
|
198
|
+
Aws::S3::Endpoints::PutBucketEncryption.build(context)
|
199
|
+
when :put_bucket_intelligent_tiering_configuration
|
200
|
+
Aws::S3::Endpoints::PutBucketIntelligentTieringConfiguration.build(context)
|
201
|
+
when :put_bucket_inventory_configuration
|
202
|
+
Aws::S3::Endpoints::PutBucketInventoryConfiguration.build(context)
|
203
|
+
when :put_bucket_lifecycle
|
204
|
+
Aws::S3::Endpoints::PutBucketLifecycle.build(context)
|
205
|
+
when :put_bucket_lifecycle_configuration
|
206
|
+
Aws::S3::Endpoints::PutBucketLifecycleConfiguration.build(context)
|
207
|
+
when :put_bucket_logging
|
208
|
+
Aws::S3::Endpoints::PutBucketLogging.build(context)
|
209
|
+
when :put_bucket_metrics_configuration
|
210
|
+
Aws::S3::Endpoints::PutBucketMetricsConfiguration.build(context)
|
211
|
+
when :put_bucket_notification
|
212
|
+
Aws::S3::Endpoints::PutBucketNotification.build(context)
|
213
|
+
when :put_bucket_notification_configuration
|
214
|
+
Aws::S3::Endpoints::PutBucketNotificationConfiguration.build(context)
|
215
|
+
when :put_bucket_ownership_controls
|
216
|
+
Aws::S3::Endpoints::PutBucketOwnershipControls.build(context)
|
217
|
+
when :put_bucket_policy
|
218
|
+
Aws::S3::Endpoints::PutBucketPolicy.build(context)
|
219
|
+
when :put_bucket_replication
|
220
|
+
Aws::S3::Endpoints::PutBucketReplication.build(context)
|
221
|
+
when :put_bucket_request_payment
|
222
|
+
Aws::S3::Endpoints::PutBucketRequestPayment.build(context)
|
223
|
+
when :put_bucket_tagging
|
224
|
+
Aws::S3::Endpoints::PutBucketTagging.build(context)
|
225
|
+
when :put_bucket_versioning
|
226
|
+
Aws::S3::Endpoints::PutBucketVersioning.build(context)
|
227
|
+
when :put_bucket_website
|
228
|
+
Aws::S3::Endpoints::PutBucketWebsite.build(context)
|
229
|
+
when :put_object
|
230
|
+
Aws::S3::Endpoints::PutObject.build(context)
|
231
|
+
when :put_object_acl
|
232
|
+
Aws::S3::Endpoints::PutObjectAcl.build(context)
|
233
|
+
when :put_object_legal_hold
|
234
|
+
Aws::S3::Endpoints::PutObjectLegalHold.build(context)
|
235
|
+
when :put_object_lock_configuration
|
236
|
+
Aws::S3::Endpoints::PutObjectLockConfiguration.build(context)
|
237
|
+
when :put_object_retention
|
238
|
+
Aws::S3::Endpoints::PutObjectRetention.build(context)
|
239
|
+
when :put_object_tagging
|
240
|
+
Aws::S3::Endpoints::PutObjectTagging.build(context)
|
241
|
+
when :put_public_access_block
|
242
|
+
Aws::S3::Endpoints::PutPublicAccessBlock.build(context)
|
243
|
+
when :restore_object
|
244
|
+
Aws::S3::Endpoints::RestoreObject.build(context)
|
245
|
+
when :select_object_content
|
246
|
+
Aws::S3::Endpoints::SelectObjectContent.build(context)
|
247
|
+
when :upload_part
|
248
|
+
Aws::S3::Endpoints::UploadPart.build(context)
|
249
|
+
when :upload_part_copy
|
250
|
+
Aws::S3::Endpoints::UploadPartCopy.build(context)
|
251
|
+
when :write_get_object_response
|
252
|
+
Aws::S3::Endpoints::WriteGetObjectResponse.build(context)
|
253
|
+
end
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
def add_handlers(handlers, _config)
|
258
|
+
handlers.add(Handler, step: :build, priority: 75)
|
259
|
+
end
|
260
|
+
end
|
261
|
+
end
|
262
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Aws
|
2
4
|
module S3
|
3
5
|
module Plugins
|
@@ -13,10 +15,9 @@ module Aws
|
|
13
15
|
class Handler < Seahorse::Client::Handler
|
14
16
|
|
15
17
|
def call(context)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
then
|
18
|
+
body = context.http_request.body
|
19
|
+
if body.respond_to?(:size) && body.size > 0 &&
|
20
|
+
!context[:use_accelerate_endpoint]
|
20
21
|
context.http_request.headers['expect'] = '100-continue'
|
21
22
|
end
|
22
23
|
@handler.call(context)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Aws
|
2
4
|
module S3
|
3
5
|
module Plugins
|
@@ -9,7 +11,7 @@ module Aws
|
|
9
11
|
@handler.call(context).on(200) do |response|
|
10
12
|
response.data = S3::Types::GetBucketLocationOutput.new
|
11
13
|
xml = context.http_response.body_contents
|
12
|
-
matches = xml.match(
|
14
|
+
matches = xml.match(/<LocationConstraint.*?>(.+?)<\/LocationConstraint>/)
|
13
15
|
response.data[:location_constraint] = matches ? matches[1] : ''
|
14
16
|
end
|
15
17
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Aws
|
2
4
|
module S3
|
3
5
|
module Plugins
|
@@ -27,12 +29,19 @@ module Aws
|
|
27
29
|
error_code = xml.match(/<Code>(.+?)<\/Code>/)[1]
|
28
30
|
error_message = xml.match(/<Message>(.+?)<\/Message>/)[1]
|
29
31
|
S3::Errors.error_class(error_code).new(context, error_message)
|
32
|
+
elsif !xml.match(/<\w/) # Must have the start of an XML Tag
|
33
|
+
# Other incomplete xml bodies will result in XML ParsingError
|
34
|
+
Seahorse::Client::NetworkingError.new(
|
35
|
+
S3::Errors
|
36
|
+
.error_class('InternalError')
|
37
|
+
.new(context, 'Empty or incomplete response body')
|
38
|
+
)
|
30
39
|
end
|
31
40
|
end
|
32
|
-
|
33
41
|
end
|
34
42
|
|
35
|
-
handler(
|
43
|
+
handler(
|
44
|
+
Handler,
|
36
45
|
step: :sign,
|
37
46
|
operations: [
|
38
47
|
:complete_multipart_upload,
|
@@ -40,7 +49,6 @@ module Aws
|
|
40
49
|
:upload_part_copy,
|
41
50
|
]
|
42
51
|
)
|
43
|
-
|
44
52
|
end
|
45
53
|
end
|
46
54
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Aws
|
4
|
+
module S3
|
5
|
+
module Plugins
|
6
|
+
|
7
|
+
class IADRegionalEndpoint < Seahorse::Client::Plugin
|
8
|
+
|
9
|
+
option(:s3_us_east_1_regional_endpoint,
|
10
|
+
default: 'legacy',
|
11
|
+
doc_type: String,
|
12
|
+
docstring: <<-DOCS) do |cfg|
|
13
|
+
Pass in `regional` to enable the `us-east-1` regional endpoint.
|
14
|
+
Defaults to `legacy` mode which uses the global endpoint.
|
15
|
+
DOCS
|
16
|
+
resolve_iad_regional_endpoint(cfg)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def self.resolve_iad_regional_endpoint(cfg)
|
22
|
+
default_mode_value =
|
23
|
+
if cfg.respond_to?(:defaults_mode_config_resolver)
|
24
|
+
cfg.defaults_mode_config_resolver.resolve(:s3_us_east_1_regional_endpoint)
|
25
|
+
end
|
26
|
+
|
27
|
+
mode = ENV['AWS_S3_US_EAST_1_REGIONAL_ENDPOINT'] ||
|
28
|
+
Aws.shared_config.s3_us_east_1_regional_endpoint(profile: cfg.profile) ||
|
29
|
+
default_mode_value ||
|
30
|
+
'legacy'
|
31
|
+
mode = mode.downcase
|
32
|
+
unless %w(legacy regional).include?(mode)
|
33
|
+
raise ArgumentError, "expected :s3_us_east_1_regional_endpoint or"\
|
34
|
+
" ENV['AWS_S3_US_EAST_1_REGIONAL_ENDPOINT'] to be `legacy` or"\
|
35
|
+
" `regional`."
|
36
|
+
end
|
37
|
+
mode
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -1,18 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'openssl'
|
2
|
-
require 'base64'
|
3
4
|
|
4
5
|
module Aws
|
5
6
|
module S3
|
6
7
|
module Plugins
|
8
|
+
# @api private
|
9
|
+
# This plugin is effectively deprecated in favor of modeled
|
10
|
+
# httpChecksumRequired traits.
|
7
11
|
class Md5s < Seahorse::Client::Plugin
|
8
|
-
|
9
|
-
#
|
10
|
-
|
11
|
-
:
|
12
|
-
:
|
13
|
-
:put_bucket_lifecycle,
|
14
|
-
:put_bucket_policy,
|
15
|
-
:put_bucket_tagging,
|
12
|
+
# These operations allow Content MD5 but are not required by
|
13
|
+
# httpChecksumRequired. This list should not grow.
|
14
|
+
OPTIONAL_OPERATIONS = [
|
15
|
+
:put_object,
|
16
|
+
:upload_part
|
16
17
|
]
|
17
18
|
|
18
19
|
# @api private
|
@@ -21,9 +22,11 @@ module Aws
|
|
21
22
|
CHUNK_SIZE = 1 * 1024 * 1024 # one MB
|
22
23
|
|
23
24
|
def call(context)
|
24
|
-
|
25
|
-
|
26
|
-
|
25
|
+
if !context[:checksum_algorithms] # skip in favor of flexible checksum
|
26
|
+
body = context.http_request.body
|
27
|
+
if body.respond_to?(:size) && body.size > 0
|
28
|
+
context.http_request.headers['Content-Md5'] ||= md5(body)
|
29
|
+
end
|
27
30
|
end
|
28
31
|
@handler.call(context)
|
29
32
|
end
|
@@ -34,18 +37,20 @@ module Aws
|
|
34
37
|
# @return [String<MD5>]
|
35
38
|
def md5(value)
|
36
39
|
if (File === value || Tempfile === value) && !value.path.nil? && File.exist?(value.path)
|
37
|
-
|
40
|
+
OpenSSL::Digest::MD5.file(value).base64digest
|
38
41
|
elsif value.respond_to?(:read)
|
39
42
|
md5 = OpenSSL::Digest::MD5.new
|
40
43
|
update_in_chunks(md5, value)
|
41
|
-
|
44
|
+
md5.base64digest
|
42
45
|
else
|
43
|
-
|
46
|
+
OpenSSL::Digest::MD5.digest(value).base64digest
|
44
47
|
end
|
45
48
|
end
|
46
49
|
|
47
50
|
def update_in_chunks(digest, io)
|
48
|
-
|
51
|
+
loop do
|
52
|
+
chunk = io.read(CHUNK_SIZE)
|
53
|
+
break unless chunk
|
49
54
|
digest.update(chunk)
|
50
55
|
end
|
51
56
|
io.rewind
|
@@ -57,20 +62,22 @@ module Aws
|
|
57
62
|
default: true,
|
58
63
|
doc_type: 'Boolean',
|
59
64
|
docstring: <<-DOCS)
|
60
|
-
When `true` a MD5 checksum will be computed
|
61
|
-
|
62
|
-
|
63
|
-
|
65
|
+
When `true` a MD5 checksum will be computed and sent in the Content Md5
|
66
|
+
header for :put_object and :upload_part. When `false`, MD5 checksums
|
67
|
+
will not be computed for these operations. Checksums are still computed
|
68
|
+
for operations requiring them. Checksum errors returned by Amazon S3 are
|
69
|
+
automatically retried up to `:retry_limit` times.
|
64
70
|
DOCS
|
65
71
|
|
66
72
|
def add_handlers(handlers, config)
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
73
|
+
if config.compute_checksums
|
74
|
+
# priority set low to ensure md5 is computed AFTER the request is
|
75
|
+
# built but before it is signed
|
76
|
+
handlers.add(
|
77
|
+
Handler,
|
78
|
+
priority: 10, step: :build, operations: OPTIONAL_OPERATIONS
|
79
|
+
)
|
80
|
+
end
|
74
81
|
end
|
75
82
|
|
76
83
|
end
|