analogsea (version 0.7.0)

volume_attach: Attach a volume to a droplet

Description

Attach a volume to a droplet

Usage

volume_attach(volume, droplet, region = "nyc1", ...)

volume_detach(volume, droplet, region = "nyc1", ...)

volume_resize(volume, size, region = "nyc1", ...)

volume_action(volume, actionid, ...)

volume_actions(volume, page = 1, per_page = 25, ...)

Arguments

volume

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

droplet

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

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

...

Additional options passed down to GET, POST, etc.

size

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

actionid

(integer) Optional. An action id.

page

Page to return. Default: 1.

per_page

Number of results per page. Default: 25.

Details

Note that there is a way to attach a volume to or remove from a droplet by name, but we only support doing this by ID. However, as the user, all you need to do is make a volume class object via as.volume and pass it to volume_attach or volume_detach, which is pretty darn easy.

Examples

Run this code
# NOT RUN {
# resize a volume
## create a volume
(vol1 <- volume_create('foobar', 5))
## resize it
volume_resize(vol1, 6)
volume(vol1)

# attach a volume to a droplet
## create a droplet
(d <- droplet_create(region = "nyc1"))
## attach volume to droplet
volume_attach(vol1, d)
## refresh droplet info, see volumes slot
droplet(d$id)

# detach a volume from a droplet
(act <- volume_detach(vol1, d))
## refresh droplet info, see volumes slot
droplet(d$id)

# list an action
volume_action(vol1, 154689758)

# list all volume actions
volume_actions(volumes()[[1]])
# }

Run the code above in your browser using DataCamp Workspace