aws-sdk-core 3.126.1 → 3.126.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: 46193e52f3ea24b17d0d2ff28e7abf1ef462586db550c10f0540810da7a45fed
4
- data.tar.gz: 3dc8f9629d7d7057632bd639c097747792dd40d6c6c81ca5f91e4366ca9dd6bb
3
+ metadata.gz: 43456ebcfb658f355c30401c60fbc040821ad6e166a5341f6fe6c6ee13504fb2
4
+ data.tar.gz: e2b3ad8937b2abfd04fb996466dfcfaedd6f30fc2a01d3129568eb1c92410fb1
5
5
  SHA512:
6
- metadata.gz: 6f72443886e4e7077c1dc7d1f816b1774ceeae361f13e6f13a5ce532bc77a669e297e5fb3f3582eb772563e315dd0afcef9c5d9acd45d672fea79706537b8868
7
- data.tar.gz: 3ed264c5a2ed5cb2dcd3c050224785e62618ded48137d8dd217a75107865f58679a26e5ded1e8498971e8de862e8f91e684eb1a5c64fa9e3db3f53d186d8b351
6
+ metadata.gz: c2d1633574df08000c0d247dd044ab137481c616da29bca727c0f8e534655f4bf85ac7a10b3f2dab6fb3ec1bb5bfdb75053b2b124bcdead670dc080af98eb608
7
+ data.tar.gz: cc10baad99ea717024d2b841a529d5a89a4b10585cf38b008d51e5c36ab9981b330d3d2769b4e9a6e94b05cd66596cba9d0e5a687e8f90c89be214498680720b
data/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  Unreleased Changes
2
2
  ------------------
3
3
 
4
+ 3.126.2 (2022-02-16)
5
+ ------------------
6
+
7
+ * Issue - Add a before_refresh callback to AssumeRoleCredentials (#2529).
8
+ * Issue - Raise a `NoSuchProfileError` when config and credentials files don't exist.
9
+
4
10
  3.126.1 (2022-02-14)
5
11
  ------------------
6
12
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.126.1
1
+ 3.126.2
@@ -17,6 +17,11 @@ module Aws
17
17
  #
18
18
  # If you omit `:client` option, a new {STS::Client} object will be
19
19
  # constructed.
20
+ #
21
+ # The AssumeRoleCredentials also provides a `before_refresh` callback
22
+ # that can be used to help manage refreshing tokens.
23
+ # `before_refresh` is called when AWS credentials are required and need
24
+ # to be refreshed and it is called with the AssumeRoleCredentials object.
20
25
  class AssumeRoleCredentials
21
26
 
22
27
  include CredentialProvider
@@ -28,6 +33,16 @@ module Aws
28
33
  # @option options [Integer] :duration_seconds
29
34
  # @option options [String] :external_id
30
35
  # @option options [STS::Client] :client
36
+ # @option options [Callable] before_refresh Proc called before
37
+ # credentials are refreshed. Useful for updating tokens.
38
+ # `before_refresh` is called when AWS credentials are
39
+ # required and need to be refreshed. Tokens can be refreshed using
40
+ # the following example:
41
+ #
42
+ # before_refresh = Proc.new do |assume_role_credentials| do
43
+ # assume_role_credentials.assume_role_params['token_code'] = update_token
44
+ # end
45
+ #
31
46
  def initialize(options = {})
32
47
  client_opts = {}
33
48
  @assume_role_params = {}
@@ -45,6 +60,9 @@ module Aws
45
60
  # @return [STS::Client]
46
61
  attr_reader :client
47
62
 
63
+ # @return [Hash]
64
+ attr_reader :assume_role_params
65
+
48
66
  private
49
67
 
50
68
  def refresh
@@ -39,6 +39,11 @@ module Aws
39
39
  # encoded UUID is generated as the session name
40
40
  #
41
41
  # @option options [STS::Client] :client
42
+ #
43
+ # @option options [Callable] before_refresh Proc called before
44
+ # credentials are refreshed. `before_refresh` is called
45
+ # with an instance of this object when
46
+ # AWS credentials are required and need to be refreshed.
42
47
  def initialize(options = {})
43
48
  client_opts = {}
44
49
  @assume_role_web_identity_params = {}
@@ -43,6 +43,10 @@ module Aws
43
43
  # @option options [IO] :http_debug_output (nil) HTTP wire
44
44
  # traces are sent to this object. You can specify something
45
45
  # like $stdout.
46
+ # @option options [Callable] before_refresh Proc called before
47
+ # credentials are refreshed. `before_refresh` is called
48
+ # with an instance of this object when
49
+ # AWS credentials are required and need to be refreshed.
46
50
  def initialize options = {}
47
51
  @retries = options[:retries] || 5
48
52
  @ip_address = options[:ip_address] || '169.254.170.2'
@@ -63,6 +63,10 @@ module Aws
63
63
  # @option options [Integer] :token_ttl Time-to-Live in seconds for EC2
64
64
  # Metadata Token used for fetching Metadata Profile Credentials, defaults
65
65
  # to 21600 seconds
66
+ # @option options [Callable] before_refresh Proc called before
67
+ # credentials are refreshed. `before_refresh` is called
68
+ # with an instance of this object when
69
+ # AWS credentials are required and need to be refreshed.
66
70
  def initialize(options = {})
67
71
  @retries = options[:retries] || 1
68
72
  endpoint_mode = resolve_endpoint_mode(options)
@@ -19,6 +19,9 @@ module Aws
19
19
 
20
20
  def initialize(options = {})
21
21
  @mutex = Mutex.new
22
+ @before_refresh = options.delete(:before_refresh) if Hash === options
23
+
24
+ @before_refresh.call(self) if @before_refresh
22
25
  refresh
23
26
  end
24
27
 
@@ -37,7 +40,11 @@ module Aws
37
40
  # Refresh credentials.
38
41
  # @return [void]
39
42
  def refresh!
40
- @mutex.synchronize { refresh }
43
+ @mutex.synchronize do
44
+ @before_refresh.call(self) if @before_refresh
45
+
46
+ refresh
47
+ end
41
48
  end
42
49
 
43
50
  private
@@ -47,7 +54,11 @@ module Aws
47
54
  def refresh_if_near_expiration
48
55
  if near_expiration?
49
56
  @mutex.synchronize do
50
- refresh if near_expiration?
57
+ if near_expiration?
58
+ @before_refresh.call(self) if @before_refresh
59
+
60
+ refresh
61
+ end
51
62
  end
52
63
  end
53
64
  end
@@ -100,7 +100,7 @@ module Aws
100
100
  # or `nil` if no valid credentials were found.
101
101
  def credentials(opts = {})
102
102
  p = opts[:profile] || @profile_name
103
- validate_profile_exists(p) if credentials_present?
103
+ validate_profile_exists(p)
104
104
  if (credentials = credentials_from_shared(p, opts))
105
105
  credentials
106
106
  elsif (credentials = credentials_from_config(p, opts))
@@ -195,11 +195,6 @@ module Aws
195
195
  value
196
196
  end
197
197
 
198
- def credentials_present?
199
- (@parsed_credentials && !@parsed_credentials.empty?) ||
200
- (@parsed_config && !@parsed_config.empty?)
201
- end
202
-
203
198
  def assume_role_from_profile(cfg, profile, opts, chain_config)
204
199
  if cfg && prof_cfg = cfg[profile]
205
200
  opts[:source_profile] ||= prof_cfg['source_profile']
@@ -63,6 +63,11 @@ module Aws
63
63
  #
64
64
  # @option options [SSO::Client] :client Optional `SSO::Client`. If not
65
65
  # provided, a client will be constructed.
66
+ #
67
+ # @option options [Callable] before_refresh Proc called before
68
+ # credentials are refreshed. `before_refresh` is called
69
+ # with an instance of this object when
70
+ # AWS credentials are required and need to be refreshed.
66
71
  def initialize(options = {})
67
72
 
68
73
  missing_keys = SSO_REQUIRED_OPTS.select { |k| options[k].nil? }
@@ -543,7 +543,7 @@ module Aws::SSO
543
543
  params: params,
544
544
  config: config)
545
545
  context[:gem_name] = 'aws-sdk-core'
546
- context[:gem_version] = '3.126.1'
546
+ context[:gem_version] = '3.126.2'
547
547
  Seahorse::Client::Request.new(handlers, context)
548
548
  end
549
549
 
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.126.1'
53
+ GEM_VERSION = '3.126.2'
54
54
 
55
55
  end
@@ -2286,7 +2286,7 @@ module Aws::STS
2286
2286
  params: params,
2287
2287
  config: config)
2288
2288
  context[:gem_name] = 'aws-sdk-core'
2289
- context[:gem_version] = '3.126.1'
2289
+ context[:gem_version] = '3.126.2'
2290
2290
  Seahorse::Client::Request.new(handlers, context)
2291
2291
  end
2292
2292
 
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.126.1'
53
+ GEM_VERSION = '3.126.2'
54
54
 
55
55
  end
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.126.1
4
+ version: 3.126.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: 2022-02-14 00:00:00.000000000 Z
11
+ date: 2022-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jmespath