databases: Get all the available databases that can be used to create a...

View source: R/databases.R View source: R/databases.R

databasesR Documentation

Get all the available databases that can be used to create a droplet.

Description

database

get a single database

databases

list databases

database_create

create a database

database_snapshot_create

create a snapshot of a database

database_snapshots

list snapshots for a database

database_delete

delete a database

Usage

databases(...)

as.database(x)

databases(...)

database(database, ...)

database_create(
  name,
  size,
  description = NULL,
  region = "nyc1",
  snapshot_id = NULL,
  engine = NULL,
  tags = NULL,
  ...
)

database_snapshot_create(database, name, ...)

database_snapshots(database, ...)

database_delete(database, ...)

Arguments

...

Additional options passed down to GET, POST, etc.

x

Object to coerce to an database

database

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

name

(character) Name of the new database. required.

size

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

description

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

region

(character) The region where the Block Storage database will be created. When setting a region, the value should be the slug identifier for the region. When you query a Block Storage database, 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 database snapshot from which to create the database. Should not be specified with a region_id.

engine

(character) The name of the engine type to be used on the database. When provided, the database will be created with the specified backend type. Currently, the available options are "pg", "mysql", "redis" and "mongodb".

tags

(character) tag names to apply to the database after it is created. Tag names can either be existing or new tags.

Details

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

Value

A data.frame with available databases (RAM, disk, no. CPU's) and their costs

Examples

## Not run: 
databases()

## End(Not run)
## Not run: 
# list databases
databases()

# create a database
vol1 <- database_create('testing', 5)
vol2 <- database_create('foobar', 6, tags = c('stuff', 'things'))

# create snapshot of a database
xx <- database_snapshot_create(vol2, "howdy")

# list snaphots for a database
database_snapshots(xx)

# list databases again
res <- databases()

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

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

# delete many databases
lapply(databases(), database_delete)

## End(Not run)

analogsea documentation built on May 9, 2022, 1:05 a.m.