forked from rstudio/shinyapps
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add applications method to list currently deployed applications
- Loading branch information
Showing
6 changed files
with
132 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,4 @@ Collate: | |
'utils.R' | ||
'lucid.R' | ||
'deployments.R' | ||
'applications.R' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export(accountInfo) | ||
export(accounts) | ||
export(applications) | ||
export(deploy) | ||
export(removeAccount) | ||
export(setAccountInfo) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
#' List Deployed Applications | ||
#' | ||
#' List all applications currently deployed to ShinyApps for a given account. | ||
#' @param account Account name. If a single account is registered on the | ||
#' system then this parameter can be omitted. | ||
#' @return | ||
#' Returns a data frame with the following columns: | ||
#' \tabular{ll}{ | ||
#' \code{id} \tab Unique id for the application\cr | ||
#' \code{name} \tab Name of application \cr | ||
#' \code{url} \tab URL where application can be accessed\cr | ||
#' \code{status} \tab Current status of application. Valid values are \code{pending}, | ||
#' \code{deploying}, \code{running}, \code{terminating}, \code{terminated}. | ||
#' } | ||
#' @note To register an account you call the \link{setAccountInfo} function. | ||
#' @examples | ||
#' \dontrun{ | ||
#' | ||
#' # list all applications for the default account | ||
#' applications() | ||
#' | ||
#' # list all applications for a specific account | ||
#' applications("myaccount") | ||
#' } | ||
#' @export | ||
applications <- function(account = NULL) { | ||
|
||
# resolve account (use default if possible, confirm exists, etc.) | ||
accountInfo <- accountInfo(resolveAccount(account)) | ||
|
||
# create lucid client and retreive applications | ||
lucid <- lucidClient(accountInfo) | ||
apps <- lucid$applications(accountInfo$accountId) | ||
|
||
# convert the list into a data frame with a subset of fields | ||
id <- numeric() | ||
name <- character() | ||
url <- character() | ||
status <- character() | ||
for (app in apps) { | ||
id <- append(id, app$id) | ||
name <- append(name, app$name) | ||
url <- append(url, app$url) | ||
status <- append(status, app$status) | ||
} | ||
data.frame(id = id, | ||
name = I(name), | ||
url = I(url), | ||
status = status) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
\name{applications} | ||
\alias{applications} | ||
\title{List Deployed Applications} | ||
\usage{ | ||
applications(account = NULL) | ||
} | ||
\arguments{ | ||
\item{account}{Account name. If a single account is | ||
registered on the system then this parameter can be | ||
omitted.} | ||
} | ||
\value{ | ||
Returns a data frame with the following columns: | ||
\tabular{ll}{ \code{id} \tab Unique id for the | ||
application\cr \code{name} \tab Name of application \cr | ||
\code{url} \tab URL where application can be accessed\cr | ||
\code{status} \tab Current status of application. Valid | ||
values are \code{pending}, \code{deploying}, | ||
\code{running}, \code{terminating}, \code{terminated}. } | ||
} | ||
\description{ | ||
List all applications currently deployed to ShinyApps for | ||
a given account. | ||
} | ||
\note{ | ||
To register an account you call the \link{setAccountInfo} | ||
function. | ||
} | ||
\examples{ | ||
\dontrun{ | ||
|
||
# list all applications for the default account | ||
applications() | ||
|
||
# list all applications for a specific account | ||
applications("myaccount") | ||
} | ||
} | ||
|