snapshots: Snapshot operations

View source: R/snapshots.R

as.snapshotR Documentation

Snapshot operations

Description

snapshot

retrieve a snapshot

snapshots

list snapshots, all, droplets, or volumes

snapshot_delete

delete a snapshot

Usage

as.snapshot(x)

snapshots(type = NULL, page = 1, per_page = 20, ...)

snapshot(id, ...)

snapshot_delete(snapshot, ...)

Arguments

x

Object to coerce to an snapshot

type

(character) NULL (all snapshots), or one of droplet (droplet snapshots) or volume (volume snapshots)

page

Which 'page' of paginated results to return (default 1).

per_page

Number of items returned per page (default 20, maximum 200)

...

Additional options passed down to GET, POST, etc.

id

A snapshot id (varies depending on droplet or volume ID)

snapshot

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

Examples

## Not run: 
# list all snapshots
(res <- snapshots())

# list droplet snapshots
snapshots(type = "droplet")

# list volume snapshots
snapshots(type = "volume")

# paging
snapshots(per_page = 5)
snapshots(per_page = 5, page = 2)

# get a single snapshot
snapshot(res[[1]]$id)

# delete a snapshot
## a whole snapshot class object
snapshot_delete(res[[2]])
## by id
snapshot_delete(res[[2]]$id)
## by name
snapshot_delete(res[[2]]$name)

# delete many snapshots
lapply(snapshots(), snapshot_delete)

## End(Not run)

sckott/analogsea documentation built on July 18, 2023, 3:31 p.m.