R/crom_iam_engine_for_job_manager_api.R

# FireCloud
#
# FireCloud API 
#
# The version of the OpenAPI document: 0.1
# 
# Generated by: https://openapi-generator.tech

#' @docType class
#' @title CromIAMEngineForJobManager operations
#' @description openapi.CromIAMEngineForJobManager
#' @format An \code{R6Class} generator object
#' @field apiClient Handles the client-server communication.
#'
#' @section Methods:
#' \describe{
#' \strong{ EngineVersionStatusGet } \emph{ Returns the current health status of any monitored subsystems }
#' 
#'
#' \itemize{
#' \item \emph{ @param } version character
#' \item \emph{ @returnType } \link{StatusResponse} \cr
#'
#'
#' \item status code : 200 | All subsystems report an \"ok\" status
#'
#' \item return type : StatusResponse 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 500 | At least one subsystem does not have an \"ok\" status
#'
#' \item return type : StatusResponse 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ EngineVersionVersionGet } \emph{ Returns the version of the Cromwell Engine }
#' 
#'
#' \itemize{
#' \item \emph{ @param } version character
#' \item \emph{ @returnType } \link{VersionResponse} \cr
#'
#'
#' \item status code : 200 | Successful Request
#'
#' \item return type : VersionResponse 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' }
#'
#'
#' @examples
#' \dontrun{
#' ####################  EngineVersionStatusGet  ####################
#'
#' library(openapi)
#' var.version <- 'v1' # character | API Version
#'
#' #Returns the current health status of any monitored subsystems
#' api.instance <- CromIAMEngineForJobManagerApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$EngineVersionStatusGet(var.version)
#'
#'
#' ####################  EngineVersionVersionGet  ####################
#'
#' library(openapi)
#' var.version <- 'v1' # character | API Version
#'
#' #Returns the version of the Cromwell Engine
#' api.instance <- CromIAMEngineForJobManagerApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$EngineVersionVersionGet(var.version)
#'
#'
#' }
#' @importFrom R6 R6Class
#' @importFrom base64enc base64encode
#' @export
CromIAMEngineForJobManagerApi <- R6::R6Class(
  'CromIAMEngineForJobManagerApi',
  public = list(
    apiClient = NULL,
    initialize = function(apiClient){
      if (!missing(apiClient)) {
        self$apiClient <- apiClient
      }
      else {
        self$apiClient <- ApiClient$new()
      }
    },
    EngineVersionStatusGet = function(version, ...){
      apiResponse <- self$EngineVersionStatusGetWithHttpInfo(version, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    EngineVersionStatusGetWithHttpInfo = function(version, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`version`)) {
        stop("Missing required parameter `version`.")
      }

      body <- NULL
      urlPath <- "/engine/{version}/status"
      if (!missing(`version`)) {
        urlPath <- gsub(paste0("\\{", "version", "\\}"), URLencode(as.character(`version`), reserved = TRUE), urlPath)
      }

      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "StatusResponse", loadNamespace("openapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    EngineVersionVersionGet = function(version, ...){
      apiResponse <- self$EngineVersionVersionGetWithHttpInfo(version, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    EngineVersionVersionGetWithHttpInfo = function(version, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`version`)) {
        stop("Missing required parameter `version`.")
      }

      body <- NULL
      urlPath <- "/engine/{version}/version"
      if (!missing(`version`)) {
        urlPath <- gsub(paste0("\\{", "version", "\\}"), URLencode(as.character(`version`), reserved = TRUE), urlPath)
      }

      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "VersionResponse", loadNamespace("openapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    }
  )
)
vjcitn/terraClientR documentation built on Dec. 23, 2021, 4:07 p.m.