Class: Keystone::V2_0::TokenManager
- Inherits:
-
Openstack::Client::Manager
- Object
- Openstack::Client::Manager
- Keystone::V2_0::TokenManager
- Defined in:
- lib/keystone/v2_0/tokens.rb
Constant Summary collapse
- RESOURCE_CLASS =
Token
Instance Attribute Summary
Attributes inherited from Openstack::Client::Manager
Instance Method Summary collapse
-
#authenticate(options) ⇒ Object
options: :username :tenant_id :tenant_name :password :token :return_raw.
- #delete(token) ⇒ Object
- #endpoints(token) ⇒ Object
-
#initialize(api) ⇒ TokenManager
constructor
A new instance of TokenManager.
Methods inherited from Openstack::Client::Manager
#_create, #_delete, #_get, #_list, #_update, #get_id, #url_with_params
Constructor Details
#initialize(api) ⇒ TokenManager
Returns a new instance of TokenManager.
15 16 17 |
# File 'lib/keystone/v2_0/tokens.rb', line 15 def initialize api super end |
Instance Method Details
#authenticate(options) ⇒ Object
options:
:username
:tenant_id
:tenant_name
:password
:token
:return_raw
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/keystone/v2_0/tokens.rb', line 26 def authenticate if [:token] params = { 'auth' => { 'token' => { 'id' => [:token] } } } elsif [:username] and [:password] params = { 'auth' => { 'passwordCredentials' => { 'username' => [:username], 'password' => [:password] }}} else raise 'A username and password or token is required.' end if [:tenant_id] params['auth']['tenantId'] = [:tenant_id] elsif [:tenant_name] params['auth']['tenantName'] = [:tenant_name] end return self._create('/tokens', params, 'access', [:return_raw]) end |
#delete(token) ⇒ Object
49 50 51 |
# File 'lib/keystone/v2_0/tokens.rb', line 49 def delete token self._delete("/tokens/#{token.id}") end |
#endpoints(token) ⇒ Object
53 54 55 |
# File 'lib/keystone/v2_0/tokens.rb', line 53 def endpoints token self._get("/tokens/#{token.id}/endpoints", 'token') end |