This commit is contained in:
Hong Ooi 2019-03-26 18:06:24 +11:00
Родитель ff89528bdd
Коммит bc3cbb8432
8 изменённых файлов: 126 добавлений и 0 удалений

10
.Rbuildignore Normal file
Просмотреть файл

@ -0,0 +1,10 @@
^misc$
^\.vs$
\.sln$
\.Rproj$
\.Rxproj$
^\.Rproj\.user$
CONTRIBUTING.md
drat.sh
.travis.yml
^LICENSE\.md$

2
.gitignore поставляемый
Просмотреть файл

@ -34,3 +34,5 @@ vignettes/*.pdf
# Shiny token, see https://shiny.rstudio.com/articles/shinyapps.html
rsconnect/
misc/

29
DESCRIPTION Normal file
Просмотреть файл

@ -0,0 +1,29 @@
Package: AzureKeyVault
Title: Key and Secret Management in 'Azure'
Version: 2.0.1
Authors@R: c(
person("Hong", "Ooi", , "hongooi@microsoft.com", role = c("aut", "cre")),
person("Microsoft", role="cph")
)
Description: Manage keys, certificates and secrets in Microsoft's 'Key Vault' service: <https://azure.microsoft.com/services/key-vault>.
License: MIT + file LICENSE
URL: https://github.com/cloudyr/AzureKeyVault
BugReports: https://github.com/cloudyr/AzureKeyVault/issues
VignetteBuilder: knitr
Depends:
R (>= 3.3),
Imports:
utils,
parallel,
R6,
httr,
mime,
openssl
AzureRMR,
AzureAuth (>= 1.0.1)
Suggests:
knitr,
jsonlite,
testthat
Roxygen: list(markdown=TRUE)
RoxygenNote: 6.1.1

2
LICENSE Normal file
Просмотреть файл

@ -0,0 +1,2 @@
YEAR: 2019
COPYRIGHT HOLDER: Microsoft

21
LICENSE.md Normal file
Просмотреть файл

@ -0,0 +1,21 @@
# MIT License
Copyright (c) 2019 Microsoft
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

4
R/AzureKeyVault.R Normal file
Просмотреть файл

@ -0,0 +1,4 @@
#' @import AzureRMR
NULL
utils::globalVariables("self")

48
R/add_methods.R Normal file
Просмотреть файл

@ -0,0 +1,48 @@
add_methods <- function()
{
## extending AzureRMR classes
AzureRMR::az_resource_group$set("public", "create_vault", overwrite=TRUE,
function(name, location=self$location, access=configure_vault_access(), sku="Standard", ...)
{
configure_vault_access=function()
{
creds <- decode_jwt(self$token$credentials$access_token)
tenant <- creds$tid
owner <- creds$oid
}
props <- utils::modifyList(
list(accessPolicies=access, sku=list(family="A", name=sku)),
list(...)
)
AzureKeyVault::az_vault$new(self$token, self$subscription, self$name,
type="Microsoft.KeyVault/vaults", name=name, location=location,
properties=props, wait=wait)
})
AzureRMR::az_resource_group$set("public", "get_vault", overwrite=TRUE,
function(name)
{
AzureKeyVault::az_vault$new(self$token, self$subscription, self$name,
type="Microsoft.KeyVault/vaults", name=name)
})
AzureRMR::az_resource_group$set("public", "delete_vault", overwrite=TRUE,
function(name, confirm=TRUE, wait=FALSE)
{
self$get_vault(name)$delete(confirm=confirm, wait=wait)
})
AzureRMR::az_subscription$set("public", "purge_vault", overwrite=TRUE,
function(name, location)
{
api_version=self$get_provider_api_version("Microsoft.KeyVault", "vaults")
op <- construct_path("providers/Microsoft.KeyVault/locations", location, "deletedVaults", name, "purge")
sub_op(op, api_version=api_version)
})
}

10
R/az_vault.R Normal file
Просмотреть файл

@ -0,0 +1,10 @@
az_vault=R6::R6Class("az_vault", inherit=AzureRMR::az_resource,
public=list(
update_access=function()
{},
get_vault_endpoint=function()
{}
))