github.com/adityamillind98/nomad@v0.11.8/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-session
    31  $ curl \
    32      https://localhost:4646/v1/scaling/policies
    33  ```
    34  
    35  ### Sample Response
    36  
    37  ```json
    38  [
    39    {
    40      "CreateIndex": 10,
    41      "Enabled": true,
    42      "ID": "5e9f9ef2-5223-6d35-bac1-be0f3cb974ad",
    43      "ModifyIndex": 10,
    44      "Target": {
    45        "Group": "cache",
    46        "Job": "example",
    47        "Namespace": "default"
    48      }
    49    }
    50  ]
    51  ```
    52  
    53  ## Read Scaling Policy <sup>Beta</sup>
    54  
    55  This endpoint reads a specific scaling policy.
    56  
    57  | Method | Path                         | Produces           |
    58  | ------ | ---------------------------- | ------------------ |
    59  | `GET`  | `/scaling/policy/:policy_id` | `application/json` |
    60  
    61  The table below shows this endpoint's support for
    62  [blocking queries](/api-docs#blocking-queries), [consistency modes](/api-docs#consistency-modes) and
    63  [required ACLs](/api-docs#acls).
    64  
    65  | Blocking Queries | Consistency Modes | ACL Required                    |
    66  | ---------------- | ----------------- | ------------------------------- |
    67  | `YES`            | `all`             | `namespace:read-scaling-policy` |
    68  
    69  ### Parameters
    70  
    71  - `:policy_id` `(string: <required>)` - Specifies the ID of the scaling policy (as returned
    72    by the scaling policy list endpoint). This is specified as part of the path.
    73  
    74  ### Sample Request
    75  
    76  ```shell-session
    77  $ curl \
    78      https://localhost:4646/v1/scaling/policy/5e9f9ef2-5223-6d35-bac1-be0f3cb974ad
    79  ```
    80  
    81  ### Sample Response
    82  
    83  ```json
    84  {
    85    "CreateIndex": 10,
    86    "Enabled": true,
    87    "ID": "5e9f9ef2-5223-6d35-bac1-be0f3cb974ad",
    88    "Max": 10,
    89    "Min": 0,
    90    "ModifyIndex": 10,
    91    "Policy": {
    92      "engage": true,
    93      "foo": "bar",
    94      "howdy": "doody",
    95      "value": 6.0
    96    },
    97    "Target": {
    98      "Group": "cache",
    99      "Job": "example",
   100      "Namespace": "default"
   101    }
   102  }
   103  ```