github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/website/pages/api-docs/scaling-policies.mdx (about)

     1  ---
     2  layout: api
     3  page_title: Scaling Policies - HTTP API
     4  sidebar_title: Scaling Policies <sup>Beta</sup>
     5  description: The /scaling/policy endpoints are used to list and view scaling policies.
     6  ---
     7  
     8  # Scaling Policies HTTP API
     9  
    10  The `/scaling/policies` and `/scaling/policy/` endpoints are used to list and view scaling policies.
    11  
    12  ## List Scaling Policies <sup>Beta</sup>
    13  
    14  This endpoint returns the scaling policies from all jobs.
    15  
    16  | Method | Path                | Produces           |
    17  | ------ | ------------------- | ------------------ |
    18  | `GET`  | `/scaling/policies` | `application/json` |
    19  
    20  The table below shows this endpoint's support for
    21  [blocking queries](/api-docs#blocking-queries), [consistency modes](/api-docs#consistency-modes) and
    22  [required ACLs](/api-docs#acls).
    23  
    24  | Blocking Queries | Consistency Modes | ACL Required                      |
    25  | ---------------- | ----------------- | --------------------------------- |
    26  | `YES`            | `all`             | `namespace:list-scaling-policies` |
    27  
    28  ### Sample Request
    29  
    30  ```shell-sessioncurl \
    31      https://localhost:4646/v1/scaling/policies
    32  ```
    33  
    34  ### Sample Response
    35  
    36  ```json
    37  [
    38    {
    39      "CreateIndex": 10,
    40      "Enabled": true,
    41      "ID": "5e9f9ef2-5223-6d35-bac1-be0f3cb974ad",
    42      "ModifyIndex": 10,
    43      "Target": {
    44        "Group": "cache",
    45        "Job": "example",
    46        "Namespace": "default"
    47      }
    48    }
    49  ]
    50  ```
    51  
    52  ## Read Scaling Policy <sup>Beta</sup>
    53  
    54  This endpoint reads a specific scaling policy.
    55  
    56  | Method | Path                         | Produces           |
    57  | ------ | ---------------------------- | ------------------ |
    58  | `GET`  | `/scaling/policy/:policy_id` | `application/json` |
    59  
    60  The table below shows this endpoint's support for
    61  [blocking queries](/api-docs#blocking-queries), [consistency modes](/api-docs#consistency-modes) and
    62  [required ACLs](/api-docs#acls).
    63  
    64  | Blocking Queries | Consistency Modes | ACL Required                    |
    65  | ---------------- | ----------------- | ------------------------------- |
    66  | `YES`            | `all`             | `namespace:read-scaling-policy` |
    67  
    68  ### Parameters
    69  
    70  - `:policy_id` `(string: <required>)` - Specifies the ID of the scaling policy (as returned
    71    by the scaling policy list endpoint). This is specified as part of the path.
    72  
    73  ### Sample Request
    74  
    75  ```shell-sessioncurl \
    76      https://localhost:4646/v1/scaling/policy/5e9f9ef2-5223-6d35-bac1-be0f3cb974ad
    77  ```
    78  
    79  ### Sample Response
    80  
    81  ```json
    82  {
    83    "CreateIndex": 10,
    84    "Enabled": true,
    85    "ID": "5e9f9ef2-5223-6d35-bac1-be0f3cb974ad",
    86    "Max": 10,
    87    "Min": 0,
    88    "ModifyIndex": 10,
    89    "Policy": {
    90      "engage": true,
    91      "foo": "bar",
    92      "howdy": "doody",
    93      "value": 6.0
    94    },
    95    "Target": {
    96      "Group": "cache",
    97      "Job": "example",
    98      "Namespace": "default"
    99    }
   100  }
   101  ```