Class: Aws::Google
- Inherits:
-
Object
- Object
- Aws::Google
- Includes:
- CredentialProvider, CachedCredentials
- Defined in:
- lib/aws/google.rb,
lib/aws/google/version.rb,
lib/aws/google/cached_credentials.rb,
lib/aws/google/credential_provider.rb
Overview
An auto-refreshing credential provider that works by assuming a role via STS::Client#assume_role_with_web_identity, using an ID token derived from a Google refresh token.
role_credentials = Aws::Google.new(
role_arn: aws_role,
google_client_id: client_id,
google_client_secret: client_secret
)
ec2 = Aws::EC2::Client.new(credentials: role_credentials)
If you omit ‘:client` option, a new STS::Client object will be constructed.
Defined Under Namespace
Modules: CachedCredentials, CredentialProvider, GoogleSharedCredentials
Constant Summary collapse
- VERSION =
'0.2.3'.freeze
Class Attribute Summary collapse
-
.config ⇒ Object
Use ‘Aws::Google.config` to set default options for any instance of this provider.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Google
constructor
A new instance of Google.
Methods included from CachedCredentials
#refresh_if_near_expiration, #write_credentials
Constructor Details
#initialize(options = {}) ⇒ Google
Returns a new instance of Google.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/aws/google.rb', line 47 def initialize( = {}) = .merge(self.class.config) @oauth_attempted = false @assume_role_params = .slice( *Aws::STS::Client.api.operation(:assume_role_with_web_identity). input.shape.member_names ) @google_id = ::Google::Auth::ClientId.new( [:client_id], [:client_secret] ) @client = [:client] || Aws::STS::Client.new(credentials: nil) @domain = [:domain] @online = [:online] @port = [:port] || 1234 super end |
Class Attribute Details
.config ⇒ Object
Use ‘Aws::Google.config` to set default options for any instance of this provider.
31 32 33 |
# File 'lib/aws/google.rb', line 31 def config @config end |