Added List Batch Accounts function

This commit is contained in:
Brian 2017-06-12 12:08:41 -07:00
Родитель 2b4175986d
Коммит 62a6585d5b
4 изменённых файлов: 68 добавлений и 9 удалений

Просмотреть файл

@ -33,6 +33,7 @@ export(azureHDIConf)
export(azureHiveSQL)
export(azureHiveStatus)
export(azureListAllResources)
export(azureListBatchAccount)
export(azureListHDI)
export(azureListRG)
export(azureListSA)

Просмотреть файл

@ -1,3 +1,32 @@
#' List batch accounts.
#'
#' @inheritParams setAzureContext
#' @inheritParams azureAuthenticate
#' @inheritParams azureBatchGetKey
#' @family Batch account functions
#' @export
azureListBatchAccount <- function(azureActiveContext, resourceGroup, subscriptionID,
verbose = FALSE) {
assert_that(is.azureActiveContext(azureActiveContext))
azureCheckToken(azureActiveContext)
azToken <- azureActiveContext$Token
if (missing(subscriptionID)) subscriptionID <- azureActiveContext$subscriptionID
assert_that(is_subscription_id(subscriptionID))
verbosity <- set_verbosity(verbose)
type_batch <- "Microsoft.Batch/batchAccounts"
z <- if(missing(resourceGroup)) {
azureListAllResources(azureActiveContext, type = type_batch)
} else {
azureListAllResources(azureActiveContext, type = type_batch, resourceGroup = resourceGroup, subscriptionID = subscriptionID)
}
rownames(z) <- NULL
z$batchAccount <- extractStorageAccount(z$id)
z
}
#' Create an Azure Batch Account.
#'
@ -52,7 +81,7 @@ azureCreateBatchAccount <- function(azureActiveContext, batchAccount,
if (!asynchronous) {
wait_for_azure(
batchAccount %in% azureListSA(azureActiveContext)$batchAccount
batchAccount %in% azureListBatchAccount(azureActiveContext, subscriptionID = subscriptionID)$name
)
}
TRUE
@ -62,7 +91,7 @@ azureCreateBatchAccount <- function(azureActiveContext, batchAccount,
#'
#' @inheritParams setAzureContext
#' @inheritParams azureAuthenticate
#' @inheritParams azureSAGetKey
#' @inheritParams azureBatchGetKey
#' @family Batch account functions
#' @export
@ -75,7 +104,7 @@ azureDeleteBatchAccount <- function(azureActiveContext, batchAccount,
if (missing(resourceGroup)) resourceGroup <- azureActiveContext$resourceGroup
if (missing(subscriptionID)) subscriptionID <- azureActiveContext$subscriptionID
assert_that(is_storage_account(batchKey))
assert_that(is_storage_account(batchAccount))
assert_that(is_resource_group(resourceGroup))
assert_that(is_subscription_id(subscriptionID))
verbosity <- set_verbosity(verbose)
@ -113,12 +142,12 @@ azureBatchGetKey <- function(azureActiveContext, batchAccount,
if (missing(resourceGroup)) resourceGroup <- azureActiveContext$resourceGroup
if (missing(subscriptionID)) subscriptionID <- azureActiveContext$subscriptionID
assert_that(is_storage_account(storageAccount))
assert_that(is_storage_account(batchAccount))
assert_that(is_resource_group(resourceGroup))
assert_that(is_subscription_id(subscriptionID))
verbosity <- set_verbosity(verbose)
message("Fetching Storage Key..")
message("Fetching Batch Key..")
URL <- paste0("https://management.azure.com/subscriptions/", subscriptionID,
"/resourceGroups/", resourceGroup,
@ -132,7 +161,7 @@ azureBatchGetKey <- function(azureActiveContext, batchAccount,
df <- fromJSON(rl)
azureActiveContext$batchAccount <- batchAccount
azureActiveContext$resourceGroup <- resourceGroup
azureActiveContext$batchKey <- df$keys$value[1]
azureActiveContext$batchKey <- df$primary
return(azureActiveContext$batchKey)
}

Просмотреть файл

@ -8,11 +8,11 @@ azureBatchGetKey(azureActiveContext, batchAccount, resourceGroup,
subscriptionID, verbose = FALSE)
}
\arguments{
\item{azureActiveContext}{A container used for caching variables used by \code{AzureSMR}}
\item{azureActiveContext}{A container used for caching variables used by `AzureSMR`}
\item{resourceGroup}{Name of the resource group}
\item{subscriptionID}{Subscription ID. This is obtained automatically by \code{\link[=azureAuthenticate]{azureAuthenticate()}} when only a single subscriptionID is available via Active Directory}
\item{subscriptionID}{Subscription ID. This is obtained automatically by [azureAuthenticate()] when only a single subscriptionID is available via Active Directory}
\item{verbose}{Print Tracing information (Default False)}
}
@ -21,5 +21,7 @@ Get the Batch Keys for Specified Batch Account.
}
\seealso{
Other Batch account functions: \code{\link{azureCreateBatchAccount}},
\code{\link{azureDeleteBatchAccount}}
\code{\link{azureDeleteBatchAccount}},
\code{\link{azureListBatchAccount}}
}

Просмотреть файл

@ -0,0 +1,27 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/AzureBatch.R
\name{azureListBatchAccount}
\alias{azureListBatchAccount}
\title{List batch accounts.}
\usage{
azureListBatchAccount(azureActiveContext, resourceGroup, subscriptionID,
verbose = FALSE)
}
\arguments{
\item{azureActiveContext}{A container used for caching variables used by `AzureSMR`}
\item{resourceGroup}{Name of the resource group}
\item{subscriptionID}{Subscription ID. This is obtained automatically by [azureAuthenticate()] when only a single subscriptionID is available via Active Directory}
\item{verbose}{Print Tracing information (Default False)}
}
\description{
List batch accounts.
}
\seealso{
Other Batch account functions: \code{\link{azureBatchGetKey}},
\code{\link{azureCreateBatchAccount}},
\code{\link{azureDeleteBatchAccount}}
}