aws-sdk-core 3.85.0 → 3.89.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3b886138d094d6e84d381f1bb005b0eccf254f3a
4
- data.tar.gz: 494272b4b2023250f4ce9d436b7e04b23f8e557f
3
+ metadata.gz: 4792718d8a5ff91e016c51a0c086d283c2ac7ba2
4
+ data.tar.gz: dff849117e3ccf090d80b3d4d2982549af9efbcc
5
5
  SHA512:
6
- metadata.gz: 8099062c26429ee165c039b5f8b82188bf4f775d1f7d51b6cc645a96d6d131278b467404411ad0fec901e0f8a099e084d9d9dc0736579232c4e2a997a89fef9f
7
- data.tar.gz: 853ea7b6a336a90bff25edb5702a240e69e05d1b233bbb29ebd17a1da5ec27ece237444304b8753030f6ee47fd65f988ccd63ebabffd96318bb5bf1ee539c7d0
6
+ metadata.gz: 88c0554839f9982b6ef115edb9aaac87d7bceb6e41f35b20efd1235cf4f14bfd922a50a6e75611fc6147bf0178fddedcd51b9735abe3f4509aff71fb6254c44a
7
+ data.tar.gz: 530fc62c766be09fe9b4a3d180a4050e5d41137dc53ac0c42d2b6d2524a56763a65e893f77c368ce6892270389f52294edc6dfae001a996bac254bf9ef948b17
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.85.0
1
+ 3.89.0
@@ -80,6 +80,7 @@ require_relative 'aws-sdk-core/client_side_monitoring/request_metrics'
80
80
  require_relative 'aws-sdk-core/client_side_monitoring/publisher'
81
81
 
82
82
  # arn
83
+
83
84
  require_relative 'aws-sdk-core/arn'
84
85
  require_relative 'aws-sdk-core/arn_parser'
85
86
 
@@ -29,24 +29,24 @@ module Aws
29
29
  Errno::ENETUNREACH,
30
30
  SocketError,
31
31
  Timeout::Error,
32
- Non200Response,
33
- ]
32
+ Non200Response
33
+ ].freeze
34
34
 
35
35
  # Path base for GET request for profile and credentials
36
36
  # @api private
37
- METADATA_PATH_BASE = '/latest/meta-data/iam/security-credentials/'
37
+ METADATA_PATH_BASE = '/latest/meta-data/iam/security-credentials/'.freeze
38
38
 
39
39
  # Path for PUT request for token
40
40
  # @api private
41
- METADATA_TOKEN_PATH = '/latest/api/token'
41
+ METADATA_TOKEN_PATH = '/latest/api/token'.freeze
42
42
 
43
43
  # @param [Hash] options
44
- # @option options [Integer] :retries (5) Number of times to retry
44
+ # @option options [Integer] :retries (1) Number of times to retry
45
45
  # when retrieving credentials.
46
46
  # @option options [String] :ip_address ('169.254.169.254')
47
47
  # @option options [Integer] :port (80)
48
- # @option options [Float] :http_open_timeout (5)
49
- # @option options [Float] :http_read_timeout (5)
48
+ # @option options [Float] :http_open_timeout (1)
49
+ # @option options [Float] :http_read_timeout (1)
50
50
  # @option options [Numeric, Proc] :delay By default, failures are retried
51
51
  # with exponential back-off, i.e. `sleep(1.2 ** num_failures)`. You can
52
52
  # pass a number of seconds to sleep between failed attempts, or
@@ -57,15 +57,15 @@ module Aws
57
57
  # @option options [Integer] :token_ttl Time-to-Live in seconds for EC2
58
58
  # Metadata Token used for fetching Metadata Profile Credentials, defaults
59
59
  # to 21600 seconds
60
- def initialize options = {}
61
- @retries = options[:retries] || 5
60
+ def initialize(options = {})
61
+ @retries = options[:retries] || 1
62
62
  @ip_address = options[:ip_address] || '169.254.169.254'
63
63
  @port = options[:port] || 80
64
- @http_open_timeout = options[:http_open_timeout] || 5
65
- @http_read_timeout = options[:http_read_timeout] || 5
64
+ @http_open_timeout = options[:http_open_timeout] || 1
65
+ @http_read_timeout = options[:http_read_timeout] || 1
66
66
  @http_debug_output = options[:http_debug_output]
67
67
  @backoff = backoff(options[:backoff])
68
- @token_ttl = options[:token_ttl] || 21600
68
+ @token_ttl = options[:token_ttl] || 21_600
69
69
  @token = nil
70
70
  super
71
71
  end
@@ -80,8 +80,8 @@ module Aws
80
80
  def backoff(backoff)
81
81
  case backoff
82
82
  when Proc then backoff
83
- when Numeric then lambda { |_| sleep(backoff) }
84
- else lambda { |num_failures| Kernel.sleep(1.2 ** num_failures) }
83
+ when Numeric then ->(_) { sleep(backoff) }
84
+ else ->(num_failures) { Kernel.sleep(1.2**num_failures) }
85
85
  end
86
86
  end
87
87
 
@@ -100,7 +100,7 @@ module Aws
100
100
  @expiration = c['Expiration'] ? Time.iso8601(c['Expiration']) : nil
101
101
  end
102
102
  rescue JSON::ParserError
103
- raise Aws::Errors::MetadataParserError.new
103
+ raise Aws::Errors::MetadataParserError
104
104
  end
105
105
  end
106
106
 
@@ -118,7 +118,9 @@ module Aws
118
118
  begin
119
119
  retry_errors(NETWORK_ERRORS, max_retries: @retries) do
120
120
  unless token_set?
121
- token_value, ttl = http_put(conn, METADATA_TOKEN_PATH, @token_ttl)
121
+ token_value, ttl = http_put(
122
+ conn, METADATA_TOKEN_PATH, @token_ttl
123
+ )
122
124
  @token = Token.new(token_value, ttl) if token_value && ttl
123
125
  end
124
126
  end
@@ -128,13 +130,10 @@ module Aws
128
130
  @token = nil
129
131
  end
130
132
 
131
- if token_set?
132
- profile_name = http_get(conn, METADATA_PATH_BASE, @token.value).lines.first.strip
133
- http_get(conn, METADATA_PATH_BASE + profile_name, @token.value)
134
- else
135
- profile_name = http_get(conn, METADATA_PATH_BASE).lines.first.strip
136
- http_get(conn, METADATA_PATH_BASE + profile_name)
137
- end
133
+ token = @token.value if token_set?
134
+ metadata = http_get(conn, METADATA_PATH_BASE, token)
135
+ profile_name = metadata.lines.first.strip
136
+ http_get(conn, METADATA_PATH_BASE + profile_name, token)
138
137
  end
139
138
  end
140
139
  rescue
@@ -148,8 +147,7 @@ module Aws
148
147
  end
149
148
 
150
149
  def _metadata_disabled?
151
- flag = ENV["AWS_EC2_METADATA_DISABLED"]
152
- !flag.nil? && flag.downcase == "true"
150
+ ENV.fetch('AWS_EC2_METADATA_DISABLED', 'false').downcase == 'true'
153
151
  end
154
152
 
155
153
  def open_connection
@@ -162,59 +160,54 @@ module Aws
162
160
  end
163
161
 
164
162
  # GET request fetch profile and credentials
165
- def http_get(connection, path, token=nil)
166
- headers = {"User-Agent" => "aws-sdk-ruby3/#{CORE_GEM_VERSION}"}
167
- headers["x-aws-ec2-metadata-token"] = token if token
163
+ def http_get(connection, path, token = nil)
164
+ headers = { 'User-Agent' => "aws-sdk-ruby3/#{CORE_GEM_VERSION}" }
165
+ headers['x-aws-ec2-metadata-token'] = token if token
168
166
  response = connection.request(Net::HTTP::Get.new(path, headers))
169
- if response.code.to_i == 200
170
- response.body
171
- else
172
- raise Non200Response
173
- end
167
+ raise Non200Response unless response.code.to_i == 200
168
+
169
+ response.body
174
170
  end
175
171
 
176
172
  # PUT request fetch token with ttl
177
173
  def http_put(connection, path, ttl)
178
174
  headers = {
179
- "User-Agent" => "aws-sdk-ruby3/#{CORE_GEM_VERSION}",
180
- "x-aws-ec2-metadata-token-ttl-seconds" => ttl.to_s
175
+ 'User-Agent' => "aws-sdk-ruby3/#{CORE_GEM_VERSION}",
176
+ 'x-aws-ec2-metadata-token-ttl-seconds' => ttl.to_s
181
177
  }
182
178
  response = connection.request(Net::HTTP::Put.new(path, headers))
183
179
  case response.code.to_i
184
180
  when 200
185
181
  [
186
182
  response.body,
187
- response.header["x-aws-ec2-metadata-token-ttl-seconds"].to_i
183
+ response.header['x-aws-ec2-metadata-token-ttl-seconds'].to_i
188
184
  ]
189
- when 401
190
- raise TokenExpiredError
191
185
  when 400
192
186
  raise TokenRetrivalError
187
+ when 401
188
+ raise TokenExpiredError
193
189
  else
194
190
  raise Non200Response
195
191
  end
196
192
  end
197
193
 
198
- def retry_errors(error_classes, options = {}, &block)
194
+ def retry_errors(error_classes, options = {}, &_block)
199
195
  max_retries = options[:max_retries]
200
196
  retries = 0
201
197
  begin
202
198
  yield
203
199
  rescue *error_classes
204
- if retries < max_retries
205
- @backoff.call(retries)
206
- retries += 1
207
- retry
208
- else
209
- raise
210
- end
200
+ raise unless retries < max_retries
201
+
202
+ @backoff.call(retries)
203
+ retries += 1
204
+ retry
211
205
  end
212
206
  end
213
207
 
214
208
  # @api private
215
209
  # Token used to fetch IMDS profile and credentials
216
210
  class Token
217
-
218
211
  def initialize(value, ttl)
219
212
  @ttl = ttl
220
213
  @value = value
@@ -227,8 +220,6 @@ module Aws
227
220
  def expired?
228
221
  Time.now - @created_time > @ttl
229
222
  end
230
-
231
223
  end
232
-
233
224
  end
234
225
  end
@@ -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, :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, :e164_phone_number, :email, :email_address, :email_message, :embed_url, :error, :external_model_endpoint_data_blobs, :external_user_id, :feedback_token, :file, :first_name, :full_name, :host_key, :id, :id_token, :input, :input_text, :ion_text, :join_token, :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_password, :meeting_host_id, :message, :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, :public_key, :qr_code_png, :query, :random_password, :recovery_point_tags, :refresh_token, :registrant_contact, :request_attributes, :revision, :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, :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, :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_model_endpoint_data_blobs, :external_user_id, :feedback_token, :file, :first_name, :full_name, :host_key, :id, :id_token, :input, :input_text, :ion_text, :join_token, :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_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, :public_key, :qr_code_png, :query, :random_password, :recovery_point_tags, :refresh_token, :registrant_contact, :request_attributes, :restore_metadata, :revision, :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, :zip_file]
15
15
  # end
16
16
 
17
17
  def initialize(options = {})
@@ -2,20 +2,16 @@ module Aws
2
2
  module Plugins
3
3
  # @api private
4
4
  class UserAgent < Seahorse::Client::Plugin
5
-
6
5
  option(:user_agent_suffix)
7
6
 
8
7
  # @api private
9
8
  class Handler < Seahorse::Client::Handler
10
-
11
9
  def call(context)
12
10
  set_user_agent(context)
13
11
  @handler.call(context)
14
12
  end
15
13
 
16
14
  def set_user_agent(context)
17
- execution_env = ENV["AWS_EXECUTION_ENV"]
18
-
19
15
  ua = "aws-sdk-ruby3/#{CORE_GEM_VERSION}"
20
16
 
21
17
  begin
@@ -30,19 +26,19 @@ module Aws
30
26
  ua += " #{context[:gem_name]}/#{context[:gem_version]}"
31
27
  end
32
28
 
33
- if execution_env
29
+ if (execution_env = ENV['AWS_EXECUTION_ENV'])
34
30
  ua += " exec-env/#{execution_env}"
35
31
  end
36
32
 
37
- ua += " #{context.config.user_agent_suffix}" if context.config.user_agent_suffix
33
+ if context.config.user_agent_suffix
34
+ ua += " #{context.config.user_agent_suffix}"
35
+ end
38
36
 
39
37
  context.http_request.headers['User-Agent'] = ua.strip
40
38
  end
41
-
42
39
  end
43
40
 
44
41
  handler(Handler)
45
-
46
42
  end
47
43
  end
48
44
  end
@@ -40,6 +40,6 @@ require_relative 'aws-sdk-sts/customizations'
40
40
  # @service
41
41
  module Aws::STS
42
42
 
43
- GEM_VERSION = '3.85.0'
43
+ GEM_VERSION = '3.89.0'
44
44
 
45
45
  end
@@ -975,6 +975,36 @@ module Aws::STS
975
975
  # * {Types::AssumeRoleWithSAMLResponse#audience #audience} => String
976
976
  # * {Types::AssumeRoleWithSAMLResponse#name_qualifier #name_qualifier} => String
977
977
  #
978
+ #
979
+ # @example Example: To assume a role using a SAML assertion
980
+ #
981
+ # resp = client.assume_role_with_saml({
982
+ # duration_seconds: 3600,
983
+ # principal_arn: "arn:aws:iam::123456789012:saml-provider/SAML-test",
984
+ # role_arn: "arn:aws:iam::123456789012:role/TestSaml",
985
+ # saml_assertion: "VERYLONGENCODEDASSERTIONEXAMPLExzYW1sOkF1ZGllbmNlPmJsYW5rPC9zYW1sOkF1ZGllbmNlPjwvc2FtbDpBdWRpZW5jZVJlc3RyaWN0aW9uPjwvc2FtbDpDb25kaXRpb25zPjxzYW1sOlN1YmplY3Q+PHNhbWw6TmFtZUlEIEZvcm1hdD0idXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOm5hbWVpZC1mb3JtYXQ6dHJhbnNpZW50Ij5TYW1sRXhhbXBsZTwvc2FtbDpOYW1lSUQ+PHNhbWw6U3ViamVjdENvbmZpcm1hdGlvbiBNZXRob2Q9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDpjbTpiZWFyZXIiPjxzYW1sOlN1YmplY3RDb25maXJtYXRpb25EYXRhIE5vdE9uT3JBZnRlcj0iMjAxOS0xMS0wMVQyMDoyNTowNS4xNDVaIiBSZWNpcGllbnQ9Imh0dHBzOi8vc2lnbmluLmF3cy5hbWF6b24uY29tL3NhbWwiLz48L3NhbWw6U3ViamVjdENvbmZpcm1hdGlvbj48L3NhbWw6U3ViamVjdD48c2FtbDpBdXRoblN0YXRlbWVudCBBdXRoPD94bWwgdmpSZXNwb25zZT4=",
986
+ # })
987
+ #
988
+ # resp.to_h outputs the following:
989
+ # {
990
+ # assumed_role_user: {
991
+ # arn: "arn:aws:sts::123456789012:assumed-role/TestSaml",
992
+ # assumed_role_id: "ARO456EXAMPLE789:TestSaml",
993
+ # },
994
+ # audience: "https://signin.aws.amazon.com/saml",
995
+ # credentials: {
996
+ # access_key_id: "ASIAV3ZUEFP6EXAMPLE",
997
+ # expiration: Time.parse("2019-11-01T20:26:47Z"),
998
+ # secret_access_key: "8P+SQvWIuLnKhh8d++jpw0nNmQRBZvNEXAMPLEKEY",
999
+ # session_token: "IQoJb3JpZ2luX2VjEOz////////////////////wEXAMPLEtMSJHMEUCIDoKK3JH9uGQE1z0sINr5M4jk+Na8KHDcCYRVjJCZEvOAiEA3OvJGtw1EcViOleS2vhs8VdCKFJQWPQrmGdeehM4IC1NtBmUpp2wUE8phUZampKsburEDy0KPkyQDYwT7WZ0wq5VSXDvp75YU9HFvlRd8Tx6q6fE8YQcHNVXAkiY9q6d+xo0rKwT38xVqr7ZD0u0iPPkUL64lIZbqBAz+scqKmlzm8FDrypNC9Yjc8fPOLn9FX9KSYvKTr4rvx3iSIlTJabIQwj2ICCR/oLxBA==",
1000
+ # },
1001
+ # issuer: "https://integ.example.com/idp/shibboleth",
1002
+ # name_qualifier: "SbdGOnUkh1i4+EXAMPLExL/jEvs=",
1003
+ # packed_policy_size: 6,
1004
+ # subject: "SamlExample",
1005
+ # subject_type: "transient",
1006
+ # }
1007
+ #
978
1008
  # @example Request syntax with placeholder values
979
1009
  #
980
1010
  # resp = client.assume_role_with_saml({
@@ -2101,7 +2131,7 @@ module Aws::STS
2101
2131
  params: params,
2102
2132
  config: config)
2103
2133
  context[:gem_name] = 'aws-sdk-core'
2104
- context[:gem_version] = '3.85.0'
2134
+ context[:gem_version] = '3.89.0'
2105
2135
  Seahorse::Client::Request.new(handlers, context)
2106
2136
  end
2107
2137
 
@@ -18,6 +18,7 @@ module Seahorse
18
18
 
19
19
  @pools_mutex = Mutex.new
20
20
  @pools = {}
21
+ @default_logger = Logger.new($stdout)
21
22
 
22
23
  OPTIONS = {
23
24
  http_proxy: nil,
@@ -231,7 +232,7 @@ module Seahorse
231
232
  # @return [Hash]
232
233
  def pool_options options
233
234
  wire_trace = !!options[:http_wire_trace]
234
- logger = options[:logger] || Logger.new($stdout) if wire_trace
235
+ logger = options[:logger] || @default_logger if wire_trace
235
236
  verify_peer = options.key?(:ssl_verify_peer) ?
236
237
  !!options[:ssl_verify_peer] : true
237
238
  {
@@ -163,7 +163,13 @@ module Seahorse
163
163
  # @return [Hash] Returns a vanilla hash of headers to send with the
164
164
  # HTTP request.
165
165
  def headers(request)
166
- # setting these to stop net/http from providing defaults
166
+ # Net::HTTP adds default headers for content-type to POSTs (1.8.7+)
167
+ # and accept-encoding (2.0.0+). Setting a default empty value defeats
168
+ # this.
169
+ #
170
+ # Removing these are necessary for most services to not break request
171
+ # signatures as well as dynamodb crc32 checks (these fail if the
172
+ # response is gzipped).
167
173
  headers = { 'content-type' => '', 'accept-encoding' => '' }
168
174
  request.headers.each_pair do |key, value|
169
175
  headers[key] = value
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.85.0
4
+ version: 3.89.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: 2019-12-09 00:00:00.000000000 Z
11
+ date: 2020-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jmespath