From b9dcb251d551e90ecfc416ba134efe83cbcbc1b3 Mon Sep 17 00:00:00 2001 From: Zelin Hao Date: Fri, 31 Jan 2025 02:58:31 -0800 Subject: [PATCH] Add security create user 201 response to OpenAPI spec (#810) * Add security create user 201 response Signed-off-by: Zelin Hao * Add tests for creating internal users Signed-off-by: Zelin Hao * Update changelog Signed-off-by: Zelin Hao * Match the format for CHANGELOG Signed-off-by: Zelin Hao --------- Signed-off-by: Zelin Hao --- CHANGELOG.md | 1 + spec/namespaces/security.yaml | 7 +++++++ tests/default/security/api/internalusers.yaml | 19 ++++++++++++++++--- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 073dcec25..126abb1f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,6 +56,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Added a warning for test file names that don't match the API being tested ([#793](https://github.com/opensearch-project/opensearch-api-specification/pull/793)) - Added `time` field to the `GetStats` schema in `_common.yml` ([#803](https://github.com/opensearch-project/opensearch-api-specification/pull/803)) - Added version for `POST /_plugins/_ml/_train/{algorithm_name}`, `_predict/{algorithm_name}/{model_id}`, and `_train_predict/{algorithm_name}` ([#763](https://github.com/opensearch-project/opensearch-api-specification/pull/763)) +- Added `POST _plugins/_security/api/internalusers/{username}` response `201` ([#810](https://github.com/opensearch-project/opensearch-api-specification/pull/810)) ### Removed - Removed unsupported `_common.mapping:SourceField`'s `mode` field and associated `_common.mapping:SourceFieldMode` enum ([#652](https://github.com/opensearch-project/opensearch-api-specification/pull/652)) diff --git a/spec/namespaces/security.yaml b/spec/namespaces/security.yaml index 0a3a44bed..73f744878 100644 --- a/spec/namespaces/security.yaml +++ b/spec/namespaces/security.yaml @@ -615,6 +615,8 @@ paths: responses: '200': $ref: '#/components/responses/security.create_user@200' + '201': + $ref: '#/components/responses/security.create_user@201' patch: operationId: security.patch_user.0 x-operation-group: security.patch_user @@ -1657,6 +1659,11 @@ components: application/json: schema: $ref: '../schemas/security._common.yaml#/components/schemas/Ok' + security.create_user@201: + content: + application/json: + schema: + $ref: '../schemas/security._common.yaml#/components/schemas/Created' security.create_user_legacy@200: content: application/json: diff --git a/tests/default/security/api/internalusers.yaml b/tests/default/security/api/internalusers.yaml index 9285ea3b2..e79022a6a 100644 --- a/tests/default/security/api/internalusers.yaml +++ b/tests/default/security/api/internalusers.yaml @@ -12,18 +12,31 @@ chapters: method: GET response: status: 200 + - synopsis: Create internal user for first time. + path: /_plugins/_security/api/internalusers/{username} + method: PUT + parameters: + username: test + request: + payload: + password: myWeakPassword123! + opendistro_security_roles: [] + backend_roles: [] + attributes: {} + response: + status: 201 - synopsis: Patch internal users bulk. path: /_plugins/_security/api/internalusers method: PATCH request: - payload: + payload: - op: add path: /test - value: + value: backend_roles: [admin] response: status: 200 - - synopsis: Create internal user. + - synopsis: Create internal user with existing name. path: /_plugins/_security/api/internalusers/{username} method: PUT parameters: