Skip to content

Commit

Permalink
fix #149 fix for droplet sizes, changes to a few create methods
Browse files Browse the repository at this point in the history
clean up params missing, etc.
  • Loading branch information
sckott committed Jun 11, 2018
1 parent 60d70fd commit f66e5c2
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 47 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Description: Provides a set of functions for interacting with the 'Digital
Ocean' API at <https://developers.digitalocean.com/documentation/v2>, including
creating images, destroying them, rebooting, getting details on regions, and
available images.
Version: 0.6.4.9220
Version: 0.6.5.9110
Authors@R: c(
person("Scott", "Chamberlain", role = c("aut", "cre"), email = "myrmecocystus@gmail.com"),
person("Hadley", "Wickham", role = "aut", email = "hadley@rstudio.com"),
Expand Down
26 changes: 18 additions & 8 deletions R/certificates.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ certificate_url <- function(certificate = NULL) {

#' @param x Object to coerce to an certificate
#' @export
#' @rdname firewalls
#' @rdname certificates
as.certificate <- function(x) UseMethod("as.certificate")
#' @export
as.certificate.list <- function(x) list_to_object(x, "certificate")
Expand All @@ -16,12 +16,22 @@ as.certificate.character <- function(x) certificate(x)
#' Get list of certificate and their metadata, or a single certificate
#'
#' @export
#' @param id (numeric) certificate id.
#' @param id (numeric) certificate id
#' @param name (character) a certificate name
#' @param inbound_rules (list) inbound rules
#' @param outbound_rules (list) outbound rules
#' @param droplet_ids (numeric/integer) droplet ids
#' @param tags (character) tag strings
#' @param type (character) a string representing the type of certificate.
#' The value should be "custom" for a user-uploaded certificate or
#' "lets_encrypt" for one automatically generated with Let's Encrypt.
#' If not provided, "custom" will be assumed by default.
#' @param private_key (character) the contents of a PEM-formatted private-key
#' corresponding to the SSL certificate
#' @param leaf_certificate (character) the contents of a PEM-formatted public
#' SSL certificate
#' @param certificate_chain (character) the full PEM-formatted trust chain
#' between the certificate authority's certificate and your domain's
#' SSL certificate
#' @param dns_names (character) a vector of fully qualified domain names
#' (FQDNs) for which the certificate will be issued. The domains must be
#' managed using DigitalOcean's DNS
#' @inheritParams droplets
#' @examples \dontrun{
#' # list certificates
Expand All @@ -39,14 +49,14 @@ certificates <- function(page = 1, per_page = 25, ...) {
}

#' @export
#' @rdname firewalls
#' @rdname certificates
certificate <- function(id, ...) {
res <- do_GET(certificate_url(id), ...)
as.certificate(res)
}

#' @export
#' @rdname firewalls
#' @rdname certificates
certificate_create <- function(name, type, private_key = NULL,
leaf_certificate = NULL, certificate_chain = NULL,
dns_names = NULL, ...) {
Expand Down
5 changes: 4 additions & 1 deletion R/docklet.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#' @export
#'
#' @inheritParams droplet_create
#' @param size (character) Size slug identifier. See \code{\link{sizes}()} for
#' a complete list. Default: s-1vcpu-2gb
#' @param droplet A droplet, or something that can be coerced to a droplet by
#' \code{\link{as.droplet}}.
#' @param all (logical) List all containers or images. Default: \code{TRUE}
Expand Down Expand Up @@ -44,6 +46,7 @@
#' @param keyfile Optional private key file.
#' @param ssh_passwd Optional passphrase or callback function for authentication.
#' Refer to the \code{\link[ssh]{ssh_connect}} documentation for more details.
#' @param verbose If TRUE, will print command before executing it.
#' @seealso \code{\link{docklets_create}}
#'
#' @return all functions return a droplet
Expand Down Expand Up @@ -106,7 +109,7 @@
#' d %>% droplet_upload(path2, "/srv/shinyapps") # then go to browser
#' }
docklet_create <- function(name = random_name(),
size = getOption("do_size", "1gb"),
size = getOption("do_size", "s-1vcpu-2gb"),
region = getOption("do_region", "sfo1"),
ssh_keys = getOption("do_ssh_keys", NULL),
backups = getOption("do_backups", NULL),
Expand Down
2 changes: 1 addition & 1 deletion R/docklets_create.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#' docklets_create(names = c('drop3', 'drop4'))
#' }
docklets_create <- function(names = NULL,
size = getOption("do_size", "1gb"),
size = getOption("do_size", "s-1vcpu-2gb"),
region = getOption("do_region", "sfo1"),
ssh_keys = getOption("do_ssh_keys", NULL),
backups = getOption("do_backups", NULL),
Expand Down
6 changes: 3 additions & 3 deletions R/firewalls.R
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ firewall_delete <- function(id, ...) {
#' @export
#' @param id (character) A firewall id (not the name) to delete
#' @param droplet_ids (integer/numeric) a vector of droplet ids
#' @param ... Options passed on to httr::DELETE
#' @param ... Options passed on to httr::POST or httr::DELETE
#' @examples \dontrun{
#' drops <- droplets_create()
#' drop_ids <- vapply(drops, "[[", numeric(1), "id")
Expand Down Expand Up @@ -136,8 +136,8 @@ firewall_remove_droplets <- function(id, droplet_ids, ...) {
#'
#' @export
#' @param id (character) A firewall id (not the name) to delete
#' @param droplet_ids (integer/numeric) a vector of droplet ids
#' @param ... Options passed on to httr::DELETE
#' @param tags (character) tag strings
#' @param ... Options passed on to httr::POST or httr::DELETE
#' @examples \dontrun{
#' drops <- droplets_create()
#' drop_ids <- vapply(drops, "[[", numeric(1), "id")
Expand Down
35 changes: 29 additions & 6 deletions man/certificates.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions man/docklet_create.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/docklets_create.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/firewall_add_droplets.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/firewall_add_tags.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 8 additions & 20 deletions man/firewalls.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f66e5c2

Please sign in to comment.