diff --git a/api-ref/source/index.rst b/api-ref/source/index.rst index 2c482ea7c3..9c829ec1b6 100644 --- a/api-ref/source/index.rst +++ b/api-ref/source/index.rst @@ -15,3 +15,4 @@ .. include:: certificates.inc .. include:: mservices.inc .. include:: stats.inc +.. include:: quotas.inc diff --git a/api-ref/source/quotas.inc b/api-ref/source/quotas.inc new file mode 100644 index 0000000000..a80f01ebb4 --- /dev/null +++ b/api-ref/source/quotas.inc @@ -0,0 +1,124 @@ +.. -*- rst -*- + +================= + Magnum Quota API +================= + +Lists, creates, shows details, and updates Quotas. + +Set new quota +================== + +.. rest_method:: POST /v1/quotas + +Create new quota for a project. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 201 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + - 404 + +Request Example +---------------- + +.. literalinclude:: samples/quota-create-req.json + :language: javascript + +Response Example +---------------- + +.. literalinclude:: samples/quota-create-resp.json + :language: javascript + +List all quotas +================ + +.. rest_method:: GET /v1/quotas + +List all quotas in Magnum. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 200 + +.. rest_status_code:: error status.yaml + + - 401 + - 403 + +Response Example +---------------- + +.. literalinclude:: samples/quota-get-all-resp.json + :language: javascript + +Show details of a quota +========================= + +.. rest_method:: GET /v1/quotas/{project_id}/{resource} + +Get quota information for the given project_id and resource. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 200 + +.. rest_status_code:: error status.yaml + + - 401 + - 403 + - 404 + +Response Example +---------------- + +.. literalinclude:: samples/quota-get-one-resp.json + :language: javascript + +Update a resource quota +============================= + +.. rest_method:: PATCH /v1/quotas/{project_id}/{resource} + +Update resource quota for the given projec id. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 202 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + - 404 + +Request Example +---------------- + +.. literalinclude:: samples/quota-update-req.json + :language: javascript + +Response Example +---------------- + +.. literalinclude:: samples/quota-update-resp.json + :language: javascript diff --git a/api-ref/source/samples/quota-create-req.json b/api-ref/source/samples/quota-create-req.json new file mode 100644 index 0000000000..c5f941c938 --- /dev/null +++ b/api-ref/source/samples/quota-create-req.json @@ -0,0 +1,5 @@ +{ + "project_id": "aa5436ab58144c768ca4e9d2e9f5c3b2", + "resource": "Cluster", + "hard_limit": 10 +} \ No newline at end of file diff --git a/api-ref/source/samples/quota-create-resp.json b/api-ref/source/samples/quota-create-resp.json new file mode 100644 index 0000000000..05499eed6d --- /dev/null +++ b/api-ref/source/samples/quota-create-resp.json @@ -0,0 +1,8 @@ +{ + "resource": "Cluster", + "created_at": "2017-01-17T17:35:48+00:00", + "updated_at": null, + "hard_limit": 1, + "project_id": "aa5436ab58144c768ca4e9d2e9f5c3b2", + "id": 26 +} \ No newline at end of file diff --git a/api-ref/source/samples/quota-get-all-resp.json b/api-ref/source/samples/quota-get-all-resp.json new file mode 100644 index 0000000000..c9321fbaac --- /dev/null +++ b/api-ref/source/samples/quota-get-all-resp.json @@ -0,0 +1,12 @@ +{ + "quotas": [ + { + "resource": "Cluster", + "created_at": "2017-01-17T17:35:49+00:00", + "updated_at": "2017-01-17T17:38:21+00:00", + "hard_limit": 10, + "project_id": "aa5436ab58144c768ca4e9d2e9f5c3b2", + "id": 26 + } + ] +} \ No newline at end of file diff --git a/api-ref/source/samples/quota-get-one-resp.json b/api-ref/source/samples/quota-get-one-resp.json new file mode 100644 index 0000000000..0cb18cd81a --- /dev/null +++ b/api-ref/source/samples/quota-get-one-resp.json @@ -0,0 +1,8 @@ +{ + "resource": "Cluster", + "created_at": "2017-01-17T17:35:49+00:00", + "updated_at": "2017-01-17T17:38:20+00:00", + "hard_limit": 10, + "project_id": "aa5436ab58144c768ca4e9d2e9f5c3b2", + "id": 26 +} \ No newline at end of file diff --git a/api-ref/source/samples/quota-udpate-resp.json b/api-ref/source/samples/quota-udpate-resp.json new file mode 100644 index 0000000000..0cb18cd81a --- /dev/null +++ b/api-ref/source/samples/quota-udpate-resp.json @@ -0,0 +1,8 @@ +{ + "resource": "Cluster", + "created_at": "2017-01-17T17:35:49+00:00", + "updated_at": "2017-01-17T17:38:20+00:00", + "hard_limit": 10, + "project_id": "aa5436ab58144c768ca4e9d2e9f5c3b2", + "id": 26 +} \ No newline at end of file diff --git a/api-ref/source/samples/quota-update-req.json b/api-ref/source/samples/quota-update-req.json new file mode 100644 index 0000000000..8d83881311 --- /dev/null +++ b/api-ref/source/samples/quota-update-req.json @@ -0,0 +1,3 @@ +{ + "hard_limit": 10 +} \ No newline at end of file