summaryrefslogtreecommitdiff
path: root/api-ref
diff options
context:
space:
mode:
authorLingxian Kong <anlin.kong@gmail.com>2020-07-12 21:26:44 +1200
committerLingxian Kong <anlin.kong@gmail.com>2020-07-17 11:35:53 +1200
commit828e873846495df6d6911f9c196ae1fb478492f5 (patch)
tree40594616246e68fe54bef919cdc02d7dc310b682 /api-ref
parentf8ca333b4302ef5681f7f63731cce141e4ad7cf3 (diff)
downloadtrove-828e873846495df6d6911f9c196ae1fb478492f5.tar.gz
Support backup strategy API
Change-Id: I0ddd7214dae6e29ddfaf045fdb282f4980a8afff
Diffstat (limited to 'api-ref')
-rw-r--r--api-ref/source/backup-strategy.inc111
-rw-r--r--api-ref/source/backups.inc5
-rwxr-xr-xapi-ref/source/index.rst1
-rwxr-xr-xapi-ref/source/parameters.yaml28
-rw-r--r--api-ref/source/samples/backup-strategy-create-request.json6
-rw-r--r--api-ref/source/samples/backup-strategy-create-response.json8
-rw-r--r--api-ref/source/samples/backup-strategy-list-response.json10
7 files changed, 167 insertions, 2 deletions
diff --git a/api-ref/source/backup-strategy.inc b/api-ref/source/backup-strategy.inc
new file mode 100644
index 00000000..1f36f475
--- /dev/null
+++ b/api-ref/source/backup-strategy.inc
@@ -0,0 +1,111 @@
+.. -*- rst -*-
+
+===============
+Backup Strategy
+===============
+
+Backup strategy allows the user to customize the way of creating backups. Users
+can create strategy either in the project scope or for a particular database
+instance.
+
+
+List backup strategies
+~~~~~~~~~~~~~~~~~~~~~~
+
+.. rest_method:: GET /v1.0/{project_id}/backup_strategies
+
+List backup strategies for a project. You can filter the results by
+using query string parameters. The following filters are supported:
+
+- ``instance_id={instance_id}`` - Return the list of backup strategies for a
+ particular database instance.
+- ``project_id={project_id}`` - Return the list of backup strategies for a
+ particular project, admin only.
+
+Normal response codes: 200
+
+Request
+-------
+
+.. rest_parameters:: parameters.yaml
+
+ - project_id: project_id
+
+Response Parameters
+-------------------
+
+.. rest_parameters:: parameters.yaml
+
+ - backup_strategies: backup_strategy_list
+ - project_id: project_id
+ - instance_id: instanceId1
+ - backend: backup_backend
+ - swift_container: swift_container_required
+
+Response Example
+----------------
+
+.. literalinclude:: samples/backup-strategy-list-response.json
+ :language: javascript
+
+
+Create backup strategy
+~~~~~~~~~~~~~~~~~~~~~~
+
+.. rest_method:: POST /v1.0/{project_id}/backup_strategies
+
+Creates or updates backup strategy for the project or a database instance.
+
+Normal response codes: 202
+
+Request
+-------
+
+.. rest_parameters:: parameters.yaml
+
+ - project_id: project_id
+ - instance_id: instance_id_optional
+ - swift_container: swift_container_required
+
+Request Example
+---------------
+
+.. literalinclude:: samples/backup-strategy-create-request.json
+ :language: javascript
+
+Response Parameters
+-------------------
+
+.. rest_parameters:: parameters.yaml
+
+ - project_id: project_id
+ - instance_id: instanceId1
+ - backend: backup_backend
+ - swift_container: swift_container_required
+
+Response Example
+----------------
+
+.. literalinclude:: samples/backup-strategy-create-response.json
+ :language: javascript
+
+
+Delete database strategy
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. rest_method:: DELETE /v1.0/{project_id}/backup_strategies
+
+Deletes a database strategy for a project. If ``instance_id`` is specified in
+the URL query parameters, delete the database strategy for that particular
+database instance. Additionally, admin user is allowed to delete backup
+strategy of other projects by specifying ``project_id`` in the URL query
+parameters.
+
+Normal response codes: 202
+
+Request
+-------
+
+.. rest_parameters:: parameters.yaml
+
+ - project_id: project_id \ No newline at end of file
diff --git a/api-ref/source/backups.inc b/api-ref/source/backups.inc
index 9fd8d331..b7156a64 100644
--- a/api-ref/source/backups.inc
+++ b/api-ref/source/backups.inc
@@ -70,8 +70,8 @@ Create database backup
Creates a database backup for instance.
In the Trove deployment with service tenant enabled, The backup data is
-stored as objects in OpenStack Swift service in the user's
-container(``database_backups`` by default)
+stored as objects in OpenStack Swift service in the user's container. If not
+specified, the container name is defined by the cloud admin.
Normal response codes: 202
@@ -86,6 +86,7 @@ Request
- parent_id: backup_parentId
- incremental: backup_incremental
- description: backup_description
+ - swift_container: swift_container
Request Example
---------------
diff --git a/api-ref/source/index.rst b/api-ref/source/index.rst
index ed988b90..e2fa2732 100755
--- a/api-ref/source/index.rst
+++ b/api-ref/source/index.rst
@@ -13,6 +13,7 @@
.. include:: instance-actions.inc
.. include:: instance-logs.inc
.. include:: backups.inc
+.. include:: backup-strategy.inc
.. include:: configurations.inc
.. include:: databases.inc
.. include:: users.inc
diff --git a/api-ref/source/parameters.yaml b/api-ref/source/parameters.yaml
index a685ce88..1edc9f7a 100755
--- a/api-ref/source/parameters.yaml
+++ b/api-ref/source/parameters.yaml
@@ -105,6 +105,12 @@ availability_zone:
in: body
required: false
type: string
+backup_backend:
+ description: |
+ The storage backend of instance backups, currently only swift is supported.
+ in: body
+ required: true
+ type: string
backup_description:
description: |
An optional description for the backup.
@@ -173,6 +179,12 @@ backup_status:
in: body
required: true
type: string
+backup_strategy_list:
+ description: |
+ A list of ``backup_strategy`` objects.
+ in: body
+ required: true
+ type: array
characterSet:
description: |
A set of symbols and encodings. Default is
@@ -417,6 +429,12 @@ instance_hostname:
in: body
require: false
type: string
+instance_id_optional:
+ description: |
+ The ID of the database instance.
+ in: body
+ required: false
+ type: string
instance_ip_address:
description: |
The IP address of an instance(deprecated).
@@ -738,6 +756,16 @@ slave_of:
in: body
required: false
type: string
+swift_container:
+ description: User defined swift container name.
+ in: body
+ required: false
+ type: string
+swift_container_required:
+ description: User defined swift container name.
+ in: body
+ required: true
+ type: string
tenant_id:
description: |
The ID of a tenant.
diff --git a/api-ref/source/samples/backup-strategy-create-request.json b/api-ref/source/samples/backup-strategy-create-request.json
new file mode 100644
index 00000000..7c30d9c8
--- /dev/null
+++ b/api-ref/source/samples/backup-strategy-create-request.json
@@ -0,0 +1,6 @@
+{
+ "backup_strategy": {
+ "instance_id": "0602db72-c63d-11ea-b87c-00224d6b7bc1",
+ "swift_container": "my_trove_backups"
+ }
+} \ No newline at end of file
diff --git a/api-ref/source/samples/backup-strategy-create-response.json b/api-ref/source/samples/backup-strategy-create-response.json
new file mode 100644
index 00000000..a6c3ac6c
--- /dev/null
+++ b/api-ref/source/samples/backup-strategy-create-response.json
@@ -0,0 +1,8 @@
+{
+ "backup_strategy": {
+ "project_id": "922b47766bcb448f83a760358337f2b4",
+ "instance_id": "0602db72-c63d-11ea-b87c-00224d6b7bc1",
+ "backend": "swift",
+ "swift_container": "my_trove_backups"
+ }
+} \ No newline at end of file
diff --git a/api-ref/source/samples/backup-strategy-list-response.json b/api-ref/source/samples/backup-strategy-list-response.json
new file mode 100644
index 00000000..98ee13ce
--- /dev/null
+++ b/api-ref/source/samples/backup-strategy-list-response.json
@@ -0,0 +1,10 @@
+{
+ "backup_strategies": [
+ {
+ "backend": "swift",
+ "instance_id": "0602db72-c63d-11ea-b87c-00224d6b7bc1",
+ "project_id": "922b47766bcb448f83a760358337f2b4",
+ "swift_container": "my_trove_backups"
+ }
+ ]
+} \ No newline at end of file