2015/07/20 - Apache Deltacloud has been retired.

For more information, please explore the Attic.



Working with Machines

Retrieve the Machine Collection in json format:

 curl --user "user:pass" -H "Accept: application/json" http://localhost:3001/cimi/machines 

Create a new Machine with the message body in XML format:

curl -v --user "mockuser:mockpassword" -X POST -H "Content-Type: application/xml" -H "Accept: application/xml" -d '<MachineCreate xmlns="http://schemas.dmtf.org/cimi/1"> <name> myMachine1 </name> <description> my machine description </description> <machineTemplate> <machineConfig href="http://localhost:3001/cimi/machine_configurations/m1-small"> </machineConfig> <machineImage href="http://localhost:3001/cimi/machine_images/img1"> </machineImage> </machineTemplate> </MachineCreate>' http://localhost:3001/cimi/machines

Alternatively, specifying the message body in JSON:

 curl -v --user "user:password" -X POST -H "Content-Type: application/json" -H "Accept: application/xml" -d '{ "resourceURI": "http://schemas.dmtf.org/cimi/1/MachineCreate", "name": "myMachine3", "description": "My very first json machine", "machineTemplate": { "machineConfig": { "href": "http://localhost:3001/cimi/machine_configurations/m1.small" }, "machineImage": { "href": "http://localhost:3001/cimi/machine_images/ami-48aa4921" } } }' http://localhost:3001/cimi/machines

Perform a Machine operation - stop - with the message body in XML format:

curl -v -X POST --user "mockuser:mockpassword" -H "Content-Type: application/xml" -H "Accept: application/xml" -d '<Action xmlns="http://schemas.dmtf.org/cimi/1"><action> http://http://schemas.dmtf.org/cimi/1/action/stop </action> </Action>'  http://localhost:3001/cimi/machines/inst3/stop

Alternatively, specifying the message body in JSON:

 curl -v -X POST --user "user:password" -H "Accept: application/json" -H "Content-Type: application/json" -d '{"resourceURI": "http://www.dmtf.org/cimi/1/Action", "action":"http://www.dmtf.org/cimi/action/stop"}' http://localhost:3001/cimi/machines/i-5feb7c20/stop


Working with Machine Images

Retrieve the Machine Image Collection:

curl --user "user:pass" -H "Accept: application/json" http://localhost:3001/cimi/machine_images

Create a new Machine Image from an existing Machine, with message body in JSON:

curl --user "mockuser:mockpassword" -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d '{"resourceURI":"http://schemas.dmtf.org/cimi/1/MachineImage", "name":"new_image","description":"my new machine image","type":"IMAGE", "imageLocation":"http://localhost:3001/cimi/machines/inst1"}' http://localhost:3001/cimi/machine_images

Alternatively, specifying the message body in XML:

curl -v --user "mockuser:mockpassword" -H "Content-Type: application/xml" -H "Accept: application/xml" -X POST -d "<MachineImage><name>some_name</name><description>my new machine image</description><type>IMAGE</type><imageLocation>http://localhost:3001/cimi/machines/inst1</imageLocation></MachineImage>" http://localhost:3001/cimi/machine_images

Delete a Machine Image:

curl -X DELETE --user "user:pass" http://localhost:3001/cimi/machine_images/my_image 


Working with Machine Configurations

Retrieve the Machine Configuration Collection:

curl --user "user:pass" -H "Accept: application/json" http://localhost:3001/cimi/machine_configurations

Retrieve a specific Machine Configuration:

curl --user "user:pass" -H "Accept: application/json" http://localhost:3001/cimi/machine_configurations/m1-large

Working with Machine Templates

Retrieve the Machine Template Collection:

curl --user "user:pass" -H "Accept: application/json" http://localhost:3001/cimi/machine_templates

Retrieve a specific Machine Template:

curl --user "user:pass" -H "Accept: application/json" http://localhost:3001/cimi/machine_templates/m1-large

Create a Machine Template with XML body:

curl -v --user "mockuser:mockpassword" -X POST -d '<MachineTemplateCreate><name>myXmlTestMachineTemplate1</name><description>Description of my MachineTemplate</description><property key="test">value</property><machineConfig href="http://localhost:3001/cimi/machine_configurations/m1-xlarge"/><machineImage href="http://localhost:3001/cimi/machine_images/img3"/></MachineTemplateCreate>' -H "Content-Type: application/xml"  -H "Accept: application/xml" http://localhost:3001/cimi/machine_templates

Create a Machine Template with JSON body:

curl -v --user "mockuser:mockpassword" -X POST -d '{"resourceURI": "http://schemas.dmtf.org/cimi/1/MachineTemplateCreate","name": "myMachineDemoTemplate","description": "My very loved machine template","machineConfig": { "href": "http://localhost:3001/cimi/machine_configurations/m1-xlarge" },"machineImage": { "href": "http://localhost:3001/cimi/machine_images/img3" },"properties": { "foo": "bar","life": "is life"}}' -H "Content-Type: application/json"  -H "Accept: application/json" http://localhost:3001/cimi/machine_templates

Delete a Machine Template:

curl -v --user "mockuser:mockpassword" -H "Accept: application/xml" -X DELETE http://localhost:3001/cimi/machine_templates/2

Working with Machine Volumes

Retrieve the Machine Volume Collection of a given Machine resource:

curl -v --user "mockuser:mockpassword" -H "Accept: application/xml" http://localhost:3001/cimi/machines/inst1/volumes

Attach a Volume to a Machine, with XML body:

curl -v --user "mockuser:mockpassword" -H "Content-Type: application/xml" -H "Accept: application/xml" -X POST -d ' /dev/sdf  '  http://localhost:3001/cimi/machines/inst1/volume_attach

Attach a Volume to a Machine, with JSON body:

curl -v --user "mockuser:mockpassword" -H "Content-Type: application/json" -H "Accept: application/xml" -X POST -d '{"resourceURI":"http://schemas.dmtf.org/cimi/1/MachineVolume", "initialLocation": "/dev/sdf", "volume": {"href":"http://localhost:3001/cimi/volumes/vol2"}}' http://localhost:3001/cimi/machines/inst1/volume_attach

Detach a Volume from a Machine:

curl -v --user "mockuser:mockpassword" -H "Accept: application/xml" -X DELETE http://localhost:3001/cimi/machines/inst1/volumes/vol2