# Storage Snapshot Management Policies Controller Resource

The API allows you to list, view, create and edit snapshot management policies for storages.

### GET /policies/storage-snapshot

Returns list of snapshot management policies.

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 StorageSnapshotMgmtPolicyListRecord (JSON) | list of snapshot management policies

#### Example

##### Request

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

Create snapshot management policy.

Request Body
media type | data type | description
--- | --- | ---
application/json | StorageSnapshotMgmtPolicyRequest (JSON) | specify details for new snapshot management policy

Response Body
media type | data type | description
--- | --- | ---
application/json | StorageSnapshotMgmtPolicyDetails (JSON) | details of newly created snapshot management policy

#### Example

##### Request

    POST /policies/storage-snapshot
    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

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

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

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

Request Body
media type | data type | description
--- | --- | ---
application/json | StorageSnapshotMgmtPolicyRequest (JSON) | specify storage snapshot management 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-snapshot/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

    [ { } ]

### GET /policies/storage-snapshot/detailed

Returns detailed list of snapshot management policies.

Response Body
media type | data type | description
--- | --- | ---
application/json | array of StorageSnapshotMgmtPolicyDetails (JSON) | detailed list of snapshot management policies

#### Example

##### Request

    GET /policies/storage-snapshot/detailed
    Content-Type: */*
    Accept: application/json

    ...

##### Response

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

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

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

Remove snapshot management policy.

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

#### Example

##### Request

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

    ...

##### Response

    HTTP/1.1 204 No Content

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

Get a single snapshot management policy.

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

Response Body
media type | data type | description
--- | --- | ---
application/json | StorageSnapshotMgmtPolicyDetails (JSON) | a single snapshot management policy details

#### Example

##### Request

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

Change snapshot management policy details.

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

Request Body
media type | data type | description
--- | --- | ---
application/json | StorageSnapshotMgmtPolicyRequest (JSON) | specify snapshot management policy details to update

Response Body
media type | data type | description
--- | --- | ---
application/json | StorageSnapshotMgmtPolicyDetails (JSON) | updated details of snapshot management policy

#### Example

##### Request

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

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

##### Response

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

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

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

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

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

Request Body
media type | data type | description
--- | --- | ---
application/json | StorageSnapshotMgmtPolicyRequest (JSON) | specify storage snapshot management 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-snapshot/{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-snapshot/{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 | StorageSnapshotMgmtPolicyDetails (JSON) |

#### Example

##### Request

    POST /policies/storage-snapshot/{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
    }