Reddwarfapi


 * Launchpad Entry: https://blueprints.launchpad.net/reddwarf/+spec/redddwarf-public-api
 * Created: 30 Sep 2011
 * Contributors: Reddwarf Drivers

= Summary =

This is a proposal for a possible list of api operations for the first version of the Database as a Service.

= API Operations =

Response
{   "versions": [ {           "id": "v1.0", "links": [ {                   "href": "http://localhost:8775/", "rel": "self" }           ],            "status": "CURRENT", "updated": "2012-01-01T00:00:00Z" }   ] }

Response
{   "version": { "id": "v1.0", "links": [ {               "href": "http://localhost:8775/", "rel": "self" }       ],        "status": "CURRENT", "updated": "2012-01-01T00:00:00Z" } }

Request
{   "instance": { "name": "'my_instance_name'", "flavor": "url_to_flavor_version", "port": "3306", "dbtype": { "name": "mysql", "version": "5.1.2" },       "databases": [ {               "name": "testdb", "character_set": "utf8", "collate": "utf8_general_ci" },           {                "name": "abfadklfgklq3u4q78tzdfjhvgajkdshfgjaef72346JKVFE4" }       ],        "volume": {               "size": "2" }   } }

Response
{   "instance": { "status": "BUILD", "flavor": "url_to_flavor_of_instance", "links": [ {               "href": "url_to_server_version_info", "rel": "self" },           {                "href": "url_to_server_version_info", "rel": "bookmark" },       ],        "name": "my_instance_name-instance-id", "id": "generated-db-instance-id", "volume": {               "size": "2" }   } }

Response
{   "instances": [ {           "name": "testing", "links": [ {                   "href": "http://localhost:8775/v1.0/instances/55", "rel": "self" },               {                    "href": "http://localhost:8775/v1.0/instances/55", "rel": "bookmark" }           ],            "id": "55", "status": "ACTIVE" },       {            "name": "testing2", "links": [ {                   "href": "http://localhost:8775/v1.0/instances/56", "rel": "self" },               {                    "href": "http://localhost:8775/v1.0/instances/56", "rel": "bookmark" }           ],            "id": "56", "status": "ACTIVE" }   ] }

Response
{   "instances": [ {           "name": "testing", "links": [ {                   "href": "http://localhost:8775/v1.0/instances/55", "rel": "self" },               {                    "href": "http://localhost:8775/v1.0/instances/55", "rel": "bookmark" }           ],            "id": "55", "status": "ACTIVE" "flavor": { "id": 1 "link": "http://localhost:8775/v1.0/flavors/1" }           "created": "2011-09-30T20:29:42Z" "updated": "2011-09-30T20:31:21Z" "hostname": "my-name-instance-55" "volume": { "size": 2 }       },        {            "name": "testing2", "links": [ {                   "href": "http://localhost:8775/v1.0/instances/56", "rel": "self" },               {                    "href": "http://localhost:8775/v1.0/instances/56", "rel": "bookmark" }           ],            "id": "56", "status": "ACTIVE" "flavor": { "id": 2 "link": "http://localhost:8775/v1.0/flavors/2" }           "created": "2011-09-30T20:29:42Z" "updated": "2011-09-30T20:31:21Z" "hostname": "my-name-instance-56" "volume": { "size": 2 }       }    ] }

Response
{   "instances": [ {           "name": "testing", "links": [ {                   "href": "http://localhost:8775/v1.0/instances/55", "rel": "self" },               {                    "href": "http://localhost:8775/v1.0/instances/55", "rel": "bookmark" }           ],            "id": "55", "status": "ACTIVE" "flavor": { "id": 1 "link": "http://localhost:8775/v1.0/flavors/1" }           "created": "2011-09-30T20:29:42Z" "updated": "2011-09-30T20:31:21Z" "hostname": "my-name-instance-55" "volume": { "size": 2 }            "databases": [] "rootEnabled": False },       {            "name": "testing2", "links": [ {                   "href": "http://localhost:8775/v1.0/instances/56", "rel": "self" },               {                    "href": "http://localhost:8775/v1.0/instances/56", "rel": "bookmark" }           ],            "id": "56", "status": "ACTIVE" "flavor": { "id": 2 "link": "http://localhost:8775/v1.0/flavors/2" }           "created": "2011-09-30T20:29:42Z" "updated": "2011-09-30T20:31:21Z" "hostname": "my-name-instance-56" "volume": { "size": 2 }           "databases": [ {               "name": "testdb", "character_set": "utf8", "collate": "utf8_general_ci" },           {                "name": "abfadklfgklq3u4q78tzdfjhvgajkdshfgjaef72346JKVFE4" }       ],       "rootEnabled": True }   ] }

Response will be a 202 Accepted

Request
{   "databases": [ {           "name": "sampledb", "character_set": "utf8", "collate": "utf8_general_ci" },       {            "name": "nextround" }   ] }

Response is a 202 Accepted

Response
{   "databases": [ {           "name": "abfadklfgklq3u4q78tzdfjhvgajkdshfgjaef72346JKVFE4" },       {            "name": "testdb" }   ] }

Response is a 202 Accepted

Request
{   "users": [ {           "name": "dbuser3", "password": "password", "database": "databaseA" },       {            "name": "dbuser4", "password": "password", "databases": [ {                   "name": "databaseB" },               {                    "name": "databaseC" }           ]        }    ] }

Response is a 202 Accepted

Response
{   "users": [ {           "name": "username" },       {            "name": "otheruser" }   ] }

Response is a 202 Accepted

Root Access
No Request body

Response
{   "user": {"name": "root", "password": "generated-password"} }

Response
{   "rootEnabled": True }