From 3fbb560af1e4d53e701c423311e4d01cb5b1f62a Mon Sep 17 00:00:00 2001 From: Tzu-Mainn Chen Date: Thu, 21 Nov 2019 21:27:36 +0000 Subject: Add owner to allocations and create relevant policies Add an owner to allocations. Depending on policy, a non-admin can then create an allocation and have the owner set to their project. Allocation processing then respects the owner. Change-Id: I2965a4a601b9fa2c0212097da37b104a3e5514df Story: #2006506 Task: #37540 --- api-ref/source/baremetal-api-v1-allocation.inc | 15 +++++++++++++++ api-ref/source/parameters.yaml | 2 +- api-ref/source/samples/allocation-create-response.json | 1 + api-ref/source/samples/allocation-show-response.json | 1 + api-ref/source/samples/allocation-update-response.json | 1 + api-ref/source/samples/allocations-list-response.json | 2 ++ 6 files changed, 21 insertions(+), 1 deletion(-) (limited to 'api-ref') diff --git a/api-ref/source/baremetal-api-v1-allocation.inc b/api-ref/source/baremetal-api-v1-allocation.inc index 040450d9c..808005dba 100644 --- a/api-ref/source/baremetal-api-v1-allocation.inc +++ b/api-ref/source/baremetal-api-v1-allocation.inc @@ -47,6 +47,9 @@ parameters must be missing or match the provided node. .. versionadded:: 1.58 Added support for backfilling allocations. +.. versionadded:: 1.60 + Introduced the ``owner`` field. + Normal response codes: 201 Error response codes: 400, 401, 403, 409, 503 @@ -63,6 +66,7 @@ Request - uuid: req_uuid - extra: req_extra - node: req_allocation_node + - owner: owner Request Example --------------- @@ -83,6 +87,7 @@ Response Parameters - resource_class: allocation_resource_class - state: allocation_state - traits: allocation_traits + - owner: owner - extra: extra - created_at: created_at - updated_at: updated_at @@ -104,6 +109,9 @@ Lists all Allocations. .. versionadded:: 1.52 Allocation API was introduced. +.. versionadded:: 1.60 + Introduced the ``owner`` field. + Normal response codes: 200 Error response codes: 400, 401, 403, 404 @@ -116,6 +124,7 @@ Request - node: r_allocation_node - resource_class: r_resource_class - state: r_allocation_state + - owner: owner - fields: fields - limit: limit - marker: marker @@ -135,6 +144,7 @@ Response Parameters - resource_class: allocation_resource_class - state: allocation_state - traits: allocation_traits + - owner: owner - extra: extra - created_at: created_at - updated_at: updated_at @@ -156,6 +166,9 @@ Shows details for an Allocation. .. versionadded:: 1.52 Allocation API was introduced. +.. versionadded:: 1.60 + Introduced the ``owner`` field. + Normal response codes: 200 Error response codes: 400, 401, 403, 404 @@ -181,6 +194,7 @@ Response Parameters - resource_class: allocation_resource_class - state: allocation_state - traits: allocation_traits + - owner: owner - extra: extra - created_at: created_at - updated_at: updated_at @@ -237,6 +251,7 @@ Response Parameters - resource_class: allocation_resource_class - state: allocation_state - traits: allocation_traits + - owner: owner - extra: extra - created_at: created_at - updated_at: updated_at diff --git a/api-ref/source/parameters.yaml b/api-ref/source/parameters.yaml index 8707d111a..c2d15d54d 100644 --- a/api-ref/source/parameters.yaml +++ b/api-ref/source/parameters.yaml @@ -1048,7 +1048,7 @@ nodes: type: array owner: description: | - A string or UUID of the tenant who owns the baremetal node. + A string or UUID of the tenant who owns the object. in: body required: false type: string diff --git a/api-ref/source/samples/allocation-create-response.json b/api-ref/source/samples/allocation-create-response.json index 8016ffc14..67357d7f5 100644 --- a/api-ref/source/samples/allocation-create-response.json +++ b/api-ref/source/samples/allocation-create-response.json @@ -15,6 +15,7 @@ ], "name": "allocation-1", "node_uuid": null, + "owner": null, "resource_class": "bm-large", "state": "allocating", "traits": [], diff --git a/api-ref/source/samples/allocation-show-response.json b/api-ref/source/samples/allocation-show-response.json index 62d13cc83..faf572e93 100644 --- a/api-ref/source/samples/allocation-show-response.json +++ b/api-ref/source/samples/allocation-show-response.json @@ -15,6 +15,7 @@ ], "name": "allocation-1", "node_uuid": "6d85703a-565d-469a-96ce-30b6de53079d", + "owner": null, "resource_class": "bm-large", "state": "active", "traits": [], diff --git a/api-ref/source/samples/allocation-update-response.json b/api-ref/source/samples/allocation-update-response.json index 682e46d19..598699ce0 100644 --- a/api-ref/source/samples/allocation-update-response.json +++ b/api-ref/source/samples/allocation-update-response.json @@ -17,6 +17,7 @@ }, "last_error": null, "created_at": "2019-06-04T07:46:25+00:00", + "owner": null, "resource_class": "CUSTOM_GOLD", "updated_at": "2019-06-06T03:28:19.496960+00:00", "traits": [], diff --git a/api-ref/source/samples/allocations-list-response.json b/api-ref/source/samples/allocations-list-response.json index ff05159f0..992cdc1a3 100644 --- a/api-ref/source/samples/allocations-list-response.json +++ b/api-ref/source/samples/allocations-list-response.json @@ -17,6 +17,7 @@ ], "name": "allocation-1", "node_uuid": "6d85703a-565d-469a-96ce-30b6de53079d", + "owner": null, "resource_class": "bm-large", "state": "active", "traits": [], @@ -40,6 +41,7 @@ ], "name": "allocation-2", "node_uuid": null, + "owner": null, "resource_class": "bm-large", "state": "error", "traits": [ -- cgit v1.2.1