R/crom_iam_workflows_for_admin_api.R

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

#' @docType class
#' @title CromIAMWorkflowsForAdmin operations
#' @description openapi.CromIAMWorkflowsForAdmin
#' @format An \code{R6Class} generator object
#' @field apiClient Handles the client-server communication.
#'
#' @section Methods:
#' \describe{
#' \strong{ ApiWorkflowsVersionCallcachingDiffGet } \emph{ Return the hash differential between two calls }
#' 
#'
#' \itemize{
#' \item \emph{ @param } version character
#' \item \emph{ @param } workflow.a character
#' \item \emph{ @param } call.a character
#' \item \emph{ @param } workflow.b character
#' \item \emph{ @param } call.b character
#' \item \emph{ @param } index.a numeric
#' \item \emph{ @param } index.b numeric
#' \item \emph{ @returnType } \link{WorkflowCacheDiffResponse} \cr
#'
#'
#' \item status code : 200 | Successful Request
#'
#' \item return type : WorkflowCacheDiffResponse 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Malformed query parameters
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 404 | No matching cache entry
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 500 | Internal Error
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ ApiWorkflowsVersionIdReleaseHoldPost } \emph{ Request Cromwell to release the hold on a workflow. It will switch the status of a workflow from ‘On Hold’ to ‘Submitted’ so it can be picked for running. For instance this might be necessary in cases where you have submitted a workflow with workflowOnHold = true. }
#' 
#'
#' \itemize{
#' \item \emph{ @param } version character
#' \item \emph{ @param } id character
#' \item \emph{ @returnType } \link{WorkflowStatusResponse} \cr
#'
#'
#' \item status code : 200 | Successful Request
#'
#' \item return type : WorkflowStatusResponse 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Malformed Workflow ID
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 403 | Malformed Request
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 404 | Workflow ID Not Found
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 500 | Internal Error
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' }
#'
#'
#' @examples
#' \dontrun{
#' ####################  ApiWorkflowsVersionCallcachingDiffGet  ####################
#'
#' library(openapi)
#' var.version <- 'v1' # character | API Version
#' var.workflow.a <- 'workflow.a_example' # character | Workflow Id of the first workflow
#' var.call.a <- 'call.a_example' # character | Call FQN (including workflow name) of the first call
#' var.workflow.b <- 'workflow.b_example' # character | Workflow Id of the second workflow
#' var.call.b <- 'call.b_example' # character | Call FQN (including workflow name) of the second call
#' var.index.a <- 3.4 # numeric | Index of the first call
#' var.index.b <- 3.4 # numeric | Index of the second call
#'
#' #Return the hash differential between two calls
#' api.instance <- CromIAMWorkflowsForAdminApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$ApiWorkflowsVersionCallcachingDiffGet(var.version, var.workflow.a, var.call.a, var.workflow.b, var.call.b, index.a=var.index.a, index.b=var.index.b)
#'
#'
#' ####################  ApiWorkflowsVersionIdReleaseHoldPost  ####################
#'
#' library(openapi)
#' var.version <- 'v1' # character | API Version
#' var.id <- 'id_example' # character | Workflow ID
#'
#' #Request Cromwell to release the hold on a workflow. It will switch the status of a workflow from ‘On Hold’ to ‘Submitted’ so it can be picked for running. For instance this might be necessary in cases where you have submitted a workflow with workflowOnHold = true.
#' api.instance <- CromIAMWorkflowsForAdminApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$ApiWorkflowsVersionIdReleaseHoldPost(var.version, var.id)
#'
#'
#' }
#' @importFrom R6 R6Class
#' @importFrom base64enc base64encode
#' @export
CromIAMWorkflowsForAdminApi <- R6::R6Class(
  'CromIAMWorkflowsForAdminApi',
  public = list(
    apiClient = NULL,
    initialize = function(apiClient){
      if (!missing(apiClient)) {
        self$apiClient <- apiClient
      }
      else {
        self$apiClient <- ApiClient$new()
      }
    },
    ApiWorkflowsVersionCallcachingDiffGet = function(version, workflow.a, call.a, workflow.b, call.b, index.a=NULL, index.b=NULL, ...){
      apiResponse <- self$ApiWorkflowsVersionCallcachingDiffGetWithHttpInfo(version, workflow.a, call.a, workflow.b, call.b, index.a, index.b, ...)
      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
      }
    },

    ApiWorkflowsVersionCallcachingDiffGetWithHttpInfo = function(version, workflow.a, call.a, workflow.b, call.b, index.a=NULL, index.b=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

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

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

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

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

      queryParams['workflowA'] <- workflow.a

      queryParams['callA'] <- call.a

      queryParams['indexA'] <- index.a

      queryParams['workflowB'] <- workflow.b

      queryParams['callB'] <- call.b

      queryParams['indexB'] <- index.b

      body <- NULL
      urlPath <- "/api/workflows/{version}/callcaching/diff"
      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, "WorkflowCacheDiffResponse", 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)
      }
    },
    ApiWorkflowsVersionIdReleaseHoldPost = function(version, id, ...){
      apiResponse <- self$ApiWorkflowsVersionIdReleaseHoldPostWithHttpInfo(version, id, ...)
      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
      }
    },

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

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

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

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

      if (!missing(`id`)) {
        urlPath <- gsub(paste0("\\{", "id", "\\}"), URLencode(as.character(`id`), reserved = TRUE), urlPath)
      }

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

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

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "WorkflowStatusResponse", 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.