github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/website/content/api-docs/scaling-policies.mdx (about) 1 --- 2 layout: api 3 page_title: Scaling Policies - HTTP API 4 description: The /scaling/policy endpoints are used to list and view scaling policies. 5 --- 6 7 # Scaling Policies HTTP API 8 9 The `/scaling/policies` and `/scaling/policy/` endpoints are used to list and view scaling policies. 10 11 ## List Scaling Policies 12 13 This endpoint returns the scaling policies from all jobs. 14 15 | Method | Path | Produces | 16 | ------ | ------------------- | ------------------ | 17 | `GET` | `/scaling/policies` | `application/json` | 18 19 The table below shows this endpoint's support for 20 [blocking queries](/api-docs#blocking-queries), [consistency modes](/api-docs#consistency-modes) and 21 [required ACLs](/api-docs#acls). 22 23 | Blocking Queries | Consistency Modes | ACL Required | 24 | ---------------- | ----------------- | --------------------------------- | 25 | `YES` | `all` | `namespace:list-scaling-policies` | 26 27 ### Parameters 28 29 - `job` `(string: "")`- Specifies the job ID to filter policies by. 30 31 - `type` `(string: "")` - Specifies the type of scaling policy to filter by. In 32 the open source version of Nomad, `horizontal` is the only supported value. 33 Within Nomad Enterprise, `vertical_mem` and `vertical_cpu` are supported along 34 with `vertical`. The latter returns policies matching both `vertical_mem` and 35 `vertical_cpu`. 36 37 ### Sample Request 38 39 ```shell-session 40 $ curl \ 41 https://localhost:4646/v1/scaling/policies 42 ``` 43 44 ```shell-session 45 $ curl \ 46 https://localhost:4646/v1/scaling/policies?job=example 47 ``` 48 49 ```shell-session 50 $ curl \ 51 https://localhost:4646/v1/scaling/policies?type=vertical 52 ``` 53 54 ### Sample Response 55 56 ```json 57 [ 58 { 59 "ID": "b2c64295-4315-2fdc-6158-a27156808729", 60 "Enabled": true, 61 "Type": "vertical_cpu", 62 "Target": { 63 "Namespace": "default", 64 "Job": "example", 65 "Group": "cache", 66 "Task": "redis" 67 }, 68 "CreateIndex": 1340, 69 "ModifyIndex": 1340 70 }, 71 { 72 "ID": "c355d0ec-7aa1-2604-449d-4ec79c813d2c", 73 "Enabled": true, 74 "Type": "vertical_mem", 75 "Target": { 76 "Job": "example", 77 "Group": "cache", 78 "Task": "redis", 79 "Namespace": "default" 80 }, 81 "CreateIndex": 1340, 82 "ModifyIndex": 1340 83 }, 84 { 85 "ID": "31a53813-24df-b2ad-77dc-1b4bad4e7dca", 86 "Enabled": true, 87 "Type": "horizontal", 88 "Target": { 89 "Job": "example", 90 "Group": "cache", 91 "Namespace": "default" 92 }, 93 "CreateIndex": 1358, 94 "ModifyIndex": 1358 95 } 96 ] 97 ``` 98 99 ## Read Scaling Policy 100 101 This endpoint reads a specific scaling policy. 102 103 | Method | Path | Produces | 104 | ------ | ---------------------------- | ------------------ | 105 | `GET` | `/scaling/policy/:policy_id` | `application/json` | 106 107 The table below shows this endpoint's support for 108 [blocking queries](/api-docs#blocking-queries), [consistency modes](/api-docs#consistency-modes) and 109 [required ACLs](/api-docs#acls). 110 111 | Blocking Queries | Consistency Modes | ACL Required | 112 | ---------------- | ----------------- | ------------------------------- | 113 | `YES` | `all` | `namespace:read-scaling-policy` | 114 115 ### Parameters 116 117 - `:policy_id` `(string: <required>)` - Specifies the ID of the scaling policy (as returned 118 by the scaling policy list endpoint). This is specified as part of the path. 119 120 ### Sample Request 121 122 ```shell-session 123 $ curl \ 124 https://localhost:4646/v1/scaling/policy/5e9f9ef2-5223-6d35-bac1-be0f3cb974ad 125 ``` 126 127 ### Sample Response 128 129 ```json 130 { 131 "CreateIndex": 10, 132 "Enabled": true, 133 "ID": "5e9f9ef2-5223-6d35-bac1-be0f3cb974ad", 134 "Type": "horizontal", 135 "Max": 10, 136 "Min": 0, 137 "ModifyIndex": 10, 138 "Policy": { 139 "engage": true, 140 "foo": "bar", 141 "howdy": "doody", 142 "value": 6.0 143 }, 144 "Target": { 145 "Group": "cache", 146 "Job": "example", 147 "Namespace": "default" 148 } 149 } 150 ```