mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-24 23:27:25 -04:00
Expand example in HLRC put-role docs (#82139)
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
This commit is contained in:
parent
cf8efe77df
commit
bbd504275a
1 changed files with 8 additions and 0 deletions
|
@ -1462,6 +1462,14 @@ public class SecurityDocumentationIT extends ESRestHighLevelClientTestCase {
|
||||||
final Role role = Role.builder()
|
final Role role = Role.builder()
|
||||||
.name("testPutRole")
|
.name("testPutRole")
|
||||||
.clusterPrivileges(randomSubsetOf(1, Role.ClusterPrivilegeName.ALL_ARRAY))
|
.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();
|
.build();
|
||||||
final PutRoleRequest request = new PutRoleRequest(role, RefreshPolicy.NONE);
|
final PutRoleRequest request = new PutRoleRequest(role, RefreshPolicy.NONE);
|
||||||
// end::put-role-request
|
// end::put-role-request
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue