R/DBConnection.r

# Looker API 3.0 Reference
# 
# ### Authorization  The Looker API uses Looker **API3** credentials for authorization and access control. Looker admins can create API3 credentials on Looker's **Admin/Users** page. Pass API3 credentials to the **/login** endpoint to obtain a temporary access_token. Include that access_token in the Authorization header of Looker API requests. For details, see [Looker API Authorization](https://looker.com/docs/r/api/authorization)  ### Client SDKs  The Looker API is a RESTful system that should be usable by any programming language capable of making HTTPS requests. Client SDKs for a variety of programming languages can be generated from the Looker API's Swagger JSON metadata to streamline use of the Looker API in your applications. A client SDK for Ruby is available as an example. For more information, see [Looker API Client SDKs](https://looker.com/docs/r/api/client_sdks)  ### Try It Out!  The 'api-docs' page served by the Looker instance includes 'Try It Out!' buttons for each API method. After logging in with API3 credentials, you can use the \"Try It Out!\" buttons to call the API directly from the documentation page to interactively explore API features and responses.  ### Versioning  Future releases of Looker will expand this API release-by-release to securely expose more and more of the core power of Looker to API client applications. API endpoints marked as \"beta\" may receive breaking changes without warning. Stable (non-beta) API endpoints should not receive breaking changes in future releases. For more information, see [Looker API Versioning](https://looker.com/docs/r/api/versioning) 
# 
# OpenAPI spec version: 3.0.0
# 
# Generated by: https://github.com/swagger-api/swagger-codegen.git


#' DBConnection Class
#'
#' @field name 
#' @field dialect 
#' @field snippets 
#' @field host 
#' @field port 
#' @field username 
#' @field password 
#' @field certificate 
#' @field file_type 
#' @field database 
#' @field db_timezone 
#' @field query_timezone 
#' @field schema 
#' @field max_connections 
#' @field max_billing_gigabytes 
#' @field ssl 
#' @field verify_ssl 
#' @field tmp_db_name 
#' @field jdbc_additional_params 
#' @field pool_timeout 
#' @field dialect_name 
#' @field created_at 
#' @field user_id 
#' @field example 
#' @field user_db_credentials 
#' @field user_attribute_fields 
#' @field maintenance_cron 
#' @field last_regen_at 
#' @field last_reap_at 
#' @field sql_runner_precache_tables 
#' @field can 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
DBConnection <- R6::R6Class(
  'DBConnection',
  public = list(
    `name` = NULL,
    `dialect` = NULL,
    `snippets` = NULL,
    `host` = NULL,
    `port` = NULL,
    `username` = NULL,
    `password` = NULL,
    `certificate` = NULL,
    `file_type` = NULL,
    `database` = NULL,
    `db_timezone` = NULL,
    `query_timezone` = NULL,
    `schema` = NULL,
    `max_connections` = NULL,
    `max_billing_gigabytes` = NULL,
    `ssl` = NULL,
    `verify_ssl` = NULL,
    `tmp_db_name` = NULL,
    `jdbc_additional_params` = NULL,
    `pool_timeout` = NULL,
    `dialect_name` = NULL,
    `created_at` = NULL,
    `user_id` = NULL,
    `example` = NULL,
    `user_db_credentials` = NULL,
    `user_attribute_fields` = NULL,
    `maintenance_cron` = NULL,
    `last_regen_at` = NULL,
    `last_reap_at` = NULL,
    `sql_runner_precache_tables` = NULL,
    `can` = NULL,
    initialize = function(`name`, `dialect`, `snippets`, `host`, `port`, `username`, `password`, `certificate`, `file_type`, `database`, `db_timezone`, `query_timezone`, `schema`, `max_connections`, `max_billing_gigabytes`, `ssl`, `verify_ssl`, `tmp_db_name`, `jdbc_additional_params`, `pool_timeout`, `dialect_name`, `created_at`, `user_id`, `example`, `user_db_credentials`, `user_attribute_fields`, `maintenance_cron`, `last_regen_at`, `last_reap_at`, `sql_runner_precache_tables`, `can`){
      if (!missing(`name`)) {
        stopifnot(is.character(`name`), length(`name`) == 1)
        self$`name` <- `name`
      }
      if (!missing(`dialect`)) {
        stopifnot(R6::is.R6(`dialect`))
        self$`dialect` <- `dialect`
      }
      if (!missing(`snippets`)) {
        stopifnot(is.list(`snippets`), length(`snippets`) != 0)
        lapply(`snippets`, function(x) stopifnot(R6::is.R6(x)))
        self$`snippets` <- `snippets`
      }
      if (!missing(`host`)) {
        stopifnot(is.character(`host`), length(`host`) == 1)
        self$`host` <- `host`
      }
      if (!missing(`port`)) {
        stopifnot(is.character(`port`), length(`port`) == 1)
        self$`port` <- `port`
      }
      if (!missing(`username`)) {
        stopifnot(is.character(`username`), length(`username`) == 1)
        self$`username` <- `username`
      }
      if (!missing(`password`)) {
        stopifnot(is.character(`password`), length(`password`) == 1)
        self$`password` <- `password`
      }
      if (!missing(`certificate`)) {
        stopifnot(is.character(`certificate`), length(`certificate`) == 1)
        self$`certificate` <- `certificate`
      }
      if (!missing(`file_type`)) {
        stopifnot(is.character(`file_type`), length(`file_type`) == 1)
        self$`file_type` <- `file_type`
      }
      if (!missing(`database`)) {
        stopifnot(is.character(`database`), length(`database`) == 1)
        self$`database` <- `database`
      }
      if (!missing(`db_timezone`)) {
        stopifnot(is.character(`db_timezone`), length(`db_timezone`) == 1)
        self$`db_timezone` <- `db_timezone`
      }
      if (!missing(`query_timezone`)) {
        stopifnot(is.character(`query_timezone`), length(`query_timezone`) == 1)
        self$`query_timezone` <- `query_timezone`
      }
      if (!missing(`schema`)) {
        stopifnot(is.character(`schema`), length(`schema`) == 1)
        self$`schema` <- `schema`
      }
      if (!missing(`max_connections`)) {
        stopifnot(is.numeric(`max_connections`), length(`max_connections`) == 1)
        self$`max_connections` <- `max_connections`
      }
      if (!missing(`max_billing_gigabytes`)) {
        stopifnot(is.character(`max_billing_gigabytes`), length(`max_billing_gigabytes`) == 1)
        self$`max_billing_gigabytes` <- `max_billing_gigabytes`
      }
      if (!missing(`ssl`)) {
        self$`ssl` <- `ssl`
      }
      if (!missing(`verify_ssl`)) {
        self$`verify_ssl` <- `verify_ssl`
      }
      if (!missing(`tmp_db_name`)) {
        stopifnot(is.character(`tmp_db_name`), length(`tmp_db_name`) == 1)
        self$`tmp_db_name` <- `tmp_db_name`
      }
      if (!missing(`jdbc_additional_params`)) {
        stopifnot(is.character(`jdbc_additional_params`), length(`jdbc_additional_params`) == 1)
        self$`jdbc_additional_params` <- `jdbc_additional_params`
      }
      if (!missing(`pool_timeout`)) {
        stopifnot(is.numeric(`pool_timeout`), length(`pool_timeout`) == 1)
        self$`pool_timeout` <- `pool_timeout`
      }
      if (!missing(`dialect_name`)) {
        stopifnot(is.character(`dialect_name`), length(`dialect_name`) == 1)
        self$`dialect_name` <- `dialect_name`
      }
      if (!missing(`created_at`)) {
        stopifnot(is.character(`created_at`), length(`created_at`) == 1)
        self$`created_at` <- `created_at`
      }
      if (!missing(`user_id`)) {
        stopifnot(is.character(`user_id`), length(`user_id`) == 1)
        self$`user_id` <- `user_id`
      }
      if (!missing(`example`)) {
        self$`example` <- `example`
      }
      if (!missing(`user_db_credentials`)) {
        self$`user_db_credentials` <- `user_db_credentials`
      }
      if (!missing(`user_attribute_fields`)) {
        stopifnot(is.list(`user_attribute_fields`), length(`user_attribute_fields`) != 0)
        lapply(`user_attribute_fields`, function(x) stopifnot(is.character(x)))
        self$`user_attribute_fields` <- `user_attribute_fields`
      }
      if (!missing(`maintenance_cron`)) {
        stopifnot(is.character(`maintenance_cron`), length(`maintenance_cron`) == 1)
        self$`maintenance_cron` <- `maintenance_cron`
      }
      if (!missing(`last_regen_at`)) {
        stopifnot(is.character(`last_regen_at`), length(`last_regen_at`) == 1)
        self$`last_regen_at` <- `last_regen_at`
      }
      if (!missing(`last_reap_at`)) {
        stopifnot(is.character(`last_reap_at`), length(`last_reap_at`) == 1)
        self$`last_reap_at` <- `last_reap_at`
      }
      if (!missing(`sql_runner_precache_tables`)) {
        self$`sql_runner_precache_tables` <- `sql_runner_precache_tables`
      }
      if (!missing(`can`)) {
        self$`can` <- `can`
      }
    },
    toJSON = function() {
      DBConnectionObject <- list()
      if (!is.null(self$`name`)) {
        DBConnectionObject[['name']] <- self$`name`
      }
      if (!is.null(self$`dialect`)) {
        DBConnectionObject[['dialect']] <- self$`dialect`$toJSON()
      }
      if (!is.null(self$`snippets`)) {
        DBConnectionObject[['snippets']] <- lapply(self$`snippets`, function(x) x$toJSON())
      }
      if (!is.null(self$`host`)) {
        DBConnectionObject[['host']] <- self$`host`
      }
      if (!is.null(self$`port`)) {
        DBConnectionObject[['port']] <- self$`port`
      }
      if (!is.null(self$`username`)) {
        DBConnectionObject[['username']] <- self$`username`
      }
      if (!is.null(self$`password`)) {
        DBConnectionObject[['password']] <- self$`password`
      }
      if (!is.null(self$`certificate`)) {
        DBConnectionObject[['certificate']] <- self$`certificate`
      }
      if (!is.null(self$`file_type`)) {
        DBConnectionObject[['file_type']] <- self$`file_type`
      }
      if (!is.null(self$`database`)) {
        DBConnectionObject[['database']] <- self$`database`
      }
      if (!is.null(self$`db_timezone`)) {
        DBConnectionObject[['db_timezone']] <- self$`db_timezone`
      }
      if (!is.null(self$`query_timezone`)) {
        DBConnectionObject[['query_timezone']] <- self$`query_timezone`
      }
      if (!is.null(self$`schema`)) {
        DBConnectionObject[['schema']] <- self$`schema`
      }
      if (!is.null(self$`max_connections`)) {
        DBConnectionObject[['max_connections']] <- self$`max_connections`
      }
      if (!is.null(self$`max_billing_gigabytes`)) {
        DBConnectionObject[['max_billing_gigabytes']] <- self$`max_billing_gigabytes`
      }
      if (!is.null(self$`ssl`)) {
        DBConnectionObject[['ssl']] <- self$`ssl`
      }
      if (!is.null(self$`verify_ssl`)) {
        DBConnectionObject[['verify_ssl']] <- self$`verify_ssl`
      }
      if (!is.null(self$`tmp_db_name`)) {
        DBConnectionObject[['tmp_db_name']] <- self$`tmp_db_name`
      }
      if (!is.null(self$`jdbc_additional_params`)) {
        DBConnectionObject[['jdbc_additional_params']] <- self$`jdbc_additional_params`
      }
      if (!is.null(self$`pool_timeout`)) {
        DBConnectionObject[['pool_timeout']] <- self$`pool_timeout`
      }
      if (!is.null(self$`dialect_name`)) {
        DBConnectionObject[['dialect_name']] <- self$`dialect_name`
      }
      if (!is.null(self$`created_at`)) {
        DBConnectionObject[['created_at']] <- self$`created_at`
      }
      if (!is.null(self$`user_id`)) {
        DBConnectionObject[['user_id']] <- self$`user_id`
      }
      if (!is.null(self$`example`)) {
        DBConnectionObject[['example']] <- self$`example`
      }
      if (!is.null(self$`user_db_credentials`)) {
        DBConnectionObject[['user_db_credentials']] <- self$`user_db_credentials`
      }
      if (!is.null(self$`user_attribute_fields`)) {
        DBConnectionObject[['user_attribute_fields']] <- self$`user_attribute_fields`
      }
      if (!is.null(self$`maintenance_cron`)) {
        DBConnectionObject[['maintenance_cron']] <- self$`maintenance_cron`
      }
      if (!is.null(self$`last_regen_at`)) {
        DBConnectionObject[['last_regen_at']] <- self$`last_regen_at`
      }
      if (!is.null(self$`last_reap_at`)) {
        DBConnectionObject[['last_reap_at']] <- self$`last_reap_at`
      }
      if (!is.null(self$`sql_runner_precache_tables`)) {
        DBConnectionObject[['sql_runner_precache_tables']] <- self$`sql_runner_precache_tables`
      }
      if (!is.null(self$`can`)) {
        DBConnectionObject[['can']] <- self$`can`
      }

      DBConnectionObject
    },
    fromJSON = function(DBConnectionJson) {
      DBConnectionObject <- jsonlite::fromJSON(DBConnectionJson)
      if (!is.null(DBConnectionObject$`name`)) {
        self$`name` <- DBConnectionObject$`name`
      }
      if (!is.null(DBConnectionObject$`dialect`)) {
        dialectObject <- Dialect$new()
        dialectObject$fromJSON(jsonlite::toJSON(DBConnectionObject$dialect, auto_unbox = TRUE))
        self$`dialect` <- dialectObject
      }
      if (!is.null(DBConnectionObject$`snippets`)) {
        self$`snippets` <- lapply(DBConnectionObject$`snippets`, function(x) {
          snippetsObject <- Snippet$new()
          snippetsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE))
          snippetsObject
        })
      }
      if (!is.null(DBConnectionObject$`host`)) {
        self$`host` <- DBConnectionObject$`host`
      }
      if (!is.null(DBConnectionObject$`port`)) {
        self$`port` <- DBConnectionObject$`port`
      }
      if (!is.null(DBConnectionObject$`username`)) {
        self$`username` <- DBConnectionObject$`username`
      }
      if (!is.null(DBConnectionObject$`password`)) {
        self$`password` <- DBConnectionObject$`password`
      }
      if (!is.null(DBConnectionObject$`certificate`)) {
        self$`certificate` <- DBConnectionObject$`certificate`
      }
      if (!is.null(DBConnectionObject$`file_type`)) {
        self$`file_type` <- DBConnectionObject$`file_type`
      }
      if (!is.null(DBConnectionObject$`database`)) {
        self$`database` <- DBConnectionObject$`database`
      }
      if (!is.null(DBConnectionObject$`db_timezone`)) {
        self$`db_timezone` <- DBConnectionObject$`db_timezone`
      }
      if (!is.null(DBConnectionObject$`query_timezone`)) {
        self$`query_timezone` <- DBConnectionObject$`query_timezone`
      }
      if (!is.null(DBConnectionObject$`schema`)) {
        self$`schema` <- DBConnectionObject$`schema`
      }
      if (!is.null(DBConnectionObject$`max_connections`)) {
        self$`max_connections` <- DBConnectionObject$`max_connections`
      }
      if (!is.null(DBConnectionObject$`max_billing_gigabytes`)) {
        self$`max_billing_gigabytes` <- DBConnectionObject$`max_billing_gigabytes`
      }
      if (!is.null(DBConnectionObject$`ssl`)) {
        self$`ssl` <- DBConnectionObject$`ssl`
      }
      if (!is.null(DBConnectionObject$`verify_ssl`)) {
        self$`verify_ssl` <- DBConnectionObject$`verify_ssl`
      }
      if (!is.null(DBConnectionObject$`tmp_db_name`)) {
        self$`tmp_db_name` <- DBConnectionObject$`tmp_db_name`
      }
      if (!is.null(DBConnectionObject$`jdbc_additional_params`)) {
        self$`jdbc_additional_params` <- DBConnectionObject$`jdbc_additional_params`
      }
      if (!is.null(DBConnectionObject$`pool_timeout`)) {
        self$`pool_timeout` <- DBConnectionObject$`pool_timeout`
      }
      if (!is.null(DBConnectionObject$`dialect_name`)) {
        self$`dialect_name` <- DBConnectionObject$`dialect_name`
      }
      if (!is.null(DBConnectionObject$`created_at`)) {
        self$`created_at` <- DBConnectionObject$`created_at`
      }
      if (!is.null(DBConnectionObject$`user_id`)) {
        self$`user_id` <- DBConnectionObject$`user_id`
      }
      if (!is.null(DBConnectionObject$`example`)) {
        self$`example` <- DBConnectionObject$`example`
      }
      if (!is.null(DBConnectionObject$`user_db_credentials`)) {
        self$`user_db_credentials` <- DBConnectionObject$`user_db_credentials`
      }
      if (!is.null(DBConnectionObject$`user_attribute_fields`)) {
        self$`user_attribute_fields` <- DBConnectionObject$`user_attribute_fields`
      }
      if (!is.null(DBConnectionObject$`maintenance_cron`)) {
        self$`maintenance_cron` <- DBConnectionObject$`maintenance_cron`
      }
      if (!is.null(DBConnectionObject$`last_regen_at`)) {
        self$`last_regen_at` <- DBConnectionObject$`last_regen_at`
      }
      if (!is.null(DBConnectionObject$`last_reap_at`)) {
        self$`last_reap_at` <- DBConnectionObject$`last_reap_at`
      }
      if (!is.null(DBConnectionObject$`sql_runner_precache_tables`)) {
        self$`sql_runner_precache_tables` <- DBConnectionObject$`sql_runner_precache_tables`
      }
      if (!is.null(DBConnectionObject$`can`)) {
        self$`can` <- DBConnectionObject$`can`
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "name": %s,
           "dialect": %s,
           "snippets": [%s],
           "host": %s,
           "port": %s,
           "username": %s,
           "password": %s,
           "certificate": %s,
           "file_type": %s,
           "database": %s,
           "db_timezone": %s,
           "query_timezone": %s,
           "schema": %s,
           "max_connections": %d,
           "max_billing_gigabytes": %s,
           "ssl": %s,
           "verify_ssl": %s,
           "tmp_db_name": %s,
           "jdbc_additional_params": %s,
           "pool_timeout": %d,
           "dialect_name": %s,
           "created_at": %s,
           "user_id": %s,
           "example": %s,
           "user_db_credentials": %s,
           "user_attribute_fields": [%s],
           "maintenance_cron": %s,
           "last_regen_at": %s,
           "last_reap_at": %s,
           "sql_runner_precache_tables": %s,
           "can": %s
        }',
        self$`name`,
        self$`dialect`$toJSON(),
        lapply(self$`snippets`, function(x) paste(x$toJSON(), sep=",")),
        self$`host`,
        self$`port`,
        self$`username`,
        self$`password`,
        self$`certificate`,
        self$`file_type`,
        self$`database`,
        self$`db_timezone`,
        self$`query_timezone`,
        self$`schema`,
        self$`max_connections`,
        self$`max_billing_gigabytes`,
        self$`ssl`,
        self$`verify_ssl`,
        self$`tmp_db_name`,
        self$`jdbc_additional_params`,
        self$`pool_timeout`,
        self$`dialect_name`,
        self$`created_at`,
        self$`user_id`,
        self$`example`,
        self$`user_db_credentials`,
        lapply(self$`user_attribute_fields`, function(x) paste(paste0('"', x, '"'), sep=",")),
        self$`maintenance_cron`,
        self$`last_regen_at`,
        self$`last_reap_at`,
        self$`sql_runner_precache_tables`,
        self$`can`
      )
    },
    fromJSONString = function(DBConnectionJson) {
      DBConnectionObject <- jsonlite::fromJSON(DBConnectionJson)
      self$`name` <- DBConnectionObject$`name`
      DialectObject -> Dialect$new()
      self$`dialect` <- DialectObject$fromJSON(jsonlite::toJSON(DBConnectionObject$dialect, auto_unbox = TRUE))
      self$`snippets` <- lapply(DBConnectionObject$`snippets`, function(x) Snippet$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
      self$`host` <- DBConnectionObject$`host`
      self$`port` <- DBConnectionObject$`port`
      self$`username` <- DBConnectionObject$`username`
      self$`password` <- DBConnectionObject$`password`
      self$`certificate` <- DBConnectionObject$`certificate`
      self$`file_type` <- DBConnectionObject$`file_type`
      self$`database` <- DBConnectionObject$`database`
      self$`db_timezone` <- DBConnectionObject$`db_timezone`
      self$`query_timezone` <- DBConnectionObject$`query_timezone`
      self$`schema` <- DBConnectionObject$`schema`
      self$`max_connections` <- DBConnectionObject$`max_connections`
      self$`max_billing_gigabytes` <- DBConnectionObject$`max_billing_gigabytes`
      self$`ssl` <- DBConnectionObject$`ssl`
      self$`verify_ssl` <- DBConnectionObject$`verify_ssl`
      self$`tmp_db_name` <- DBConnectionObject$`tmp_db_name`
      self$`jdbc_additional_params` <- DBConnectionObject$`jdbc_additional_params`
      self$`pool_timeout` <- DBConnectionObject$`pool_timeout`
      self$`dialect_name` <- DBConnectionObject$`dialect_name`
      self$`created_at` <- DBConnectionObject$`created_at`
      self$`user_id` <- DBConnectionObject$`user_id`
      self$`example` <- DBConnectionObject$`example`
      self$`user_db_credentials` <- DBConnectionObject$`user_db_credentials`
      self$`user_attribute_fields` <- DBConnectionObject$`user_attribute_fields`
      self$`maintenance_cron` <- DBConnectionObject$`maintenance_cron`
      self$`last_regen_at` <- DBConnectionObject$`last_regen_at`
      self$`last_reap_at` <- DBConnectionObject$`last_reap_at`
      self$`sql_runner_precache_tables` <- DBConnectionObject$`sql_runner_precache_tables`
      self$`can` <- DBConnectionObject$`can`
    }
  )
)
haarthi/R_sdk documentation built on May 18, 2019, 11:28 p.m.