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


#' Cluster Class
#'
#' @field name 
#' @field kind 
#' @field url 
#' @field ca 
#' @field version 
#' @field auth_type 
#' @field jwt_signing_key 
#' @field slurm_user 
#' @field tags 
#' @field description 
#' @field plugin 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
Cluster <- R6::R6Class(
  'Cluster',
  public = list(
    `name` = NULL,
    `kind` = NULL,
    `url` = NULL,
    `ca` = NULL,
    `version` = NULL,
    `auth_type` = NULL,
    `jwt_signing_key` = NULL,
    `slurm_user` = NULL,
    `tags` = NULL,
    `description` = NULL,
    `plugin` = NULL,
    initialize = function(`name`, `kind`, `url`, `ca`, `version`, `auth_type`, `jwt_signing_key`, `slurm_user`, `tags`, `description`, `plugin`){
      if (!missing(`name`)) {
        stopifnot(is.character(`name`), length(`name`) == 1)
        self$`name` <- `name`
      }
      if (!missing(`kind`)) {
        stopifnot(is.character(`kind`), length(`kind`) == 1)
        self$`kind` <- `kind`
      }
      if (!missing(`url`)) {
        stopifnot(is.character(`url`), length(`url`) == 1)
        self$`url` <- `url`
      }
      if (!missing(`ca`)) {
        stopifnot(is.character(`ca`), length(`ca`) == 1)
        self$`ca` <- `ca`
      }
      if (!missing(`version`)) {
        stopifnot(is.character(`version`), length(`version`) == 1)
        self$`version` <- `version`
      }
      if (!missing(`auth_type`)) {
        stopifnot(is.character(`auth_type`), length(`auth_type`) == 1)
        self$`auth_type` <- `auth_type`
      }
      if (!missing(`jwt_signing_key`)) {
        stopifnot(is.character(`jwt_signing_key`), length(`jwt_signing_key`) == 1)
        self$`jwt_signing_key` <- `jwt_signing_key`
      }
      if (!missing(`slurm_user`)) {
        stopifnot(is.character(`slurm_user`), length(`slurm_user`) == 1)
        self$`slurm_user` <- `slurm_user`
      }
      if (!missing(`tags`)) {
        stopifnot(is.list(`tags`), length(`tags`) != 0)
        lapply(`tags`, function(x) stopifnot(is.character(x)))
        self$`tags` <- `tags`
      }
      if (!missing(`description`)) {
        stopifnot(is.character(`description`), length(`description`) == 1)
        self$`description` <- `description`
      }
      if (!missing(`plugin`)) {
        stopifnot(is.character(`plugin`), length(`plugin`) == 1)
        self$`plugin` <- `plugin`
      }
    },
    toJSON = function() {
      ClusterObject <- list()
      if (!is.null(self$`name`)) {
        ClusterObject[['name']] <- self$`name`
      }
      if (!is.null(self$`kind`)) {
        ClusterObject[['kind']] <- self$`kind`
      }
      if (!is.null(self$`url`)) {
        ClusterObject[['url']] <- self$`url`
      }
      if (!is.null(self$`ca`)) {
        ClusterObject[['ca']] <- self$`ca`
      }
      if (!is.null(self$`version`)) {
        ClusterObject[['version']] <- self$`version`
      }
      if (!is.null(self$`auth_type`)) {
        ClusterObject[['auth_type']] <- self$`auth_type`
      }
      if (!is.null(self$`jwt_signing_key`)) {
        ClusterObject[['jwt_signing_key']] <- self$`jwt_signing_key`
      }
      if (!is.null(self$`slurm_user`)) {
        ClusterObject[['slurm_user']] <- self$`slurm_user`
      }
      if (!is.null(self$`tags`)) {
        ClusterObject[['tags']] <- self$`tags`
      }
      if (!is.null(self$`description`)) {
        ClusterObject[['description']] <- self$`description`
      }
      if (!is.null(self$`plugin`)) {
        ClusterObject[['plugin']] <- self$`plugin`
      }

      ClusterObject
    },
    fromJSON = function(ClusterJson) {
      ClusterObject <- jsonlite::fromJSON(ClusterJson)
      if (!is.null(ClusterObject$`name`)) {
        self$`name` <- ClusterObject$`name`
      }
      if (!is.null(ClusterObject$`kind`)) {
        self$`kind` <- ClusterObject$`kind`
      }
      if (!is.null(ClusterObject$`url`)) {
        self$`url` <- ClusterObject$`url`
      }
      if (!is.null(ClusterObject$`ca`)) {
        self$`ca` <- ClusterObject$`ca`
      }
      if (!is.null(ClusterObject$`version`)) {
        self$`version` <- ClusterObject$`version`
      }
      if (!is.null(ClusterObject$`auth_type`)) {
        self$`auth_type` <- ClusterObject$`auth_type`
      }
      if (!is.null(ClusterObject$`jwt_signing_key`)) {
        self$`jwt_signing_key` <- ClusterObject$`jwt_signing_key`
      }
      if (!is.null(ClusterObject$`slurm_user`)) {
        self$`slurm_user` <- ClusterObject$`slurm_user`
      }
      if (!is.null(ClusterObject$`tags`)) {
        self$`tags` <- ClusterObject$`tags`
      }
      if (!is.null(ClusterObject$`description`)) {
        self$`description` <- ClusterObject$`description`
      }
      if (!is.null(ClusterObject$`plugin`)) {
        self$`plugin` <- ClusterObject$`plugin`
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "name": %s,
           "kind": %s,
           "url": %s,
           "ca": %s,
           "version": %s,
           "auth_type": %s,
           "jwt_signing_key": %s,
           "slurm_user": %s,
           "tags": [%s],
           "description": %s,
           "plugin": %s
        }',
        self$`name`,
        self$`kind`,
        self$`url`,
        self$`ca`,
        self$`version`,
        self$`auth_type`,
        self$`jwt_signing_key`,
        self$`slurm_user`,
        lapply(self$`tags`, function(x) paste(paste0('"', x, '"'), sep=",")),
        self$`description`,
        self$`plugin`
      )
    },
    fromJSONString = function(ClusterJson) {
      ClusterObject <- jsonlite::fromJSON(ClusterJson)
      self$`name` <- ClusterObject$`name`
      self$`kind` <- ClusterObject$`kind`
      self$`url` <- ClusterObject$`url`
      self$`ca` <- ClusterObject$`ca`
      self$`version` <- ClusterObject$`version`
      self$`auth_type` <- ClusterObject$`auth_type`
      self$`jwt_signing_key` <- ClusterObject$`jwt_signing_key`
      self$`slurm_user` <- ClusterObject$`slurm_user`
      self$`tags` <- ClusterObject$`tags`
      self$`description` <- ClusterObject$`description`
      self$`plugin` <- ClusterObject$`plugin`
    }
  )
)
riteshkarvaloc/dkubeR documentation built on Feb. 25, 2021, 9:28 p.m.