put-autoscaling-policy.asciidoc 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. [role="xpack"]
  2. [[autoscaling-put-autoscaling-policy]]
  3. === Create or update autoscaling policy API
  4. ++++
  5. <titleabbrev>Create or update autoscaling policy</titleabbrev>
  6. ++++
  7. NOTE: {cloud-only}
  8. .New API reference
  9. [sidebar]
  10. --
  11. For the most up-to-date API details, refer to {api-es}/group/endpoint-autoscaling[Autoscaling APIs].
  12. --
  13. Creates or updates an {cloud}/ec-autoscaling.html[autoscaling] policy.
  14. [[autoscaling-put-autoscaling-policy-request]]
  15. ==== {api-request-title}
  16. [source,console]
  17. --------------------------------------------------
  18. PUT /_autoscaling/policy/<name>
  19. {
  20. "roles": [],
  21. "deciders": {
  22. "fixed": {
  23. }
  24. }
  25. }
  26. --------------------------------------------------
  27. // TEST[s/<name>/name/]
  28. //////////////////////////
  29. [source,console]
  30. --------------------------------------------------
  31. DELETE /_autoscaling/policy/name
  32. --------------------------------------------------
  33. // TEST[continued]
  34. //////////////////////////
  35. [[autoscaling-put-autoscaling-policy-prereqs]]
  36. ==== {api-prereq-title}
  37. * If the {es} {security-features} are enabled, you must have the
  38. `manage_autoscaling` <<privileges-list-cluster,cluster privilege>> to use this
  39. API.
  40. * If the <<operator-privileges,{operator-feature}>> is enabled, only operator
  41. users can use this API.
  42. [[autoscaling-put-autoscaling-policy-desc]]
  43. ==== {api-description-title}
  44. This API puts an autoscaling policy with the provided name.
  45. See <<autoscaling-deciders,Autoscaling Deciders>> for available deciders.
  46. [[autoscaling-put-autoscaling-policy-params]]
  47. ==== {api-query-parms-title}
  48. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
  49. [[autoscaling-put-autoscaling-policy-examples]]
  50. ==== {api-examples-title}
  51. This example puts an autoscaling policy named `my_autoscaling_policy` using the
  52. fixed autoscaling decider, applying to the set of nodes having (only) the
  53. "data_hot" role.
  54. [source,console]
  55. --------------------------------------------------
  56. PUT /_autoscaling/policy/my_autoscaling_policy
  57. {
  58. "roles" : [ "data_hot" ],
  59. "deciders": {
  60. "fixed": {
  61. }
  62. }
  63. }
  64. --------------------------------------------------
  65. // TEST
  66. The API returns the following result:
  67. [source,console-result]
  68. --------------------------------------------------
  69. {
  70. "acknowledged": true
  71. }
  72. --------------------------------------------------
  73. //////////////////////////
  74. [source,console]
  75. --------------------------------------------------
  76. DELETE /_autoscaling/policy/my_autoscaling_policy
  77. --------------------------------------------------
  78. // TEST[continued]
  79. //////////////////////////