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


#' DSJobModelExecutor Class
#'
#' @field choice 
#' @field buildfromproject 
#' @field dkube 
#' @field custom 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
DSJobModelExecutor <- R6::R6Class(
  'DSJobModelExecutor',
  public = list(
    `choice` = NULL,
    `buildfromproject` = NULL,
    `dkube` = NULL,
    `custom` = NULL,
    initialize = function(`choice`, `buildfromproject`, `dkube`, `custom`){
      if (!missing(`choice`)) {
        stopifnot(is.character(`choice`), length(`choice`) == 1)
        self$`choice` <- `choice`
      }
      if (!missing(`buildfromproject`)) {
        self$`buildfromproject` <- `buildfromproject`
      }
      if (!missing(`dkube`)) {
        stopifnot(R6::is.R6(`dkube`))
        self$`dkube` <- `dkube`
      }
      if (!missing(`custom`)) {
        stopifnot(R6::is.R6(`custom`))
        self$`custom` <- `custom`
      }
    },
    toJSON = function() {
      DSJobModelExecutorObject <- list()
      if (!is.null(self$`choice`)) {
        DSJobModelExecutorObject[['choice']] <- self$`choice`
      }
      if (!is.null(self$`buildfromproject`)) {
        DSJobModelExecutorObject[['buildfromproject']] <- self$`buildfromproject`
      }
      if (!is.null(self$`dkube`)) {
        DSJobModelExecutorObject[['dkube']] <- self$`dkube`$toJSON()
      }
      if (!is.null(self$`custom`)) {
        DSJobModelExecutorObject[['custom']] <- self$`custom`$toJSON()
      }

      DSJobModelExecutorObject
    },
    fromJSON = function(DSJobModelExecutorJson) {
      DSJobModelExecutorObject <- jsonlite::fromJSON(DSJobModelExecutorJson)
      if (!is.null(DSJobModelExecutorObject$`choice`)) {
        self$`choice` <- DSJobModelExecutorObject$`choice`
      }
      if (!is.null(DSJobModelExecutorObject$`buildfromproject`)) {
        self$`buildfromproject` <- DSJobModelExecutorObject$`buildfromproject`
      }
      if (!is.null(DSJobModelExecutorObject$`dkube`)) {
        dkubeObject <- DkubeContainerModel$new()
        dkubeObject$fromJSON(jsonlite::toJSON(DSJobModelExecutorObject$dkube, auto_unbox = TRUE))
        self$`dkube` <- dkubeObject
      }
      if (!is.null(DSJobModelExecutorObject$`custom`)) {
        customObject <- CustomContainerModel$new()
        customObject$fromJSON(jsonlite::toJSON(DSJobModelExecutorObject$custom, auto_unbox = TRUE))
        self$`custom` <- customObject
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "choice": %s,
           "buildfromproject": %s,
           "dkube": %s,
           "custom": %s
        }',
        self$`choice`,
        self$`buildfromproject`,
        self$`dkube`$toJSON(),
        self$`custom`$toJSON()
      )
    },
    fromJSONString = function(DSJobModelExecutorJson) {
      DSJobModelExecutorObject <- jsonlite::fromJSON(DSJobModelExecutorJson)
      self$`choice` <- DSJobModelExecutorObject$`choice`
      self$`buildfromproject` <- DSJobModelExecutorObject$`buildfromproject`
      DkubeContainerModelObject <- DkubeContainerModel$new()
      self$`dkube` <- DkubeContainerModelObject$fromJSON(jsonlite::toJSON(DSJobModelExecutorObject$dkube, auto_unbox = TRUE))
      CustomContainerModelObject <- CustomContainerModel$new()
      self$`custom` <- CustomContainerModelObject$fromJSON(jsonlite::toJSON(DSJobModelExecutorObject$custom, auto_unbox = TRUE))
    }
  )
)
riteshkarvaloc/dkubeR documentation built on Feb. 25, 2021, 9:28 p.m.