Module: Fog::OpenStack::Auth::Token
- Defined in:
- lib/fog/openstack/auth/token.rb,
lib/fog/openstack/auth/token/v2.rb,
lib/fog/openstack/auth/token/v3.rb
Defined Under Namespace
Classes: CredentialsError, ExpiryError, StandardError, URLError, V2, V3
Instance Attribute Summary collapse
-
#catalog ⇒ Object
readonly
Returns the value of attribute catalog.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#expires ⇒ Object
readonly
Returns the value of attribute expires.
-
#tenant ⇒ Object
readonly
Returns the value of attribute tenant.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#catalog ⇒ Object (readonly)
Returns the value of attribute catalog.
10 11 12 |
# File 'lib/fog/openstack/auth/token.rb', line 10 def catalog @catalog end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
10 11 12 |
# File 'lib/fog/openstack/auth/token.rb', line 10 def data @data end |
#expires ⇒ Object (readonly)
Returns the value of attribute expires.
10 11 12 |
# File 'lib/fog/openstack/auth/token.rb', line 10 def expires @expires end |
#tenant ⇒ Object (readonly)
Returns the value of attribute tenant.
10 11 12 |
# File 'lib/fog/openstack/auth/token.rb', line 10 def tenant @tenant end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
10 11 12 |
# File 'lib/fog/openstack/auth/token.rb', line 10 def token @token end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
10 11 12 |
# File 'lib/fog/openstack/auth/token.rb', line 10 def user @user end |
Class Method Details
.build(auth, options) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/fog/openstack/auth/token.rb', line 16 def self.build(auth, ) if auth[:openstack_identity_api_version] =~ /(v)*2(\.0)*/i || auth[:openstack_tenant_id] || auth[:openstack_tenant] Fog::OpenStack::Auth::Token::V2.new(auth, ) else Fog::OpenStack::Auth::Token::V3.new(auth, ) end end |
Instance Method Details
#get ⇒ Object
35 36 37 38 |
# File 'lib/fog/openstack/auth/token.rb', line 35 def get set(authenticate(@creds, {})) if expired? @token end |
#initialize(auth, options) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/fog/openstack/auth/token.rb', line 25 def initialize(auth, ) raise URLError, 'No URL provided' if auth[:openstack_auth_url].nil? || auth[:openstack_auth_url].empty? @creds = { :data => build_credentials(auth), :uri => URI.parse(auth[:openstack_auth_url]) } response = authenticate(@creds, ) set(response) end |