Attach a Block Storage volume to a droplet using the volume name
import { DigitalOcean } from 'digitalocean-js';
const client = new DigitalOcean('your-api-key');
const request = {
type: 'attach',
volume_name: 'example',
region: 'nyc1',
droplet_id: 116121901
}
const action = await client.blockStorageActions
.attachVolumeToDropletByName(request);
Detach a Block Storage volume from a droplet
import { DigitalOcean } from 'digitalocean-js';
const client = new DigitalOcean('your-api-key');
const request = {
type: 'detach',
droplet_id: 11612190,
region: 'nyc1'
}
const action = await client.blockStorageActions
.detachVolumeFromDroplet('volume-id', request);
Detach a Block Storage volume from a droplet using the volume name
import { DigitalOcean } from 'digitalocean-js';
const client = new DigitalOcean('your-api-key');
const request = {
type: 'detach',
volume_name: 'example',
region: 'nyc1',
droplet_id: 116121901
}
const action = await client.blockStorageActions
.detachVolumeFromDropletByName(request);
List all actions that have been executed on the specified volume. Limited to 25 actions per page unless otherwise specified.
import { DigitalOcean } from 'digitalocean-js';
const client = new DigitalOcean('your-api-key');
const actions = await client.blockStorageActions.getAllVolumeActions('volume-id');
// Paginate actions, 10 per page, starting on page 1
actions = await client.blockStorageActions
.getAllVolumeActions('volume-id', 10, 1);
Optional
perPage: numberOptional
page: numberGet an existing volume action based on the provided ID
import { DigitalOcean } from 'digitalocean-js';
const client = new DigitalOcean('your-api-key');
const action = await client.blockStorageActions
.getExistingVolumeAction('volume-id', 'action-id');
Resize a Block Storage volume
import { DigitalOcean } from 'digitalocean-js';
const client = new DigitalOcean('your-api-key');
const request = {
type: 'resize',
size_gigabytes: 100,
region: 'nyc1'
}
const action = await client.blockStorageActions
.resizeVolume('volume-id', request);
Generated using TypeDoc
Attach a Block Storage volume to a droplet
Example