2019-03-14 17:16:27 +03:00
#' Service principal in Azure Active Directory
#'
2021-01-11 20:17:32 +03:00
#' Class representing an AAD service principal.
2019-03-14 17:16:27 +03:00
#'
#' @docType class
2019-03-19 14:27:04 +03:00
#' @section Fields:
#' - `token`: The token used to authenticate with the Graph host.
#' - `tenant`: The Azure Active Directory tenant for this service principal.
2019-03-22 22:36:49 +03:00
#' - `type`: always "service principal" for a service principal object.
2019-03-19 14:27:04 +03:00
#' - `properties`: The service principal properties.
2019-03-14 17:16:27 +03:00
#' @section Methods:
2019-03-14 18:59:37 +03:00
#' - `new(...)`: Initialize a new service principal object. Do not call this directly; see 'Initialization' below.
2019-03-14 17:16:27 +03:00
#' - `delete(confirm=TRUE)`: Delete a service principal. By default, ask for confirmation first.
2019-03-22 22:24:35 +03:00
#' - `update(...)`: Update the service principal information in Azure Active Directory.
2019-03-24 14:47:59 +03:00
#' - `do_operation(...)`: Carry out an arbitrary operation on the service principal.
2019-03-22 22:24:35 +03:00
#' - `sync_fields()`: Synchronise the R object with the service principal data in Azure Active Directory.
2019-03-14 17:16:27 +03:00
#'
#' @section Initialization:
2019-03-22 11:21:44 +03:00
#' Creating new objects of this class should be done via the `create_service_principal` and `get_service_principal` methods of the [ms_graph] and [az_app] classes. Calling the `new()` method for this class only constructs the R object; it does not call the Microsoft Graph API to create the actual service principal.
2019-03-14 17:16:27 +03:00
#'
#' @seealso
2019-03-22 22:24:35 +03:00
#' [ms_graph], [az_app], [az_object]
2019-03-14 17:16:27 +03:00
#'
2023-09-06 10:23:39 +03:00
#' [Azure Microsoft Graph overview](https://learn.microsoft.com/en-us/graph/overview),
#' [REST API reference](https://learn.microsoft.com/en-us/graph/api/overview?view=graph-rest-1.0)
2019-03-14 17:16:27 +03:00
#'
2019-03-22 22:24:35 +03:00
#' @format An R6 object of class `az_service_principal`, inheriting from `az_object`.
2019-03-14 12:28:37 +03:00
#' @export
2019-03-22 22:24:35 +03:00
az_service_principal <- R6 :: R6Class ( " az_service_principal" , inherit = az_object ,
2019-03-14 12:28:37 +03:00
public = list (
2019-03-14 17:55:09 +03:00
initialize = function ( token , tenant = NULL , properties = NULL )
2019-03-14 12:28:37 +03:00
{
2019-03-22 22:24:35 +03:00
self $ type <- " service principal"
2021-01-11 20:17:32 +03:00
private $ api_type <- " servicePrincipals"
2019-03-22 22:24:35 +03:00
super $ initialize ( token , tenant , properties )
2019-03-20 19:02:26 +03:00
} ,
print = function ( ... )
{
cat ( " <Graph service principal '" , self $ properties $ displayName , " '>\n" , sep = " " )
cat ( " app id:" , self $ properties $ appId , " \n" )
cat ( " directory id:" , self $ properties $ id , " \n" )
cat ( " app tenant:" , self $ properties $ appOwnerOrganizationId , " \n" )
2019-03-25 10:05:58 +03:00
cat ( " ---\n" )
cat ( format_public_methods ( self ) )
2019-03-20 19:02:26 +03:00
invisible ( self )
2019-03-14 12:28:37 +03:00
}
) )