Class: Keystone::V2_0::Client
- Inherits:
-
Object
- Object
- 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.
-
#endpoint_manager ⇒ Object
Returns the value of attribute endpoint_manager.
-
#password ⇒ Object
Returns the value of attribute password.
-
#role_manager ⇒ Object
Returns the value of attribute role_manager.
-
#service_manager ⇒ Object
Returns the value of attribute service_manager.
-
#tenant_manager ⇒ Object
Returns the value of attribute tenant_manager.
-
#tenant_name ⇒ Object
Returns the value of attribute tenant_name.
-
#user_manager ⇒ Object
query providers.
-
#username ⇒ Object
client specific attributes.
Instance Method Summary collapse
-
#initialize(username, password, tenant_name, auth_url) ⇒ Client
constructor
create a new Keystone client instance with the given credentials.
Constructor Details
#initialize(username, password, tenant_name, auth_url) ⇒ Client
create a new Keystone client instance with the given credentials
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/keystone/v2_0/client.rb', line 27 def initialize(username, password, tenant_name, auth_url) # initialize the object self.username = username self.password = password self.tenant_name = tenant_name self.auth_url = auth_url # create the initial query managers self.user_manager = Keystone::V2_0::Manager::User.new auth_url self.role_manager = Keystone::V2_0::Manager::Role.new auth_url self.tenant_manager = Keystone::V2_0::Manager::Tenant.new auth_url self.service_manager = Keystone::V2_0::Manager::Service.new auth_url self.endpoint_manager = Keystone::V2_0::Manager::Endpoint.new auth_url # create the manager methods through which queries will be performed # using meta-programming to ensure DRY principle is followed [ "users", "roles", "tenants", "services", "endpoints" ].each do |query| singular_method = query.sub(/s$/, '') self.class.send(:define_method, "#{singular_method}_interface") do unless (token = get_token).nil? self.send("#{singular_method}_manager").token = token return self.send("#{singular_method}_manager") else raise "An exception has occurred attempting to invoke '#{query}'" end end 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 |
#endpoint_manager ⇒ Object
Returns the value of attribute endpoint_manager.
24 25 26 |
# File 'lib/keystone/v2_0/client.rb', line 24 def endpoint_manager @endpoint_manager end |
#password ⇒ Object
Returns the value of attribute password.
15 16 17 |
# File 'lib/keystone/v2_0/client.rb', line 15 def password @password end |
#role_manager ⇒ Object
Returns the value of attribute role_manager.
21 22 23 |
# File 'lib/keystone/v2_0/client.rb', line 21 def role_manager @role_manager end |
#service_manager ⇒ Object
Returns the value of attribute service_manager.
23 24 25 |
# File 'lib/keystone/v2_0/client.rb', line 23 def service_manager @service_manager end |
#tenant_manager ⇒ Object
Returns the value of attribute tenant_manager.
22 23 24 |
# File 'lib/keystone/v2_0/client.rb', line 22 def tenant_manager @tenant_manager end |
#tenant_name ⇒ Object
Returns the value of attribute tenant_name.
16 17 18 |
# File 'lib/keystone/v2_0/client.rb', line 16 def tenant_name @tenant_name end |
#user_manager ⇒ Object
query providers
20 21 22 |
# File 'lib/keystone/v2_0/client.rb', line 20 def user_manager @user_manager end |
#username ⇒ Object
client specific attributes
14 15 16 |
# File 'lib/keystone/v2_0/client.rb', line 14 def username @username end |