Each type of a resource has an associated model. Where resource refers to other resources, natural navigation across the object model is possible. For example:
puts instance.image.name puts instance.hardware_profile.architecture
Retrieve a complete list of realms available to you:
realm = client.realms
You can access a specific realm by adding its identifier:
realm = client.realm( 'us' )
Display a complete list of hardware profiles available for launching machines:
hwp = client.hardware_profiles
You can filter hardware profiles by architecture.
hardware_profiles = client.hardware_profiles( :architecture=>'x86_64' )
Retrieve a specific hardware profile by its identifier:
hardware_profile = client.hardware_profile( 'm1-small' )
Return a complete list of images:
images = client.images
Retrieve a list of images owned by the currently authenticated user:
images = client.images( :owner_id=>:self )
You can also retrieve a list of images visible to you but owned by a specific user:
images = client.images( :owner_id=>'daryll' )
Access a specific image by its identifier:
image = client.image( 'ami-8675309' )
Get a list of all instances visible to you:
instances = client.instances
Retrieve a list of all running instances:
instances = client.instances( :state =>:running )
Look up the first instance in the list:
instance = client.instances.first
Find a specific instance by its identifier:
instance = client.instance( 'i-90125' )
Launch an instance using an image identifier:
instance = client.create_instance(image_id)
You may specify a hardware profile:
instance = client.create_instance(image_id, :hwp_id => 'm1-small')
To create new instance, you can also use the 'user_name' feature:
instance = client.create_instance(image_id, :name => 'myinst1')
Start an instance:
instance.start!
Execute the 'reboot' operation:
instance.reboot!
Destroy an instance:
instance.destroy!
For more details on Deltacloud Ruby client see the full documentation.