Class: Keystone::V2_0::Client
- Inherits:
-
Openstack::Client
- Object
- Openstack::Client
- Keystone::V2_0::Client
- Defined in:
- lib/keystone/v2_0/client.rb
Instance Attribute Summary collapse
-
#auth_url ⇒ Object
Returns the value of attribute auth_url.
-
#ec2 ⇒ Object
Returns the value of attribute ec2.
-
#password ⇒ Object
Returns the value of attribute password.
-
#region_name ⇒ Object
Returns the value of attribute region_name.
-
#roles ⇒ Object
Returns the value of attribute roles.
-
#service_catalog ⇒ Object
Returns the value of attribute service_catalog.
-
#services ⇒ Object
Returns the value of attribute services.
-
#tenant_id ⇒ Object
Returns the value of attribute tenant_id.
-
#tenant_name ⇒ Object
Returns the value of attribute tenant_name.
-
#tenants ⇒ Object
Returns the value of attribute tenants.
-
#tokens ⇒ Object
Returns the value of attribute tokens.
-
#user ⇒ Object
Returns the value of attribute user.
-
#username ⇒ Object
Returns the value of attribute username.
-
#users ⇒ Object
Returns the value of attribute users.
-
#version ⇒ Object
Returns the value of attribute version.
Attributes inherited from Openstack::Client
Instance Method Summary collapse
- #_extract_service_catalog(url, body) ⇒ Object
-
#authenticate ⇒ boolean
Authenticate against the Keystone API.
-
#initialize(options = {}) ⇒ Client
constructor
Creates a new Keystone::V2_0::Client object.
Methods inherited from Openstack::Client
#delete, #execute, #get, #post, #put
Constructor Details
#initialize(options = {}) ⇒ Client
Creates a new Keystone::V2_0::Client object.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/keystone/v2_0/client.rb', line 46 def initialize ={} self.username = [:username] self.tenant_id = [:tenant_id] self.tenant_name = [:tenant_name] self.password = [:password] self.auth_url = [:auth_url].chomp('/') if [:auth_url] self.version = 'v2.0' self.region_name = [:region_name] self.auth_token = [:token] # self.roles = roles.RoleManager(self) # self.services = services.ServiceManager(self) self.tenants = Keystone::V2_0::TenantManager.new(self) self.tokens = Keystone::V2_0::TokenManager.new(self) # self.users = users.UserManager(self) # extensions self.ec2 = Keystone::V2_0::EC2CredentialsManager.new(self) unless [:endpoint] authenticate else self.management_url = [:endpoint] end end |
Instance Attribute Details
#auth_url ⇒ Object
Returns the value of attribute auth_url.
17 18 19 |
# File 'lib/keystone/v2_0/client.rb', line 17 def auth_url @auth_url end |
#ec2 ⇒ Object
Returns the value of attribute ec2.
30 31 32 |
# File 'lib/keystone/v2_0/client.rb', line 30 def ec2 @ec2 end |
#password ⇒ Object
Returns the value of attribute password.
16 17 18 |
# File 'lib/keystone/v2_0/client.rb', line 16 def password @password end |
#region_name ⇒ Object
Returns the value of attribute region_name.
19 20 21 |
# File 'lib/keystone/v2_0/client.rb', line 19 def region_name @region_name end |
#roles ⇒ Object
Returns the value of attribute roles.
21 22 23 |
# File 'lib/keystone/v2_0/client.rb', line 21 def roles @roles end |
#service_catalog ⇒ Object
Returns the value of attribute service_catalog.
26 27 28 |
# File 'lib/keystone/v2_0/client.rb', line 26 def service_catalog @service_catalog end |
#services ⇒ Object
Returns the value of attribute services.
22 23 24 |
# File 'lib/keystone/v2_0/client.rb', line 22 def services @services end |
#tenant_id ⇒ Object
Returns the value of attribute tenant_id.
14 15 16 |
# File 'lib/keystone/v2_0/client.rb', line 14 def tenant_id @tenant_id end |
#tenant_name ⇒ Object
Returns the value of attribute tenant_name.
15 16 17 |
# File 'lib/keystone/v2_0/client.rb', line 15 def tenant_name @tenant_name end |
#tenants ⇒ Object
Returns the value of attribute tenants.
23 24 25 |
# File 'lib/keystone/v2_0/client.rb', line 23 def tenants @tenants end |
#tokens ⇒ Object
Returns the value of attribute tokens.
24 25 26 |
# File 'lib/keystone/v2_0/client.rb', line 24 def tokens @tokens end |
#user ⇒ Object
Returns the value of attribute user.
28 29 30 |
# File 'lib/keystone/v2_0/client.rb', line 28 def user @user end |
#username ⇒ Object
Returns the value of attribute username.
13 14 15 |
# File 'lib/keystone/v2_0/client.rb', line 13 def username @username end |
#users ⇒ Object
Returns the value of attribute users.
25 26 27 |
# File 'lib/keystone/v2_0/client.rb', line 25 def users @users end |
#version ⇒ Object
Returns the value of attribute version.
18 19 20 |
# File 'lib/keystone/v2_0/client.rb', line 18 def version @version end |
Instance Method Details
#_extract_service_catalog(url, body) ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/keystone/v2_0/client.rb', line 96 def _extract_service_catalog url, body self.service_catalog = Openstack::Client::ServiceCatalog.new(body) self.auth_token = self.service_catalog.token['id'] begin self.management_url = self.service_catalog.url_for( attribute: 'region', filter_value: self.region_name, endpoint_type: 'adminURL' ) rescue # logger.info 'identity endpoint Not Found' end end |
#authenticate ⇒ boolean
Authenticate against the Keystone API.
Uses the data provided at instantiation to authenticate against the Keystone server. This may use either a username and password or token for authentication. If a tenant id was provided then the resulting authenticated client will be scoped to that tenant and contain a service catalog of available endpoints.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/keystone/v2_0/client.rb', line 81 def authenticate self.management_url = self.auth_url raw_token = self.tokens.authenticate( username: username, tenant_id: tenant_id, tenant_name: tenant_name, password: password, token: auth_token, return_raw: true ) self._extract_service_catalog(self.auth_url, raw_token) self.user = raw_token['user'] return true end |