R/PreprocessingJobModel.r

# Dkube api server
#
# No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
#
# OpenAPI spec version: 2.2.1.11
# 
# Generated by: https://github.com/swagger-api/swagger-codegen.git


#' PreprocessingJobModel Class
#'
#' @field kind 
#' @field executor 
#' @field datums 
#' @field featuresets 
#' @field tags 
#' @field config 
#' @field cluster 
#' @field ngpus 
#' @field gpus_override 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
PreprocessingJobModel <- R6::R6Class(
  'PreprocessingJobModel',
  public = list(
    `kind` = NULL,
    `executor` = NULL,
    `datums` = NULL,
    `featuresets` = NULL,
    `tags` = NULL,
    `config` = NULL,
    `cluster` = NULL,
    `ngpus` = NULL,
    `gpus_override` = NULL,
    initialize = function(`kind`, `executor`, `datums`, `featuresets`, `tags`, `config`, `cluster`, `ngpus`, `gpus_override`){
      if (!missing(`kind`)) {
        stopifnot(is.character(`kind`), length(`kind`) == 1)
        self$`kind` <- `kind`
      }
      if (!missing(`executor`)) {
        stopifnot(R6::is.R6(`executor`))
        self$`executor` <- `executor`
      }
      if (!missing(`datums`)) {
        stopifnot(R6::is.R6(`datums`))
        self$`datums` <- `datums`
      }
      if (!missing(`featuresets`)) {
        stopifnot(R6::is.R6(`featuresets`))
        self$`featuresets` <- `featuresets`
      }
      if (!missing(`tags`)) {
        stopifnot(is.list(`tags`), length(`tags`) != 0)
        lapply(`tags`, function(x) stopifnot(is.character(x)))
        self$`tags` <- `tags`
      }
      if (!missing(`config`)) {
        stopifnot(R6::is.R6(`config`))
        self$`config` <- `config`
      }
      if (!missing(`cluster`)) {
        stopifnot(R6::is.R6(`cluster`))
        self$`cluster` <- `cluster`
      }
      if (!missing(`ngpus`)) {
        stopifnot(is.numeric(`ngpus`), length(`ngpus`) == 1)
        self$`ngpus` <- `ngpus`
      }
      if (!missing(`gpus_override`)) {
        self$`gpus_override` <- `gpus_override`
      }
    },
    toJSON = function() {
      PreprocessingJobModelObject <- list()
      if (!is.null(self$`kind`)) {
        PreprocessingJobModelObject[['kind']] <- self$`kind`
      }
      if (!is.null(self$`executor`)) {
        PreprocessingJobModelObject[['executor']] <- self$`executor`$toJSON()
      }
      if (!is.null(self$`datums`)) {
        PreprocessingJobModelObject[['datums']] <- self$`datums`$toJSON()
      }
      if (!is.null(self$`featuresets`)) {
        PreprocessingJobModelObject[['featuresets']] <- self$`featuresets`$toJSON()
      }
      if (!is.null(self$`tags`)) {
        PreprocessingJobModelObject[['tags']] <- self$`tags`
      }
      if (!is.null(self$`config`)) {
        PreprocessingJobModelObject[['config']] <- self$`config`$toJSON()
      }
      if (!is.null(self$`cluster`)) {
        PreprocessingJobModelObject[['cluster']] <- self$`cluster`$toJSON()
      }
      if (!is.null(self$`ngpus`)) {
        PreprocessingJobModelObject[['ngpus']] <- self$`ngpus`
      }
      if (!is.null(self$`gpus_override`)) {
        PreprocessingJobModelObject[['gpus_override']] <- self$`gpus_override`
      }

      PreprocessingJobModelObject
    },
    fromJSON = function(PreprocessingJobModelJson) {
      PreprocessingJobModelObject <- jsonlite::fromJSON(PreprocessingJobModelJson)
      if (!is.null(PreprocessingJobModelObject$`kind`)) {
        self$`kind` <- PreprocessingJobModelObject$`kind`
      }
      if (!is.null(PreprocessingJobModelObject$`executor`)) {
        executorObject <- PreprocessingJobModelExecutor$new()
        executorObject$fromJSON(jsonlite::toJSON(PreprocessingJobModelObject$executor, auto_unbox = TRUE))
        self$`executor` <- executorObject
      }
      if (!is.null(PreprocessingJobModelObject$`datums`)) {
        datumsObject <- JobDatumModel$new()
        datumsObject$fromJSON(jsonlite::toJSON(PreprocessingJobModelObject$datums, auto_unbox = TRUE))
        self$`datums` <- datumsObject
      }
      if (!is.null(PreprocessingJobModelObject$`featuresets`)) {
        featuresetsObject <- JobFeaturesetModel$new()
        featuresetsObject$fromJSON(jsonlite::toJSON(PreprocessingJobModelObject$featuresets, auto_unbox = TRUE))
        self$`featuresets` <- featuresetsObject
      }
      if (!is.null(PreprocessingJobModelObject$`tags`)) {
        self$`tags` <- PreprocessingJobModelObject$`tags`
      }
      if (!is.null(PreprocessingJobModelObject$`config`)) {
        configObject <- JobConfigModel$new()
        configObject$fromJSON(jsonlite::toJSON(PreprocessingJobModelObject$config, auto_unbox = TRUE))
        self$`config` <- configObject
      }
      if (!is.null(PreprocessingJobModelObject$`cluster`)) {
        clusterObject <- JobClusterModel$new()
        clusterObject$fromJSON(jsonlite::toJSON(PreprocessingJobModelObject$cluster, auto_unbox = TRUE))
        self$`cluster` <- clusterObject
      }
      if (!is.null(PreprocessingJobModelObject$`ngpus`)) {
        self$`ngpus` <- PreprocessingJobModelObject$`ngpus`
      }
      if (!is.null(PreprocessingJobModelObject$`gpus_override`)) {
        self$`gpus_override` <- PreprocessingJobModelObject$`gpus_override`
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "kind": %s,
           "executor": %s,
           "datums": %s,
           "featuresets": %s,
           "tags": [%s],
           "config": %s,
           "cluster": %s,
           "ngpus": %d,
           "gpus_override": %s
        }',
        self$`kind`,
        self$`executor`$toJSON(),
        self$`datums`$toJSON(),
        self$`featuresets`$toJSON(),
        lapply(self$`tags`, function(x) paste(paste0('"', x, '"'), sep=",")),
        self$`config`$toJSON(),
        self$`cluster`$toJSON(),
        self$`ngpus`,
        self$`gpus_override`
      )
    },
    fromJSONString = function(PreprocessingJobModelJson) {
      PreprocessingJobModelObject <- jsonlite::fromJSON(PreprocessingJobModelJson)
      self$`kind` <- PreprocessingJobModelObject$`kind`
      PreprocessingJobModelExecutorObject <- PreprocessingJobModelExecutor$new()
      self$`executor` <- PreprocessingJobModelExecutorObject$fromJSON(jsonlite::toJSON(PreprocessingJobModelObject$executor, auto_unbox = TRUE))
      JobDatumModelObject <- JobDatumModel$new()
      self$`datums` <- JobDatumModelObject$fromJSON(jsonlite::toJSON(PreprocessingJobModelObject$datums, auto_unbox = TRUE))
      JobFeaturesetModelObject <- JobFeaturesetModel$new()
      self$`featuresets` <- JobFeaturesetModelObject$fromJSON(jsonlite::toJSON(PreprocessingJobModelObject$featuresets, auto_unbox = TRUE))
      self$`tags` <- PreprocessingJobModelObject$`tags`
      JobConfigModelObject <- JobConfigModel$new()
      self$`config` <- JobConfigModelObject$fromJSON(jsonlite::toJSON(PreprocessingJobModelObject$config, auto_unbox = TRUE))
      JobClusterModelObject <- JobClusterModel$new()
      self$`cluster` <- JobClusterModelObject$fromJSON(jsonlite::toJSON(PreprocessingJobModelObject$cluster, auto_unbox = TRUE))
      self$`ngpus` <- PreprocessingJobModelObject$`ngpus`
      self$`gpus_override` <- PreprocessingJobModelObject$`gpus_override`
    }
  )
)
riteshkarvaloc/dkubeR documentation built on Feb. 25, 2021, 9:28 p.m.