To create a snapshot of a First Class Disk (FCD), you make a POST request with the block device ID of the FCD. Using the snapshot ID created, you can revert an FCD to a snapshot or delete a snapshot of an FCD.

Prerequisites

Procedure

  1. Assign the block device ID variable.
    block_device_id='<your_block_device_id>'
  2. Create a snapshot of the FCD.
    curl -X POST \
      $url/iaas/api/block-devices/$block_device_id/operations/snapshots?apiVersion=$api_version \
      -H 'Content-Type: application/json' \
      -H "Authorization: Bearer $access_token" \
      -d '{
        "description": "example description"
      }' | jq "."
    The response includes a selfLink value.
    {
      "progress": 0,
      "status": "INPROGRESS",
      "name": "Provisioning",
      "id": "example-selfLink-alphanumeric-string",
      "selfLink": "/iaas/api/request-tracker/example-selfLink-alphanumeric-string"
    }
  3. Assign the selfLink variable.
    selfLink_id='example-selfLink-alphanumeric-string'
  4. Use the selfLink to track the progress of the FCD snapshot creation.
    curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" $url/iaas/api/request-tracker/$selfLink_id?apiVersion=$api_version | jq "."
    
    The response indicates if the snapshot is successful.
    {
      "progress": 100,
      "message": "success",
      "status": "FINISHED",
      "resources": [
        "/iaas/api/block-devices/your-block-device-id"
      ],
      ...
    }
  5. (Optional) To create additional FCD snapshots, repeat Step 2 to Step 4.
  6. To get a snapshot ID, list all FCD snapshots.
    curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" $url/iaas/api/block-devices/$block_device_id/snapshots?apiVersion=$api_version | jq "."
    
    If you created multiple snapshots, the response lists multiple snapshot IDs.
  7. Examine the response and select a snapshot ID to assign as a variable.
    snapshot_id=<your_snapshot_id_1>
  8. (Optional) You can list an individual snapshot.
    curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" $url/iaas/api/block-devices/$block_device_id/snapshots/$snapshot_id?apiVersion=$api_version | jq "."
    
  9. (Optional) You can revert an FCD to a snapshot.
    curl -X POST \
      $url/iaas/api/block-devices/$block_device_id/operations/revert?id=$snapshot_id\&apiVersion=$api_version \
     -H 'Content-Type: application/json' \
     -H "Authorization: Bearer $access_token" \
     -d '' | jq "."

    To track the progress of the reversion, perform Step 3 and Step 4.

  10. (Optional) You can delete a snapshot.
    curl -X DELETE -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" $url/iaas/api/block-devices/$block_device_id/snapshots/$snapshot_id?apiVersion=$api_version | jq "."
    

Example: Create snapshots of a First Class Disk and revert an FCD to a snapshot

With the block device ID from the created FCD, create multiple snapshots of an FCD.

$ url='https://appliance.domain.com'
$ api_version='2021-07-15'
$ block_device_id='e1cbc8e1-76bb-4bef-8e51-a582437266c2'

Create a snapshot of the FCD.

$ curl -X POST \
  $url/iaas/api/block-devices/$block_device_id/operations/snapshots?apiVersion=$api_version \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $access_token" \
  -d '{
    "description": "Example description 1"
  }' | jq "."

The response provides a selfLink to the request.

{
  "progress": 0,
  "status": "INPROGRESS",
  "name": "Provisioning",
  "id": "d08bb46c-cf7e-40b6-bdf8-893390ba4d51",
  "selfLink": "/iaas/api/request-tracker/d08bb46c-cf7e-40b6-bdf8-893390ba4d51"
}

Assign the selfLink ID variable.

$ selfLink_id='d08bb46c-cf7e-40b6-bdf8-893390ba4d51'

Track the progress of the request.

$ curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" $url/iaas/api/request-tracker/$selfLink_id?apiVersion=$api_version | jq "."

Create a second snapshot of the FCD.

$ curl -X POST \
  $url/iaas/api/block-devices/$block_device_id/operations/snapshots?apiVersion=$api_version \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $access_token" \
  -d '{
    "description": "Example description 2"
  }' | jq "."

List all the snapshots of the FCD.

curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" $url/iaas/api/block-devices/$block_device_id/snapshots?apiVersion=$api_version | jq "."

Examine the response to see all snapshot IDs.

[
  {
    "name": "357ed3e5-8b2e-4533-b6fe-3ea6e15b8de5",
    "desc": "Example description 1",
    "isCurrent": false,
    "id": "16cfdbb8-559c-49ff-8162-0a4c57079c81",
    "createdAt": "2022-04-02",
    "updatedAt": "2022-04-02",
    "owner": "[email protected]",
    "organizationId": "b373cda4-ae0f-4d5a-9eca-f307bd30c9cd",
    "orgId": "b373cda4-ae0f-4d5a-9eca-f307bd30c9cd",
    "_links": {
      "self": {
        "href": "/iaas/api/block-devices/e1cbc8e1-76bb-4bef-8e51-a582437266c2/snapshots/16cfdbb8-559c-49ff-8162-0a4c57079c81"
      }
    }
  },
  {
    "name": "b04f7513-c695-4662-b5e8-a023a7b1bfe7",
    "desc": "Example description 2",
    "isCurrent": true,
    "id": "ed1b09ff-1175-4cdd-b07e-7bb906a9ddc4",
    "createdAt": "2022-04-02",
    "updatedAt": "2022-04-02",
    "owner": "[email protected]",
    "organizationId": "b373cda4-ae0f-4d5a-9eca-f307bd30c9cd",
    "orgId": "b373cda4-ae0f-4d5a-9eca-f307bd30c9cd",
    "_links": {
      "self": {
        "href": "/iaas/api/block-devices/e1cbc8e1-76bb-4bef-8e51-a582437266c2/snapshots/ed1b09ff-1175-4cdd-b07e-7bb906a9ddc4"
      }
    }
  }
]

Assign a snapshot ID variable.

snapshot_id='16cfdbb8-559c-49ff-8162-0a4c57079c81'

List information about the snapshot.

$ curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" $url/iaas/api/block-devices/$block_device_id/snapshots/$snapshot_id?apiVersion=$api_version | jq "."

The response shows information about the single snapshot.

{
    "name": "357ed3e5-8b2e-4533-b6fe-3ea6e15b8de5",
    "desc": "Example description 1",
    "isCurrent": false,
    "id": "16cfdbb8-559c-49ff-8162-0a4c57079c81",
    "createdAt": "2022-04-02",
    "updatedAt": "2022-04-02",
    "owner": "[email protected]",
    "organizationId": "b373cda4-ae0f-4d5a-9eca-f307bd30c9cd",
    "orgId": "b373cda4-ae0f-4d5a-9eca-f307bd30c9cd",
    "_links": {
      "self": {
        "href": "/iaas/api/block-devices/e1cbc8e1-76bb-4bef-8e51-a582437266c2/snapshots/16cfdbb8-559c-49ff-8162-0a4c57079c81"
      }
    }

Revert the FCD to the snapshot.

$ curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" $url/iaas/api/block-devices/$block_device_id/snapshots/$snapshot_id?apiVersion=$api_version | jq "."

To validate the reversion, list information about the snapshot again.

$ curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" $url/iaas/api/block-devices/$block_device_id/snapshots/$snapshot_id?apiVersion=$api_version | jq "."

In the response, "isCurrent":true shows that the FCD has reverted to the snapshot.

{
    "name": "357ed3e5-8b2e-4533-b6fe-3ea6e15b8de5",
    "desc": "Example description 1",
    "isCurrent": true,
    "id": "16cfdbb8-559c-49ff-8162-0a4c57079c81",
    "createdAt": "2022-04-02",
    "updatedAt": "2022-04-02",
    "owner": "[email protected]",
    "organizationId": "b373cda4-ae0f-4d5a-9eca-f307bd30c9cd",
    "orgId": "b373cda4-ae0f-4d5a-9eca-f307bd30c9cd",
    "_links": {
      "self": {
        "href": "/iaas/api/block-devices/e1cbc8e1-76bb-4bef-8e51-a582437266c2/snapshots/16cfdbb8-559c-49ff-8162-0a4c57079c81"
      }
    }