Workflows for PowerProtect Cloud Snapshot Manager REST API v2

The following workflows are presented to the REST API programmer as examples of how to create a workflow using the PowerProtect Cloud Snapshot Manager REST API. These examples are only to guide the programming effort, and they have to be customized according to the requirements. As part of each workflow, examples of API requests and responses for every step have been provided.

Create a protection plan

The following is a sample workflow for creating a protection plan.

Procedure

  1. Create the Authentication token and send it as Bearer Authentication token under the
    'Authorization'
    header for each of the subsequent API calls.
  2. Discover policies that are registered with Cloud Snapshot Manager:
    GET /v2/policies
    1. Set the
      'Authorization'
      header as mentioned in step 1.
    2. Copy the backup policy id, cross-region policy id and cross-account policy id value from the list in the response. This is used for the
      'backp_policy_id'
      ,
      'cross_region_policy_id'
      and
      'cross_account_policy_id'
      query parameter for GET and JSON keypair in the POST body for each of the subsequent calls.
  3. Create a protection plan:
    POST /v2/plans
    1. Set the
      'Authorization'
      header as mentioned in step 1.
    2. Set the
      'Content-Type'
      header to
      application/x-www-formurlencoded
    3. In the POST body, provide
      'backup_policy_id'
      ,
      'cross_region_policy_id'
      ,
      'cross_account_policy_id'
      , Protection plan start time with
      'start_time_zone'
      and
      'start_time_utc'
      . You can give either
      'resources'
      or
      'tags'
      . For application consistency, for aws you have tow options. Either you can set
      'vss_enabled'
      flag or give
      'scripts'
      . For azure yo have only
      'scripts'
      option.
    4. Copy the
      id
      value from the response. This is the protection plan id that can be used to read its details from the server.
  4. Get protection plan details:
    GET /v2/plans/{planId}
    1. Replace
      {planId}
      in the above URL with the one from step 3.4.
    2. Set the
      'Authorization'
      header as mentioned in step 1.

Example usage for the workflow

The following are examples of the API requests and responses for each of the steps in the workflow.

Create Authentication Token 

API Request

The following command uses the Cloud Snapshot Manager REST API to create an authentication token.

  
curl -X POST \ https://ssgosge.emc.com/external/auth/oauth/v2/token \ -H 'cache-control: no-cache' \ -H 'content-type: application/x-www-form-urlencoded' \ -d 'grant_type=client_credentials&client_id=l7xx6bf585bee63e499799b11ca75ed1c99e&client_secret=c540564f40df4491bfff83e89a14254f'
API Response
  
{ "access_token": "cc387d99-7c95-477b-ab5a-5f2c2b5293dc", "token_type": "Bearer", "expires_in": 3600, "scope": "oob" }

Discover protection plans created with Cloud Snapshot Manager 

API request

The following command uses the Cloud Snapshot Manager REST API to generate the list of protection plans.

  
curl -X GET \ https://ssgosge.emc.com/csm/v2/plans \ -H 'accept: application/json' \ -H 'authorization: Bearer cc387d99-7c95-477b-ab5a-5f2c2b5293dc' \ -H 'cache-control: no-cache' \ -H 'content-type: application/json'
API response

The following response is received from the API.

  
[{ "account_number": "341004231416", "subscription_id": "341004231416" "id": "b402fe9b-42d2-4347-ad12-dca6e5c87ffc", "name": "AWS Protection plan", "description": "AWS Protection plan with cross-region and cross-account copy", "backup_policy_name": "Daily Backup", "backup_policy_id": "a502fe9b-42d2-4347-ad12-dca6e5c87ffc", "cross_region_policy_name": "us-west-2 copy", "cross_region_policy_id": "c602fe9b-42d2-4347-ad12-dca6e5c87ffc", "cross_account_policy_name": "other account copy", "cross_account_policy_id": "d702fe9b-42d2-4347-ad12-dca6e5c87ffc", "enabled": true, "exclude_data_volumes": true, "start_time_zone": "Asia/Calcutta", "start_time_utc": "2020-07-28T07:14:21Z", "application_consistency": { "aws": { "vss_enabled": true } }, "resources": [ { "id": "b402fe9b-42d2-4347-ad12-dca6e5c87ffc", "region": "us-west-2", "resource_type": "vm", "cloud_account_id": "341004231416" } ], "start_time_epoch": 121232344 } ]