Skip to content

Commit

Permalink
Expand example in HLRC put-role docs (#82139)
Browse files Browse the repository at this point in the history
This expands the example in the High Level Rest Client's Put Role
documentation to include an example of creating a role with index
privileges, include FLS and DLS Relates: #81354
  • Loading branch information
tvernum committed Dec 30, 2021
1 parent cf8efe7 commit bbd5042
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1462,6 +1462,14 @@ public void testPutRole() throws Exception {
final Role role = Role.builder()
.name("testPutRole")
.clusterPrivileges(randomSubsetOf(1, Role.ClusterPrivilegeName.ALL_ARRAY))
.indicesPrivileges(IndicesPrivileges.builder()
.indices("my-index-*")
.allowRestrictedIndices(false)
.privileges(Role.IndexPrivilegeName.READ)
.grantedFields("*")
.deniedFields("secret_field")
.query("{ \"term\": { \"public\": true } }")
.build())
.build();
final PutRoleRequest request = new PutRoleRequest(role, RefreshPolicy.NONE);
// end::put-role-request
Expand Down

0 comments on commit bbd5042

Please sign in to comment.