R/SystemStorageConfig.r

# Agave Platform Science API
#
# Power your digital lab and reduce the time from theory to discovery using the Agave Science-as-a-Service API Platform. Agave provides hosted services that allow researchers to manage data, conduct experiments, and publish and share results from anywhere at any time.
#
# Agave Platform version: 2.2.14
# 
# Generated by: https://github.com/swagger-api/swagger-codegen.git


#' SystemStorageConfig Class
#'
#' 
#'
#' @field auth 
#' @field containerName The name of the bucket to interact with when using an object store.
#' @field homeDir The path on the remote system to use as the home directory for all API requests. For cases where the home directory should be dynamically defined, the ${USERNAME} token can be included in the homeDir value to represent the username of the authenticated user. ex. /home/${USERNAME}.
#' @field host The hostname or ip address of the storage server
#' @field port The port number of the storage server.
#' @field mirror Whether the permissions set on the server should be pushed to the storage system itself. This only applies to IRODS and AWS systems.
#' @field protocol 
#' @field publicAppsDir The path on the remote system where apps will be stored if this is set as the default public storage system.
#' @field resource The name of the target resource when defining an IRODS system.
#' @field rootDir The path on the remote system to use as the root for all API requests.
#' @field zone The name of the zone when defining an IRODS system.
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
SystemStorageConfig <- R6::R6Class(
  'SystemStorageConfig',
  public = list(
    `auth` = NULL,
    `containerName` = NULL,
    `homeDir` = NULL,
    `host` = NULL,
    `port` = NULL,
    `mirror` = NULL,
    `protocol` = NULL,
    `publicAppsDir` = NULL,
    `resource` = NULL,
    `rootDir` = NULL,
    `zone` = NULL,
    initialize = function(`auth`, `containerName`, `homeDir`, `host`, `port`, `mirror`, `protocol`, `publicAppsDir`, `resource`, `rootDir`, `zone`){
      if (!missing(`auth`)) {
        stopifnot(R6::is.R6(`auth`))
        self$`auth` <- `auth`
      }
      if (!missing(`containerName`)) {
        stopifnot(is.character(`containerName`), length(`containerName`) == 1)
        self$`containerName` <- `containerName`
      }
      if (!missing(`homeDir`)) {
        stopifnot(is.character(`homeDir`), length(`homeDir`) == 1)
        self$`homeDir` <- `homeDir`
      }
      if (!missing(`host`)) {
        stopifnot(is.character(`host`), length(`host`) == 1)
        self$`host` <- `host`
      }
      if (!missing(`port`)) {
        stopifnot(is.numeric(`port`), length(`port`) == 1)
        self$`port` <- `port`
      }
      if (!missing(`mirror`)) {
        self$`mirror` <- `mirror`
      }
      if (!missing(`protocol`)) {
        stopifnot(R6::is.R6(`protocol`))
        self$`protocol` <- `protocol`
      }
      if (!missing(`publicAppsDir`)) {
        stopifnot(is.character(`publicAppsDir`), length(`publicAppsDir`) == 1)
        self$`publicAppsDir` <- `publicAppsDir`
      }
      if (!missing(`resource`)) {
        stopifnot(is.character(`resource`), length(`resource`) == 1)
        self$`resource` <- `resource`
      }
      if (!missing(`rootDir`)) {
        stopifnot(is.character(`rootDir`), length(`rootDir`) == 1)
        self$`rootDir` <- `rootDir`
      }
      if (!missing(`zone`)) {
        stopifnot(is.character(`zone`), length(`zone`) == 1)
        self$`zone` <- `zone`
      }
    },
    asJSON = function() {
      self$toJSON()
    },
    toJSON = function() {
      SystemStorageConfigObject <- list()
      if (!is.null(self$`auth`)) {
        SystemStorageConfigObject[['auth']] <- self$`auth`$toJSON()
      }
      else {
        SystemStorageConfigObject[['auth']] <- NULL
      }
      if (!is.null(self$`containerName`)) {
        SystemStorageConfigObject[['containerName']] <- self$`containerName`
      }
      else {
        SystemStorageConfigObject[['containerName']] <- NULL
      }
      if (!is.null(self$`homeDir`)) {
        SystemStorageConfigObject[['homeDir']] <- self$`homeDir`
      }
      else {
        SystemStorageConfigObject[['homeDir']] <- NULL
      }
      if (!is.null(self$`host`)) {
        SystemStorageConfigObject[['host']] <- self$`host`
      }
      else {
        SystemStorageConfigObject[['host']] <- NULL
      }
      if (!is.null(self$`port`)) {
        SystemStorageConfigObject[['port']] <- self$`port`
      }
      else {
        SystemStorageConfigObject[['port']] <- NULL
      }
      if (!is.null(self$`mirror`)) {
        SystemStorageConfigObject[['mirror']] <- self$`mirror`
      }
      else {
        SystemStorageConfigObject[['mirror']] <- NULL
      }
      if (!is.null(self$`protocol`)) {
        SystemStorageConfigObject[['protocol']] <- self$`protocol`$toJSON()
      }
      else {
        SystemStorageConfigObject[['protocol']] <- NULL
      }
      if (!is.null(self$`publicAppsDir`)) {
        SystemStorageConfigObject[['publicAppsDir']] <- self$`publicAppsDir`
      }
      else {
        SystemStorageConfigObject[['publicAppsDir']] <- NULL
      }
      if (!is.null(self$`resource`)) {
        SystemStorageConfigObject[['resource']] <- self$`resource`
      }
      else {
        SystemStorageConfigObject[['resource']] <- NULL
      }
      if (!is.null(self$`rootDir`)) {
        SystemStorageConfigObject[['rootDir']] <- self$`rootDir`
      }
      else {
        SystemStorageConfigObject[['rootDir']] <- NULL
      }
      if (!is.null(self$`zone`)) {
        SystemStorageConfigObject[['zone']] <- self$`zone`
      }
      else {
        SystemStorageConfigObject[['zone']] <- NULL
      }

      SystemStorageConfigObject
    },
    fromJSON = function(SystemStorageConfigObject) {
      if (is.character(SystemStorageConfigObject)) {
        SystemStorageConfigObject <- jsonlite::fromJSON(SystemStorageConfigJson)
      }

      if ("result" %in% names(SystemStorageConfigObject)) {
        SystemStorageConfigObject <- SystemStorageConfigObject$result
      }

      if (!is.null(SystemStorageConfigObject$`auth`)) {
        authObject <- SystemAuthConfig$new()
        authObject$fromJSON(jsonlite::toJSON(SystemStorageConfigObject$auth, auto_unbox = TRUE))
        self$`auth` <- authObject
      }
      if (!is.null(SystemStorageConfigObject$`containerName`)) {
        self$`containerName` <- SystemStorageConfigObject$`containerName`
      }
      if (!is.null(SystemStorageConfigObject$`homeDir`)) {
        self$`homeDir` <- SystemStorageConfigObject$`homeDir`
      }
      if (!is.null(SystemStorageConfigObject$`host`)) {
        self$`host` <- SystemStorageConfigObject$`host`
      }
      if (!is.null(SystemStorageConfigObject$`port`)) {
        self$`port` <- SystemStorageConfigObject$`port`
      }
      if (!is.null(SystemStorageConfigObject$`mirror`)) {
        self$`mirror` <- SystemStorageConfigObject$`mirror`
      }
      if (!is.null(SystemStorageConfigObject$`protocol`)) {
        protocolObject <- SystemStorageProtocolType$new()
        protocolObject$fromJSON(jsonlite::toJSON(SystemStorageConfigObject$protocol, auto_unbox = TRUE))
        self$`protocol` <- protocolObject
      }
      if (!is.null(SystemStorageConfigObject$`publicAppsDir`)) {
        self$`publicAppsDir` <- SystemStorageConfigObject$`publicAppsDir`
      }
      if (!is.null(SystemStorageConfigObject$`resource`)) {
        self$`resource` <- SystemStorageConfigObject$`resource`
      }
      if (!is.null(SystemStorageConfigObject$`rootDir`)) {
        self$`rootDir` <- SystemStorageConfigObject$`rootDir`
      }
      if (!is.null(SystemStorageConfigObject$`zone`)) {
        self$`zone` <- SystemStorageConfigObject$`zone`
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "auth": %s,
           "containerName": %s,
           "homeDir": %s,
           "host": %s,
           "port": %d,
           "mirror": %s,
           "protocol": %s,
           "publicAppsDir": %s,
           "resource": %s,
           "rootDir": %s,
           "zone": %s
        }',
        self$`auth`$toJSON(),
        ifelse( is.null(self$`containerName`),"null",paste0(c('"', self$`containerName`, '"'))),
        ifelse( is.null(self$`homeDir`),"null",paste0(c('"', self$`homeDir`, '"'))),
        ifelse( is.null(self$`host`),"null",paste0(c('"', self$`host`, '"'))),
        ifelse( is.null(self$`port`),"null",paste0(c('"', self$`port`, '"'))),
        ifelse( is.null(self$`mirror`),"null",paste0(c('"', self$`mirror`, '"'))),
        self$`protocol`$toJSON(),
        ifelse( is.null(self$`publicAppsDir`),"null",paste0(c('"', self$`publicAppsDir`, '"'))),
        ifelse( is.null(self$`resource`),"null",paste0(c('"', self$`resource`, '"'))),
        ifelse( is.null(self$`rootDir`),"null",paste0(c('"', self$`rootDir`, '"'))),
        ifelse( is.null(self$`zone`),"null",paste0(c('"', self$`zone`, '"')))
      )
    },
    fromJSONString = function(SystemStorageConfigJson) {
      SystemStorageConfigObject <- jsonlite::fromJSON(SystemStorageConfigJson)
      self::fromJSON(SystemStorageConfigObject)

    }
  )
)
deardooley/agave-rlang-sdk documentation built on May 17, 2019, 10:12 p.m.