R/namespace_actions.R

Defines functions .parse_NamespaceActions

# 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 NamespaceActions
#'
#' @description NamespaceActions Class
#'
#' @format An \code{R6Class} generator object
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
NamespaceActions <- R6::R6Class(
    "NamespaceActions",
    public = list(
        initialize = function(...) {
            local.optional.var <- list(...)
            val <- unlist(local.optional.var)

            # MANUAL EDIT AFTER OPENAPI AUTOGEN
            .check_openapi_enum("NamespaceActions", val, .parse_NamespaceActions())

            private$value <- val
        },
        toJSON = function() {
            jsonlite::toJSON(private$value, auto_unbox = TRUE)
        },
        fromJSON = function(NamespaceActionsJson) {
            private$value <- jsonlite::fromJSON(NamespaceActionsJson,
                simplifyVector = FALSE)
            self
        },
        toJSONString = function() {
            as.character(jsonlite::toJSON(private$value,
                auto_unbox = TRUE))
        },
        fromJSONString = function(NamespaceActionsJson) {
            private$value <- jsonlite::fromJSON(NamespaceActionsJson,
                simplifyVector = FALSE)
            self
        }
    ),
    private = list(
        value = NULL
    )
)

# add to utils.R
.parse_NamespaceActions <- function(vals) {
    res <- gsub("^\\[|\\]$", "",
        "[read, write, create, delete, edit, read_array_logs, read_job_logs, read_object_logs, run_job, delete_organization, edit_organization, edit_billing]"
    )
    unlist(strsplit(res, ", "))
}
TileDB-Inc/TileDB-Cloud-R documentation built on July 18, 2024, 3:33 p.m.