as.volume {analogsea} | R Documentation |
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,
filesystem_type = NULL,
filesystem_label = NULL,
tags = NULL,
...
)
volume_snapshot_create(volume, name, ...)
volume_snapshots(volume, ...)
volume_delete(volume, ...)
Arguments
x |
Object to coerce to an volume |
... |
|
volume |
A volume, or something that can be coerced to a volume by
|
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. |
filesystem_type |
(character) The name of the filesystem type to be used on the volume. When provided, the volume will automatically be formatted to the specified filesystem type. Currently, the available options are "ext4" and "xfs". Pre-formatted volumes are automatically mounted when attached to Ubuntu, Debian, Fedora, Fedora Atomic, and CentOS Droplets created on or after April 26, 2018. Attaching pre-formatted volumes to other Droplets is not recommended. |
filesystem_label |
(character) The label to be applied to the filesystem. Labels for ext4 type filesystems may contain 16 characters while lables for xfs type filesystems are limited to 12 characters. May only be used in conjunction with filesystem_type. |
tags |
(character) tag names to apply to the Volume after it is created. Tag names can either be existing or new tags. |
Details
note that if you delete a volume, and it has a snapshot, the snapshot still exists, so beware
Examples
## Not run:
# list volumes
volumes()
# create a volume
vol1 <- volume_create('testing', 5)
vol2 <- volume_create('foobar', 6, tags = c('stuff', 'things'))
# 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)
## End(Not run)