From f89614d2e22bf1f7ad76a1221544c102ef589976 Mon Sep 17 00:00:00 2001 From: wangxiyuan Date: Mon, 19 Jun 2017 10:10:10 +0800 Subject: [PATCH] [api-ref] Add snapshot metadata key api The patch did: 1. Add the missing GET/DELETE/PUT api-ref for snapshot metadata key. 2. Fix snapshot_id description. Change-Id: I817b1ccffd5e929bcf78b913d666073596b93612 --- api-ref/source/v3/parameters.yaml | 10 +- .../snapshot-metadata-show-key-response.json | 5 + .../snapshot-metadata-update-key-request.json | 5 + ...snapshot-metadata-update-key-response.json | 5 + api-ref/source/v3/volumes-v3-snapshots.inc | 111 +++++++++++++++++- 5 files changed, 128 insertions(+), 8 deletions(-) create mode 100644 api-ref/source/v3/samples/snapshot-metadata-show-key-response.json create mode 100644 api-ref/source/v3/samples/snapshot-metadata-update-key-request.json create mode 100644 api-ref/source/v3/samples/snapshot-metadata-update-key-response.json diff --git a/api-ref/source/v3/parameters.yaml b/api-ref/source/v3/parameters.yaml index e722390a2ee..44ac3e6d948 100644 --- a/api-ref/source/v3/parameters.yaml +++ b/api-ref/source/v3/parameters.yaml @@ -132,11 +132,11 @@ resource: in: path required: false type: string -snapshot_id_1: +snapshot_id_path: description: | The UUID of the snapshot. in: path - required: false + required: true type: string transfer_id: description: | @@ -1135,6 +1135,12 @@ meta: in: body required: true type: object +meta_1: + description: | + The metadata key and value pair for the snapshot. + in: body + required: true + type: object metadata: description: | One or more metadata key and value pairs for the diff --git a/api-ref/source/v3/samples/snapshot-metadata-show-key-response.json b/api-ref/source/v3/samples/snapshot-metadata-show-key-response.json new file mode 100644 index 00000000000..ebd589c1b2d --- /dev/null +++ b/api-ref/source/v3/samples/snapshot-metadata-show-key-response.json @@ -0,0 +1,5 @@ +{ + "meta": { + "name": "test" + } +} diff --git a/api-ref/source/v3/samples/snapshot-metadata-update-key-request.json b/api-ref/source/v3/samples/snapshot-metadata-update-key-request.json new file mode 100644 index 00000000000..023712fce45 --- /dev/null +++ b/api-ref/source/v3/samples/snapshot-metadata-update-key-request.json @@ -0,0 +1,5 @@ +{ + "meta": { + "name": "new_name" + } +} diff --git a/api-ref/source/v3/samples/snapshot-metadata-update-key-response.json b/api-ref/source/v3/samples/snapshot-metadata-update-key-response.json new file mode 100644 index 00000000000..023712fce45 --- /dev/null +++ b/api-ref/source/v3/samples/snapshot-metadata-update-key-response.json @@ -0,0 +1,5 @@ +{ + "meta": { + "name": "new_name" + } +} diff --git a/api-ref/source/v3/volumes-v3-snapshots.inc b/api-ref/source/v3/volumes-v3-snapshots.inc index 777a463a172..3f55b73618f 100644 --- a/api-ref/source/v3/volumes-v3-snapshots.inc +++ b/api-ref/source/v3/volumes-v3-snapshots.inc @@ -186,7 +186,7 @@ Request .. rest_parameters:: parameters.yaml - project_id: project_id_path - - snapshot_id: snapshot_id + - snapshot_id: snapshot_id_path Response Parameters @@ -235,7 +235,7 @@ Request - metadata: metadata - project_id: project_id_path - - snapshot_id: snapshot_id + - snapshot_id: snapshot_id_path Request Example --------------- @@ -269,7 +269,7 @@ Request - metadata: metadata - project_id: project_id_path - - snapshot_id: snapshot_id + - snapshot_id: snapshot_id_path Request Example --------------- @@ -303,7 +303,7 @@ Request .. rest_parameters:: parameters.yaml - project_id: project_id_path - - snapshot_id: snapshot_id + - snapshot_id: snapshot_id_path Response Parameters @@ -351,7 +351,7 @@ Request - description: description - name: name - project_id: project_id_path - - snapshot_id: snapshot_id + - snapshot_id: snapshot_id_path Request Example --------------- @@ -399,4 +399,103 @@ Request .. rest_parameters:: parameters.yaml - project_id: project_id_path - - snapshot_id: snapshot_id + - snapshot_id: snapshot_id_path + + + + +Show a snapshot's metadata for a specific key +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. rest_method:: GET /v3/{project_id}/snapshot/{snapshot_id}/metadata/{key} + +Shows metadata for a snapshot for a specific key. + +Normal response codes: 200 + + +Request +------- + +.. rest_parameters:: parameters.yaml + + - project_id: project_id_path + - snapshot_id: snapshot_id_path + - key: key_2 + + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - meta: meta_1 + + + +Response Example +---------------- + +.. literalinclude:: ./samples/snapshot-metadata-show-key-response.json + :language: javascript + + + +Delete a snapshot's metadata +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. rest_method:: DELETE /v3/{project_id}/snapshots/{snapshot_id}/metadata/{key} + +Deletes metadata for a snapshot. + +Normal response codes: 200 + + +Request +------- + +.. rest_parameters:: parameters.yaml + + - project_id: project_id_path + - snapshot_id: snapshot_id_path + - key: key_1 + + +Update a snapshot's metadata for a specific key +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. rest_method:: PUT /v3/{project_id}/snapshots/{snapshot_id}/metadata/{key} + +Update metadata for a snapshot for a specific key. + +Normal response codes: 200 + + +Request +------- + +.. rest_parameters:: parameters.yaml + + - project_id: project_id_path + - snapshot_id: snapshot_id_path + - key: key_3 + - meta: meta_1 + +Request Example +--------------- + +.. literalinclude:: ./samples/snapshot-metadata-update-key-request.json + :language: javascript + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - meta: meta_1 + +Response Example +---------------- + +.. literalinclude:: ./samples/snapshot-metadata-update-key-response.json + :language: javascript