REST - Virtual disks

Listing virtual disks

Query

GET /v2/storage-volumes

Returns an array with a list of existing virtual disks.

Response

{  
  "success":true,
  "storage_volumes": [
     {
       "id":"$volume_id",
       "label":"$volume_label",
       "size": $volume_size,
       "cost_per_hour": $volume_cost,
       "type": "$volume_type",
       "system_disk": $volume_system,

        // if shared_disk is equal to true then
        // the 'virtual_machines' field will exist if the disk
        // is connected to at least one virtual machine
        "shared_disk": $shared_disk, //if false
        "virtual_machine": {
           "id": "$vm_id",
           "label": "$vm_label",
           "attach_time": "$attach_time"
        }

        // if shared_disk is equal to false then
        // the 'virtual_machine' field will exist if
        // the disk is connected to a virtual machine
        "shared_disk": $shared_disk, //if true
        "virtual_machines": [{
              "id": "$vm_id",
              "label": "$vm_label",
              "attach_time": "$attach_time",
            },
            { ... },
            {
              "id": "$vm_id",
              "label": "$vm_label",
              "attach_time": "$attach_time"
           }
        ]
     },
    { ... }
  ]
}

Returned information

  • $volume_id (string) - UUID of the virtual disk
  • $volume_label (string) - name of the virtual disk
  • $volume_size (int) - size of the disk (in GB)
  • $volume_cost (float) - cost of the disk per hour
  • $volume_system (int) - specifies whether the disk is a system disk
  • $volume_type (string) - specifies the type of disk HDD/SSD
  • $shared_disk (bool) - specifies whether the disk is a shared or a regular disk
  • $vm_id (string) - UUID of the virtual machine to which the disk is connected
  • $vm_label (string) - name of the virtual machine to which the disk is connected
  • $attach_time (datetime) - date and time when the disk was connected to the virtual server


Retrieving information about a virtual disk

Query

GET /v2/storage-volumes/$VOLUME_ID

Returns information about a virtual disk with the specified $VOLUME_ID.

Response

{  
  "success":true,
  "storage_volume": [
     {
       "id": "$volume_id",
       "label": "$volume_label",
       "size": $volume_size,
       "cost_per_hour": $volume_cost,
       "type": "$volume_type",
       "system_disk": $volume_system,

        // if shared_disk is equal to true then
        // the 'virtual_machines' field will exist if the disk
        // is connected to at least one virtual machine
        "shared_disk": $shared_disk, //if false
        "virtual_machine": {
           "id": "$vm_id",
           "label": "$vm_label",
           "attach_time": "$attach_time"
        }

        // if shared_disk is equal to false then
        // the 'virtual_machine' field will exist if
        // the disk is connected to a virtual machine
        "shared_disk": $shared_disk, //if true
        "virtual_machines": [{
              "id": "$vm_id",
              "label": "$vm_label",
              "attach_time": "$attach_time",
            },
            { ... },
            {
              "id": "$vm_id",
              "label": "$vm_label",
              "attach_time": "$attach_time"
           }
        ]
     }
  ]
}

Returned information

  • $volume_id (string) - UUID of the virtual disk
  • $volume_label (string) - name of the virtual disk
  • $volume_size (int) - size of the disk (in GB)
  • $volume_cost (float) - cost of the disk per hour
  • $volume_system (int) - specifies whether the disk is a system disk
  • $volume_type (string) - specifies the type of disk HDD/SSD
  • $shared_disk (bool) - specifies whether the disk is a shared or a regular disk
  • $vm_id (string) - UUID of the virtual machine to which the disk is connected
  • $vm_label (string) - name of the virtual machine to which the disk is connected
  • $attach_time (datetime) - date and time when the disk was connected to the virtual server


Attaching a virtual disk

Query

POST /v2/storage-volumes/$VOLUME_ID/attach

Content of the query

{
   "virtual_machine_id": "$vm_id"
}

Description of parameters

  • $vm_id (string) - UUID of the virtual machine

Response

{  
  "success":true
}


Detaching a virtual disk

Query

POST /v2/storage-volumes/$VOLUME_ID/detach

Adds a task to detach the disk $VOLUME_ID from the virtual machine. The disk must be connected to the virtual machine for the operation to succeed.

Response

{  
  "success":true
}


Dodawanie wirtualnego dysku

Query

PUT /v2/storage-volumes

Dodaje nowy dysk wirtualny.

Content of the query

{
    "zone_id": "$location_id",
    "type": "$disk_type",
    "name": "$disk_label",
    "shared_volume": $shared_volume,
    "size": $disk_size,
    "recovery_point_id": "$recovery_point_id"
}

Description of parameters

  • $location_id (string) - UUID of the location
  • $disk_type (string) - type of disk (ssd/hdd)
  • $disk_label (string) - name of the image
  • $shared_volume (int) - whether the disk is shared (10)
  • $disk_size (int) - size of the disk (in GB)
  • $recovery_point_id (string) - optional parameter UUID of the recovery point image, if provided the disk will be created from the recovery point

Response

{  
  "success":true
}


Deleting a virtual disk

Query

DELETE /v2/storage-volumes/$VOLUME_ID

Adds a task to delete the disk $VOLUME_ID. If the disk is connected to a virtual machine, it will be automatically detached from it.

Response

{  
  "success":true
}