R/JobModelParameters.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


#' JobModelParameters Class
#'
#' @field class 
#' @field gpu_allocation 
#' @field priority 
#' @field training 
#' @field notebook 
#' @field inference 
#' @field preprocessing 
#' @field custom 
#' @field run 
#' @field generated 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
JobModelParameters <- R6::R6Class(
  'JobModelParameters',
  public = list(
    `class` = NULL,
    `gpu_allocation` = NULL,
    `priority` = NULL,
    `training` = NULL,
    `notebook` = NULL,
    `inference` = NULL,
    `preprocessing` = NULL,
    `custom` = NULL,
    `run` = NULL,
    `generated` = NULL,
    initialize = function(`class`, `gpu_allocation`, `priority`, `training`, `notebook`, `inference`, `preprocessing`, `custom`, `run`, `generated`){
      if (!missing(`class`)) {
        stopifnot(is.character(`class`), length(`class`) == 1)
        self$`class` <- `class`
      }
      if (!missing(`gpu_allocation`)) {
        stopifnot(R6::is.R6(`gpu_allocation`))
        self$`gpu_allocation` <- `gpu_allocation`
      }
      if (!missing(`priority`)) {
        stopifnot(R6::is.R6(`priority`))
        self$`priority` <- `priority`
      }
      if (!missing(`training`)) {
        stopifnot(R6::is.R6(`training`))
        self$`training` <- `training`
      }
      if (!missing(`notebook`)) {
        stopifnot(R6::is.R6(`notebook`))
        self$`notebook` <- `notebook`
      }
      if (!missing(`inference`)) {
        stopifnot(R6::is.R6(`inference`))
        self$`inference` <- `inference`
      }
      if (!missing(`preprocessing`)) {
        stopifnot(R6::is.R6(`preprocessing`))
        self$`preprocessing` <- `preprocessing`
      }
      if (!missing(`custom`)) {
        stopifnot(R6::is.R6(`custom`))
        self$`custom` <- `custom`
      }
      if (!missing(`run`)) {
        stopifnot(R6::is.R6(`run`))
        self$`run` <- `run`
      }
      if (!missing(`generated`)) {
        stopifnot(R6::is.R6(`generated`))
        self$`generated` <- `generated`
      }
    },
    toJSON = function() {
      JobModelParametersObject <- list()
      if (!is.null(self$`class`)) {
        JobModelParametersObject[['class']] <- self$`class`
      }
      if (!is.null(self$`gpu_allocation`)) {
        JobModelParametersObject[['gpu_allocation']] <- self$`gpu_allocation`$toJSON()
      }
      if (!is.null(self$`priority`)) {
        JobModelParametersObject[['priority']] <- self$`priority`$toJSON()
      }
      if (!is.null(self$`training`)) {
        JobModelParametersObject[['training']] <- self$`training`$toJSON()
      }
      if (!is.null(self$`notebook`)) {
        JobModelParametersObject[['notebook']] <- self$`notebook`$toJSON()
      }
      if (!is.null(self$`inference`)) {
        JobModelParametersObject[['inference']] <- self$`inference`$toJSON()
      }
      if (!is.null(self$`preprocessing`)) {
        JobModelParametersObject[['preprocessing']] <- self$`preprocessing`$toJSON()
      }
      if (!is.null(self$`custom`)) {
        JobModelParametersObject[['custom']] <- self$`custom`$toJSON()
      }
      if (!is.null(self$`run`)) {
        JobModelParametersObject[['run']] <- self$`run`$toJSON()
      }
      if (!is.null(self$`generated`)) {
        JobModelParametersObject[['generated']] <- self$`generated`$toJSON()
      }

      JobModelParametersObject
    },
    fromJSON = function(JobModelParametersJson) {
      JobModelParametersObject <- jsonlite::fromJSON(JobModelParametersJson)
      if (!is.null(JobModelParametersObject$`class`)) {
        self$`class` <- JobModelParametersObject$`class`
      }
      if (!is.null(JobModelParametersObject$`gpu_allocation`)) {
        gpu_allocationObject <- GpuAllocation$new()
        gpu_allocationObject$fromJSON(jsonlite::toJSON(JobModelParametersObject$gpu_allocation, auto_unbox = TRUE))
        self$`gpu_allocation` <- gpu_allocationObject
      }
      if (!is.null(JobModelParametersObject$`priority`)) {
        priorityObject <- RunTemplateModelParametersPriority$new()
        priorityObject$fromJSON(jsonlite::toJSON(JobModelParametersObject$priority, auto_unbox = TRUE))
        self$`priority` <- priorityObject
      }
      if (!is.null(JobModelParametersObject$`training`)) {
        trainingObject <- DSJobModel$new()
        trainingObject$fromJSON(jsonlite::toJSON(JobModelParametersObject$training, auto_unbox = TRUE))
        self$`training` <- trainingObject
      }
      if (!is.null(JobModelParametersObject$`notebook`)) {
        notebookObject <- DSJobModel$new()
        notebookObject$fromJSON(jsonlite::toJSON(JobModelParametersObject$notebook, auto_unbox = TRUE))
        self$`notebook` <- notebookObject
      }
      if (!is.null(JobModelParametersObject$`inference`)) {
        inferenceObject <- InferenceJobModel$new()
        inferenceObject$fromJSON(jsonlite::toJSON(JobModelParametersObject$inference, auto_unbox = TRUE))
        self$`inference` <- inferenceObject
      }
      if (!is.null(JobModelParametersObject$`preprocessing`)) {
        preprocessingObject <- PreprocessingJobModel$new()
        preprocessingObject$fromJSON(jsonlite::toJSON(JobModelParametersObject$preprocessing, auto_unbox = TRUE))
        self$`preprocessing` <- preprocessingObject
      }
      if (!is.null(JobModelParametersObject$`custom`)) {
        customObject <- CustomJobModel$new()
        customObject$fromJSON(jsonlite::toJSON(JobModelParametersObject$custom, auto_unbox = TRUE))
        self$`custom` <- customObject
      }
      if (!is.null(JobModelParametersObject$`run`)) {
        runObject <- JobModelParametersRun$new()
        runObject$fromJSON(jsonlite::toJSON(JobModelParametersObject$run, auto_unbox = TRUE))
        self$`run` <- runObject
      }
      if (!is.null(JobModelParametersObject$`generated`)) {
        generatedObject <- JobModelParametersGenerated$new()
        generatedObject$fromJSON(jsonlite::toJSON(JobModelParametersObject$generated, auto_unbox = TRUE))
        self$`generated` <- generatedObject
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "class": %s,
           "gpu_allocation": %s,
           "priority": %s,
           "training": %s,
           "notebook": %s,
           "inference": %s,
           "preprocessing": %s,
           "custom": %s,
           "run": %s,
           "generated": %s
        }',
        self$`class`,
        self$`gpu_allocation`$toJSON(),
        self$`priority`$toJSON(),
        self$`training`$toJSON(),
        self$`notebook`$toJSON(),
        self$`inference`$toJSON(),
        self$`preprocessing`$toJSON(),
        self$`custom`$toJSON(),
        self$`run`$toJSON(),
        self$`generated`$toJSON()
      )
    },
    fromJSONString = function(JobModelParametersJson) {
      JobModelParametersObject <- jsonlite::fromJSON(JobModelParametersJson)
      self$`class` <- JobModelParametersObject$`class`
      GpuAllocationObject <- GpuAllocation$new()
      self$`gpu_allocation` <- GpuAllocationObject$fromJSON(jsonlite::toJSON(JobModelParametersObject$gpu_allocation, auto_unbox = TRUE))
      RunTemplateModelParametersPriorityObject <- RunTemplateModelParametersPriority$new()
      self$`priority` <- RunTemplateModelParametersPriorityObject$fromJSON(jsonlite::toJSON(JobModelParametersObject$priority, auto_unbox = TRUE))
      DSJobModelObject <- DSJobModel$new()
      self$`training` <- DSJobModelObject$fromJSON(jsonlite::toJSON(JobModelParametersObject$training, auto_unbox = TRUE))
      DSJobModelObject <- DSJobModel$new()
      self$`notebook` <- DSJobModelObject$fromJSON(jsonlite::toJSON(JobModelParametersObject$notebook, auto_unbox = TRUE))
      InferenceJobModelObject <- InferenceJobModel$new()
      self$`inference` <- InferenceJobModelObject$fromJSON(jsonlite::toJSON(JobModelParametersObject$inference, auto_unbox = TRUE))
      PreprocessingJobModelObject <- PreprocessingJobModel$new()
      self$`preprocessing` <- PreprocessingJobModelObject$fromJSON(jsonlite::toJSON(JobModelParametersObject$preprocessing, auto_unbox = TRUE))
      CustomJobModelObject <- CustomJobModel$new()
      self$`custom` <- CustomJobModelObject$fromJSON(jsonlite::toJSON(JobModelParametersObject$custom, auto_unbox = TRUE))
      JobModelParametersRunObject <- JobModelParametersRun$new()
      self$`run` <- JobModelParametersRunObject$fromJSON(jsonlite::toJSON(JobModelParametersObject$run, auto_unbox = TRUE))
      JobModelParametersGeneratedObject <- JobModelParametersGenerated$new()
      self$`generated` <- JobModelParametersGeneratedObject$fromJSON(jsonlite::toJSON(JobModelParametersObject$generated, auto_unbox = TRUE))
    }
  )
)
riteshkarvaloc/dkubeR documentation built on Feb. 25, 2021, 9:28 p.m.