From aa16c5a6d27e94b448f2c43db7b3d19fdd3f8abc Mon Sep 17 00:00:00 2001 From: songwenping Date: Mon, 20 Mar 2023 16:51:34 +0800 Subject: [PATCH] Add api ref for create of attributes Change-Id: I6fe61a13a3fb0b99f5400b9cf50c10b9cf10a66e --- api-ref/source/attributes.inc | 25 ++++++++++++++++++++++++- api-ref/source/parameters.yaml | 18 ++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/api-ref/source/attributes.inc b/api-ref/source/attributes.inc index 900600bf..0d984303 100644 --- a/api-ref/source/attributes.inc +++ b/api-ref/source/attributes.inc @@ -4,7 +4,7 @@ Attributes ++++++++++ -Lists, shows details for attributes. +Lists, shows details, creates for attributes. A `attribute` represents the trait of a physical card like FPGA or GPU. @@ -79,3 +79,26 @@ Response .. literalinclude:: ../../doc/api_samples/attributes/attributes-getone-resp.json :language: javascript + +Create Attributes +----------------- + +.. rest_method:: POST /v2/attributes + +Creates an attribute. The payload should have the following field: + +Request +======= +.. rest_parameters:: parameters.yaml + + - deployable_id: attribute_deployable_id_req + - key: attribute_key_req + - value: attribute_value_req + +**Example post curl** + +.. literalinclude:: ../../doc/api_samples/attributes/attributes-post-curl.json + +**Example response: create an attribute** + +.. literalinclude:: ../../doc/api_samples/attributes/attributes-create-resp.json diff --git a/api-ref/source/parameters.yaml b/api-ref/source/parameters.yaml index 9d0fb643..2ad56713 100644 --- a/api-ref/source/parameters.yaml +++ b/api-ref/source/parameters.yaml @@ -79,6 +79,12 @@ hostname: type: string # variables in body +attribute_deployable_id_req: + description: | + ID of deployable associated with the attribute. + in: body + required: true + type: integer attribute_deployable_id_resp: description: | ID of deployable associated with the attribute. @@ -91,6 +97,12 @@ attribute_id_resp: in: body required: true type: integer +attribute_key_req: + description: | + The key of the attribute. + in: body + required: true + type: string attribute_key_resp: description: | The key of the attribute. @@ -103,6 +115,12 @@ attribute_uuid_resp: in: body required: true type: string +attribute_value_req: + description: | + The value of the attribute. + in: body + required: true + type: string attribute_value_resp: description: | The value of the attribute.