Skip to content

Commit

Permalink
Add security create user 201 response to OpenAPI spec (#810)
Browse files Browse the repository at this point in the history
* Add security create user 201 response

Signed-off-by: Zelin Hao <zelinhao@amazon.com>

* Add tests for creating internal users

Signed-off-by: Zelin Hao <zelinhao@amazon.com>

* Update changelog

Signed-off-by: Zelin Hao <zelinhao@amazon.com>

* Match the format for CHANGELOG

Signed-off-by: Zelin Hao <zelinhao@amazon.com>

---------

Signed-off-by: Zelin Hao <zelinhao@amazon.com>
  • Loading branch information
zelinh authored Jan 31, 2025
1 parent 9df46f8 commit b9dcb25
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
7 changes: 7 additions & 0 deletions spec/namespaces/security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
19 changes: 16 additions & 3 deletions tests/default/security/api/internalusers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit b9dcb25

Please sign in to comment.