# Storage Backup Policies Controller Resource

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

### GET /policies/storage-backup

Returns list of storage 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 |  |  |
size | query |  |  |

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

#### Example

##### Request

    GET /policies/storage-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/storage-backup

Create storage backup policy

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

Response Body
media type | data type | description
--- | --- | ---
application/json | StorageBackupPolicyDetails (JSON) | details of newly storage backup policy

#### Example

##### Request

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

    {
      "storage-changeset" : {
        "added" : [ "...", "..." ],
        "storage-provider-type" : "FILE_SYSTEM",
        "removed" : [ "...", "..." ],
        "remove-all" : true,
        "select-all" : true,
        "name-like" : "...",
        "storageProviderTypeFilterString" : "...",
        "active" : true
      },
      "priority" : 50
    }

##### Response

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

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

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

Get auto-assignment preview for all storages and given backup policy.

Request Body
media type | data type | description
--- | --- | ---
application/json | StorageBackupPolicyRequest (JSON) | specify storage 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/storage-backup/auto-assignment-preview
    Content-Type: application/json
    Accept: application/json

    {
      "storage-changeset" : {
        "added" : [ "...", "..." ],
        "storage-provider-type" : "DEFAULT",
        "removed" : [ "...", "..." ],
        "remove-all" : true,
        "select-all" : true,
        "name-like" : "...",
        "storageProviderTypeFilterString" : "...",
        "active" : true
      },
      "priority" : 50
    }

##### Response

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

    [ { } ]

### GET /policies/storage-backup/detailed

Returns detailed list of storage backup policies.

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

#### Example

##### Request

    GET /policies/storage-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/storage-backup/list-by-entities

Get all the policies and rules from selected protected entities

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

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

#### Example

##### Request

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

    { }

##### Response

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

    [ { } ]

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

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

#### Example

##### Request

    GET /policies/storage-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"
    } ]

### GET /policies/storage-backup/v2

Request Parameters
name | type | description
--- | --- | ---
direction | query |
filter | query |
nameLike | query |
orderBy | query |
page | query |
size | query |

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

#### Example

##### Request

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

    ...

##### Response

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

    [ { } ]

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

Remove storage backup policy.

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

#### Example

##### Request

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

    ...

##### Response

    HTTP/1.1 204 No Content

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

Get a single storage backup policy.

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

Response Body
media type | data type | description
--- | --- | ---
application/json | StorageBackupPolicyDetailsResponseDto (JSON) | single storage backup policy details

#### Example

##### Request

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

    ...

##### Response

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

    { }

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

Change storage backup policy details.

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

Request Body
media type | data type | description
--- | --- | ---
application/json | StorageBackupPolicyRequest (JSON) | specify storage backup policy details for update

#### Example

##### Request

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

    {
      "storage-changeset" : {
        "added" : [ "...", "..." ],
        "storage-provider-type" : "FILE_SYSTEM",
        "removed" : [ "...", "..." ],
        "remove-all" : true,
        "select-all" : true,
        "name-like" : "...",
        "storageProviderTypeFilterString" : "...",
        "active" : true
      },
      "priority" : 50
    }

##### Response

    HTTP/1.1 204 No Content

### GET /policies/storage-backup/v2/{guid}

Get a single storage backup policy.

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

Response Body
media type | data type | description
--- | --- | ---
application/json | StorageBackupPolicyDetailsDto (JSON) | single storage backup policy details

#### Example

##### Request

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

    ...

##### Response

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

    { }

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

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

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

#### Example

##### Request

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

    {
      "priority" : 50,
      "backupDestinationGuids" : [ "...", "..." ]
    }

##### Response

    HTTP/1.1 204 No Content

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

Get auto-assignment preview for all storages and given backup policy.

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

Request Body
media type | data type | description
--- | --- | ---
application/json | StorageBackupPolicyRequest (JSON) | specify storage 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/storage-backup/{guid}/auto-assignment-preview
    Content-Type: application/json
    Accept: application/json

    {
      "storage-changeset" : {
        "added" : [ "...", "..." ],
        "storage-provider-type" : "CEPH_RBD",
        "removed" : [ "...", "..." ],
        "remove-all" : true,
        "select-all" : true,
        "name-like" : "...",
        "storageProviderTypeFilterString" : "...",
        "active" : true
      },
      "priority" : 50
    }

##### Response

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

    [ { } ]

### POST /policies/storage-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 | StorageBackupPolicyDetails (JSON) |

#### Example

##### Request

    POST /policies/storage-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/storage-backup/{guid}/entities

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

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

#### Example

##### Request

    GET /policies/storage-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/storage-backup/{guid}/statistics

Returns architecture statistics from Storage Backup Policy.

Request Parameters
name | type | description | constraints
--- | --- | --- | ---
guid | path | specify local unique identifier for Storage 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 Storage Backup Policy

#### Example

##### Request

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

    ...

##### Response

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

    { }