ByCloud Docs
GuidesCLIAPISDK

Python SDK

Block Storage

Volumes, snapshots, and backups

20 methods

GET

list_backups()

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

from bycloud import ByCloud
client = ByCloud(token="YOUR_ACCESS_TOKEN")
result = client.block_storage.list_backups()
print(result)
POST

create_backup()

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

from bycloud import ByCloud
client = ByCloud(token="YOUR_ACCESS_TOKEN")
result = client.block_storage.create_backup(volume_id="550e8400-e29b-41d4-a716-446655440000")
print(result)
GET

get_backup()

Get backup

Parameters

backup_id

string

required

- Backup ID

Example

from bycloud import ByCloud
client = ByCloud(token="YOUR_ACCESS_TOKEN")
result = client.block_storage.get_backup(backup_id="550e8400-e29b-41d4-a716-446655440000")
print(result)
DELETE

delete_backup()

Delete backup

Parameters

backup_id

string

required

- Backup ID

Example

from bycloud import ByCloud
client = ByCloud(token="YOUR_ACCESS_TOKEN")
result = client.block_storage.delete_backup(backup_id="550e8400-e29b-41d4-a716-446655440000")
print(result)
POST

restore_backup()

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

from bycloud import ByCloud
client = ByCloud(token="YOUR_ACCESS_TOKEN")
result = client.block_storage.restore_backup(backup_id="550e8400-e29b-41d4-a716-446655440000")
print(result)
GET

list_snapshots()

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

from bycloud import ByCloud
client = ByCloud(token="YOUR_ACCESS_TOKEN")
result = client.block_storage.list_snapshots()
print(result)
POST

create_snapshot()

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

from bycloud import ByCloud
client = ByCloud(token="YOUR_ACCESS_TOKEN")
result = client.block_storage.create_snapshot(volume_id="550e8400-e29b-41d4-a716-446655440000")
print(result)
GET

get_snapshot()

Get snapshot

Parameters

snapshot_id

string

required

- Snapshot ID

Example

from bycloud import ByCloud
client = ByCloud(token="YOUR_ACCESS_TOKEN")
result = client.block_storage.get_snapshot(snapshot_id="550e8400-e29b-41d4-a716-446655440000")
print(result)
PATCH

update_snapshot()

Update snapshot

Parameters

snapshot_id

string

required

- Snapshot ID

name

string

description

string

metadata

object

Example

from bycloud import ByCloud
client = ByCloud(token="YOUR_ACCESS_TOKEN")
result = client.block_storage.update_snapshot(snapshot_id="550e8400-e29b-41d4-a716-446655440000")
print(result)
DELETE

delete_snapshot()

Delete snapshot

Parameters

snapshot_id

string

required

- Snapshot ID

Example

from bycloud import ByCloud
client = ByCloud(token="YOUR_ACCESS_TOKEN")
result = client.block_storage.delete_snapshot(snapshot_id="550e8400-e29b-41d4-a716-446655440000")
print(result)
GET

list_volume_types()

List volume types

Example

from bycloud import ByCloud
client = ByCloud(token="YOUR_ACCESS_TOKEN")
result = client.block_storage.list_volume_types()
print(result)
GET

get_volume_type()

Get volume type

Parameters

volume_type_id

string

required

- Volume Type ID

Example

from bycloud import ByCloud
client = ByCloud(token="YOUR_ACCESS_TOKEN")
result = client.block_storage.get_volume_type(volume_type_id="550e8400-e29b-41d4-a716-446655440000")
print(result)
GET

list_volumes()

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

from bycloud import ByCloud
client = ByCloud(token="YOUR_ACCESS_TOKEN")
result = client.block_storage.list_volumes()
print(result)
POST

create_volume()

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

from bycloud import ByCloud
client = ByCloud(token="YOUR_ACCESS_TOKEN")
result = client.block_storage.create_volume(size=100)
print(result)
GET

get_volume()

Get volume

Parameters

volume_id

string

required

- Volume ID

Example

from bycloud import ByCloud
client = ByCloud(token="YOUR_ACCESS_TOKEN")
result = client.block_storage.get_volume(volume_id="550e8400-e29b-41d4-a716-446655440000")
print(result)
PATCH

update_volume()

Update volume

Parameters

volume_id

string

required

- Volume ID

name

string

description

string

metadata

object

Example

from bycloud import ByCloud
client = ByCloud(token="YOUR_ACCESS_TOKEN")
result = client.block_storage.update_volume(volume_id="550e8400-e29b-41d4-a716-446655440000")
print(result)
DELETE

delete_volume()

Delete volume

Parameters

volume_id

string

required

- Volume ID

force

boolean

- Force delete even if volume is in use

Example

from bycloud import ByCloud
client = ByCloud(token="YOUR_ACCESS_TOKEN")
result = client.block_storage.delete_volume(volume_id="550e8400-e29b-41d4-a716-446655440000")
print(result)
POST

attach_volume()

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

from bycloud import ByCloud
client = ByCloud(token="YOUR_ACCESS_TOKEN")
result = client.block_storage.attach_volume(volume_id="550e8400-e29b-41d4-a716-446655440000", instance_id="550e8400-e29b-41d4-a716-446655440000")
print(result)
POST

detach_volume()

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

from bycloud import ByCloud
client = ByCloud(token="YOUR_ACCESS_TOKEN")
result = client.block_storage.detach_volume(volume_id="550e8400-e29b-41d4-a716-446655440000", instance_id="550e8400-e29b-41d4-a716-446655440000")
print(result)
POST

extend_volume()

Extend volume

Parameters

volume_id

string

required

- Volume ID

new_size

integer

required

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

Example

from bycloud import ByCloud
client = ByCloud(token="YOUR_ACCESS_TOKEN")
result = client.block_storage.extend_volume(volume_id="550e8400-e29b-41d4-a716-446655440000", new_size=10)
print(result)