aws-sdk-core 3.116.0 → 3.117.0

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: 7a1315234c9e3c212dc0e7c1b4dda2c92280857fb0217248d353f399e7eb8687
4
- data.tar.gz: fb0e2a094c882762c95c3d528f5a006a126b5001c74dd026f34058e35cbeff01
3
+ metadata.gz: 87480a79b026cd9f4a732927079633d67b5fa7cb0150c3cef3c7eedd954d179d
4
+ data.tar.gz: 42e118b53803b2d5bb5514059852fe684f4f64a22fadee010541851eca299fc5
5
5
  SHA512:
6
- metadata.gz: fb9e12d6ca261891f84891af10f57218bf1cfc6d7d7d40826b60790c48b2dc8e7400413ac8ae5772dc9521dcfaa184fdf1560d34a21b9983f97771d355cc6fb1
7
- data.tar.gz: 13326486b1cb0062e20a8fc766146baa548361ee0b147250ca87f0a8f6ef8beee00cf0d0d90ad8cba96df9c3cd23bff4b14f002f9279184b1c651f2f8366e669
6
+ metadata.gz: 71053f9fca038e4fb57084f29d972034e845d58c45a973ac3e9690717689ba74228d6b1d25c2b1e473e8f2358091916875dfd3ffb90ed4ece0b36aaa38d9e81e
7
+ data.tar.gz: 6e353f5356d8a61a4cfc70dce05f176859e5180e53b7de74c09bf1da7e57d0a5ac9f7cc58a584880b98b95d8518da62ed22adac942cf8d37a596300ea9caa102
data/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
1
  Unreleased Changes
2
2
  ------------------
3
3
 
4
+ 3.117.0 (2021-07-12)
5
+ ------------------
6
+
7
+ * Feature - Support IPv6 endpoints for `Aws::InstanceProfileCredentials`. It supports two shared configuration options (`ec2_metadata_service_endpoint` & `ec2_metadata_service_endpoint_mode`), two ENV variables (`AWS_EC2_METADATA_SERVICE_ENDPOINT` & `AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE`), and two constructor options (`:endpoint` & `:endpoint_mode`).
8
+
9
+ * Feature - Support IPv6 endpoint for `Aws::EC2Metadata` client. It can be configured with `:endpoint` or `:endpoint_mode`.
10
+
4
11
  3.116.0 (2021-07-07)
5
12
  ------------------
6
13
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.116.0
1
+ 3.117.0
@@ -160,10 +160,11 @@ module Aws
160
160
  end
161
161
 
162
162
  def instance_profile_credentials(options)
163
+ profile_name = determine_profile_name(options)
163
164
  if ENV['AWS_CONTAINER_CREDENTIALS_RELATIVE_URI']
164
165
  ECSCredentials.new(options)
165
166
  else
166
- InstanceProfileCredentials.new(options)
167
+ InstanceProfileCredentials.new(options.merge(profile: profile_name))
167
168
  end
168
169
  end
169
170
 
@@ -39,7 +39,11 @@ module Aws
39
39
  # defaulting to 6 hours.
40
40
  # @option options [Integer] :retries (3) The number of retries for failed
41
41
  # requests.
42
- # @option options [String] :endpoint (169.254.169.254) The IMDS endpoint.
42
+ # @option options [String] :endpoint ('http://169.254.169.254') The IMDS
43
+ # endpoint. This option has precedence over the :endpoint_mode.
44
+ # @option options [String] :endpoint_mode ('IPv4') The endpoint mode for
45
+ # the instance metadata service. This is either 'IPv4'
46
+ # ('http://169.254.169.254') or 'IPv6' ('http://[fd00:ec2::254]').
43
47
  # @option options [Integer] :port (80) The IMDS endpoint port.
44
48
  # @option options [Integer] :http_open_timeout (1) The number of seconds to
45
49
  # wait for the connection to open.
@@ -55,7 +59,8 @@ module Aws
55
59
  @retries = options[:retries] || 3
56
60
  @backoff = backoff(options[:backoff])
57
61
 
58
- @endpoint = options[:endpoint] || '169.254.169.254'
62
+ endpoint_mode = options[:endpoint_mode] || 'IPv4'
63
+ @endpoint = resolve_endpoint(options[:endpoint], endpoint_mode)
59
64
  @port = options[:port] || 80
60
65
 
61
66
  @http_open_timeout = options[:http_open_timeout] || 1
@@ -76,7 +81,7 @@ module Aws
76
81
  # ec2_metadata.get('/latest/meta-data/instance-id')
77
82
  # => "i-023a25f10a73a0f79"
78
83
  #
79
- # @Note This implementation always returns a String and will not parse any
84
+ # @note This implementation always returns a String and will not parse any
80
85
  # responses. Parsable responses may include JSON objects or directory
81
86
  # listings, which are strings separated by line feeds (ASCII 10).
82
87
  #
@@ -93,7 +98,7 @@ module Aws
93
98
  # listing.split(10.chr)
94
99
  # => ["ami-id", "ami-launch-index", ...]
95
100
  #
96
- # @Note Unlike other services, IMDS does not have a service API model. This
101
+ # @note Unlike other services, IMDS does not have a service API model. This
97
102
  # means that we cannot confidently generate code with methods and
98
103
  # response structures. This implementation ensures that new IMDS features
99
104
  # are always supported by being deployed to the instance and does not
@@ -116,6 +121,19 @@ module Aws
116
121
 
117
122
  private
118
123
 
124
+ def resolve_endpoint(endpoint, endpoint_mode)
125
+ return endpoint if endpoint
126
+
127
+ case endpoint_mode.downcase
128
+ when 'ipv4' then 'http://169.254.169.254'
129
+ when 'ipv6' then 'http://[fd00:ec2::254]'
130
+ else
131
+ raise ArgumentError,
132
+ ':endpoint_mode is not valid, expected IPv4 or IPv6, '\
133
+ "got: #{endpoint_mode}"
134
+ end
135
+ end
136
+
119
137
  def fetch_token
120
138
  open_connection do |conn|
121
139
  token_value, token_ttl = http_put(conn, @token_ttl)
@@ -163,7 +181,8 @@ module Aws
163
181
  end
164
182
 
165
183
  def open_connection
166
- http = Net::HTTP.new(@endpoint, @port, nil)
184
+ uri = URI.parse(@endpoint)
185
+ http = Net::HTTP.new(uri.hostname || @endpoint, @port || uri.port)
167
186
  http.open_timeout = @http_open_timeout
168
187
  http.read_timeout = @http_read_timeout
169
188
  http.set_debug_output(@http_debug_output) if @http_debug_output
@@ -5,7 +5,6 @@ require 'net/http'
5
5
 
6
6
  module Aws
7
7
  class InstanceProfileCredentials
8
-
9
8
  include CredentialProvider
10
9
  include RefreshingCredentials
11
10
 
@@ -44,7 +43,13 @@ module Aws
44
43
  # @param [Hash] options
45
44
  # @option options [Integer] :retries (1) Number of times to retry
46
45
  # when retrieving credentials.
47
- # @option options [String] :ip_address ('169.254.169.254')
46
+ # @option options [String] :endpoint ('http://169.254.169.254') The IMDS
47
+ # endpoint. This option has precedence over the :endpoint_mode.
48
+ # @option options [String] :endpoint_mode ('IPv4') The endpoint mode for
49
+ # the instance metadata service. This is either 'IPv4' ('169.254.169.254')
50
+ # or 'IPv6' ('[fd00:ec2::254]').
51
+ # @option options [String] :ip_address ('169.254.169.254') Deprecated. Use
52
+ # :endpoint instead. The IP address for the endpoint.
48
53
  # @option options [Integer] :port (80)
49
54
  # @option options [Float] :http_open_timeout (1)
50
55
  # @option options [Float] :http_read_timeout (1)
@@ -60,7 +65,8 @@ module Aws
60
65
  # to 21600 seconds
61
66
  def initialize(options = {})
62
67
  @retries = options[:retries] || 1
63
- @ip_address = options[:ip_address] || '169.254.169.254'
68
+ endpoint_mode = resolve_endpoint_mode(options)
69
+ @endpoint = resolve_endpoint(options, endpoint_mode)
64
70
  @port = options[:port] || 80
65
71
  @http_open_timeout = options[:http_open_timeout] || 1
66
72
  @http_read_timeout = options[:http_read_timeout] || 1
@@ -78,6 +84,34 @@ module Aws
78
84
 
79
85
  private
80
86
 
87
+ def resolve_endpoint_mode(options)
88
+ value = options[:endpoint_mode]
89
+ value ||= ENV['AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE']
90
+ value ||= Aws.shared_config.ec2_metadata_service_endpoint_mode(
91
+ profile: options[:profile]
92
+ )
93
+ value || 'IPv4'
94
+ end
95
+
96
+ def resolve_endpoint(options, endpoint_mode)
97
+ value = options[:endpoint] || options[:ip_address]
98
+ value ||= ENV['AWS_EC2_METADATA_SERVICE_ENDPOINT']
99
+ value ||= Aws.shared_config.ec2_metadata_service_endpoint(
100
+ profile: options[:profile]
101
+ )
102
+
103
+ return value if value
104
+
105
+ case endpoint_mode.downcase
106
+ when 'ipv4' then 'http://169.254.169.254'
107
+ when 'ipv6' then 'http://[fd00:ec2::254]'
108
+ else
109
+ raise ArgumentError,
110
+ ':endpoint_mode is not valid, expected IPv4 or IPv6, '\
111
+ "got: #{endpoint_mode}"
112
+ end
113
+ end
114
+
81
115
  def backoff(backoff)
82
116
  case backoff
83
117
  when Proc then backoff
@@ -152,7 +186,8 @@ module Aws
152
186
  end
153
187
 
154
188
  def open_connection
155
- http = Net::HTTP.new(@ip_address, @port, nil)
189
+ uri = URI.parse(@endpoint)
190
+ http = Net::HTTP.new(uri.hostname || @endpoint, @port || uri.port)
156
191
  http.open_timeout = @http_open_timeout
157
192
  http.read_timeout = @http_read_timeout
158
193
  http.set_debug_output(@http_debug_output) if @http_debug_output
@@ -163,6 +163,8 @@ module Aws
163
163
  :ca_bundle,
164
164
  :credential_process,
165
165
  :endpoint_discovery_enabled,
166
+ :ec2_metadata_service_endpoint,
167
+ :ec2_metadata_service_endpoint_mode,
166
168
  :max_attempts,
167
169
  :retry_mode,
168
170
  :adaptive_retry_wait_to_fill,
@@ -14,11 +14,17 @@ module Aws
14
14
  'aws_session_token' => 'session_token',
15
15
  }
16
16
 
17
- # Constructs a new SharedCredentials object. This will load AWS access
17
+ # Constructs a new SharedCredentials object. This will load static
18
+ # (access_key_id, secret_access_key and session_token) AWS access
18
19
  # credentials from an ini file, which supports profiles. The default
19
20
  # profile name is 'default'. You can specify the profile name with the
20
21
  # `ENV['AWS_PROFILE']` or with the `:profile_name` option.
21
22
  #
23
+ # To use credentials from the default credential resolution chain
24
+ # create a client without the credential option specified.
25
+ # You may access the resolved credentials through
26
+ # `client.config.credentials`.
27
+ #
22
28
  # @option [String] :path Path to the shared file. Defaults
23
29
  # to "#{Dir.home}/.aws/credentials".
24
30
  #
data/lib/aws-sdk-sso.rb CHANGED
@@ -50,6 +50,6 @@ require_relative 'aws-sdk-sso/customizations'
50
50
  # @!group service
51
51
  module Aws::SSO
52
52
 
53
- GEM_VERSION = '3.116.0'
53
+ GEM_VERSION = '3.117.0'
54
54
 
55
55
  end
@@ -523,7 +523,7 @@ module Aws::SSO
523
523
  params: params,
524
524
  config: config)
525
525
  context[:gem_name] = 'aws-sdk-core'
526
- context[:gem_version] = '3.116.0'
526
+ context[:gem_version] = '3.117.0'
527
527
  Seahorse::Client::Request.new(handlers, context)
528
528
  end
529
529
 
data/lib/aws-sdk-sts.rb CHANGED
@@ -50,6 +50,6 @@ require_relative 'aws-sdk-sts/customizations'
50
50
  # @!group service
51
51
  module Aws::STS
52
52
 
53
- GEM_VERSION = '3.116.0'
53
+ GEM_VERSION = '3.117.0'
54
54
 
55
55
  end
@@ -2303,7 +2303,7 @@ module Aws::STS
2303
2303
  params: params,
2304
2304
  config: config)
2305
2305
  context[:gem_name] = 'aws-sdk-core'
2306
- context[:gem_version] = '3.116.0'
2306
+ context[:gem_version] = '3.117.0'
2307
2307
  Seahorse::Client::Request.new(handlers, context)
2308
2308
  end
2309
2309
 
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.116.0
4
+ version: 3.117.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: 2021-07-07 00:00:00.000000000 Z
11
+ date: 2021-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jmespath