ByCloud Docs
GuidesCLIAPISDK

PHP SDK

Block Storage

Volumes, snapshots, and backups

20 methods

GET

listBackups()

List backups

Parameters

limit

integer

- Maximum number of items to return

marker

string

- ID of the last item from the previous page (for pagination)

name

string

- Filter by name (exact match or prefix with *)

status

string

- Filter by status

volume_id

string

- Filter by volume ID

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->blockStorage->listBackups();
print_r($result);
POST

createBackup()

Create backup

Parameters

volume_id

string

required

- Volume to backup

name

string

description

string

container

string

- Backup container

incremental

boolean

- Create incremental backup

force

boolean

- Force backup even if volume is attached

snapshot_id

string

- Create backup from snapshot instead of volume

metadata

object

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->blockStorage->createBackup([
'volume_id' => '550e8400-e29b-41d4-a716-446655440000'
]);
print_r($result);
GET

getBackup()

Get backup

Parameters

backup_id

string

required

- Backup ID

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->blockStorage->getBackup([
'backup_id' => '550e8400-e29b-41d4-a716-446655440000'
]);
print_r($result);
DELETE

deleteBackup()

Delete backup

Parameters

backup_id

string

required

- Backup ID

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->blockStorage->deleteBackup([
'backup_id' => '550e8400-e29b-41d4-a716-446655440000'
]);
print_r($result);
POST

restoreBackup()

Restore backup

Parameters

backup_id

string

required

- Backup ID

volume_id

string

- Existing volume to restore to (creates new volume if omitted)

name

string

- Name for new volume (if not restoring to existing)

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->blockStorage->restoreBackup([
'backup_id' => '550e8400-e29b-41d4-a716-446655440000'
]);
print_r($result);
GET

listSnapshots()

List snapshots

Parameters

limit

integer

- Maximum number of items to return

marker

string

- ID of the last item from the previous page (for pagination)

name

string

- Filter by name (exact match or prefix with *)

status

string

- Filter by status

volume_id

string

- Filter by volume ID

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->blockStorage->listSnapshots();
print_r($result);
POST

createSnapshot()

Create snapshot

Parameters

volume_id

string

required

- Volume to snapshot

name

string

description

string

force

boolean

- Force snapshot even if volume is attached

metadata

object

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->blockStorage->createSnapshot([
'volume_id' => '550e8400-e29b-41d4-a716-446655440000'
]);
print_r($result);
GET

getSnapshot()

Get snapshot

Parameters

snapshot_id

string

required

- Snapshot ID

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->blockStorage->getSnapshot([
'snapshot_id' => '550e8400-e29b-41d4-a716-446655440000'
]);
print_r($result);
PATCH

updateSnapshot()

Update snapshot

Parameters

snapshot_id

string

required

- Snapshot ID

name

string

description

string

metadata

object

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->blockStorage->updateSnapshot([
'snapshot_id' => '550e8400-e29b-41d4-a716-446655440000'
]);
print_r($result);
DELETE

deleteSnapshot()

Delete snapshot

Parameters

snapshot_id

string

required

- Snapshot ID

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->blockStorage->deleteSnapshot([
'snapshot_id' => '550e8400-e29b-41d4-a716-446655440000'
]);
print_r($result);
GET

listVolumeTypes()

List volume types

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->blockStorage->listVolumeTypes();
print_r($result);
GET

getVolumeType()

Get volume type

Parameters

volume_type_id

string

required

- Volume Type ID

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->blockStorage->getVolumeType([
'volume_type_id' => '550e8400-e29b-41d4-a716-446655440000'
]);
print_r($result);
GET

listVolumes()

List volumes

Parameters

limit

integer

- Maximum number of items to return

marker

string

- ID of the last item from the previous page (for pagination)

name

string

- Filter by name (exact match or prefix with *)

status

string

- Filter by status

bootable

boolean

- Filter by bootable status

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->blockStorage->listVolumes();
print_r($result);
POST

createVolume()

Create volume

Parameters

name

string

description

string

size

integer

required

- Size in GB

volume_type

string

- Volume type name or ID

snapshot_id

string

- Create volume from snapshot

source_volume_id

string

- Clone from existing volume

image_id

string

- Create volume from image

multiattach

boolean

metadata

object

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->blockStorage->createVolume([
'size' => 100
]);
print_r($result);
GET

getVolume()

Get volume

Parameters

volume_id

string

required

- Volume ID

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->blockStorage->getVolume([
'volume_id' => '550e8400-e29b-41d4-a716-446655440000'
]);
print_r($result);
PATCH

updateVolume()

Update volume

Parameters

volume_id

string

required

- Volume ID

name

string

description

string

metadata

object

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->blockStorage->updateVolume([
'volume_id' => '550e8400-e29b-41d4-a716-446655440000'
]);
print_r($result);
DELETE

deleteVolume()

Delete volume

Parameters

volume_id

string

required

- Volume ID

force

boolean

- Force delete even if volume is in use

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->blockStorage->deleteVolume([
'volume_id' => '550e8400-e29b-41d4-a716-446655440000'
]);
print_r($result);
POST

attachVolume()

Attach volume

Parameters

volume_id

string

required

- Volume ID

instance_id

string

required

- Instance to attach to

device

string

- Device name (e.g., /dev/vdb). Auto-assigned if omitted.

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->blockStorage->attachVolume([
'volume_id' => '550e8400-e29b-41d4-a716-446655440000',
'instance_id' => '550e8400-e29b-41d4-a716-446655440000'
]);
print_r($result);
POST

detachVolume()

Detach volume

Parameters

volume_id

string

required

- Volume ID

instance_id

string

required

- Instance to detach from

force

boolean

- Force detach even if instance is running

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->blockStorage->detachVolume([
'volume_id' => '550e8400-e29b-41d4-a716-446655440000',
'instance_id' => '550e8400-e29b-41d4-a716-446655440000'
]);
print_r($result);
POST

extendVolume()

Extend volume

Parameters

volume_id

string

required

- Volume ID

new_size

integer

required

- New size in GB (must be larger than current size)

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->blockStorage->extendVolume([
'volume_id' => '550e8400-e29b-41d4-a716-446655440000',
'new_size' => 10
]);
print_r($result);