To create a First Class Disk (FCD), you make a POST request using the block device specification. The request body includes a project ID, disk capacity, persistence setting, and constraints from the vSphere Storage Profile for an FCD creation.

Prerequisites

Procedure

  1. Assign the project ID variable.
    project_id='<your_project_id>'
  2. Set the capacity and persistence for the disk.
    capacity_in_gb=<integer>
    persistence=<true|false>
    
  3. Deploy the FCD.
    curl -X POST \
      $url/iaas/api/block-devices?apiVersion=$api_version \
      -H 'Content-Type: application/json' \
      -H "Authorization: Bearer $access_token" \
      -d '{
        "projectId": "'$project_id'",
        "name": "FCD-example",
        "capacityInGB": "'$capacity_in_gb'",
        "persistent" : "'$persistent'",
        "constraints": [
            {
                "mandatory": "true",
                "expression": "type:fcd"
            }
        ]
    }' | 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"
    }
  4. Assign the selfLink variable.
    selfLink_id='example-selfLink-alphanumeric-string'
  5. Use the selfLink variable to track the progress of the FCD 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 "."
    
    In the list of resources, the response includes block devices with the block device ID in the path.
    {
      "progress": 100,
      "message": "success",
      "status": "FINISHED",
      "resources": [
        "/iaas/api/block-devices/example-blockdevice-alphanumeric-string"
      ],
      ...
    }
  6. Assign the block device ID variable.
    block_device_id='example-blockdevice-alphanumeric-string'
  7. (Optional) Retrieve the created block device object.
    curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" $url/iaas/api/block-devices/$block_device_id?apiVersion=$api_version | jq "."
    
  8. (Optional) Retrieve all the FCD block device types.
    curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/block-devices?%24filter=customProperties.diskType%20eq%20firstClass&apiVersion=$api_version" | jq "."
    
  9. (Optional) Delete the FCD block device.
    curl -X DELETE -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" $url/iaas/api/block-devices/$block_device_id?apiVersion=$api_version | jq "."
    

Example: Create a First Class Disk

With constraints from a vSphere Storage Profile for FCD storage, use the block device specification to deploy a First Class Disk for a project ID with a two GB capacity and persistence set to false.

$ url='https://appliance.domain.com'
$ api_version='2021-07-15'
$ project_id='f5357a28-df59-47e0-b983-8a562910d0be'
$ capacity_in_gb=2
$ persistent=false

Deploy the FCD.

$ curl -X POST \
  $url/iaas/api/block-devices?apiVersion=$api_version \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $access_token" \
  -d '{
    "projectId": "'$project_id'",
    "name": "FCD-example",
    "capacityInGB": "'$capacity_in_gb'",
    "persistent" : "'$persistent'",
    "constraints": [
        {
            "mandatory": "true",
            "expression": "type:fcd"
        }
    ]
}' | jq "."

The response provides a selfLink to the request.

{
  "progress": 0,
  "status": "INPROGRESS",
  "name": "Provisioning",
  "id": "86707da6-d5d6-4ebc-94a2-0a22f3fcb794",
  "selfLink": "/iaas/api/request-tracker/86707da6-d5d6-4ebc-94a2-0a22f3fcb794"
}

Assign the selfLink ID variable.

$ selfLink_id='86707da6-d5d6-4ebc-94a2-0a22f3fcb794'

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 "."

After the request completes successfully, the response provides the block device ID.

{
  "progress": 100,
  "message": "success",
  "status": "FINISHED",
  "resources": [
    "/iaas/api/block-devices/e1cbc8e1-76bb-4bef-8e51-a582437266c2"
  ],
  "name": "Provisioning",
  "id": "86707da6-d5d6-4ebc-94a2-0a22f3fcb794",
  "selfLink": "/iaas/api/request-tracker/86707da6-d5d6-4ebc-94a2-0a22f3fcb794"
}

Assign the block device ID variable.

$ block_device_id='e1cbc8e1-76bb-4bef-8e51-a582437266c2'

What to do next

Use the block device ID to attach your FCD to a VM and manage your FCD snapshots. See Attach a First Class Disk and Manage First Class Disk Snapshots.