Skip to content

Commit 17e4b3d

Browse files
authored
Fix documentation of credentials classes and modules in aws-sdk-core (#3306)
1 parent 06e3e15 commit 17e4b3d

File tree

5 files changed

+30
-29
lines changed

5 files changed

+30
-29
lines changed

gems/aws-sdk-core/lib/aws-sdk-core/assume_role_credentials.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module Aws
77
# {Aws::STS::Client#assume_role}.
88
#
99
# role_credentials = Aws::AssumeRoleCredentials.new(
10-
# client: Aws::STS::Client.new(...),
10+
# client: Aws::STS::Client.new(sts_options),
1111
# role_arn: "linked::account::arn",
1212
# role_session_name: "session-name"
1313
# )
@@ -28,15 +28,15 @@ class AssumeRoleCredentials
2828
# @option options [Integer] :duration_seconds
2929
# @option options [String] :external_id
3030
# @option options [STS::Client] :client
31-
# @option options [Callable] before_refresh Proc called before
31+
# @option options [Proc] :before_refresh A Proc called before
3232
# credentials are refreshed. Useful for updating tokens.
33-
# `before_refresh` is called when AWS credentials are
34-
# required and need to be refreshed. Tokens can be refreshed using
35-
# the following example:
33+
# `:before_refresh` is called when AWS credentials are
34+
# required and need to be refreshed. See the example in this doc.
3635
#
37-
# before_refresh = Proc.new do |assume_role_credentials| do
38-
# assume_role_credentials.assume_role_params['token_code'] = update_token
39-
# end
36+
# @example Tokens can be refreshed using a Proc.
37+
# before_refresh = Proc.new do |assume_role_credentials|
38+
# assume_role_credentials.assume_role_params['token_code'] = update_token
39+
# end
4040
#
4141
def initialize(options = {})
4242
client_opts = {}

gems/aws-sdk-core/lib/aws-sdk-core/assume_role_web_identity_credentials.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ module Aws
99
# {Aws::STS::Client#assume_role_with_web_identity}.
1010
#
1111
# role_credentials = Aws::AssumeRoleWebIdentityCredentials.new(
12-
# client: Aws::STS::Client.new(...),
12+
# client: Aws::STS::Client.new(sts_options),
1313
# role_arn: "linked::account::arn",
1414
# web_identity_token_file: "/path/to/token/file",
1515
# role_session_name: "session-name"
16-
# ...
16+
# # ...
1717
# )
1818
# ec2 = Aws::EC2::Client.new(credentials: role_credentials)
1919
#

gems/aws-sdk-core/lib/aws-sdk-core/ecs_credentials.rb

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,26 +42,26 @@ class InvalidTokenError < RuntimeError; end
4242
# @option options [Integer] :retries (5) Number of times to retry
4343
# when retrieving credentials.
4444
# @option options [String] :ip_address ('169.254.170.2') This value is
45-
# ignored if `endpoint` is set and `credential_path` is not set.
46-
# @option options [Integer] :port (80) This value is ignored if `endpoint`
47-
# is set and `credential_path` is not set.
45+
# ignored if `:endpoint` is set and `:credential_path` is not set.
46+
# @option options [Integer] :port (80) This value is ignored if `:endpoint`
47+
# is set and `:credential_path` is not set.
4848
# @option options [String] :credential_path By default, the value of the
49-
# AWS_CONTAINER_CREDENTIALS_RELATIVE_URI environment variable.
49+
# `AWS_CONTAINER_CREDENTIALS_RELATIVE_URI` environment variable.
5050
# @option options [String] :endpoint The container credential endpoint.
51-
# By default, this is the value of the AWS_CONTAINER_CREDENTIALS_FULL_URI
52-
# environment variable. This value is ignored if `credential_path` or
53-
# ENV['AWS_CONTAINER_CREDENTIALS_RELATIVE_URI'] is set.
51+
# By default, this is the value of the `AWS_CONTAINER_CREDENTIALS_FULL_URI`
52+
# environment variable. This value is ignored if `:credential_path` or
53+
# `ENV['AWS_CONTAINER_CREDENTIALS_RELATIVE_URI']` is set.
5454
# @option options [Float] :http_open_timeout (5)
5555
# @option options [Float] :http_read_timeout (5)
56-
# @option options [Numeric, Proc] :delay By default, failures are retried
56+
# @option options [IO] :http_debug_output (nil) HTTP wire
57+
# traces are sent to this object. You can specify something
58+
# like `$stdout`.
59+
# @option options [Numeric, Proc] :backoff By default, failures are retried
5760
# with exponential back-off, i.e. `sleep(1.2 ** num_failures)`. You can
5861
# pass a number of seconds to sleep between failed attempts, or
5962
# a Proc that accepts the number of failures.
60-
# @option options [IO] :http_debug_output (nil) HTTP wire
61-
# traces are sent to this object. You can specify something
62-
# like $stdout.
63-
# @option options [Callable] before_refresh Proc called before
64-
# credentials are refreshed. `before_refresh` is called
63+
# @option options [Proc] :before_refresh A Proc called before
64+
# credentials are refreshed. `:before_refresh` is called
6565
# with an instance of this object when
6666
# AWS credentials are required and need to be refreshed.
6767
def initialize(options = {})

gems/aws-sdk-core/lib/aws-sdk-core/refreshing_credentials.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,21 @@
33
module Aws
44
# Base class used credential classes that can be refreshed. This
55
# provides basic refresh logic in a thread-safe manner. Classes mixing in
6-
# this module are expected to implement a #refresh method that populates
6+
# this module are expected to implement a `#refresh` method that populates
77
# the following instance variables:
88
#
9-
# * `@access_key_id`
10-
# * `@secret_access_key`
11-
# * `@session_token`
12-
# * `@expiration`
9+
# * `@credentials` ({Credentials})
10+
# * `@expiration` (Time)
1311
#
1412
module RefreshingCredentials
1513
SYNC_EXPIRATION_LENGTH = 300 # 5 minutes
1614
ASYNC_EXPIRATION_LENGTH = 600 # 10 minutes
1715

1816
CLIENT_EXCLUDE_OPTIONS = Set.new([:before_refresh]).freeze
1917

18+
# @param [Hash] options
19+
# @option options [Proc] :before_refresh A Proc called before credentials are refreshed.
20+
# It accepts `self` as the only argument.
2021
def initialize(options = {})
2122
@mutex = Mutex.new
2223
@before_refresh = options.delete(:before_refresh) if options.is_a?(Hash)

gems/aws-sdk-core/lib/aws-sdk-core/sso_credentials.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module Aws
77
# {Aws::SSOTokenProvider} will be used to refresh the token if possible.
88
# This class does NOT implement the SSO login token flow - tokens
99
# must generated separately by running `aws login` from the
10-
# AWS CLI with the correct profile. The `SSOCredentials` will
10+
# AWS CLI with the correct profile. The {SSOCredentials} will
1111
# auto-refresh the AWS credentials from SSO.
1212
#
1313
# # You must first run aws sso login --profile your-sso-profile

0 commit comments

Comments
 (0)