trove/api-ref/source/databases.inc
Zhao Chao b0577ae97e [api-ref] Update style and instances api.
Doc style:
* use tildes for heading 2 (following the rst convention);
* break source lines exceeded 79 characters (rst convention);
* remove unneccessary blank lines:
  * 4 blank lines between sections;
  * 2 blank lines between sub-sections;
  * 1 blank line between paragraphs in a section/subsection;
  * no blank lines at the bottom of a source file.
* add a space after commas in the middle of a line;

Instances API:
* change the order to match the description at the begin;
* add "Update instance name";
* add "Upgrade datastore version".

Change-Id: I3520e42f6ad97cb30632cf05241cec316409c9be
Signed-off-by: Zhao Chao <zhaochao1984@gmail.com>
2018-01-25 22:55:13 +08:00

107 lines
2.2 KiB
ReStructuredText

.. -*- rst -*-
=====================
Databases (databases)
=====================
Creates, lists all, and deletes databases.
Delete database
~~~~~~~~~~~~~~~
.. rest_method:: DELETE /v1.0/{accountId}/instances/{instanceId}/databases/{databaseName}
Deletes a database.
This operation also deletes all data that is associated with the
database.
Normal response codes: 202
Error response codes: badRequest(400), unauthorized(401), forbidden(403),
itemNotFound(404), badMethod(405), overLimit(413), unprocessableEntity(422),
instanceFault(500), notImplemented(501), serviceUnavailable(503)
Request
-------
.. rest_parameters:: parameters.yaml
- instanceId: instanceId
- databaseName: databaseName
- accountId: accountId
Create database
~~~~~~~~~~~~~~~
.. rest_method:: POST /v1.0/{accountId}/instances/{instanceId}/databases
Creates a database within an instance.
Normal response codes: 202
Error response codes: badRequest(400), unauthorized(401), forbidden(403),
itemNotFound(404), badMethod(405), overLimit(413), unprocessableEntity(422),
instanceFault(500), notImplemented(501), serviceUnavailable(503)
Request
-------
.. rest_parameters:: parameters.yaml
- characterSet: characterSet
- collate: collate
- name: name
- instanceId: instanceId
- accountId: accountId
Request Example
---------------
.. literalinclude:: samples/db-create-databases-request.json
:language: javascript
List instance databases
~~~~~~~~~~~~~~~~~~~~~~~
.. rest_method:: GET /v1.0/{accountId}/instances/{instanceId}/databases
Lists databases for an instance.
This operation returns only the user-defined databases and not the
system databases. Only the database administrator can view the
``mysql``, ``information_schema``, and ``lost+found`` system
databases.
Normal response codes: 200
Error response codes: badRequest(400), unauthorized(401), forbidden(403),
itemNotFound(404), badMethod(405), overLimit(413), unprocessableEntity(422),
instanceFault(500), notImplemented(501), serviceUnavailable(503)
Request
-------
.. rest_parameters:: parameters.yaml
- instanceId: instanceId
- accountId: accountId
Response Example
----------------
.. literalinclude:: samples/db-list-databases-response.json
:language: javascript