# VM Backup Policies Controller Resource

The API allows you to list, view, create and edit virtual machine backup policies.

### GET /policies/vm-backup

Returns list of virtual machine backup policies filtered by specified query parameters.

Request Parameters
name | type | description | default | constraints
--- | --- | --- | --- | ---
direction | query |  |  |
extended | query |  | false | boolean
filter | query |  |  |
nameLike | query |  |  |
orderBy | query |  |  |
page | query |  |  |
project | query |  |  |
project-uuid | query |  |  |
size | query |  |  |
virtual-machine | query |  |  |

Response Body
media type | data type | description
--- | --- | ---
application/json | array of VmBackupPolicyListRecord (JSON) | list of virtual machine backup policies filtered by specified query parameters

#### Example

##### Request

    GET /policies/vm-backup
    Content-Type: */*
    Accept: application/json

    ...

##### Response

    HTTP/1.1 200 OK
    Content-Type: application/json

    [ {
      "guid" : "f8f73bf9-2445-4bce-a7dd-753be3b40a67",
      "priority" : 50
    } ]

### POST /policies/vm-backup

Create virtual machine backup policy.

Request Parameters
name | type | description
--- | --- | ---
project-uuid | query | specify uuid of project in which returned policies are visible

Request Body
media type | data type | description
--- | --- | ---
application/json | VmBackupPolicyRequest (JSON) | specify details for new virtual machine backup policy

Response Body
media type | data type | description
--- | --- | ---
application/json | VmBackupPolicyDetails (JSON) | details of newly created virtual machine backup policy

#### Example

##### Request

    POST /policies/vm-backup
    Content-Type: application/json
    Accept: application/json

    {
      "priority" : 50
    }

##### Response

    HTTP/1.1 201 Created
    Content-Type: application/json

    {
      "guid" : "f8f73bf9-2445-4bce-a7dd-753be3b40a67",
      "priority" : 50
    }

### POST /policies/vm-backup/auto-assignment-preview

Get auto-assignment preview for all virtual machines and given new backup policy.

Request Parameters
name | type | description
--- | --- | ---
project-uuid | query | specify uuid of project in which the new policy will be visible

Request Body
media type | data type | description
--- | --- | ---
application/json | VmBackupPolicyRequest (JSON) | specify virtual machine backup policy details to create preview

Response Body
media type | data type | description
--- | --- | ---
application/json | array of AutoAssignResultPreviewListRecord (JSON) | list of auto-assignment result preview records

#### Example

##### Request

    POST /policies/vm-backup/auto-assignment-preview
    Content-Type: application/json
    Accept: application/json

    {
      "priority" : 50
    }

##### Response

    HTTP/1.1 201 Created
    Content-Type: application/json

    [ { } ]

### GET /policies/vm-backup/detailed

Returns detailed list of virtual machine backup policies.

Request Parameters
name | type | description | default | constraints
--- | --- | --- | --- | ---
direction | query |  |  |
extended | query |  | false | boolean
filter | query |  |  |
nameLike | query |  |  |
orderBy | query |  |  |
page | query |  |  |
project | query |  |  |
project-uuid | query |  |  |
size | query |  |  |
virtual-machine | query |  |  |

Response Body
media type | data type | description
--- | --- | ---
application/json | array of VmBackupPolicyDetails (JSON) | detailed list of virtual machine backup policies

#### Example

##### Request

    GET /policies/vm-backup/detailed
    Content-Type: */*
    Accept: application/json

    ...

##### Response

    HTTP/1.1 200 OK
    Content-Type: application/json

    [ {
      "guid" : "f8f73bf9-2445-4bce-a7dd-753be3b40a67",
      "priority" : 50
    } ]

### POST /policies/vm-backup/list-by-entities

Get all the policies and rules from selected virtual machines

Request Body
media type | data type | description
--- | --- | ---
application/json | ProtectedEntityPolicyRequest (JSON) | containing selected virtual machines

Response Body
media type | data type | description
--- | --- | ---
application/json | array of BackupPolicyForBackupListRecord (JSON) | list of policies and rules

#### Example

##### Request

    POST /policies/vm-backup/list-by-entities
    Content-Type: application/json
    Accept: application/json

    { }

##### Response

    HTTP/1.1 201 Created
    Content-Type: application/json

    [ { } ]

### GET /policies/vm-backup/pe-assignment

Response Body
media type | data type | description
--- | --- | ---
application/json | array of NameAndGuid (JSON) |

#### Example

##### Request

    GET /policies/vm-backup/pe-assignment
    Content-Type: */*
    Accept: application/json

    ...

##### Response

    HTTP/1.1 200 OK
    Content-Type: application/json

    [ {
      "guid" : "f8f73bf9-2445-4bce-a7dd-753be3b40a67",
      "name" : "Entity name"
    } ]

### PUT /policies/vm-backup/validation

Check validity of auto-assignment settings for virtual machine backup policy

Request Body
media type | data type | description
--- | --- | ---
application/json | VmBackupPolicyRequest (JSON) | specify details for new (or updated) virtual machine backup policy

Response Body
media type | data type | description
--- | --- | ---
application/json | PolicyProjectAndClusterScopeValidationResultListRecord (JSON) | validation results

#### Example

##### Request

    PUT /policies/vm-backup/validation
    Content-Type: application/json
    Accept: application/json

    {
      "priority" : 50
    }

##### Response

    HTTP/1.1 204 No Content
    Content-Type: application/json

    { }

### DELETE /policies/vm-backup/{guid}

Remove virtual machine backup policy.

Request Parameters
name | type | description
--- | --- | ---
guid | path | specify local unique identifier for virtual machine backup policy (use by vProtect)

#### Example

##### Request

    DELETE /policies/vm-backup/{guid}
    Content-Type: */*

    ...

##### Response

    HTTP/1.1 204 No Content

### GET /policies/vm-backup/{guid}

Get a single virtual machine backup policy.

Request Parameters
name | type | description
--- | --- | ---
guid | path | specify local unique identifier for virtual machine backup policy (use by vProtect)

Response Body
media type | data type | description
--- | --- | ---
application/json | VmBackupPolicyDetails (JSON) | a single virtual machine backup policy details

#### Example

##### Request

    GET /policies/vm-backup/{guid}
    Content-Type: */*
    Accept: application/json

    ...

##### Response

    HTTP/1.1 200 OK
    Content-Type: application/json

    {
      "guid" : "f8f73bf9-2445-4bce-a7dd-753be3b40a67",
      "priority" : 50
    }

### PUT /policies/vm-backup/{guid}

This method has been deprecated.

Change virtual machine backup policy details.

Request Parameters
name | type | description
--- | --- | ---
guid | path | specify local unique identifier for virtual machine backup policy (use by vProtect)

Request Body
media type | data type | description
--- | --- | ---
application/json | VmBackupPolicyRequest (JSON) | specify virtual machine backup policy details to update

Response Body
media type | data type | description
--- | --- | ---
application/json | VmBackupPolicyDetails (JSON) | updated details of virtual machine backup policy

#### Example

##### Request

    PUT /policies/vm-backup/{guid}
    Content-Type: application/json
    Accept: application/json

    {
      "priority" : 50
    }

##### Response

    HTTP/1.1 204 No Content
    Content-Type: application/json

    {
      "guid" : "f8f73bf9-2445-4bce-a7dd-753be3b40a67",
      "priority" : 50
    }

### POST /policies/vm-backup/{guid}/auto-assignment-preview

Get auto-assignment preview for all virtual machines and given existing backup policy.

Request Parameters
name | type | description
--- | --- | ---
guid | path | specify local unique identifier for virtual machine backup policy (use by vProtect)

Request Body
media type | data type | description
--- | --- | ---
application/json | VmBackupPolicyRequest (JSON) | specify virtual machine backup policy details to create preview

Response Body
media type | data type | description
--- | --- | ---
application/json | array of AutoAssignResultPreviewListRecord (JSON) | list of auto-assignment result preview records

#### Example

##### Request

    POST /policies/vm-backup/{guid}/auto-assignment-preview
    Content-Type: application/json
    Accept: application/json

    {
      "priority" : 50
    }

##### Response

    HTTP/1.1 201 Created
    Content-Type: application/json

    [ { } ]

### POST /policies/vm-backup/{guid}/clone

Request Parameters
name | type | description
--- | --- | ---
guid | path |

Request Body
media type | data type
--- | ---
application/json | CloneDTO (JSON)

Response Body
media type | data type | description
--- | --- | ---
application/json | VmBackupPolicyDetails (JSON) |

#### Example

##### Request

    POST /policies/vm-backup/{guid}/clone
    Content-Type: application/json
    Accept: application/json

    { }

##### Response

    HTTP/1.1 201 Created
    Content-Type: application/json

    {
      "guid" : "f8f73bf9-2445-4bce-a7dd-753be3b40a67",
      "priority" : 50
    }

### GET /policies/vm-backup/{guid}/entities

Request Parameters
name | type | description
--- | --- | ---
guid | path |

Response Body
media type | data type | description
--- | --- | ---
application/json | array of VirtualMachineListRecord (JSON) |

#### Example

##### Request

    GET /policies/vm-backup/{guid}/entities
    Content-Type: */*
    Accept: application/json

    ...

##### Response

    HTTP/1.1 200 OK
    Content-Type: application/json

    [ {
      "guid" : "f8f73bf9-2445-4bce-a7dd-753be3b40a67",
      "lastBackup" : 1451649601000
    } ]

### GET /policies/vm-backup/{guid}/statistics

Returns architecture statistics from VM Backup Policy.

Request Parameters
name | type | description | constraints
--- | --- | --- | ---
guid | path | specify local unique identifier for VM Backup Policy (use by vProtect) |
compute-zone | query |  |
from | query |  | long
to | query |  | long

Response Body
media type | data type | description
--- | --- | ---
application/json | BackupPolicyStatisticsDetailsDto (JSON) | architecture statistics from VM Backup Policy

#### Example

##### Request

    GET /policies/vm-backup/{guid}/statistics
    Content-Type: */*
    Accept: application/json

    ...

##### Response

    HTTP/1.1 200 OK
    Content-Type: application/json

    { }

### PUT /policies/vm-backup/{guid}/v2

Change virtual machine backup policy details with no return value -- for performance issues.

Request Parameters
name | type | description
--- | --- | ---
guid | path | specify local unique identifier for virtual machine backup policy (use by vProtect)

Request Body
media type | data type | description
--- | --- | ---
application/json | VmBackupPolicyRequest (JSON) | specify virtual machine backup policy details to update

#### Example

##### Request

    PUT /policies/vm-backup/{guid}/v2
    Content-Type: application/json

    {
      "priority" : 50
    }

##### Response

    HTTP/1.1 204 No Content