tuskar/tuskar — pull request #10 by mtaylor (2013-06-26 19:00:52+00:00)
Title: Updated Resource Class API

Add transactions to the database operations
Add GET and DELETE operations
Support association of Racks in POST operation
Starts work on nested marshalling

To create a new resource class with associated Rack, first create a Rack

POST /racks

```
{
"subnet": "192.168.1.0/255",
"name": "my_rack_12",
"capacities":
[
{
"name": "total_cpu",
"value": "64"
},
{
"name": "total_memory",
"value": "1024"
}
],
"chassis":
{
"links":
[
{
"url": "http://ironic.local:3333/v1/chassis/123",
"rel": "self"
}
]
},
"slots": 1
}

```

Next create a Resource Class and reference the URL returned from the POST /racks request

POST resource_classes

```
{
"service_type": "compute",
"name": "test-chassis",
"racks":[
{
"links": [
{ "href":"http://0.0.0.0:6385/v1/racks/6", "rel":"self" }
]
}
]
}

```