# FireCloud
#
# FireCloud API
#
# The version of the OpenAPI document: 0.1
#
# Generated by: https://openapi-generator.tech
#' @docType class
#' @title ServicePerimeters operations
#' @description openapi.ServicePerimeters
#' @format An \code{R6Class} generator object
#' @field apiClient Handles the client-server communication.
#'
#' @section Methods:
#' \describe{
#' \strong{ AddProjectToServicePerimeter } \emph{ Add a project to a service perimeter }
#' Add a project to a service perimeter, must have 'add_to_service_perimeter' action on project and 'add_project' action on perimeter, included in owner role for both
#'
#' \itemize{
#' \item \emph{ @param } service.perimeter.name character
#' \item \emph{ @param } project.name character
#'
#'
#' \item status code : 202 | Successful request, check the project's status for completion
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Project is already in perimeter or is not in 'Ready' state
#'
#' \item return type : ErrorReport
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 403 | Project does not exist or you do not have access
#'
#' \item return type : ErrorReport
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 404 | Service Perimeter does not exist or you do not have access
#'
#' \item return type : ErrorReport
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 500 | Rawls Internal Error
#'
#' \item return type : ErrorReport
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' }
#'
#'
#' @examples
#' \dontrun{
#' #################### AddProjectToServicePerimeter ####################
#'
#' library(openapi)
#' var.service.perimeter.name <- 'service.perimeter.name_example' # character | Fully qualified google service perimeter name in the form of accessPolicies/[POLICY NUMBER]/servicePerimeters/[NAME], url encoded
#' var.project.name <- 'project.name_example' # character | Project name
#'
#' #Add a project to a service perimeter
#' api.instance <- ServicePerimetersApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$AddProjectToServicePerimeter(var.service.perimeter.name, var.project.name)
#'
#'
#' }
#' @importFrom R6 R6Class
#' @importFrom base64enc base64encode
#' @export
ServicePerimetersApi <- R6::R6Class(
'ServicePerimetersApi',
public = list(
apiClient = NULL,
initialize = function(apiClient){
if (!missing(apiClient)) {
self$apiClient <- apiClient
}
else {
self$apiClient <- ApiClient$new()
}
},
AddProjectToServicePerimeter = function(service.perimeter.name, project.name, ...){
apiResponse <- self$AddProjectToServicePerimeterWithHttpInfo(service.perimeter.name, project.name, ...)
resp <- apiResponse$response
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
apiResponse$content
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
apiResponse
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
apiResponse
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
apiResponse
}
},
AddProjectToServicePerimeterWithHttpInfo = function(service.perimeter.name, project.name, ...){
args <- list(...)
queryParams <- list()
headerParams <- c()
if (missing(`service.perimeter.name`)) {
stop("Missing required parameter `service.perimeter.name`.")
}
if (missing(`project.name`)) {
stop("Missing required parameter `project.name`.")
}
body <- NULL
urlPath <- "/servicePerimeters/{servicePerimeterName}/projects/{projectName}"
if (!missing(`service.perimeter.name`)) {
urlPath <- gsub(paste0("\\{", "servicePerimeterName", "\\}"), URLencode(as.character(`service.perimeter.name`), reserved = TRUE), urlPath)
}
if (!missing(`project.name`)) {
urlPath <- gsub(paste0("\\{", "projectName", "\\}"), URLencode(as.character(`project.name`), reserved = TRUE), urlPath)
}
# OAuth token
headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")
resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
method = "PUT",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
ApiResponse$new(NULL, resp)
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
ApiResponse$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
ApiResponse$new("API server error", resp)
}
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.