-
Notifications
You must be signed in to change notification settings - Fork 24.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create/Update role mapping API #34171
Conversation
This commit adds create/update role mapping API.
Pinging @elastic/es-security |
Pinging @elastic/es-core-infra |
|
||
public PutRoleMappingRequest(final String name, final boolean enabled, final List<String> roles, final RoleMapperExpression rules, | ||
@Nullable final Map<String, Object> metadata, @Nullable final RefreshPolicy refreshPolicy) { | ||
super(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed this, Thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with some minor comments @bizybot
private boolean created; | ||
|
||
public PutRoleMappingResponse(boolean created) { | ||
super(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this needed?
...t-high-level/src/test/java/org/elasticsearch/client/security/PutRoleMappingRequestTests.java
Show resolved
Hide resolved
- also added few missing cases
*/ | ||
public final class PutRoleMappingResponse { | ||
|
||
private boolean created; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make it final
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, Thanks.
*/ | ||
public final class PutRoleMappingRequest implements Validatable, ToXContentObject { | ||
|
||
private String name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make all of the class member variables final
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, Thanks.
private List<String> roles; | ||
private RoleMapperExpression rules; | ||
|
||
@Nullable private Map<String, Object> metadata; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
metadata cannot be null based on the constructor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, Thank you.
private RoleMapperExpression rules; | ||
|
||
@Nullable private Map<String, Object> metadata; | ||
@Nullable private RefreshPolicy refreshPolicy; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refreshPolicy cannot be null based on the constructor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, Thank you.
} | ||
final RefreshPolicy refreshPolicy = randomFrom(randomFrom(RefreshPolicy.values()), null); | ||
|
||
if (Strings.hasText(name) == false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rather than use randomization for these branches can we just test the valid case and invalid cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separated into cases, Thank you.
.../rest-high-level/src/main/java/org/elasticsearch/client/security/PutRoleMappingResponse.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left one comment. Otherwise LGTM
.../rest-high-level/src/main/java/org/elasticsearch/client/security/PutRoleMappingResponse.java
Outdated
Show resolved
Hide resolved
Correct the tags mapping with the documentation. This was added in #34171
We added support for role mapper expression DSL in #33745, that allows us to build the role mapper expression used in the role mapping (as rules for determining user roles based on what the boolean expression resolves to). This change now adds support for create/update role mapping API to the high-level rest client.
Correct the tags mapping with the documentation. This was added in #34171
We added support for role mapper expression DSL in #33745, that allows us to build the role mapper expression used in the role mapping (as rules for determining user roles based on what the boolean expression resolves to). This change now adds support for create/update role mapping API to the high-level rest client.
Correct the tags mapping with the documentation. This was added in #34171
We added support for role mapper expression DSL in #33745,
that allows us to build the role mapper expression used in the
role mapping (as rules for determining user roles based on what
the boolean expression resolves to).
This change now adds support for create/update role mapping
API to the high-level rest client.