[HLRC] Add support for Delete role mapping API#34531
Conversation
Building on expression dsl and create role mapping API, this commit adds support for delete role mapping API to high level client.
|
Pinging @elastic/es-core-infra |
|
Pinging @elastic/es-security |
|
@elasticmachine test this please |
| * Delete a role mapping. | ||
| * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-role-mapping.html"> | ||
| * the docs</a> for more. | ||
| * @param request the request with the role mapping information to be deleted. |
There was a problem hiding this comment.
s/role mapping information/role mapping name/
| * Asynchronously delete a role mapping. | ||
| * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-role-mapping.html"> | ||
| * the docs</a> for more. | ||
| * @param request the request with the role mapping information to be deleted. |
There was a problem hiding this comment.
s/role mapping information/role mapping name/
...est-high-level/src/main/java/org/elasticsearch/client/security/DeleteRoleMappingRequest.java
Show resolved
Hide resolved
| private final RefreshPolicy refreshPolicy; | ||
|
|
||
| public DeleteRoleMappingRequest(final String name, @Nullable final RefreshPolicy refreshPolicy) { | ||
| this.name = Objects.requireNonNull(name, "role-mapping name is missing"); |
There was a problem hiding this comment.
I'd change the message to role mapping name is required for consistency with other mandatory fields in API requests
...est-high-level/src/main/java/org/elasticsearch/client/security/DeleteRoleMappingRequest.java
Show resolved
Hide resolved
...st-high-level/src/main/java/org/elasticsearch/client/security/DeleteRoleMappingResponse.java
Show resolved
Hide resolved
| private final RefreshPolicy refreshPolicy; | ||
|
|
||
| public DeleteRoleMappingRequest(final String name, @Nullable final RefreshPolicy refreshPolicy) { | ||
| this.name = Objects.requireNonNull(name, "role-mapping name is missing"); |
There was a problem hiding this comment.
This doesn't handle empty Strings. We could implement validate() and use StringUtils.hasText()
There was a problem hiding this comment.
I'd validate in the constructor. You can use Strings.hasText to check and then throw an exception
...igh-level/src/test/java/org/elasticsearch/client/security/DeleteRoleMappingRequestTests.java
Show resolved
Hide resolved
| [[java-rest-high-security-delete-role-mapping-response]] | ||
| ==== Response | ||
| The returned `DeleteRoleMappingResponse` contains a single field, `found`. If the mapping | ||
| is successfully found and deleted, the request returns true. Otherwise, found is set to false. |
There was a problem hiding this comment.
If the mapping is successfully found and deleted, the request returns true. Otherwise, found is set to false.
Maybe change to
If the mapping is successfully found and deleted, found is set to true. Otherwise, it is set to false.
There was a problem hiding this comment.
Corrected it, Thanks.
| -------------------------------------------------- | ||
| include-tagged::{doc-tests}/SecurityDocumentationIT.java[delete-role-mapping-execute-async] | ||
| -------------------------------------------------- | ||
| <1> The `DeleteRoleMappingResponse` to execute and the `ActionListener` to use when |
There was a problem hiding this comment.
s/DeleteRoleMappingResponse/DeleteRoleMappingRequest
There was a problem hiding this comment.
Also corrected in the put-role-mapping.asciidoc. Thanks.
- Changes in java doc - Correct asciidoc - Correct the check for role mapping name in the constructor
jaymode
left a comment
There was a problem hiding this comment.
I left two really minor comments. Otherwise LGTM
| assertNull(request.getEntity()); | ||
| } | ||
|
|
||
|
|
| [[java-rest-high-security-delete-role-mapping-response]] | ||
| ==== Response | ||
| The returned `DeleteRoleMappingResponse` contains a single field, `found`. If the mapping | ||
| is successfully found and deleted, the found is set to true. Otherwise, found is set to false. |
Building on expression dsl and create role mapping API, this commit adds support for delete role mapping API to high level client.
Building on expression dsl and create role mapping API, this commit adds support for delete role mapping API to high level client.
Building on expression dsl and create role mapping API, this
commit adds support for delete role mapping API to high level client.