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


#' JobSummary Class
#'
#' 
#'
#' @field appId The unique name of the application being run by this job. This must be a valid application that the calling user has permission to run.
#' @field endTime The date the job ended in ISO 8601 format.
#' @field executionSystem The system id of the execution system.
#' @field id The unique id of the job.
#' @field name The name of the job.
#' @field owner The job owner.
#' @field startTime The date the job started in ISO 8601 format.
#' @field status The status of the job. Possible values are: PENDING, STAGING_INPUTS, CLEANING_UP, ARCHIVING, STAGING_JOB, FINISHED, KILLED, FAILED, STOPPED, RUNNING, PAUSED, QUEUED, SUBMITTING, STAGED, PROCESSING_INPUTS, ARCHIVING_FINISHED, ARCHIVING_FAILED
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
JobSummary <- R6::R6Class(
  'JobSummary',
  public = list(
    `appId` = NULL,
    `endTime` = NULL,
    `executionSystem` = NULL,
    `id` = NULL,
    `name` = NULL,
    `owner` = NULL,
    `startTime` = NULL,
    `status` = NULL,
    initialize = function(`appId`, `endTime`, `executionSystem`, `id`, `name`, `owner`, `startTime`, `status`){
      if (!missing(`appId`)) {
        stopifnot(is.character(`appId`), length(`appId`) == 1)
        self$`appId` <- `appId`
      }
      if (!missing(`endTime`)) {
        stopifnot(is.character(`endTime`), length(`endTime`) == 1)
        self$`endTime` <- `endTime`
      }
      if (!missing(`executionSystem`)) {
        stopifnot(is.character(`executionSystem`), length(`executionSystem`) == 1)
        self$`executionSystem` <- `executionSystem`
      }
      if (!missing(`id`)) {
        stopifnot(is.numeric(`id`), length(`id`) == 1)
        self$`id` <- `id`
      }
      if (!missing(`name`)) {
        stopifnot(is.character(`name`), length(`name`) == 1)
        self$`name` <- `name`
      }
      if (!missing(`owner`)) {
        stopifnot(is.character(`owner`), length(`owner`) == 1)
        self$`owner` <- `owner`
      }
      if (!missing(`startTime`)) {
        stopifnot(is.character(`startTime`), length(`startTime`) == 1)
        self$`startTime` <- `startTime`
      }
      if (!missing(`status`)) {
        stopifnot(is.character(`status`), length(`status`) == 1)
        self$`status` <- `status`
      }
    },
    asJSON = function() {
      self$toJSON()
    },
    toJSON = function() {
      JobSummaryObject <- list()
      if (!is.null(self$`appId`)) {
        JobSummaryObject[['appId']] <- self$`appId`
      }
      else {
        JobSummaryObject[['appId']] <- NULL
      }
      if (!is.null(self$`endTime`)) {
        JobSummaryObject[['endTime']] <- self$`endTime`
      }
      else {
        JobSummaryObject[['endTime']] <- NULL
      }
      if (!is.null(self$`executionSystem`)) {
        JobSummaryObject[['executionSystem']] <- self$`executionSystem`
      }
      else {
        JobSummaryObject[['executionSystem']] <- NULL
      }
      if (!is.null(self$`id`)) {
        JobSummaryObject[['id']] <- self$`id`
      }
      else {
        JobSummaryObject[['id']] <- NULL
      }
      if (!is.null(self$`name`)) {
        JobSummaryObject[['name']] <- self$`name`
      }
      else {
        JobSummaryObject[['name']] <- NULL
      }
      if (!is.null(self$`owner`)) {
        JobSummaryObject[['owner']] <- self$`owner`
      }
      else {
        JobSummaryObject[['owner']] <- NULL
      }
      if (!is.null(self$`startTime`)) {
        JobSummaryObject[['startTime']] <- self$`startTime`
      }
      else {
        JobSummaryObject[['startTime']] <- NULL
      }
      if (!is.null(self$`status`)) {
        JobSummaryObject[['status']] <- self$`status`
      }
      else {
        JobSummaryObject[['status']] <- NULL
      }

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

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

      if (!is.null(JobSummaryObject$`appId`)) {
        self$`appId` <- JobSummaryObject$`appId`
      }
      if (!is.null(JobSummaryObject$`endTime`)) {
        self$`endTime` <- JobSummaryObject$`endTime`
      }
      if (!is.null(JobSummaryObject$`executionSystem`)) {
        self$`executionSystem` <- JobSummaryObject$`executionSystem`
      }
      if (!is.null(JobSummaryObject$`id`)) {
        self$`id` <- JobSummaryObject$`id`
      }
      if (!is.null(JobSummaryObject$`name`)) {
        self$`name` <- JobSummaryObject$`name`
      }
      if (!is.null(JobSummaryObject$`owner`)) {
        self$`owner` <- JobSummaryObject$`owner`
      }
      if (!is.null(JobSummaryObject$`startTime`)) {
        self$`startTime` <- JobSummaryObject$`startTime`
      }
      if (!is.null(JobSummaryObject$`status`)) {
        self$`status` <- JobSummaryObject$`status`
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "appId": %s,
           "endTime": %s,
           "executionSystem": %s,
           "id": %d,
           "name": %s,
           "owner": %s,
           "startTime": %s,
           "status": %s
        }',
        ifelse( is.null(self$`appId`),"null",paste0(c('"', self$`appId`, '"'))),
        ifelse( is.null(self$`endTime`),"null",paste0(c('"', self$`endTime`, '"'))),
        ifelse( is.null(self$`executionSystem`),"null",paste0(c('"', self$`executionSystem`, '"'))),
        ifelse( is.null(self$`id`),"null",paste0(c('"', self$`id`, '"'))),
        ifelse( is.null(self$`name`),"null",paste0(c('"', self$`name`, '"'))),
        ifelse( is.null(self$`owner`),"null",paste0(c('"', self$`owner`, '"'))),
        ifelse( is.null(self$`startTime`),"null",paste0(c('"', self$`startTime`, '"'))),
        ifelse( is.null(self$`status`),"null",paste0(c('"', self$`status`, '"')))
      )
    },
    fromJSONString = function(JobSummaryJson) {
      JobSummaryObject <- jsonlite::fromJSON(JobSummaryJson)
      self::fromJSON(JobSummaryObject)

    }
  )
)
agaveplatform/r-sdk documentation built on May 13, 2019, 8:20 a.m.