This commit is contained in:
Hong Ooi 2019-08-03 18:48:43 +10:00
Родитель b89b3e2172
Коммит 08485b0b2f
4 изменённых файлов: 89 добавлений и 1 удалений

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

@ -1,7 +1,10 @@
# Generated by roxygen2: do not edit by hand # Generated by roxygen2: do not edit by hand
export(attested) export(attested)
export(events)
export(get_vm_cert)
export(in_azure_vm) export(in_azure_vm)
export(instance) export(instance)
export(update_attested_metadata) export(update_attested_metadata)
export(update_instance_metadata) export(update_instance_metadata)
export(update_scheduled_events)

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

@ -4,16 +4,33 @@ att_api_version <- "2018-10-01"
ev_api_version <- "2017-11-01" ev_api_version <- "2017-11-01"
#' Metadata for an Azure VM
#'
#' @param nonce For `update_attested_metadata`, an optional string to use as a nonce.
#' @details
#' The `instance`, `attested` and `events` objects are environments containing the instance metadata, attested document, and scheduled events respectively for a VM running in Azure. `instance` and `attested` are automatically populated when you load the AzureVMmetadata package, or you can manually populate them yourself with the `update_instance_metadata` and `update_attested_metadata` functions. `events` is not populated at package startup, because calling the scheduled event service can require up to several minutes if it is not running already. You can manually populate it with the `update_scheduled_events` function.
#'
#' @return
#' The updating functions return lists of metadata items, invisibly.
#' @seealso
#' [Instance metadata service documentation](https://docs.microsoft.com/en-us/azure/virtual-machines/windows/instance-metadata-service)
#'
#' To obtain OAuth tokens from the metadata service, see [AzureAuth::get_managed_token]
#'
#' @rdname metadata
#' @export #' @export
instance <- new.env() instance <- new.env()
#' @rdname metadata
#' @export #' @export
attested <- new.env() attested <- new.env()
#' @rdname metadata
#' @export #' @export
events <- new.env() events <- new.env()
#' @rdname metadata
#' @export #' @export
update_instance_metadata <- function() update_instance_metadata <- function()
{ {
@ -31,6 +48,7 @@ update_instance_metadata <- function()
} }
#' @rdname metadata
#' @export #' @export
update_attested_metadata <- function(nonce=NULL) update_attested_metadata <- function(nonce=NULL)
{ {
@ -48,6 +66,7 @@ update_attested_metadata <- function(nonce=NULL)
} }
#' @rdname metadata
#' @export #' @export
update_scheduled_events <- function() update_scheduled_events <- function()
{ {
@ -68,7 +87,7 @@ update_scheduled_events <- function()
#' Check if R is running in an Azure VM #' Check if R is running in an Azure VM
#' @param nonce An optional string to use as a nonce. #' @param nonce An optional string to use as a nonce.
#' @details #' @details
#' These functions check if R is running in an Azure VM by attempting to contact the instance metadata host. `in_azure_vm` simply returns TRUE or FALSE based on whether it succeeds. `get_vm_cert` provides a stronger check, by retrieving the VM's certificate and throwing an error if this is not found. Note that you should still verify the certificate's authenticity. #' These functions check if R is running in an Azure VM by attempting to contact the instance metadata host. `in_azure_vm` simply returns TRUE or FALSE based on whether it succeeds. `get_vm_cert` provides a stronger check, by retrieving the VM's certificate and throwing an error if this is not found. Note that you should still verify the certificate's authenticity before relying on it.
#' @return #' @return
#' For `in_azure_vm`, a boolean. For `get_vm_cert`, a PKCS-7 certificate object. #' For `in_azure_vm`, a boolean. For `get_vm_cert`, a PKCS-7 certificate object.
#' @export #' @export

23
man/in_azure_vm.Rd Normal file
Просмотреть файл

@ -0,0 +1,23 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/AzureVMmetadata.R
\name{in_azure_vm}
\alias{in_azure_vm}
\alias{get_vm_cert}
\title{Check if R is running in an Azure VM}
\usage{
in_azure_vm()
get_vm_cert(nonce = NULL)
}
\arguments{
\item{nonce}{An optional string to use as a nonce.}
}
\value{
For \code{in_azure_vm}, a boolean. For \code{get_vm_cert}, a PKCS-7 certificate object.
}
\description{
Check if R is running in an Azure VM
}
\details{
These functions check if R is running in an Azure VM by attempting to contact the instance metadata host. \code{in_azure_vm} simply returns TRUE or FALSE based on whether it succeeds. \code{get_vm_cert} provides a stronger check, by retrieving the VM's certificate and throwing an error if this is not found. Note that you should still verify the certificate's authenticity before relying on it.
}

43
man/metadata.Rd Normal file
Просмотреть файл

@ -0,0 +1,43 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/AzureVMmetadata.R
\docType{data}
\name{instance}
\alias{instance}
\alias{attested}
\alias{events}
\alias{update_instance_metadata}
\alias{update_attested_metadata}
\alias{update_scheduled_events}
\title{Metadata for an Azure VM}
\format{An object of class \code{environment} of length 0.}
\usage{
instance
attested
events
update_instance_metadata()
update_attested_metadata(nonce = NULL)
update_scheduled_events()
}
\arguments{
\item{nonce}{For \code{update_attested_metadata}, an optional string to use as a nonce.}
}
\value{
The updating functions return lists of metadata items, invisibly.
}
\description{
Metadata for an Azure VM
}
\details{
The \code{instance}, \code{attested} and \code{events} objects are environments containing the instance metadata, attested document, and scheduled events respectively for a VM running in Azure. \code{instance} and \code{attested} are automatically populated when you load the AzureVMmetadata package, or you can manually populate them yourself with the \code{update_instance_metadata} and \code{update_attested_metadata} functions. \code{events} is not populated at package startup, because calling the scheduled event service can require up to several minutes if it is not running already. You can manually populate it with the \code{update_scheduled_events} function.
}
\seealso{
\href{https://docs.microsoft.com/en-us/azure/virtual-machines/windows/instance-metadata-service}{Instance metadata service documentation}
To obtain OAuth tokens from the metadata service, see \link[AzureAuth:get_managed_token]{AzureAuth::get_managed_token}
}
\keyword{datasets}