R/billing_project_response.R

# FireCloud
#
# FireCloud API 
#
# The version of the OpenAPI document: 0.1
# 
# Generated by: https://openapi-generator.tech

#' @docType class
#' @title BillingProjectResponse
#'
#' @description BillingProjectResponse Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field projectName  character 
#'
#' @field billingAccount  character [optional]
#'
#' @field servicePerimeter  character [optional]
#'
#' @field invalidBillingAccount  character 
#'
#' @field roles  list( character ) 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
BillingProjectResponse <- R6::R6Class(
  'BillingProjectResponse',
  public = list(
    `projectName` = NULL,
    `billingAccount` = NULL,
    `servicePerimeter` = NULL,
    `invalidBillingAccount` = NULL,
    `roles` = NULL,
    initialize = function(
        `projectName`, `invalidBillingAccount`, `roles`, `billingAccount`=NULL, `servicePerimeter`=NULL, ...
    ) {
      local.optional.var <- list(...)
      if (!missing(`projectName`)) {
        stopifnot(is.character(`projectName`), length(`projectName`) == 1)
        self$`projectName` <- `projectName`
      }
      if (!missing(`invalidBillingAccount`)) {
        self$`invalidBillingAccount` <- `invalidBillingAccount`
      }
      if (!missing(`roles`)) {
        stopifnot(is.vector(`roles`), length(`roles`) != 0)
        sapply(`roles`, function(x) stopifnot(is.character(x)))
        self$`roles` <- `roles`
      }
      if (!is.null(`billingAccount`)) {
        stopifnot(is.character(`billingAccount`), length(`billingAccount`) == 1)
        self$`billingAccount` <- `billingAccount`
      }
      if (!is.null(`servicePerimeter`)) {
        stopifnot(is.character(`servicePerimeter`), length(`servicePerimeter`) == 1)
        self$`servicePerimeter` <- `servicePerimeter`
      }
    },
    toJSON = function() {
      BillingProjectResponseObject <- list()
      if (!is.null(self$`projectName`)) {
        BillingProjectResponseObject[['projectName']] <-
          self$`projectName`
      }
      if (!is.null(self$`billingAccount`)) {
        BillingProjectResponseObject[['billingAccount']] <-
          self$`billingAccount`
      }
      if (!is.null(self$`servicePerimeter`)) {
        BillingProjectResponseObject[['servicePerimeter']] <-
          self$`servicePerimeter`
      }
      if (!is.null(self$`invalidBillingAccount`)) {
        BillingProjectResponseObject[['invalidBillingAccount']] <-
          self$`invalidBillingAccount`
      }
      if (!is.null(self$`roles`)) {
        BillingProjectResponseObject[['roles']] <-
          self$`roles`
      }

      BillingProjectResponseObject
    },
    fromJSON = function(BillingProjectResponseJson) {
      BillingProjectResponseObject <- jsonlite::fromJSON(BillingProjectResponseJson)
      if (!is.null(BillingProjectResponseObject$`projectName`)) {
        self$`projectName` <- BillingProjectResponseObject$`projectName`
      }
      if (!is.null(BillingProjectResponseObject$`billingAccount`)) {
        self$`billingAccount` <- BillingProjectResponseObject$`billingAccount`
      }
      if (!is.null(BillingProjectResponseObject$`servicePerimeter`)) {
        self$`servicePerimeter` <- BillingProjectResponseObject$`servicePerimeter`
      }
      if (!is.null(BillingProjectResponseObject$`invalidBillingAccount`)) {
        self$`invalidBillingAccount` <- BillingProjectResponseObject$`invalidBillingAccount`
      }
      if (!is.null(BillingProjectResponseObject$`roles`)) {
        self$`roles` <- ApiClient$new()$deserializeObj(BillingProjectResponseObject$`roles`, "array[character]", loadNamespace("openapi"))
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`projectName`)) {
        sprintf(
        '"projectName":
          "%s"
                ',
        self$`projectName`
        )},
        if (!is.null(self$`billingAccount`)) {
        sprintf(
        '"billingAccount":
          "%s"
                ',
        self$`billingAccount`
        )},
        if (!is.null(self$`servicePerimeter`)) {
        sprintf(
        '"servicePerimeter":
          "%s"
                ',
        self$`servicePerimeter`
        )},
        if (!is.null(self$`invalidBillingAccount`)) {
        sprintf(
        '"invalidBillingAccount":
          "%s"
                ',
        self$`invalidBillingAccount`
        )},
        if (!is.null(self$`roles`)) {
        sprintf(
        '"roles":
           [%s]
        ',
        paste(unlist(lapply(self$`roles`, function(x) paste0('"', x, '"'))), collapse=",")
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(BillingProjectResponseJson) {
      BillingProjectResponseObject <- jsonlite::fromJSON(BillingProjectResponseJson)
      self$`projectName` <- BillingProjectResponseObject$`projectName`
      self$`billingAccount` <- BillingProjectResponseObject$`billingAccount`
      self$`servicePerimeter` <- BillingProjectResponseObject$`servicePerimeter`
      self$`invalidBillingAccount` <- BillingProjectResponseObject$`invalidBillingAccount`
      self$`roles` <- ApiClient$new()$deserializeObj(BillingProjectResponseObject$`roles`, "array[character]", loadNamespace("openapi"))
      self
    }
  )
)
vjcitn/terraClientR documentation built on Dec. 23, 2021, 4:07 p.m.