analogsea (version 0.7.0)

as.volume: Block storage operations

Description

volume

get a single volume

volumes

list volumes

volume_create

create a volume

volume_snapshot_create

create a snapshot of a volume

volume_snapshots

list snapshots for a volume

volume_delete

delete a volume

Usage

as.volume(x)

volumes(...)

volume(volume, ...)

volume_create(name, size, description = NULL, region = "nyc1", snapshot_id = NULL, ...)

volume_snapshot_create(volume, name, ...)

volume_snapshots(volume, ...)

volume_delete(volume, ...)

Arguments

x

Object to coerce to an volume

...

Additional options passed down to GET, POST, etc.

volume

A volume, or something that can be coerced to a volume by as.volume.

name

(character) Name of the new volume. required.

size

(integer) The size of the Block Storage volume in GiB

description

(character) An optional free-form text field to describe a Block Storage volume.

region

(character) The region where the Block Storage volume will be created. When setting a region, the value should be the slug identifier for the region. When you query a Block Storage volume, the entire region object will be returned. Should not be specified with a snapshot_id. Default: nyc1

snapshot_id

(integer) The unique identifier for the volume snapshot from which to create the volume. Should not be specified with a region_id.

Details

note that if you delete a volume, and it has a snapshot, the snapshot still exists, so beware

Examples

Run this code
# NOT RUN {
# list volumes
volumes()

# create a volume
vol1 <- volume_create('testing', 5)
vol2 <- volume_create('foobar', 6)

# create snapshot of a volume
xx <- volume_snapshot_create(vol2, "howdy")

# list snaphots for a volume
volume_snapshots(xx)

# list volumes again
res <- volumes()

# get a single volume
## a whole volume class object
volume(res$testing)
## by id
volume(res[[1]]$id)
## by name
volume(res[[1]]$name)

# delete a volume
## a whole volume class object
volume_delete(res$testing)
## by id
volume_delete(res[[1]]$id)
## by name
volume_delete(res[[1]]$name)

# delete many volumes
lapply(volumes(), volume_delete)
# }

Run the code above in your browser using DataCamp Workspace