You are viewing documentation for version 1 of the AWS SDK for Ruby. Version 2 documentation can be found here.
Class: AWS::Core::CredentialProviders::EC2Provider
- Inherits:
-
Object
- Object
- AWS::Core::CredentialProviders::EC2Provider
- Includes:
- Provider
- Defined in:
- lib/aws/core/credential_providers.rb
Overview
This credential provider tries to get credentials from the EC2 metadata service.
Constant Summary
Constant Summary
Constants included from Provider
Instance Attribute Summary collapse
-
#credentials_expiration ⇒ Time?
-
#http_debug_output ⇒ Object?
-
#http_open_timeout ⇒ Float
-
#http_read_timeout ⇒ Float
-
#ip_address ⇒ String
Defaults to '169.254.169.254'.
-
#port ⇒ Integer
Defaults to port 80.
-
#retries ⇒ Integer
Defaults to 0.
Instance Method Summary collapse
-
#credentials ⇒ Hash
Refresh provider if existing credentials will be expired in 15 min.
-
#initialize(options = {}) ⇒ EC2Provider
constructor
A new instance of EC2Provider.
Methods included from Provider
#access_key_id, #refresh, #secret_access_key, #session_token, #set?
Constructor Details
#initialize(options = {}) ⇒ EC2Provider
Returns a new instance of EC2Provider
364 365 366 367 368 369 370 371 |
# File 'lib/aws/core/credential_providers.rb', line 364 def initialize = {} @ip_address = [:ip_address] || '169.254.169.254' @port = [:port] || 80 @retries = [:retries] || 0 @http_open_timeout = [:http_open_timeout] || 1 @http_read_timeout = [:http_read_timeout] || 1 @http_debug_output = [:http_debug_output] end |
Instance Attribute Details
#credentials_expiration ⇒ Time?
392 393 394 |
# File 'lib/aws/core/credential_providers.rb', line 392 def credentials_expiration @credentials_expiration end |
#http_debug_output ⇒ Object?
389 390 391 |
# File 'lib/aws/core/credential_providers.rb', line 389 def http_debug_output @http_debug_output end |
#http_open_timeout ⇒ Float
383 384 385 |
# File 'lib/aws/core/credential_providers.rb', line 383 def http_open_timeout @http_open_timeout end |
#http_read_timeout ⇒ Float
386 387 388 |
# File 'lib/aws/core/credential_providers.rb', line 386 def http_read_timeout @http_read_timeout end |
#ip_address ⇒ String
Returns Defaults to '169.254.169.254'.
374 375 376 |
# File 'lib/aws/core/credential_providers.rb', line 374 def ip_address @ip_address end |
#port ⇒ Integer
Returns Defaults to port 80.
377 378 379 |
# File 'lib/aws/core/credential_providers.rb', line 377 def port @port end |
#retries ⇒ Integer
Returns Defaults to 0
380 381 382 |
# File 'lib/aws/core/credential_providers.rb', line 380 def retries @retries end |
Instance Method Details
#credentials ⇒ Hash
Refresh provider if existing credentials will be expired in 15 min
402 403 404 405 |
# File 'lib/aws/core/credential_providers.rb', line 402 def credentials refresh if near_expiration? super end |