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
Versions
GET |
/ |
Lists information about all versions of the API |
Response
{
"versions": [
{
"id": "v1.0",
"links": [
{
"href": "http://localhost:8775/",
"rel": "self"
}
],
"status": "CURRENT",
"updated": "2012-01-01T00:00:00Z"
}
]
}GET |
/v1.0 |
Returns detailed information about the specified version of the API |
Response
{
"version": {
"id": "v1.0",
"links": [
{
"href": "http://localhost:8775/",
"rel": "self"
}
],
"status": "CURRENT",
"updated": "2012-01-01T00:00:00Z"
}
}
Database Instances
POST |
/instances |
Creates a new database instance. |
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 |
Lists the status and summary information for all database 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 |
Lists the details for all database instances for a tenant. |
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} |
Lists complete details for a specified database instance |
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} |
Deletes the specified database instance. |
Response will be a 202 Accepted
Databases
POST |
/instances/{instanceId}/databases |
Creates a new database within the specified instance. |
Request
{
"databases": [
{
"name": "sampledb",
"character_set": "utf8",
"collate": "utf8_general_ci"
},
{
"name": "nextround"
}
]
}Response is a 202 Accepted
GET |
/instances/{instanceId}/databases |
Lists databases for the specified instance. |
Response
{
"databases": [
{
"name": "abfadklfgklq3u4q78tzdfjhvgajkdshfgjaef72346JKVFE4"
},
{
"name": "testdb"
}
]
}DELETE |
/instances/{instanceId}/databases/{databaseName} |
Deletes the specified database. |
Response is a 202 Accepted
Users
POST |
/instances/{instanceId}/users |
Creates a user for the specified database instance. |
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 |
Lists the users in the specified database instance. |
Response
{
"users": [
{
"name": "username"
},
{
"name": "otheruser"
}
]
}DELETE |
/instances/{instanceId}/users/{userId} |
Deletes the specified user for the specified database instance. |
Response is a 202 Accepted
Root Access
POST |
/instances/{instanceId}/root |
Enables the root user for the specified database instance and returns the root password. |
No Request body
Response
{
"user": {"name": "root", "password": "generated-password"}
}GET |
/instances/{instanceId}/root/ |
Returns True if root user is enabled for the specified database instance or False otherwise. |
Response
{
"rootEnabled": True
}