Jump to: navigation, search

Difference between revisions of "Reddwarfapi"

 
m (Text replace - "__NOTOC__" to "")
 
Line 1: Line 1:
__NOTOC__
+
 
 
* '''Launchpad Entry''': https://blueprints.launchpad.net/reddwarf/+spec/redddwarf-public-api
 
* '''Launchpad Entry''': https://blueprints.launchpad.net/reddwarf/+spec/redddwarf-public-api
 
* '''Created''': 30 Sep 2011
 
* '''Created''': 30 Sep 2011

Latest revision as of 23:30, 17 February 2013

Summary

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

API Operations

Versions

GET /

Response

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


GET /v1.0

Response

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




Database Instances

POST /instances

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"
            }
    }
}


GET /instances

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"
        }
    ]
}


GET /instances/detail

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
             }
        }
    ]
}


GET /instances/{instanceId}

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
        }
    ]
}


DELETE /instances/{instanceId}

Response will be a 202 Accepted



Databases

POST /instances/{instanceId}/databases

Request

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


Response is a 202 Accepted

GET /instances/{instanceId}/databases

Response

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


DELETE /instances/{instanceId}/databases/{databaseName}

Response is a 202 Accepted



Users

POST /instances/{instanceId}/users

Request

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


Response is a 202 Accepted

GET /instances/{instanceId}/users

Response

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


DELETE /instances/{instanceId}/users/{userId}

Response is a 202 Accepted



Root Access

POST /instances/{instanceId}/root

No Request body

Response

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


GET /instances/{instanceId}/root/

Response

{
    "rootEnabled": True
}