Skip to content

[HLRC] Add support for Delete role mapping API#34531

Merged
bizybot merged 6 commits intoelastic:masterfrom
bizybot:delete-role-mapping-hl-api
Oct 19, 2018
Merged

[HLRC] Add support for Delete role mapping API#34531
bizybot merged 6 commits intoelastic:masterfrom
bizybot:delete-role-mapping-hl-api

Conversation

@bizybot
Copy link
Copy Markdown
Contributor

@bizybot bizybot commented Oct 16, 2018

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.
@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-core-infra

@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-security

@bizybot
Copy link
Copy Markdown
Contributor Author

bizybot commented Oct 16, 2018

@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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/role mapping information/role mapping name/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, Thank you.

* 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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/role mapping information/role mapping name/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, Thank you.

private final RefreshPolicy refreshPolicy;

public DeleteRoleMappingRequest(final String name, @Nullable final RefreshPolicy refreshPolicy) {
this.name = Objects.requireNonNull(name, "role-mapping name is missing");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd change the message to role mapping name is required for consistency with other mandatory fields in API requests

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, Thank you.

private final RefreshPolicy refreshPolicy;

public DeleteRoleMappingRequest(final String name, @Nullable final RefreshPolicy refreshPolicy) {
this.name = Objects.requireNonNull(name, "role-mapping name is missing");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't handle empty Strings. We could implement validate() and use StringUtils.hasText()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd validate in the constructor. You can use Strings.hasText to check and then throw an exception

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, Thank you.

[[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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/DeleteRoleMappingResponse/DeleteRoleMappingRequest

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also corrected in the put-role-mapping.asciidoc. Thanks.

Yogesh Gaikwad added 3 commits October 18, 2018 06:14
- Changes in java doc
- Correct asciidoc
- Correct the check for role mapping name in the constructor
Copy link
Copy Markdown
Contributor

@jkakavas jkakavas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Member

@jaymode jaymode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left two really minor comments. Otherwise LGTM

assertNull(request.getEntity());
}


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: extra line

[[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.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/the found/found

@bizybot bizybot merged commit 39a6163 into elastic:master Oct 19, 2018
bizybot added a commit that referenced this pull request Oct 19, 2018
Building on expression dsl and create role mapping API, this
commit adds support for delete role mapping API to high level client.
@colings86 colings86 added >enhancement and removed :Security/Security Security issues without another label labels Oct 25, 2018
kcm pushed a commit that referenced this pull request Oct 30, 2018
Building on expression dsl and create role mapping API, this
commit adds support for delete role mapping API to high level client.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants