put-role.asciidoc 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. --
  2. :api: put-role
  3. :request: PutRoleRequest
  4. :response: PutRoleResponse
  5. --
  6. [role="xpack"]
  7. [id="{upid}-{api}"]
  8. === Create or update role API
  9. [id="{upid}-{api}-request"]
  10. ==== Request
  11. The +{request}+ class is used to create or update a role in the Native Roles
  12. Store. The request contains a single role, which encapsulates privileges over
  13. resources. A role can be assigned to an user using the
  14. <<{upid}-put-role-mapping,Create or update role mapping API>>.
  15. ["source","java",subs="attributes,callouts,macros"]
  16. --------------------------------------------------
  17. include-tagged::{doc-tests-file}[{api}-request]
  18. --------------------------------------------------
  19. include::../execution.asciidoc[]
  20. [id="{upid}-{api}-response"]
  21. ==== Response
  22. The returned +{response}+ contains a single field, `created`. This field
  23. serves as an indication if the role was created or if an existing entry was
  24. updated.
  25. ["source","java",subs="attributes,callouts,macros"]
  26. --------------------------------------------------
  27. include-tagged::{doc-tests-file}[{api}-response]
  28. --------------------------------------------------
  29. <1> `created` is a boolean indicating whether the role was created or updated