# Workload Policies

## Field Descriptions

Below are some of the most common fields you will find in the request and response bodies while working with these APIs.

<table><thead><tr><th width="173">Schedule Type</th><th>Field</th><th>Type</th><th>Description</th><th>Dependencies</th></tr></thead><tbody><tr><td><strong>Hourly</strong></td><td><code>interval</code></td><td>Integer</td><td>Backup interval in hours (<code>1, 2, 3, 4, 6, 12, 24</code>).</td><td>if schedule <code>enabled</code>is set to true, you must provide Hourly field.</td></tr><tr><td></td><td><code>retention</code></td><td>Integer</td><td>Retention period in backups.</td><td></td></tr><tr><td></td><td><code>snapshot_type</code></td><td>String</td><td>Snapshot type (<code>incremental</code> or <code>full</code>).</td><td></td></tr><tr><td><strong>Daily</strong></td><td><code>backup_time</code></td><td>List of String</td><td>List of specific times (<code>HH:MM</code>, 24-hour format).</td><td>Requires <code>hourly</code></td></tr><tr><td></td><td><code>retention</code></td><td>Integer</td><td>Retention period in backups.</td><td></td></tr><tr><td></td><td><code>snapshot_type</code></td><td>String</td><td>Snapshot type (<code>incremental</code> or <code>full</code>).</td><td></td></tr><tr><td><strong>Weekly</strong></td><td><code>backup_day</code></td><td>List of String</td><td>Days of the week (<code>mon, tue, wed, thu, fri, sat, sun</code>).</td><td>Requires <code>daily</code></td></tr><tr><td></td><td><code>retention</code></td><td>Integer</td><td>Retention period in backups.</td><td></td></tr><tr><td></td><td><code>snapshot_type</code></td><td>String</td><td>Only supports <code>full</code> backups.</td><td></td></tr><tr><td><strong>Monthly</strong></td><td><code>month_backup_day</code></td><td>List of Integer</td><td>Days of the month (<code>1-31</code>).</td><td>Requires <code>daily</code></td></tr><tr><td></td><td><code>retention</code></td><td>Integer</td><td>Retention period in backups.</td><td></td></tr><tr><td></td><td><code>snapshot_type</code></td><td>String</td><td>Only supports <code>full</code> backups.</td><td></td></tr><tr><td><strong>Yearly</strong></td><td><code>backup_month</code></td><td>List of String</td><td>List of months (<code>jan, feb, mar, ... dec</code>).</td><td>Requires <code>monthly</code></td></tr><tr><td></td><td><code>retention</code></td><td>Integer</td><td>Retention period in backups.</td><td></td></tr><tr><td></td><td><code>snapshot_type</code></td><td>String</td><td>Only supports <code>full</code> backups.</td><td></td></tr><tr><td><strong>Manual</strong></td><td><code>retention</code></td><td>Integer</td><td>Retention period in backups.</td><td></td></tr><tr><td>retentionmanual</td><td><code>retentionmanual</code></td><td>Integer</td><td>Number of days to keep backups manually triggered.</td><td></td></tr></tbody></table>

## List Policies

<mark style="color:green;">`GET`</mark> `https://<wlm_api_endpoint>/workload_policy/`

Requests the list of available Workload Policies

#### Path Parameters

<table><thead><tr><th width="219">Parameter Name</th><th>Description</th></tr></thead><tbody><tr><td>wlm_api_endpoint</td><td>The endpoint URL of the <code>Workloadmgr</code> service</td></tr></tbody></table>

#### Headers

| Name              | Type   | Description                     |
| ----------------- | ------ | ------------------------------- |
| X-Auth-Project-Id | string | Project to authenticate against |
| X-Auth-Token      | string | Authentication token to use     |
| Accept            | string | application/json                |
| User-Agent        | string | python-workloadmgrclient        |

<details>

<summary>Sample Response</summary>

```json5
HTTP/1.1 200 OK
x-compute-request-id: req-199f171f-b6fe-4172-8408-b069da3cfe19
content-type: application/json
content-length: 7615
date: Wed, 29 Jan 2025 09:39:36 GMT
{
  "policy_list": [
    {
      "id": "d29cb349-1953-405d-8f16-301da9c7bc84",
      "created_at": "2025-01-29T09:45:47.000000",
      "updated_at": "2025-01-29T09:45:47.000000",
      "status": "available",
      "name": "policy_api",
      "description": "",
      "metadata": [
        
      ],
      "field_values": [
        {
          "created_at": "2025-01-29T09:45:47.000000",
          "updated_at": null,
          "deleted_at": null,
          "deleted": false,
          "version": "6.0.20",
          "id": "134a9886-1621-4c51-9951-456b8ed578af",
          "policy_id": "d29cb349-1953-405d-8f16-301da9c7bc84",
          "policy_field_name": "start_time",
          "value": "12:00 AM"
        },
        {
          "created_at": "2025-01-29T09:45:47.000000",
          "updated_at": null,
          "deleted_at": null,
          "deleted": false,
          "version": "6.0.20",
          "id": "3de049cf-cb50-4c7f-82ff-88b5c256251f",
          "policy_id": "d29cb349-1953-405d-8f16-301da9c7bc84",
          "policy_field_name": "daily",
          "value": {
            "backup_time": "['01:00']",
            "retention": 7,
            "snapshot_type": "incremental"
          }
        },
        {
          "created_at": "2025-01-29T09:45:47.000000",
          "updated_at": null,
          "deleted_at": null,
          "deleted": false,
          "version": "6.0.20",
          "id": "5e7146cc-4bdf-4b69-8c0d-77146b9b432c",
          "policy_id": "d29cb349-1953-405d-8f16-301da9c7bc84",
          "policy_field_name": "yearly",
          "value": {
            "backup_month": "['mar']",
            "retention": 1,
            "snapshot_type": "full"
          }
        },
        {
          "created_at": "2025-01-29T09:45:47.000000",
          "updated_at": null,
          "deleted_at": null,
          "deleted": false,
          "version": "6.0.20",
          "id": "6ecaea3d-206d-4083-8d00-8fdea340d198",
          "policy_id": "d29cb349-1953-405d-8f16-301da9c7bc84",
          "policy_field_name": "manual",
          "value": {
            "retention": 30
          }
        },
        {
          "created_at": "2025-01-29T09:45:47.000000",
          "updated_at": null,
          "deleted_at": null,
          "deleted": false,
          "version": "6.0.20",
          "id": "7f85955b-2079-4408-95a4-339e235526a9",
          "policy_id": "d29cb349-1953-405d-8f16-301da9c7bc84",
          "policy_field_name": "retentionmanual",
          "value": {
            "retentionmanual": 30
          }
        },
        {
          "created_at": "2025-01-29T09:45:47.000000",
          "updated_at": null,
          "deleted_at": null,
          "deleted": false,
          "version": "6.0.20",
          "id": "b87eb463-2ed1-4869-92bc-256d09767d4d",
          "policy_id": "d29cb349-1953-405d-8f16-301da9c7bc84",
          "policy_field_name": "monthly",
          "value": {
            "month_backup_day": "['3']",
            "retention": 12,
            "snapshot_type": "full"
          }
        },
        {
          "created_at": "2025-01-29T09:45:47.000000",
          "updated_at": null,
          "deleted_at": null,
          "deleted": false,
          "version": "6.0.20",
          "id": "ce970c60-b38d-4b6a-82d6-a2d1b9948947",
          "policy_id": "d29cb349-1953-405d-8f16-301da9c7bc84",
          "policy_field_name": "hourly",
          "value": {
            "interval": "1",
            "retention": 3,
            "snapshot_type": "incremental"
          }
        },
        {
          "created_at": "2025-01-29T09:45:47.000000",
          "updated_at": null,
          "deleted_at": null,
          "deleted": false,
          "version": "6.0.20",
          "id": "fadef33d-9565-47f2-8180-37fadd967203",
          "policy_id": "d29cb349-1953-405d-8f16-301da9c7bc84",
          "policy_field_name": "weekly",
          "value": {
            "backup_day": "['mon']",
            "retention": 7,
            "snapshot_type": "full"
          }
        }
      ]
    }
  ]
}
```

</details>

## Show Policy

<mark style="color:green;">`GET`</mark> `https://<wlm_api_endpoint>/workload_policy/<policy_id>`

Requests the details of a given policy

#### Path Parameters

<table><thead><tr><th width="219">Parameter Name</th><th>Description</th></tr></thead><tbody><tr><td>wlm_api_endpoint</td><td>The endpoint URL of the <code>Workloadmgr</code> service</td></tr><tr><td>policy_id</td><td>ID of the Policy</td></tr></tbody></table>

#### Headers

| Name              | Type   | Description                     |
| ----------------- | ------ | ------------------------------- |
| X-Auth-Project-Id | string | Project to authenticate against |
| X-Auth-Token      | string | Authentication token to use     |
| Accept            | string | application/json                |
| User-Agent        | string | python-workloadmgrclient        |

<details>

<summary>Sample Response</summary>

```json5
HTTP/1.1 200 OK
x-compute-request-id: req-d4ffd8c4-5f20-4b74-bba9-9243964b0a61
content-type: application/json
content-length: 3237
date: Wed, 29 Jan 2025 09:54:09 GMT

{
  "policy": {
    "id": "d29cb349-1953-405d-8f16-301da9c7bc84",
    "created_at": "2025-01-29T09:45:47.000000",
    "updated_at": "2025-01-29T09:45:47.000000",
    "user_id": "6bbb210a29a043af86b7b0c667747187",
    "project_id": "dee550d3df5b497ca2e05044616bc8b1",
    "status": "available",
    "name": "policy_api",
    "description": "",
    "field_values": [
      {
        "created_at": "2025-01-29T09:45:47.000000",
        "updated_at": null,
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "134a9886-1621-4c51-9951-456b8ed578af",
        "policy_id": "d29cb349-1953-405d-8f16-301da9c7bc84",
        "policy_field_name": "start_time",
        "value": "12:00 AM"
      },
      {
        "created_at": "2025-01-29T09:45:47.000000",
        "updated_at": null,
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "3de049cf-cb50-4c7f-82ff-88b5c256251f",
        "policy_id": "d29cb349-1953-405d-8f16-301da9c7bc84",
        "policy_field_name": "daily",
        "value": {
          "backup_time": "['01:00']",
          "retention": 7,
          "snapshot_type": "incremental"
        }
      },
      {
        "created_at": "2025-01-29T09:45:47.000000",
        "updated_at": null,
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "5e7146cc-4bdf-4b69-8c0d-77146b9b432c",
        "policy_id": "d29cb349-1953-405d-8f16-301da9c7bc84",
        "policy_field_name": "yearly",
        "value": {
          "backup_month": "['mar']",
          "retention": 1,
          "snapshot_type": "full"
        }
      },
      {
        "created_at": "2025-01-29T09:45:47.000000",
        "updated_at": null,
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "6ecaea3d-206d-4083-8d00-8fdea340d198",
        "policy_id": "d29cb349-1953-405d-8f16-301da9c7bc84",
        "policy_field_name": "manual",
        "value": {
          "retention": 30
        }
      },
      {
        "created_at": "2025-01-29T09:45:47.000000",
        "updated_at": null,
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "7f85955b-2079-4408-95a4-339e235526a9",
        "policy_id": "d29cb349-1953-405d-8f16-301da9c7bc84",
        "policy_field_name": "retentionmanual",
        "value": {
          "retentionmanual": 30
        }
      },
      {
        "created_at": "2025-01-29T09:45:47.000000",
        "updated_at": null,
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "b87eb463-2ed1-4869-92bc-256d09767d4d",
        "policy_id": "d29cb349-1953-405d-8f16-301da9c7bc84",
        "policy_field_name": "monthly",
        "value": {
          "month_backup_day": "['3']",
          "retention": 12,
          "snapshot_type": "full"
        }
      },
      {
        "created_at": "2025-01-29T09:45:47.000000",
        "updated_at": null,
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "ce970c60-b38d-4b6a-82d6-a2d1b9948947",
        "policy_id": "d29cb349-1953-405d-8f16-301da9c7bc84",
        "policy_field_name": "hourly",
        "value": {
          "interval": "1",
          "retention": 3,
          "snapshot_type": "incremental"
        }
      },
      {
        "created_at": "2025-01-29T09:45:47.000000",
        "updated_at": null,
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "fadef33d-9565-47f2-8180-37fadd967203",
        "policy_id": "d29cb349-1953-405d-8f16-301da9c7bc84",
        "policy_field_name": "weekly",
        "value": {
          "backup_day": "['mon']",
          "retention": 7,
          "snapshot_type": "full"
        }
      }
    ],
    "metadata": [
      
    ],
    "policy_assignments": [
      {
        "created_at": "2025-01-29T09:49:41.000000",
        "updated_at": null,
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "0d3f0678-4cce-4e6c-9b47-9a4a475a9b1d",
        "policy_id": "d29cb349-1953-405d-8f16-301da9c7bc84",
        "project_id": "dee550d3df5b497ca2e05044616bc8b1",
        "policy_name": "policy_api",
        "project_name": "cloudproject"
      }
    ]
  }
}
```

</details>

## List Assigned Policies

<mark style="color:green;">`GET`</mark> `https://<wlm_api_endpoint>/workload_policy/assigned/<project_id>`

Requests the lists of Policies assigned to a Project.

#### Path Parameters

<table><thead><tr><th width="219">Parameter Name</th><th>Description</th></tr></thead><tbody><tr><td>wlm_api_endpoint</td><td>The endpoint URL of the <code>Workloadmgr</code> service</td></tr><tr><td>project_id</td><td>ID of the Project to fetch assigned policies from</td></tr></tbody></table>

#### Headers

| Name              | Type   | Description                     |
| ----------------- | ------ | ------------------------------- |
| X-Auth-Project-Id | string | Project to authenticate against |
| X-Auth-Token      | string | Authentication token to use     |
| Accept            | string | application/json                |
| User-Agent        | string | python-workloadmgrclient        |

<details>

<summary>Sample Response</summary>

```
HTTP/1.1 200 OK
Server: nginx/1.16.1
Date: Tue, 17 Nov 2020 09:14:01 GMT
Content-Type: application/json
Content-Length: 338
Connection: keep-alive
X-Compute-Request-Id: req-57175488-d267-4dcb-90b5-f239d8b02fe2

{
   "policies":[
      {
         "created_at":"2020-10-29T15:39:13.000000",
         "updated_at":null,
         "deleted_at":null,
         "deleted":false,
         "version":"4.0.115",
         "id":"8b4a6236-63f1-4e2d-b8d1-23b37f4b4346",
         "policy_id":"b79aa5f3-405b-4da4-96e2-893abf7cb5fd",
         "project_id":"c76b3355a164498aa95ddbc960adc238",
         "policy_name":"Gold",
         "project_name":"robert"
      }
   ]
}
```

</details>

## Create Policy

<mark style="color:orange;">`POST`</mark> `https://<wlm_api_endpoint>/workload_policy/`

Creates a Policy with the given parameters

#### Path Parameters

<table><thead><tr><th width="219">Parameter Name</th><th>Description</th></tr></thead><tbody><tr><td>wlm_api_endpoint</td><td>The endpoint URL of the <code>Workloadmgr</code> service</td></tr></tbody></table>

#### Headers

| Name              | Type   | Description                     |
| ----------------- | ------ | ------------------------------- |
| X-Auth-Project-Id | string | Project to authenticate against |
| X-Auth-Token      | string | Authentication token to use     |
| Content-Type      | string | application/json                |
| Accept            | string | application/json                |
| User-Agent        | string | python-workloadmgrclient        |

### Body Format

```json5
{
   "workload_policy":{
      "field_values":{
        "start_time": "<Time format: HH:MM AM/PM>",
        "hourly": {
          "interval": "<1, 2, 3, 4, 6, 12, 24 hours>",
          "retention": "<Integer>",
          "snapshot_type": "incremental/full"
        },
        "daily": {
          "backup_time": [
            "<HH:MM 24-hour format>"
          ],
          "retention": "<Integer>",
          "snapshot_type": "incremental/full"
        },
        "weekly": {
          "backup_day": [
            "<mon, tue, wed, thu, fri, sat, sun>"
          ],
          "retention": "<Integer>",
          "snapshot_type": "full"
        },
        "monthly": {
          "month_backup_day": [
            "<Integer: day of the month (1-31)>"
          ],
          "retention": "<Integer>",
          "snapshot_type": "full"
        },
        "yearly": {
          "backup_month": [
            "<jan, feb, mar, ... dec>"
          ],
          "retention": "<Integer>",
          "snapshot_type": "full"
        },
        "manual": {
          "retention": "<Integer>"
        },
        "retentionmanual": {
          "retentionmanual": "<Integer>"
        },
        }
      },
      "display_name":"<String>",
      "display_description":"<String>",
      "metadata":{
         <key>:<value>
      }
   }
}
```

<details>

<summary>Sample Request</summary>

```json5
{
  "workload_policy": {
    "display_name": "Api_policy_test",
    "display_description": "No description",
    "field_values": {
      "start_time": "10:00 AM",
      "hourly": {
        "interval": "1",
        "retention": "2",
        "snapshot_type": "incremental"
      },
      "daily": {
        "backup_time": [
          "11:40"
        ],
        "retention": "2",
        "snapshot_type": "incremental"
      },
      "weekly": {
        "backup_day": [
          "fri"
        ],
        "retention": "2",
        "snapshot_type": "incremental"
      },
      "monthly": {
        "month_backup_day": [
          "1"
        ],
        "snapshot_type": "full"
      },
      "yearly": {
        "backup_month": [
          "mar"
        ],
        "retention": "1",
        "snapshot_type": "full"
      },
      "manual": {
          "retention": "4",
        },
        "retentionmanual": {
          "retentionmanual": "5", 
        },
    },
    "metadata": {
      
    }
  }
}
```

</details>

<details>

<summary>Sample Response</summary>

```json5
HTTP/1.1 200 OK
x-compute-request-id: req-538517fb-aca0-4abc-9dc7-ef1ee2af1cd7
content-type: application/json
content-length: 2943
date: Wed, 29 Jan 2025 10:23:38 GMT

{
  "policy": {
    "id": "43885a4d-f9c6-42fd-a8c4-2d1816dbd88d",
    "created_at": "2025-01-29T10:23:38.000000",
    "updated_at": "2025-01-29T10:23:38.000000",
    "status": "available",
    "name": "Api_policy_test",
    "description": "No description",
    "metadata": [
      
    ],
    "field_values": [
      {
        "created_at": "2025-01-29T10:23:38.000000",
        "updated_at": null,
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "0492f64e-175b-4f8f-91da-e5986d3b9118",
        "policy_id": "43885a4d-f9c6-42fd-a8c4-2d1816dbd88d",
        "policy_field_name": "retentionmanual",
        "value": "V4\np0\n."
      },
      {
        "created_at": "2025-01-29T10:23:38.000000",
        "updated_at": null,
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "273f07f1-fa68-4883-aec9-8873095d9e0e",
        "policy_id": "43885a4d-f9c6-42fd-a8c4-2d1816dbd88d",
        "policy_field_name": "daily",
        "value": "(dp0\nVbackup_time\np1\n(lp2\nV11:40\np3\nasVretention\np4\nV2\np5\nsVsnapshot_type\np6\nVincremental\np7\ns."
      },
      {
        "created_at": "2025-01-29T10:23:38.000000",
        "updated_at": null,
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "31432273-d82c-4ea7-802b-353f818b6926",
        "policy_id": "43885a4d-f9c6-42fd-a8c4-2d1816dbd88d",
        "policy_field_name": "yearly",
        "value": "(dp0\nVbackup_month\np1\n(lp2\nVmar\np3\nasVretention\np4\nV1\np5\nsVsnapshot_type\np6\nVfull\np7\ns."
      },
      {
        "created_at": "2025-01-29T10:23:38.000000",
        "updated_at": null,
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "4ef22bcd-4b7a-4dac-9c02-1b41ec443778",
        "policy_id": "43885a4d-f9c6-42fd-a8c4-2d1816dbd88d",
        "policy_field_name": "start_time",
        "value": "V10:00 AM\np0\n."
      },
      {
        "created_at": "2025-01-29T10:23:38.000000",
        "updated_at": null,
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "58a13a57-08c3-457a-a912-0217c58ac351",
        "policy_id": "43885a4d-f9c6-42fd-a8c4-2d1816dbd88d",
        "policy_field_name": "hourly",
        "value": "(dp0\nVinterval\np1\nV1\np2\nsVretention\np3\nV2\np4\nsVsnapshot_type\np5\nVincremental\np6\ns."
      },
      {
        "created_at": "2025-01-29T10:23:38.000000",
        "updated_at": null,
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "979fc748-9434-46a8-8613-24524954ba6e",
        "policy_id": "43885a4d-f9c6-42fd-a8c4-2d1816dbd88d",
        "policy_field_name": "weekly",
        "value": "(dp0\nVbackup_day\np1\n(lp2\nVfri\np3\nasVretention\np4\nV2\np5\nsVsnapshot_type\np6\nVincremental\np7\ns."
      },
      {
        "created_at": "2025-01-29T10:23:38.000000",
        "updated_at": null,
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "cad874e6-9960-47a8-a904-25161c7704ee",
        "policy_id": "43885a4d-f9c6-42fd-a8c4-2d1816dbd88d",
        "policy_field_name": "monthly",
        "value": "(dp0\nVmonth_backup_day\np1\n(lp2\nV1\np3\nasVsnapshot_type\np4\nVfull\np5\ns."
      },
      {
        "created_at": "2025-01-29T10:23:38.000000",
        "updated_at": null,
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "f1670b32-0a3b-4876-a51c-14c24f999eab",
        "policy_id": "43885a4d-f9c6-42fd-a8c4-2d1816dbd88d",
        "policy_field_name": "manual",
        "value": "V4\np0\n."
      }
    ]
  }
}
```

</details>

## Update Policy

<mark style="color:blue;">`PUT`</mark> `https://<wlm_api_endpoint>/workload_policy/<policy-id>`

Updates a Policy with the given information

#### Path Parameters

<table><thead><tr><th width="219">Parameter Name</th><th>Description</th></tr></thead><tbody><tr><td>wlm_api_endpoint</td><td>The endpoint URL of the <code>Workloadmgr</code> service</td></tr><tr><td>policy_id</td><td>ID of the Policy</td></tr></tbody></table>

#### Headers

| Name              | Type   | Description                     |
| ----------------- | ------ | ------------------------------- |
| X-Auth-Project-Id | string | Project to authenticate against |
| X-Auth-Token      | string | Authentication token to use     |
| Content-Type      | string | application/json                |
| Accept            | string | application/json                |
| User-Agent        | string | python-workloadmgrclient        |

### Body Format

```json5
{
   "workload_policy":{
      "field_values":{
        "start_time": "<Time format: HH:MM AM/PM>",
        "hourly": {
          "interval": "<1, 2, 3, 4, 6, 12, 24 hours>",
          "retention": "<Integer>",
          "snapshot_type": "incremental/full"
        },
        "daily": {
          "backup_time": [
            "<HH:MM 24-hour format>"
          ],
          "retention": "<Integer>",
          "snapshot_type": "incremental/full"
        },
        "weekly": {
          "backup_day": [
            "<mon, tue, wed, thu, fri, sat, sun>"
          ],
          "retention": "<Integer>",
          "snapshot_type": "full"
        },
        "monthly": {
          "month_backup_day": [
            "<Integer: day of the month (1-31)>"
          ],
          "retention": "<Integer>",
          "snapshot_type": "full"
        },
        "yearly": {
          "backup_month": [
            "<jan, feb, mar, ... dec>"
          ],
          "retention": "<Integer>",
          "snapshot_type": "full"
        },
        "manual": {
          "retention": "<Integer>",
        },
        "retentionmanual": {
          "retentionmanual": "<Integer>"
        },
      },
      "display_name":"<String>",
      "display_description":"<String>",
      "metadata":{
         <key>:<value>
      }
   }
}
```

<details>

<summary>Sample Response</summary>

```json5
HTTP/1.1 200 OK
x-compute-request-id: req-9c7473ce-468c-4688-b061-a761258f7c5e
content-type: application/json
content-length: 3013
date: Wed, 29 Jan 2025 10:37:40 GMT

{
  "policy": {
    "id": "d3b638c6-d26e-4949-8493-18a4df3123bf",
    "created_at": "2025-01-29T10:21:11.000000",
    "updated_at": "2025-01-29T10:21:11.000000",
    "status": "available",
    "name": "Api_update_policy",
    "description": "No description",
    "metadata": [
      
    ],
    "field_values": [
      {
        "created_at": "2025-01-29T10:21:11.000000",
        "updated_at": "2025-01-29T10:36:59.000000",
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "36c76a9b-3599-409c-b226-c59a981d5693",
        "policy_id": "d3b638c6-d26e-4949-8493-18a4df3123bf",
        "policy_field_name": "hourly",
        "value": "(dp0\nVinterval\np1\nV2\np2\nsVretention\np3\ng2\nsVsnapshot_type\np4\nVincremental\np5\ns."
      },
      {
        "created_at": "2025-01-29T10:21:11.000000",
        "updated_at": null,
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "44633679-9fdf-4fe0-84e9-0e364cee8d02",
        "policy_id": "d3b638c6-d26e-4949-8493-18a4df3123bf",
        "policy_field_name": "monthly",
        "value": "(dp0\nVmonth_backup_day\np1\n(lp2\nV1\np3\nasVsnapshot_type\np4\nVfull\np5\ns."
      },
      {
        "created_at": "2025-01-29T10:21:11.000000",
        "updated_at": "2025-01-29T10:36:59.000000",
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "8ddfa5a3-ae39-4430-a474-9074ea3fefbc",
        "policy_id": "d3b638c6-d26e-4949-8493-18a4df3123bf",
        "policy_field_name": "daily",
        "value": "(dp0\nVbackup_time\np1\n(lp2\nV13:00\np3\nasVretention\np4\nV2\np5\nsVsnapshot_type\np6\nVincremental\np7\ns."
      },
      {
        "created_at": "2025-01-29T10:21:11.000000",
        "updated_at": null,
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "a0944765-93bd-487a-9dd2-6a756fab1d2f",
        "policy_id": "d3b638c6-d26e-4949-8493-18a4df3123bf",
        "policy_field_name": "weekly",
        "value": "(dp0\nVbackup_day\np1\n(lp2\nVfri\np3\nasVretention\np4\nV2\np5\nsVsnapshot_type\np6\nVincremental\np7\ns."
      },
      {
        "created_at": "2025-01-29T10:21:11.000000",
        "updated_at": "2025-01-29T10:36:59.000000",
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "ac6267c5-1923-4d24-b911-61427acfdc8b",
        "policy_id": "d3b638c6-d26e-4949-8493-18a4df3123bf",
        "policy_field_name": "start_time",
        "value": "V11:00 AM\np0\n."
      },
      {
        "created_at": "2025-01-29T10:21:11.000000",
        "updated_at": null,
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "b945acdd-3780-4494-b63c-42474ea65c24",
        "policy_id": "d3b638c6-d26e-4949-8493-18a4df3123bf",
        "policy_field_name": "manual",
        "value": "V4\np0\n."
      },
      {
        "created_at": "2025-01-29T10:21:11.000000",
        "updated_at": null,
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "bad15c15-5eb2-4b4b-8597-639a8c27b947",
        "policy_id": "d3b638c6-d26e-4949-8493-18a4df3123bf",
        "policy_field_name": "yearly",
        "value": "(dp0\nVbackup_month\np1\n(lp2\nVmar\np3\nasVretention\np4\nV1\np5\nsVsnapshot_type\np6\nVfull\np7\ns."
      },
      {
        "created_at": "2025-01-29T10:21:11.000000",
        "updated_at": null,
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "cf900224-2b21-4b29-9118-99ec3151d891",
        "policy_id": "d3b638c6-d26e-4949-8493-18a4df3123bf",
        "policy_field_name": "retentionmanual",
        "value": "V4\np0\n."
      }
    ]
  }
}
```

</details>

## Assign Policy

<mark style="color:orange;">`POST`</mark> `https://<wlm_api_endpoint>/workload_policy/<policy_id>/assign`

Updates a Policy with the given information

#### Path Parameters

<table><thead><tr><th width="219">Parameter Name</th><th>Description</th></tr></thead><tbody><tr><td>wlm_api_endpoint</td><td>The endpoint URL of the <code>Workloadmgr</code> service</td></tr><tr><td>policy_id</td><td>ID of the Policy</td></tr></tbody></table>

#### Headers

| Name              | Type   | Description                     |
| ----------------- | ------ | ------------------------------- |
| X-Auth-Project-Id | string | Project to authenticate against |
| X-Auth-Token      | string | Authentication token to use     |
| Content-Type      | string | application/json                |
| Accept            | string | application/json                |
| User-Agent        | string | python-workloadmgrclient        |

### Body Format

```json
{
   "policy":{
      "remove_projects":[
         "<project_id>"
      ],
      "add_projects":[
         "<project_id>",
      ]
   }
}
```

<details>

<summary>Sample Response</summary>

```json5
HTTP/1.1 200 OK
x-compute-request-id: req-a8569cd2-05a2-45ce-bae5-41a214759ff8
content-type: application/json
content-length: 3831
date: Wed, 29 Jan 2025 10:44:56 GMT

{
  "policy": {
    "id": "d3b638c6-d26e-4949-8493-18a4df3123bf",
    "created_at": "2025-01-29T10:21:11.000000",
    "updated_at": "2025-01-29T10:21:11.000000",
    "user_id": "6bbb210a29a043af86b7b0c667747187",
    "project_id": "dee550d3df5b497ca2e05044616bc8b1",
    "status": "available",
    "name": "Api_update_policy",
    "description": "No description",
    "field_values": [
      {
        "created_at": "2025-01-29T10:21:11.000000",
        "updated_at": "2025-01-29T10:36:59.000000",
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "36c76a9b-3599-409c-b226-c59a981d5693",
        "policy_id": "d3b638c6-d26e-4949-8493-18a4df3123bf",
        "policy_field_name": "hourly",
        "value": "(dp0\nVinterval\np1\nV2\np2\nsVretention\np3\ng2\nsVsnapshot_type\np4\nVincremental\np5\ns."
      },
      {
        "created_at": "2025-01-29T10:21:11.000000",
        "updated_at": null,
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "44633679-9fdf-4fe0-84e9-0e364cee8d02",
        "policy_id": "d3b638c6-d26e-4949-8493-18a4df3123bf",
        "policy_field_name": "monthly",
        "value": "(dp0\nVmonth_backup_day\np1\n(lp2\nV1\np3\nasVsnapshot_type\np4\nVfull\np5\ns."
      },
      {
        "created_at": "2025-01-29T10:21:11.000000",
        "updated_at": "2025-01-29T10:36:59.000000",
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "8ddfa5a3-ae39-4430-a474-9074ea3fefbc",
        "policy_id": "d3b638c6-d26e-4949-8493-18a4df3123bf",
        "policy_field_name": "daily",
        "value": "(dp0\nVbackup_time\np1\n(lp2\nV13:00\np3\nasVretention\np4\nV2\np5\nsVsnapshot_type\np6\nVincremental\np7\ns."
      },
      {
        "created_at": "2025-01-29T10:21:11.000000",
        "updated_at": null,
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "a0944765-93bd-487a-9dd2-6a756fab1d2f",
        "policy_id": "d3b638c6-d26e-4949-8493-18a4df3123bf",
        "policy_field_name": "weekly",
        "value": "(dp0\nVbackup_day\np1\n(lp2\nVfri\np3\nasVretention\np4\nV2\np5\nsVsnapshot_type\np6\nVincremental\np7\ns."
      },
      {
        "created_at": "2025-01-29T10:21:11.000000",
        "updated_at": "2025-01-29T10:36:59.000000",
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "ac6267c5-1923-4d24-b911-61427acfdc8b",
        "policy_id": "d3b638c6-d26e-4949-8493-18a4df3123bf",
        "policy_field_name": "start_time",
        "value": "V11:00 AM\np0\n."
      },
      {
        "created_at": "2025-01-29T10:21:11.000000",
        "updated_at": null,
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "b945acdd-3780-4494-b63c-42474ea65c24",
        "policy_id": "d3b638c6-d26e-4949-8493-18a4df3123bf",
        "policy_field_name": "manual",
        "value": "V4\np0\n."
      },
      {
        "created_at": "2025-01-29T10:21:11.000000",
        "updated_at": null,
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "bad15c15-5eb2-4b4b-8597-639a8c27b947",
        "policy_id": "d3b638c6-d26e-4949-8493-18a4df3123bf",
        "policy_field_name": "yearly",
        "value": "(dp0\nVbackup_month\np1\n(lp2\nVmar\np3\nasVretention\np4\nV1\np5\nsVsnapshot_type\np6\nVfull\np7\ns."
      },
      {
        "created_at": "2025-01-29T10:21:11.000000",
        "updated_at": null,
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "cf900224-2b21-4b29-9118-99ec3151d891",
        "policy_id": "d3b638c6-d26e-4949-8493-18a4df3123bf",
        "policy_field_name": "retentionmanual",
        "value": "V4\np0\n."
      }
    ],
    "metadata": [
      
    ],
    "policy_assignments": [
      {
        "created_at": "2025-01-29T10:44:56.000000",
        "updated_at": null,
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "2177bf6e-116f-45fc-986b-3d20f7084fc7",
        "policy_id": "d3b638c6-d26e-4949-8493-18a4df3123bf",
        "project_id": "c532c5b669304d20bbe9e2157986757c",
        "policy_name": "Api_update_policy",
        "project_name": "AP_test"
      },
      {
        "created_at": "2025-01-29T10:43:28.000000",
        "updated_at": null,
        "deleted_at": null,
        "deleted": false,
        "version": "6.0.20",
        "id": "5b3b445b-e4dd-4381-84cd-c90bdda0b7e7",
        "policy_id": "d3b638c6-d26e-4949-8493-18a4df3123bf",
        "project_id": "dee550d3df5b497ca2e05044616bc8b1",
        "policy_name": "Api_update_policy",
        "project_name": "cloudproject"
      }
    ]
  },
  "failed_ids": [
    
  ]
}
```

</details>

## Delete Policy

<mark style="color:red;">`DELETE`</mark> `https://<wlm_api_endpoint>/workload_policy/<policy_id>`

Deletes a given Policy

#### Path Parameters

<table><thead><tr><th width="219">Parameter Name</th><th>Description</th></tr></thead><tbody><tr><td>wlm_api_endpoint</td><td>The endpoint URL of the <code>Workloadmgr</code> service</td></tr><tr><td>policy_id</td><td>ID of the Policy</td></tr></tbody></table>

#### Headers

| Name              | Type   | Description                     |
| ----------------- | ------ | ------------------------------- |
| X-Auth-Project-Id | string | Project to authenticate against |
| X-Auth-Token      | string | Authentication token to use     |
| Accept            | string | application/json                |
| User-Agent        | string | python-workloadmgrclient        |

<details>

<summary>Sample Response</summary>

```json5
HTTP/1.1 202 Accepted
Server: nginx/1.16.1
Date: Tue, 17 Nov 2020 09:56:03 GMT
Content-Type: text/html; charset=UTF-8
Content-Length: 0
Connection: keep-alive
```

</details>
