# TileDB Storage Platform API
#
# TileDB Storage Platform REST API
#
# The version of the OpenAPI document: 2.2.19
#
# Generated by: https://openapi-generator.tech
#' @docType class
#' @title Notebook operations
#' @description tiledbcloud.Notebook
#' @format An \code{R6Class} generator object
#' @field apiClient Handles the client-server communication.
#'
#' @section Methods:
#' \describe{
#' \strong{ GetNotebookServerStatus } \emph{ }
#' Get status of the notebook server
#'
#' \itemize{
#' \item \emph{ @param } namespace character
#' \item \emph{ @returnType } \link{NotebookStatus} \cr
#'
#'
#' \item status code : 200 | status of running notebook
#'
#' \item return type : NotebookStatus
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 202 | Notebook server is pending
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 402 | Payment required
#'
#' \item return type : Error
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 404 | Notebook is not running
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 0 | error response
#'
#' \item return type : Error
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ ShutdownNotebookServer } \emph{ }
#' Shutdown a notebook server
#'
#' \itemize{
#' \item \emph{ @param } namespace character
#'
#'
#' \item status code : 204 | Notebook shutdown successfully
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 404 | Notebook is not running
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 0 | error response
#'
#' \item return type : Error
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ UpdateNotebookName } \emph{ }
#' update name on a notebok, moving related S3 object to new location
#'
#' \itemize{
#' \item \emph{ @param } namespace character
#' \item \emph{ @param } array character
#' \item \emph{ @param } notebook.metadata \link{ArrayInfoUpdate}
#'
#'
#' \item status code : 204 | notebook name updated successfully
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 0 | error response
#'
#' \item return type : Error
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' }
#'
#'
#' @examples
#' \dontrun{
#' #################### GetNotebookServerStatus ####################
#'
#' library(tiledbcloud)
#' var.namespace <- 'namespace_example' # character | namespace notebook is in (an organization name or user's username)
#'
#' api.instance <- NotebookApi$new()
#'
#' #Configure API key authorization: ApiKeyAuth
#' api.instance$apiClient$apiKeys['X-TILEDB-REST-API-KEY'] <- 'TODO_YOUR_API_KEY';
#'
#' #Configure HTTP basic authorization: BasicAuth
#' # provide your username in the user-serial format
#' api.instance$apiClient$username <- '<user-serial>';
#' # provide your api key generated using the developer portal
#' api.instance$apiClient$password <- '<api_key>';
#'
#' result <- api.instance$GetNotebookServerStatus(var.namespace)
#'
#'
#' #################### ShutdownNotebookServer ####################
#'
#' library(tiledbcloud)
#' var.namespace <- 'namespace_example' # character | namespace notebook is in (an organization name or user's username)
#'
#' api.instance <- NotebookApi$new()
#'
#' #Configure API key authorization: ApiKeyAuth
#' api.instance$apiClient$apiKeys['X-TILEDB-REST-API-KEY'] <- 'TODO_YOUR_API_KEY';
#'
#' #Configure HTTP basic authorization: BasicAuth
#' # provide your username in the user-serial format
#' api.instance$apiClient$username <- '<user-serial>';
#' # provide your api key generated using the developer portal
#' api.instance$apiClient$password <- '<api_key>';
#'
#' result <- api.instance$ShutdownNotebookServer(var.namespace)
#'
#'
#' #################### UpdateNotebookName ####################
#'
#' library(tiledbcloud)
#' var.namespace <- 'namespace_example' # character | namespace array is in (an organization name or user's username)
#' var.array <- 'array_example' # character | name/uri of notebook (array) that is url-encoded
#' var.notebook.metadata <- ArrayInfoUpdate$new() # ArrayInfoUpdate | notebook (array) metadata to update
#'
#' api.instance <- NotebookApi$new()
#'
#' #Configure API key authorization: ApiKeyAuth
#' api.instance$apiClient$apiKeys['X-TILEDB-REST-API-KEY'] <- 'TODO_YOUR_API_KEY';
#'
#' #Configure HTTP basic authorization: BasicAuth
#' # provide your username in the user-serial format
#' api.instance$apiClient$username <- '<user-serial>';
#' # provide your api key generated using the developer portal
#' api.instance$apiClient$password <- '<api_key>';
#'
#' result <- api.instance$UpdateNotebookName(var.namespace, var.array, var.notebook.metadata)
#'
#'
#' }
#' @importFrom R6 R6Class
#' @importFrom base64enc base64encode
#' @export
NotebookApi <- R6::R6Class(
'NotebookApi',
public = list(
apiClient = NULL,
initialize = function(apiClient){
if (!missing(apiClient)) {
self$apiClient <- apiClient
}
else {
self$apiClient <- ApiClient$new()
}
},
GetNotebookServerStatus = function(namespace, ...){
apiResponse <- self$GetNotebookServerStatusWithHttpInfo(namespace, ...)
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
}
},
GetNotebookServerStatusWithHttpInfo = function(namespace, ...){
args <- list(...)
queryParams <- list()
headerParams <- c()
if (missing(`namespace`)) {
stop("Missing required parameter `namespace`.")
}
body <- NULL
urlPath <- "/notebooks/server/{namespace}/status"
if (!missing(`namespace`)) {
urlPath <- gsub(paste0("\\{", "namespace", "\\}"), URLencode(as.character(`namespace`), reserved = TRUE), urlPath)
}
# API key authentication
if ("X-TILEDB-REST-API-KEY" %in% names(self$apiClient$apiKeys) && nchar(self$apiClient$apiKeys["X-TILEDB-REST-API-KEY"]) > 0) {
headerParams['X-TILEDB-REST-API-KEY'] <- paste(unlist(self$apiClient$apiKeys["X-TILEDB-REST-API-KEY"]), collapse='')
}
# HTTP basic auth
headerParams['Authorization'] <- paste("Basic", base64enc::base64encode(charToRaw(paste(self$apiClient$username, self$apiClient$password, 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, "NotebookStatus", loadNamespace("tiledbcloud")),
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)
}
},
ShutdownNotebookServer = function(namespace, ...){
apiResponse <- self$ShutdownNotebookServerWithHttpInfo(namespace, ...)
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
}
},
ShutdownNotebookServerWithHttpInfo = function(namespace, ...){
args <- list(...)
queryParams <- list()
headerParams <- c()
if (missing(`namespace`)) {
stop("Missing required parameter `namespace`.")
}
body <- NULL
urlPath <- "/notebooks/server/{namespace}"
if (!missing(`namespace`)) {
urlPath <- gsub(paste0("\\{", "namespace", "\\}"), URLencode(as.character(`namespace`), reserved = TRUE), urlPath)
}
# API key authentication
if ("X-TILEDB-REST-API-KEY" %in% names(self$apiClient$apiKeys) && nchar(self$apiClient$apiKeys["X-TILEDB-REST-API-KEY"]) > 0) {
headerParams['X-TILEDB-REST-API-KEY'] <- paste(unlist(self$apiClient$apiKeys["X-TILEDB-REST-API-KEY"]), collapse='')
}
# HTTP basic auth
headerParams['Authorization'] <- paste("Basic", base64enc::base64encode(charToRaw(paste(self$apiClient$username, self$apiClient$password, sep=":"))))
resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
method = "DELETE",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
ApiResponse$new(NULL, 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)
}
},
UpdateNotebookName = function(namespace, array, notebook.metadata, ...){
apiResponse <- self$UpdateNotebookNameWithHttpInfo(namespace, array, notebook.metadata, ...)
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
}
},
UpdateNotebookNameWithHttpInfo = function(namespace, array, notebook.metadata, ...){
args <- list(...)
queryParams <- list()
headerParams <- c()
if (missing(`namespace`)) {
stop("Missing required parameter `namespace`.")
}
if (missing(`array`)) {
stop("Missing required parameter `array`.")
}
if (missing(`notebook.metadata`)) {
stop("Missing required parameter `notebook.metadata`.")
}
if (!missing(`notebook.metadata`)) {
body <- `notebook.metadata`$toJSONString()
} else {
body <- NULL
}
urlPath <- "/notebooks/{namespace}/{array}/rename"
if (!missing(`namespace`)) {
urlPath <- gsub(paste0("\\{", "namespace", "\\}"), URLencode(as.character(`namespace`), reserved = TRUE), urlPath)
}
if (!missing(`array`)) {
urlPath <- gsub(paste0("\\{", "array", "\\}"), URLencode(as.character(`array`), reserved = TRUE), urlPath)
}
# API key authentication
if ("X-TILEDB-REST-API-KEY" %in% names(self$apiClient$apiKeys) && nchar(self$apiClient$apiKeys["X-TILEDB-REST-API-KEY"]) > 0) {
headerParams['X-TILEDB-REST-API-KEY'] <- paste(unlist(self$apiClient$apiKeys["X-TILEDB-REST-API-KEY"]), collapse='')
}
# HTTP basic auth
headerParams['Authorization'] <- paste("Basic", base64enc::base64encode(charToRaw(paste(self$apiClient$username, self$apiClient$password, sep=":"))))
resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
method = "PATCH",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
ApiResponse$new(NULL, 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)
}
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.