aws-sdk-core 3.83.0 → 3.87.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/aws-sdk-core.rb +1 -0
- data/lib/aws-sdk-core/instance_profile_credentials.rb +40 -49
- data/lib/aws-sdk-core/log/formatter.rb +7 -1
- data/lib/aws-sdk-core/log/param_filter.rb +1 -1
- data/lib/aws-sdk-core/plugins/user_agent.rb +4 -8
- data/lib/aws-sdk-sts.rb +1 -1
- data/lib/aws-sdk-sts/client.rb +31 -1
- data/lib/aws-sdk-sts/customizations.rb +2 -0
- data/lib/aws-sdk-sts/presigner.rb +67 -0
- data/lib/seahorse/client/logging/formatter.rb +4 -2
- data/lib/seahorse/client/net_http/connection_pool.rb +2 -1
- data/lib/seahorse/client/net_http/handler.rb +7 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d8b0101c6013769741d24b7fdc34f78e30888c8
|
4
|
+
data.tar.gz: 7420738b02fdb3dbb2ef958f9ff62ad2e28cb464
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19be2af618fe6211f82afcf2d0e5759ac99936407626ad1915c379f7a4d7380e9188f94894f8f732b32fc694bec1c829103e51aaad187b34e56282f9d7b1d5ed
|
7
|
+
data.tar.gz: 4e9b19e70ad4c0ee8c40d04239115d6ba67c08adec3667b94cfee9798cbf82cdbc9999b3d36d182ca4239ea78e5b30417076133780117687d751bfc66ab79bf6
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.87.0
|
data/lib/aws-sdk-core.rb
CHANGED
@@ -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 (
|
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 (
|
49
|
-
# @option options [Float] :http_read_timeout (
|
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
|
61
|
-
@retries = options[:retries] ||
|
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] ||
|
65
|
-
@http_read_timeout = options[:http_read_timeout] ||
|
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] ||
|
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
|
84
|
-
else
|
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
|
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(
|
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
|
-
|
133
|
-
|
134
|
-
|
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
|
-
|
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 = {
|
167
|
-
headers[
|
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
|
-
|
170
|
-
|
171
|
-
|
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
|
-
|
180
|
-
|
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[
|
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 = {}, &
|
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
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
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
|
@@ -171,7 +171,13 @@ module Aws
|
|
171
171
|
end
|
172
172
|
|
173
173
|
def _http_response_body(response)
|
174
|
-
|
174
|
+
if response.context.http_response.body.respond_to?(:rewind)
|
175
|
+
@param_formatter.summarize(
|
176
|
+
response.context.http_response.body_contents
|
177
|
+
)
|
178
|
+
else
|
179
|
+
''
|
180
|
+
end
|
175
181
|
end
|
176
182
|
|
177
183
|
def _error_class(response)
|
@@ -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, :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, :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, :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]
|
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
|
-
|
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
|
data/lib/aws-sdk-sts.rb
CHANGED
data/lib/aws-sdk-sts/client.rb
CHANGED
@@ -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.
|
2134
|
+
context[:gem_version] = '3.87.0'
|
2105
2135
|
Seahorse::Client::Request.new(handlers, context)
|
2106
2136
|
end
|
2107
2137
|
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'aws-sigv4'
|
2
|
+
|
3
|
+
module Aws
|
4
|
+
module STS
|
5
|
+
# Allows you to create presigned URLs for STS operations.
|
6
|
+
#
|
7
|
+
# @example
|
8
|
+
#
|
9
|
+
# signer = Aws::STS::Presigner.new
|
10
|
+
# url = signer.get_caller_identity_presigned_url(
|
11
|
+
# headers: {"X-K8s-Aws-Id" => 'my-eks-cluster'}
|
12
|
+
# )
|
13
|
+
class Presigner
|
14
|
+
# @option options [Client] :client Optionally provide an existing
|
15
|
+
# STS client
|
16
|
+
def initialize(options = {})
|
17
|
+
@client = options[:client] || Aws::STS::Client.new
|
18
|
+
end
|
19
|
+
|
20
|
+
# Returns a presigned url for get_caller_identity.
|
21
|
+
#
|
22
|
+
# @option options [Hash] :headers
|
23
|
+
# Headers that should be signed and sent along with the request. All
|
24
|
+
# x-amz-* headers must be present during signing. Other headers are
|
25
|
+
# optional.
|
26
|
+
#
|
27
|
+
# @return [String] A presigned url string.
|
28
|
+
#
|
29
|
+
# @example
|
30
|
+
#
|
31
|
+
# url = signer.get_caller_identity_presigned_url(
|
32
|
+
# headers: {"X-K8s-Aws-Id" => 'my-eks-cluster'},
|
33
|
+
# )
|
34
|
+
#
|
35
|
+
# This can be easily converted to a token used by the EKS service:
|
36
|
+
# {https://ruby-doc.org/stdlib-2.3.1/libdoc/base64/rdoc/Base64.html#method-i-encode64}
|
37
|
+
# "k8s-aws-v1." + Base64.urlsafe_encode64(url).chomp("==")
|
38
|
+
def get_caller_identity_presigned_url(options = {})
|
39
|
+
req = @client.build_request(:get_session_token, {})
|
40
|
+
|
41
|
+
param_list = Aws::Query::ParamList.new
|
42
|
+
param_list.set('Action', 'GetCallerIdentity')
|
43
|
+
param_list.set('Version', req.context.config.api.version)
|
44
|
+
Aws::Query::EC2ParamBuilder.new(param_list)
|
45
|
+
.apply(req.context.operation.input, {})
|
46
|
+
|
47
|
+
signer = Aws::Sigv4::Signer.new(
|
48
|
+
service: 'sts',
|
49
|
+
region: req.context.config.region,
|
50
|
+
credentials_provider: req.context.config.credentials
|
51
|
+
)
|
52
|
+
|
53
|
+
url = Aws::Partitions::EndpointProvider.resolve(
|
54
|
+
req.context.config.region, 'sts', 'regional'
|
55
|
+
)
|
56
|
+
url += "/?#{param_list}"
|
57
|
+
|
58
|
+
signer.presign_url(
|
59
|
+
http_method: 'GET',
|
60
|
+
url: url,
|
61
|
+
body: '',
|
62
|
+
headers: options[:headers]
|
63
|
+
).to_s
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -173,9 +173,11 @@ module Seahorse
|
|
173
173
|
end
|
174
174
|
|
175
175
|
def _http_response_body(response)
|
176
|
-
response.context.http_response.body.respond_to?(:rewind)
|
177
|
-
summarize_value(response.context.http_response.body_contents)
|
176
|
+
if response.context.http_response.body.respond_to?(:rewind)
|
177
|
+
summarize_value(response.context.http_response.body_contents)
|
178
|
+
else
|
178
179
|
''
|
180
|
+
end
|
179
181
|
end
|
180
182
|
|
181
183
|
def _error_class(response)
|
@@ -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] ||
|
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
|
-
#
|
166
|
+
# Net::HTTP adds a content-type (1.8.7+) and accept-encoding (2.0.0+)
|
167
|
+
# to the request if these headers are not set. Setting a default
|
168
|
+
# empty value defeats this.
|
169
|
+
#
|
170
|
+
# Removing these are necessary for most services to no 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.
|
4
|
+
version: 3.87.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:
|
11
|
+
date: 2020-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jmespath
|
@@ -222,6 +222,7 @@ files:
|
|
222
222
|
- lib/aws-sdk-sts/customizations.rb
|
223
223
|
- lib/aws-sdk-sts/errors.rb
|
224
224
|
- lib/aws-sdk-sts/plugins/sts_regional_endpoints.rb
|
225
|
+
- lib/aws-sdk-sts/presigner.rb
|
225
226
|
- lib/aws-sdk-sts/resource.rb
|
226
227
|
- lib/aws-sdk-sts/types.rb
|
227
228
|
- lib/seahorse.rb
|