aws-sdk-core 3.98.0 → 3.99.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 900cd1a6cbe9b35c88cabe17a5722dc050118ae959fc95e314c9d6b37d50fa2f
4
- data.tar.gz: 72ec66eb30d622b0b4fbdfa2a3d6c63e7b9a1667dd0d8a72ec2f7bece92212e6
3
+ metadata.gz: cf03bdc54ae7d2b3aaca392c246e2448afe60816e850b6f2389945be397a27f7
4
+ data.tar.gz: 0615a87c2daa9bc86e416d7403aedf6d934f5694dd1efda76d6821c0caa12ebd
5
5
  SHA512:
6
- metadata.gz: 79c25a4a03c167df01e62959cd8613ff3f62a4cbca3a1d8202c4327ea0dbb1db7e797ae4c1b6ab3b35483179e00965c587d71f0e8c2414cd87016a02d66e2aa8
7
- data.tar.gz: bb899f25cdc80a804e11b31881dba290cba5512c8ccd935135a52a93767d12cad8affa7700e91c2a3ef6955080a5071398220735ae8c9f16f36b9eb4c41654c6
6
+ metadata.gz: 8a9b4ba7e6cb3be4ab9fc0905a03162c5cc4b2d12509ebfb53eee3a0098f9f74ed0a5634df1f06f16a4101243c5c59c1e9aac2ed7d4f5ed90f1d068b30573856
7
+ data.tar.gz: f625151a68e124037dd2b0a42067a736b0562bebf975649721896d84460d4e830fad4a879d744ff45af39979f1fc75db5516ebc71b67150b412c8272afc90d01
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.98.0
1
+ 3.99.2
@@ -208,12 +208,40 @@ module Aws
208
208
  # Raised when a client is constructed and region is not specified.
209
209
  class MissingRegionError < ArgumentError
210
210
  def initialize(*args)
211
- msg = 'missing region; use :region option or '\
212
- "export region name to ENV['AWS_REGION']"
211
+ msg = 'No region was provided. Configure the `:region` option or '\
212
+ "export the region name to ENV['AWS_REGION']"
213
213
  super(msg)
214
214
  end
215
215
  end
216
216
 
217
+ # Raised when a client is contsructed and the region is not valid.
218
+ class InvalidRegionError < ArgumentError
219
+ def initialize(*args)
220
+ super(<<-MSG)
221
+ Invalid `:region` option was provided.
222
+
223
+ * Not every service is available in every region.
224
+
225
+ * Never suffix region names with availability zones.
226
+ Use "us-east-1", not "us-east-1a"
227
+
228
+ Known AWS regions include (not specific to this service):
229
+
230
+ #{possible_regions}
231
+ MSG
232
+ end
233
+
234
+ private
235
+
236
+ def possible_regions
237
+ Aws.partitions.each_with_object([]) do |partition, region_names|
238
+ partition.regions.each do |region|
239
+ region_names << region.name
240
+ end
241
+ end.join("\n")
242
+ end
243
+ end
244
+
217
245
  # Raised when attempting to connect to an endpoint and a `SocketError`
218
246
  # is received from the HTTP client. This error is typically the result
219
247
  # of configuring an invalid `:region`.
@@ -226,7 +254,7 @@ module Aws
226
254
  super(<<-MSG)
227
255
  Encountered a `SocketError` while attempting to connect to:
228
256
 
229
- #{endpoint.to_s}
257
+ #{endpoint}
230
258
 
231
259
  This is typically the result of an invalid `:region` option or a
232
260
  poorly formatted `:endpoint` option.
@@ -255,14 +283,12 @@ Known AWS regions include (not specific to this service):
255
283
  private
256
284
 
257
285
  def possible_regions
258
- Aws.partitions.inject([]) do |region_names, partition|
286
+ Aws.partitions.each_with_object([]) do |partition, region_names|
259
287
  partition.regions.each do |region|
260
288
  region_names << region.name
261
289
  end
262
- region_names
263
290
  end.join("\n")
264
291
  end
265
-
266
292
  end
267
293
 
268
294
  # Raised when attempting to retry a request
@@ -11,7 +11,7 @@ module Aws
11
11
  #
12
12
  # @api private
13
13
  # begin
14
- SENSITIVE = [:access_token, :account_name, :account_password, :address, :admin_contact, :admin_password, :alexa_for_business_room_arn, :artifact_credentials, :auth_code, :authentication_token, :authorization_result, :backup_plan_tags, :backup_vault_tags, :base_32_string_seed, :block, :block_address, :block_data, :blocks, :body, :bot_configuration, :bot_email, :calling_name, :cause, :client_id, :client_request_token, :client_secret, :comment, :configuration, :copy_source_sse_customer_key, :credentials, :current_password, :custom_attributes, :custom_private_key, :db_password, :default_phone_number, :definition, :description, :destination_access_token, :digest_tip_address, :display_name, :domain_signing_private_key, :e164_phone_number, :email, :email_address, :email_message, :embed_url, :error, :external_meeting_id, :external_model_endpoint_data_blobs, :external_user_id, :fall_back_phone_number, :feedback_token, :file, :filter_expression, :first_name, :full_name, :host_key, :id, :id_token, :input, :input_text, :ion_text, :join_token, :key, :key_id, :key_material, :key_store_password, :kms_key_id, :kms_master_key_id, :lambda_function_arn, :last_name, :local_console_password, :master_account_email, :master_user_name, :master_user_password, :meeting_host_id, :message, :metadata, :name, :new_password, :next_password, :notes, :number, :old_password, :outbound_events_https_endpoint, :output, :owner_information, :parameters, :passphrase, :password, :payload, :phone_number, :plaintext, :previous_password, :primary_email, :primary_provisioned_number, :private_key, :private_key_plaintext, :proof, :proposed_password, :proxy_phone_number, :public_key, :qr_code_png, :query, :random_password, :recovery_point_tags, :refresh_token, :registrant_contact, :request_attributes, :resource_arn, :restore_metadata, :revision, :saml_assertion, :search_query, :secret_access_key, :secret_binary, :secret_code, :secret_hash, :secret_string, :secret_to_authenticate_initiator, :secret_to_authenticate_target, :security_token, :service_password, :session_attributes, :session_token, :share_notes, :shared_secret, :slots, :sns_topic_arn, :source_access_token, :sqs_queue_arn, :sse_customer_key, :ssekms_encryption_context, :ssekms_key_id, :status_message, :tag_key_list, :tags, :target_address, :task_parameters, :tech_contact, :temporary_password, :text, :token, :trust_password, :type, :upload_credentials, :upload_url, :uri, :user_data, :user_email, :user_name, :user_password, :username, :value, :values, :variables, :vpn_psk, :web_identity_token, :zip_file]
14
+ SENSITIVE = [:access_token, :account_name, :account_password, :address, :admin_contact, :admin_password, :alexa_for_business_room_arn, :artifact_credentials, :auth_code, :authentication_token, :authorization_result, :backup_plan_tags, :backup_vault_tags, :base_32_string_seed, :block, :block_address, :block_data, :blocks, :body, :bot_configuration, :bot_email, :calling_name, :cause, :client_id, :client_request_token, :client_secret, :comment, :configuration, :content, :copy_source_sse_customer_key, :credentials, :current_password, :custom_attributes, :custom_private_key, :db_password, :default_phone_number, :definition, :description, :destination_access_token, :digest_tip_address, :display_name, :domain_signing_private_key, :e164_phone_number, :email, :email_address, :email_message, :embed_url, :error, :external_meeting_id, :external_model_endpoint_data_blobs, :external_user_id, :fall_back_phone_number, :feedback_token, :file, :filter_expression, :first_name, :full_name, :host_key, :id, :id_token, :input, :input_text, :ion_text, :join_token, :key, :key_id, :key_material, :key_store_password, :kms_key_id, :kms_master_key_id, :lambda_function_arn, :last_name, :local_console_password, :master_account_email, :master_user_name, :master_user_password, :meeting_host_id, :message, :metadata, :name, :new_password, :next_password, :notes, :number, :old_password, :outbound_events_https_endpoint, :output, :owner_information, :parameters, :passphrase, :password, :payload, :phone_number, :plaintext, :previous_password, :primary_email, :primary_provisioned_number, :private_key, :private_key_plaintext, :proof, :proposed_password, :proxy_phone_number, :public_key, :qr_code_png, :query, :random_password, :recovery_point_tags, :refresh_token, :registrant_contact, :request_attributes, :resource_arn, :restore_metadata, :revision, :saml_assertion, :search_query, :secret_access_key, :secret_binary, :secret_code, :secret_hash, :secret_string, :secret_to_authenticate_initiator, :secret_to_authenticate_target, :security_token, :service_password, :session_attributes, :session_token, :share_notes, :shared_secret, :slots, :sns_topic_arn, :source_access_token, :sqs_queue_arn, :sse_customer_key, :ssekms_encryption_context, :ssekms_key_id, :status_message, :tag_key_list, :tags, :target_address, :task_parameters, :tech_contact, :temporary_password, :text, :token, :trust_password, :type, :upload_credentials, :upload_url, :uri, :user_data, :user_email, :user_name, :user_password, :username, :value, :values, :variables, :vpn_psk, :web_identity_token, :zip_file]
15
15
  # end
16
16
 
17
17
  def initialize(options = {})
@@ -0,0 +1,55 @@
1
+ require 'openssl'
2
+
3
+ module Aws
4
+ module Plugins
5
+ # @api private
6
+ class HttpChecksum < Seahorse::Client::Plugin
7
+ # @api private
8
+ class Handler < Seahorse::Client::Handler
9
+ CHUNK_SIZE = 1 * 1024 * 1024 # one MB
10
+
11
+ def call(context)
12
+ if context.operation.http_checksum_required
13
+ body = context.http_request.body
14
+ context.http_request.headers['Content-Md5'] ||= md5(body)
15
+ end
16
+ @handler.call(context)
17
+ end
18
+
19
+ private
20
+
21
+ # @param [File, Tempfile, IO#read, String] value
22
+ # @return [String<MD5>]
23
+ def md5(value)
24
+ if (value.is_a?(File) || value.is_a?(Tempfile)) &&
25
+ !value.path.nil? && File.exist?(value.path)
26
+ OpenSSL::Digest::MD5.file(value).base64digest
27
+ elsif value.respond_to?(:read)
28
+ md5 = OpenSSL::Digest::MD5.new
29
+ update_in_chunks(md5, value)
30
+ md5.base64digest
31
+ else
32
+ OpenSSL::Digest::MD5.digest(value).base64digest
33
+ end
34
+ end
35
+
36
+ def update_in_chunks(digest, io)
37
+ loop do
38
+ chunk = io.read(CHUNK_SIZE)
39
+ break unless chunk
40
+ digest.update(chunk)
41
+ end
42
+ io.rewind
43
+ end
44
+
45
+ end
46
+
47
+ def add_handlers(handlers, _config)
48
+ # priority set low to ensure checksum is computed AFTER the request is
49
+ # built but before it is signed
50
+ handlers.add(Handler, priority: 10, step: :build)
51
+ end
52
+
53
+ end
54
+ end
55
+ end
@@ -2,10 +2,6 @@ module Aws
2
2
  module Plugins
3
3
  # @api private
4
4
  class RegionalEndpoint < Seahorse::Client::Plugin
5
-
6
- # raised when region is not configured
7
- MISSING_REGION = 'missing required configuration option :region'
8
-
9
5
  option(:profile)
10
6
 
11
7
  option(:region,
@@ -31,13 +27,19 @@ a default `:region` is searched for in the following locations:
31
27
  option(:endpoint, doc_type: String, docstring: <<-DOCS) do |cfg|
32
28
  The client endpoint is normally constructed from the `:region`
33
29
  option. You should only configure an `:endpoint` when connecting
34
- to test endpoints. This should be a valid HTTP(S) URI.
30
+ to test or custom endpoints. This should be a valid HTTP(S) URI.
35
31
  DOCS
36
32
  endpoint_prefix = cfg.api.metadata['endpointPrefix']
37
33
  if cfg.region && endpoint_prefix
38
34
  if cfg.respond_to?(:sts_regional_endpoints)
39
35
  sts_regional = cfg.sts_regional_endpoints
40
36
  end
37
+
38
+ # check region is a valid RFC host label
39
+ unless cfg.region =~ /^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{,63}(?<!-)$/
40
+ raise Errors::InvalidRegionError
41
+ end
42
+
41
43
  Aws::Partitions::EndpointProvider.resolve(
42
44
  cfg.region,
43
45
  endpoint_prefix,
@@ -47,21 +49,22 @@ to test endpoints. This should be a valid HTTP(S) URI.
47
49
  end
48
50
 
49
51
  def after_initialize(client)
50
- if client.config.region.nil? or client.config.region == ''
52
+ if client.config.region.nil? || client.config.region == ''
51
53
  raise Errors::MissingRegionError
52
54
  end
53
55
  end
54
56
 
55
- private
57
+ class << self
58
+ private
56
59
 
57
- def self.resolve_region(cfg)
58
- keys = %w(AWS_REGION AMAZON_REGION AWS_DEFAULT_REGION)
59
- env_region = ENV.values_at(*keys).compact.first
60
- env_region = nil if env_region == ''
61
- cfg_region = Aws.shared_config.region(profile: cfg.profile)
62
- env_region || cfg_region
60
+ def resolve_region(cfg)
61
+ keys = %w[AWS_REGION AMAZON_REGION AWS_DEFAULT_REGION]
62
+ env_region = ENV.values_at(*keys).compact.first
63
+ env_region = nil if env_region == ''
64
+ cfg_region = Aws.shared_config.region(profile: cfg.profile)
65
+ env_region || cfg_region
66
+ end
63
67
  end
64
-
65
68
  end
66
69
  end
67
70
  end
@@ -43,6 +43,6 @@ require_relative 'aws-sdk-sts/customizations'
43
43
  # @service
44
44
  module Aws::STS
45
45
 
46
- GEM_VERSION = '3.98.0'
46
+ GEM_VERSION = '3.99.2'
47
47
 
48
48
  end
@@ -24,6 +24,7 @@ require 'aws-sdk-core/plugins/jsonvalue_converter.rb'
24
24
  require 'aws-sdk-core/plugins/client_metrics_plugin.rb'
25
25
  require 'aws-sdk-core/plugins/client_metrics_send_plugin.rb'
26
26
  require 'aws-sdk-core/plugins/transfer_encoding.rb'
27
+ require 'aws-sdk-core/plugins/http_checksum.rb'
27
28
  require 'aws-sdk-core/plugins/signature_v4.rb'
28
29
  require 'aws-sdk-core/plugins/protocols/query.rb'
29
30
  require 'aws-sdk-sts/plugins/sts_regional_endpoints.rb'
@@ -70,6 +71,7 @@ module Aws::STS
70
71
  add_plugin(Aws::Plugins::ClientMetricsPlugin)
71
72
  add_plugin(Aws::Plugins::ClientMetricsSendPlugin)
72
73
  add_plugin(Aws::Plugins::TransferEncoding)
74
+ add_plugin(Aws::Plugins::HttpChecksum)
73
75
  add_plugin(Aws::Plugins::SignatureV4)
74
76
  add_plugin(Aws::Plugins::Protocols::Query)
75
77
  add_plugin(Aws::STS::Plugins::STSRegionalEndpoints)
@@ -163,7 +165,7 @@ module Aws::STS
163
165
  # @option options [String] :endpoint
164
166
  # The client endpoint is normally constructed from the `:region`
165
167
  # option. You should only configure an `:endpoint` when connecting
166
- # to test endpoints. This should be a valid HTTP(S) URI.
168
+ # to test or custom endpoints. This should be a valid HTTP(S) URI.
167
169
  #
168
170
  # @option options [Integer] :endpoint_cache_max_entries (1000)
169
171
  # Used for the maximum size limit of the LRU cache storing endpoints data
@@ -2185,7 +2187,7 @@ module Aws::STS
2185
2187
  params: params,
2186
2188
  config: config)
2187
2189
  context[:gem_name] = 'aws-sdk-core'
2188
- context[:gem_version] = '3.98.0'
2190
+ context[:gem_version] = '3.99.2'
2189
2191
  Seahorse::Client::Request.new(handlers, context)
2190
2192
  end
2191
2193
 
@@ -11,6 +11,7 @@ module Seahorse
11
11
  # @return [Integer]
12
12
  def write(chunk)
13
13
  @block.call(chunk)
14
+ ensure
14
15
  chunk.bytesize.tap { |chunk_size| @size += chunk_size }
15
16
  end
16
17
 
@@ -9,8 +9,8 @@ module Seahorse
9
9
  Normally you should not configure the `:endpoint` option
10
10
  directly. This is normally constructed from the `:region`
11
11
  option. Configuring `:endpoint` is normally reserved for
12
- connecting to test endpoints. The endpoint should be a URI
13
- formatted like:
12
+ connecting to test or custom endpoints. The endpoint should
13
+ be a URI formatted like:
14
14
 
15
15
  'http://example.com'
16
16
  'https://example.com'
@@ -28,7 +28,13 @@ module Seahorse
28
28
  def add_event_listeners(context, target)
29
29
  handler = self
30
30
  context.http_response.on_headers(200..299) do
31
- context.http_response.body = handler.send(:io, target)
31
+ # In a fresh response body will be a StringIO
32
+ # However, when a request is retried we may have
33
+ # an existing ManagedFile or BlockIO and those
34
+ # should be reused.
35
+ if context.http_response.body.is_a? StringIO
36
+ context.http_response.body = handler.send(:io, target)
37
+ end
32
38
  end
33
39
 
34
40
  context.http_response.on_success(200..299) do
@@ -40,15 +46,18 @@ module Seahorse
40
46
 
41
47
  context.http_response.on_error do
42
48
  body = context.http_response.body
43
- File.unlink(body) if ManagedFile === body
49
+
50
+ # When using response_target of file we do not want to write
51
+ # error messages to the file. So set the body to a new StringIO
52
+ if body.is_a? ManagedFile
53
+ File.unlink(body)
54
+ context.http_response.body = StringIO.new
55
+ end
56
+
44
57
  # Aws::S3::Encryption::DecryptHandler (with lower priority)
45
58
  # has callbacks registered after ResponseTarget::Handler,
46
59
  # where http_response.body is an IODecrypter
47
- # and has error callbacks handling for it.
48
- # Thus avoid early remove of IODecrypter at ResponseTarget::Handler
49
- unless context.http_response.body.respond_to?(:io)
50
- context.http_response.body = StringIO.new
51
- end
60
+ # and has error callbacks handling for it so no action is required here
52
61
  end
53
62
  end
54
63
 
@@ -20,6 +20,9 @@ module Seahorse
20
20
  # @return [String]
21
21
  attr_accessor :http_request_uri
22
22
 
23
+ # @return [Boolean]
24
+ attr_accessor :http_checksum_required
25
+
23
26
  # @return [Boolean]
24
27
  attr_accessor :deprecated
25
28
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.98.0
4
+ version: 3.99.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: 2020-06-05 00:00:00.000000000 Z
11
+ date: 2020-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jmespath
@@ -141,6 +141,7 @@ files:
141
141
  - lib/aws-sdk-core/plugins/event_stream_configuration.rb
142
142
  - lib/aws-sdk-core/plugins/global_configuration.rb
143
143
  - lib/aws-sdk-core/plugins/helpful_socket_errors.rb
144
+ - lib/aws-sdk-core/plugins/http_checksum.rb
144
145
  - lib/aws-sdk-core/plugins/idempotency_token.rb
145
146
  - lib/aws-sdk-core/plugins/invocation_id.rb
146
147
  - lib/aws-sdk-core/plugins/jsonvalue_converter.rb