R/workspace_request_clone.R

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

#' @docType class
#' @title WorkspaceRequestClone
#'
#' @description WorkspaceRequestClone Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field namespace  character 
#'
#' @field name  character 
#'
#' @field authorizationDomain  list( \link{ManagedGroupRef} ) [optional]
#'
#' @field attributes  object 
#'
#' @field copyFilesWithPrefix  character [optional]
#'
#' @field noWorkspaceOwner  character [optional]
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
WorkspaceRequestClone <- R6::R6Class(
  'WorkspaceRequestClone',
  public = list(
    `namespace` = NULL,
    `name` = NULL,
    `authorizationDomain` = NULL,
    `attributes` = NULL,
    `copyFilesWithPrefix` = NULL,
    `noWorkspaceOwner` = NULL,
    initialize = function(
        `namespace`, `name`, `attributes`, `authorizationDomain`=NULL, `copyFilesWithPrefix`=NULL, `noWorkspaceOwner`=FALSE, ...
    ) {
      local.optional.var <- list(...)
      if (!missing(`namespace`)) {
        stopifnot(is.character(`namespace`), length(`namespace`) == 1)
        self$`namespace` <- `namespace`
      }
      if (!missing(`name`)) {
        stopifnot(is.character(`name`), length(`name`) == 1)
        self$`name` <- `name`
      }
      if (!missing(`attributes`)) {
        self$`attributes` <- `attributes`
      }
      if (!is.null(`authorizationDomain`)) {
        stopifnot(is.vector(`authorizationDomain`), length(`authorizationDomain`) != 0)
        sapply(`authorizationDomain`, function(x) stopifnot(R6::is.R6(x)))
        self$`authorizationDomain` <- `authorizationDomain`
      }
      if (!is.null(`copyFilesWithPrefix`)) {
        stopifnot(is.character(`copyFilesWithPrefix`), length(`copyFilesWithPrefix`) == 1)
        self$`copyFilesWithPrefix` <- `copyFilesWithPrefix`
      }
      if (!is.null(`noWorkspaceOwner`)) {
        self$`noWorkspaceOwner` <- `noWorkspaceOwner`
      }
    },
    toJSON = function() {
      WorkspaceRequestCloneObject <- list()
      if (!is.null(self$`namespace`)) {
        WorkspaceRequestCloneObject[['namespace']] <-
          self$`namespace`
      }
      if (!is.null(self$`name`)) {
        WorkspaceRequestCloneObject[['name']] <-
          self$`name`
      }
      if (!is.null(self$`authorizationDomain`)) {
        WorkspaceRequestCloneObject[['authorizationDomain']] <-
          lapply(self$`authorizationDomain`, function(x) x$toJSON())
      }
      if (!is.null(self$`attributes`)) {
        WorkspaceRequestCloneObject[['attributes']] <-
          self$`attributes`
      }
      if (!is.null(self$`copyFilesWithPrefix`)) {
        WorkspaceRequestCloneObject[['copyFilesWithPrefix']] <-
          self$`copyFilesWithPrefix`
      }
      if (!is.null(self$`noWorkspaceOwner`)) {
        WorkspaceRequestCloneObject[['noWorkspaceOwner']] <-
          self$`noWorkspaceOwner`
      }

      WorkspaceRequestCloneObject
    },
    fromJSON = function(WorkspaceRequestCloneJson) {
      WorkspaceRequestCloneObject <- jsonlite::fromJSON(WorkspaceRequestCloneJson)
      if (!is.null(WorkspaceRequestCloneObject$`namespace`)) {
        self$`namespace` <- WorkspaceRequestCloneObject$`namespace`
      }
      if (!is.null(WorkspaceRequestCloneObject$`name`)) {
        self$`name` <- WorkspaceRequestCloneObject$`name`
      }
      if (!is.null(WorkspaceRequestCloneObject$`authorizationDomain`)) {
        self$`authorizationDomain` <- ApiClient$new()$deserializeObj(WorkspaceRequestCloneObject$`authorizationDomain`, "array[ManagedGroupRef]", loadNamespace("openapi"))
      }
      if (!is.null(WorkspaceRequestCloneObject$`attributes`)) {
        self$`attributes` <- WorkspaceRequestCloneObject$`attributes`
      }
      if (!is.null(WorkspaceRequestCloneObject$`copyFilesWithPrefix`)) {
        self$`copyFilesWithPrefix` <- WorkspaceRequestCloneObject$`copyFilesWithPrefix`
      }
      if (!is.null(WorkspaceRequestCloneObject$`noWorkspaceOwner`)) {
        self$`noWorkspaceOwner` <- WorkspaceRequestCloneObject$`noWorkspaceOwner`
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`namespace`)) {
        sprintf(
        '"namespace":
          "%s"
                ',
        self$`namespace`
        )},
        if (!is.null(self$`name`)) {
        sprintf(
        '"name":
          "%s"
                ',
        self$`name`
        )},
        if (!is.null(self$`authorizationDomain`)) {
        sprintf(
        '"authorizationDomain":
        [%s]
',
        paste(sapply(self$`authorizationDomain`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
        )},
        if (!is.null(self$`attributes`)) {
        sprintf(
        '"attributes":
          "%s"
                ',
        self$`attributes`
        )},
        if (!is.null(self$`copyFilesWithPrefix`)) {
        sprintf(
        '"copyFilesWithPrefix":
          "%s"
                ',
        self$`copyFilesWithPrefix`
        )},
        if (!is.null(self$`noWorkspaceOwner`)) {
        sprintf(
        '"noWorkspaceOwner":
          "%s"
                ',
        self$`noWorkspaceOwner`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(WorkspaceRequestCloneJson) {
      WorkspaceRequestCloneObject <- jsonlite::fromJSON(WorkspaceRequestCloneJson)
      self$`namespace` <- WorkspaceRequestCloneObject$`namespace`
      self$`name` <- WorkspaceRequestCloneObject$`name`
      self$`authorizationDomain` <- ApiClient$new()$deserializeObj(WorkspaceRequestCloneObject$`authorizationDomain`, "array[ManagedGroupRef]", loadNamespace("openapi"))
      self$`attributes` <- WorkspaceRequestCloneObject$`attributes`
      self$`copyFilesWithPrefix` <- WorkspaceRequestCloneObject$`copyFilesWithPrefix`
      self$`noWorkspaceOwner` <- WorkspaceRequestCloneObject$`noWorkspaceOwner`
      self
    }
  )
)
vjcitn/terraClientR documentation built on Dec. 23, 2021, 4:07 p.m.