JavaScript SDK
Block Storage
Volumes, snapshots, and backups
20 methods
listBackups()
List backups
Parameters
limitinteger
- Maximum number of items to return
markerstring
- ID of the last item from the previous page (for pagination)
namestring
- Filter by name (exact match or prefix with *)
statusstring
- Filter by status
volume_idstring
- Filter by volume ID
Example
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.blockStorage.listBackups();console.log(result);
createBackup()
Create backup
Parameters
volume_idstring
required- Volume to backup
namestring
descriptionstring
containerstring
- Backup container
incrementalboolean
- Create incremental backup
forceboolean
- Force backup even if volume is attached
snapshot_idstring
- Create backup from snapshot instead of volume
metadataobject
Example
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.blockStorage.createBackup({volume_id: "550e8400-e29b-41d4-a716-446655440000"});console.log(result);
getBackup()
Get backup
Parameters
backup_idstring
required- Backup ID
Example
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.blockStorage.getBackup({backup_id: "550e8400-e29b-41d4-a716-446655440000"});console.log(result);
deleteBackup()
Delete backup
Parameters
backup_idstring
required- Backup ID
Example
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.blockStorage.deleteBackup({backup_id: "550e8400-e29b-41d4-a716-446655440000"});console.log(result);
restoreBackup()
Restore backup
Parameters
backup_idstring
required- Backup ID
volume_idstring
- Existing volume to restore to (creates new volume if omitted)
namestring
- Name for new volume (if not restoring to existing)
Example
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.blockStorage.restoreBackup({backup_id: "550e8400-e29b-41d4-a716-446655440000"});console.log(result);
listSnapshots()
List snapshots
Parameters
limitinteger
- Maximum number of items to return
markerstring
- ID of the last item from the previous page (for pagination)
namestring
- Filter by name (exact match or prefix with *)
statusstring
- Filter by status
volume_idstring
- Filter by volume ID
Example
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.blockStorage.listSnapshots();console.log(result);
createSnapshot()
Create snapshot
Parameters
volume_idstring
required- Volume to snapshot
namestring
descriptionstring
forceboolean
- Force snapshot even if volume is attached
metadataobject
Example
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.blockStorage.createSnapshot({volume_id: "550e8400-e29b-41d4-a716-446655440000"});console.log(result);
getSnapshot()
Get snapshot
Parameters
snapshot_idstring
required- Snapshot ID
Example
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.blockStorage.getSnapshot({snapshot_id: "550e8400-e29b-41d4-a716-446655440000"});console.log(result);
updateSnapshot()
Update snapshot
Parameters
snapshot_idstring
required- Snapshot ID
namestring
descriptionstring
metadataobject
Example
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.blockStorage.updateSnapshot({snapshot_id: "550e8400-e29b-41d4-a716-446655440000"});console.log(result);
deleteSnapshot()
Delete snapshot
Parameters
snapshot_idstring
required- Snapshot ID
Example
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.blockStorage.deleteSnapshot({snapshot_id: "550e8400-e29b-41d4-a716-446655440000"});console.log(result);
listVolumeTypes()
List volume types
Example
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.blockStorage.listVolumeTypes();console.log(result);
getVolumeType()
Get volume type
Parameters
volume_type_idstring
required- Volume Type ID
Example
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.blockStorage.getVolumeType({volume_type_id: "550e8400-e29b-41d4-a716-446655440000"});console.log(result);
listVolumes()
List volumes
Parameters
limitinteger
- Maximum number of items to return
markerstring
- ID of the last item from the previous page (for pagination)
namestring
- Filter by name (exact match or prefix with *)
statusstring
- Filter by status
bootableboolean
- Filter by bootable status
Example
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.blockStorage.listVolumes();console.log(result);
createVolume()
Create volume
Parameters
namestring
descriptionstring
sizeinteger
required- Size in GB
volume_typestring
- Volume type name or ID
snapshot_idstring
- Create volume from snapshot
source_volume_idstring
- Clone from existing volume
image_idstring
- Create volume from image
multiattachboolean
metadataobject
Example
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.blockStorage.createVolume({size: 100});console.log(result);
getVolume()
Get volume
Parameters
volume_idstring
required- Volume ID
Example
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.blockStorage.getVolume({volume_id: "550e8400-e29b-41d4-a716-446655440000"});console.log(result);
updateVolume()
Update volume
Parameters
volume_idstring
required- Volume ID
namestring
descriptionstring
metadataobject
Example
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.blockStorage.updateVolume({volume_id: "550e8400-e29b-41d4-a716-446655440000"});console.log(result);
deleteVolume()
Delete volume
Parameters
volume_idstring
required- Volume ID
forceboolean
- Force delete even if volume is in use
Example
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.blockStorage.deleteVolume({volume_id: "550e8400-e29b-41d4-a716-446655440000"});console.log(result);
attachVolume()
Attach volume
Parameters
volume_idstring
required- Volume ID
instance_idstring
required- Instance to attach to
devicestring
- Device name (e.g., /dev/vdb). Auto-assigned if omitted.
Example
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.blockStorage.attachVolume({volume_id: "550e8400-e29b-41d4-a716-446655440000",instance_id: "550e8400-e29b-41d4-a716-446655440000"});console.log(result);
detachVolume()
Detach volume
Parameters
volume_idstring
required- Volume ID
instance_idstring
required- Instance to detach from
forceboolean
- Force detach even if instance is running
Example
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.blockStorage.detachVolume({volume_id: "550e8400-e29b-41d4-a716-446655440000",instance_id: "550e8400-e29b-41d4-a716-446655440000"});console.log(result);
extendVolume()
Extend volume
Parameters
volume_idstring
required- Volume ID
new_sizeinteger
required- New size in GB (must be larger than current size)
Example
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.blockStorage.extendVolume({volume_id: "550e8400-e29b-41d4-a716-446655440000",new_size: 10});console.log(result);