deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@redhat.com
Subject Added use_config and changed initializer for client
Date Fri, 07 Jan 2011 10:27:53 GMT
Hi,

This patch will change the way how we initialize Ruby client.
For now, you need to pass username, password and URL as a separate
attributes.
I think that passing that as Hash will give us more flexibility
to use different configs.
Also I added 'use_config' method for client which will allow you
to switch driver and URL on initialized client instance.

Example:

config = {
  :ec2 => {
    :driver => 'ec2',
    :username => 'xxx',
    :password => 'xxx',
    :url => 'http://localhost:3001/api'
  },
  :mock => {
    :driver => 'mock',
    :username => 'mockuser',
    :password => 'mockpassword',
  },
  :rhevm => {
    :driver => 'rhevm',
    :username => 'admin@domain',
    :password => 'password',
  }
}

client = DeltaCloud::new(config[:ec2])
client.realms => will return EC2 realms

client.use_config! config[:mock]
client.realms => will return Mock realms

Let me know what do you think :-)


  -- Michal


Mime
View raw message