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


#' GCSAccessInfo Class
#'
#' @field bucket 
#' @field prefix 
#' @field secret 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
GCSAccessInfo <- R6::R6Class(
  'GCSAccessInfo',
  public = list(
    `bucket` = NULL,
    `prefix` = NULL,
    `secret` = NULL,
    initialize = function(`bucket`, `prefix`, `secret`){
      if (!missing(`bucket`)) {
        stopifnot(is.character(`bucket`), length(`bucket`) == 1)
        self$`bucket` <- `bucket`
      }
      if (!missing(`prefix`)) {
        stopifnot(is.character(`prefix`), length(`prefix`) == 1)
        self$`prefix` <- `prefix`
      }
      if (!missing(`secret`)) {
        stopifnot(R6::is.R6(`secret`))
        self$`secret` <- `secret`
      }
    },
    toJSON = function() {
      GCSAccessInfoObject <- list()
      if (!is.null(self$`bucket`)) {
        GCSAccessInfoObject[['bucket']] <- self$`bucket`
      }
      if (!is.null(self$`prefix`)) {
        GCSAccessInfoObject[['prefix']] <- self$`prefix`
      }
      if (!is.null(self$`secret`)) {
        GCSAccessInfoObject[['secret']] <- self$`secret`$toJSON()
      }

      GCSAccessInfoObject
    },
    fromJSON = function(GCSAccessInfoJson) {
      GCSAccessInfoObject <- jsonlite::fromJSON(GCSAccessInfoJson)
      if (!is.null(GCSAccessInfoObject$`bucket`)) {
        self$`bucket` <- GCSAccessInfoObject$`bucket`
      }
      if (!is.null(GCSAccessInfoObject$`prefix`)) {
        self$`prefix` <- GCSAccessInfoObject$`prefix`
      }
      if (!is.null(GCSAccessInfoObject$`secret`)) {
        secretObject <- RepoGCSAccessInfoSecret$new()
        secretObject$fromJSON(jsonlite::toJSON(GCSAccessInfoObject$secret, auto_unbox = TRUE))
        self$`secret` <- secretObject
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "bucket": %s,
           "prefix": %s,
           "secret": %s
        }',
        self$`bucket`,
        self$`prefix`,
        self$`secret`$toJSON()
      )
    },
    fromJSONString = function(GCSAccessInfoJson) {
      GCSAccessInfoObject <- jsonlite::fromJSON(GCSAccessInfoJson)
      self$`bucket` <- GCSAccessInfoObject$`bucket`
      self$`prefix` <- GCSAccessInfoObject$`prefix`
      RepoGCSAccessInfoSecretObject <- RepoGCSAccessInfoSecret$new()
      self$`secret` <- RepoGCSAccessInfoSecretObject$fromJSON(jsonlite::toJSON(GCSAccessInfoObject$secret, auto_unbox = TRUE))
    }
  )
)
riteshkarvaloc/dkubeR documentation built on Feb. 25, 2021, 9:28 p.m.