From add8af3272303972fceb3ec35eeedeb2ca8b4af3 Mon Sep 17 00:00:00 2001 From: Fuad Muhic Date: Mon, 26 Mar 2018 17:07:07 +0200 Subject: [PATCH] Added project manipulation methods to autogenerated Arvados class. Arvados-DCO-1.1-Signed-off-by: Fuad Muhic --- sdk/R/R/Arvados.R | 828 +++++++++++++++++++++++-------------------- sdk/R/R/autoGenAPI.R | 46 ++- 2 files changed, 486 insertions(+), 388 deletions(-) diff --git a/sdk/R/R/Arvados.R b/sdk/R/R/Arvados.R index c629a70ca0..c69fe08490 100644 --- a/sdk/R/R/Arvados.R +++ b/sdk/R/R/Arvados.R @@ -241,17 +241,17 @@ NULL #' @name api_client_authorizations.destroy NULL -#' api_clients.get is a method defined in Arvados class. +#' containers.get is a method defined in Arvados class. #' -#' @usage arv$api_clients.get(uuid) -#' @param uuid The UUID of the ApiClient in question. -#' @return ApiClient object. -#' @name api_clients.get +#' @usage arv$containers.get(uuid) +#' @param uuid The UUID of the Container in question. +#' @return Container object. +#' @name containers.get NULL -#' api_clients.index is a method defined in Arvados class. +#' containers.index is a method defined in Arvados class. #' -#' @usage arv$api_clients.index(filters = NULL, +#' @usage arv$containers.index(filters = NULL, #' where = NULL, order = NULL, select = NULL, #' distinct = NULL, limit = "100", offset = "0", #' count = "exact") @@ -263,41 +263,80 @@ NULL #' @param limit #' @param offset #' @param count -#' @return ApiClientList object. -#' @name api_clients.index +#' @return ContainerList object. +#' @name containers.index NULL -#' api_clients.create is a method defined in Arvados class. +#' containers.create is a method defined in Arvados class. #' -#' @usage arv$api_clients.create(apiclient, +#' @usage arv$containers.create(container, #' ensure_unique_name = "false") -#' @param apiClient ApiClient object. +#' @param container Container object. #' @param ensure_unique_name Adjust name to ensure uniqueness instead of returning an error on (owner_uuid, name) collision. -#' @return ApiClient object. -#' @name api_clients.create +#' @return Container object. +#' @name containers.create NULL -#' api_clients.update is a method defined in Arvados class. +#' containers.update is a method defined in Arvados class. #' -#' @usage arv$api_clients.update(apiclient, +#' @usage arv$containers.update(container, #' uuid) -#' @param apiClient ApiClient object. -#' @param uuid The UUID of the ApiClient in question. -#' @return ApiClient object. -#' @name api_clients.update +#' @param container Container object. +#' @param uuid The UUID of the Container in question. +#' @return Container object. +#' @name containers.update NULL -#' api_clients.delete is a method defined in Arvados class. +#' containers.delete is a method defined in Arvados class. #' -#' @usage arv$api_clients.delete(uuid) -#' @param uuid The UUID of the ApiClient in question. -#' @return ApiClient object. -#' @name api_clients.delete +#' @usage arv$containers.delete(uuid) +#' @param uuid The UUID of the Container in question. +#' @return Container object. +#' @name containers.delete NULL -#' api_clients.list is a method defined in Arvados class. +#' containers.auth is a method defined in Arvados class. #' -#' @usage arv$api_clients.list(filters = NULL, +#' @usage arv$containers.auth(uuid) +#' @param uuid +#' @return Container object. +#' @name containers.auth +NULL + +#' containers.lock is a method defined in Arvados class. +#' +#' @usage arv$containers.lock(uuid) +#' @param uuid +#' @return Container object. +#' @name containers.lock +NULL + +#' containers.unlock is a method defined in Arvados class. +#' +#' @usage arv$containers.unlock(uuid) +#' @param uuid +#' @return Container object. +#' @name containers.unlock +NULL + +#' containers.secret_mounts is a method defined in Arvados class. +#' +#' @usage arv$containers.secret_mounts(uuid) +#' @param uuid +#' @return Container object. +#' @name containers.secret_mounts +NULL + +#' containers.current is a method defined in Arvados class. +#' +#' @usage arv$containers.current(NULL) +#' @return Container object. +#' @name containers.current +NULL + +#' containers.list is a method defined in Arvados class. +#' +#' @usage arv$containers.list(filters = NULL, #' where = NULL, order = NULL, select = NULL, #' distinct = NULL, limit = "100", offset = "0", #' count = "exact") @@ -309,37 +348,37 @@ NULL #' @param limit #' @param offset #' @param count -#' @return ApiClientList object. -#' @name api_clients.list +#' @return ContainerList object. +#' @name containers.list NULL -#' api_clients.show is a method defined in Arvados class. +#' containers.show is a method defined in Arvados class. #' -#' @usage arv$api_clients.show(uuid) +#' @usage arv$containers.show(uuid) #' @param uuid -#' @return ApiClient object. -#' @name api_clients.show +#' @return Container object. +#' @name containers.show NULL -#' api_clients.destroy is a method defined in Arvados class. +#' containers.destroy is a method defined in Arvados class. #' -#' @usage arv$api_clients.destroy(uuid) +#' @usage arv$containers.destroy(uuid) #' @param uuid -#' @return ApiClient object. -#' @name api_clients.destroy +#' @return Container object. +#' @name containers.destroy NULL -#' container_requests.get is a method defined in Arvados class. +#' api_clients.get is a method defined in Arvados class. #' -#' @usage arv$container_requests.get(uuid) -#' @param uuid The UUID of the ContainerRequest in question. -#' @return ContainerRequest object. -#' @name container_requests.get +#' @usage arv$api_clients.get(uuid) +#' @param uuid The UUID of the ApiClient in question. +#' @return ApiClient object. +#' @name api_clients.get NULL -#' container_requests.index is a method defined in Arvados class. +#' api_clients.index is a method defined in Arvados class. #' -#' @usage arv$container_requests.index(filters = NULL, +#' @usage arv$api_clients.index(filters = NULL, #' where = NULL, order = NULL, select = NULL, #' distinct = NULL, limit = "100", offset = "0", #' count = "exact") @@ -351,41 +390,41 @@ NULL #' @param limit #' @param offset #' @param count -#' @return ContainerRequestList object. -#' @name container_requests.index +#' @return ApiClientList object. +#' @name api_clients.index NULL -#' container_requests.create is a method defined in Arvados class. +#' api_clients.create is a method defined in Arvados class. #' -#' @usage arv$container_requests.create(containerrequest, +#' @usage arv$api_clients.create(apiclient, #' ensure_unique_name = "false") -#' @param containerRequest ContainerRequest object. +#' @param apiClient ApiClient object. #' @param ensure_unique_name Adjust name to ensure uniqueness instead of returning an error on (owner_uuid, name) collision. -#' @return ContainerRequest object. -#' @name container_requests.create +#' @return ApiClient object. +#' @name api_clients.create NULL -#' container_requests.update is a method defined in Arvados class. +#' api_clients.update is a method defined in Arvados class. #' -#' @usage arv$container_requests.update(containerrequest, +#' @usage arv$api_clients.update(apiclient, #' uuid) -#' @param containerRequest ContainerRequest object. -#' @param uuid The UUID of the ContainerRequest in question. -#' @return ContainerRequest object. -#' @name container_requests.update +#' @param apiClient ApiClient object. +#' @param uuid The UUID of the ApiClient in question. +#' @return ApiClient object. +#' @name api_clients.update NULL -#' container_requests.delete is a method defined in Arvados class. +#' api_clients.delete is a method defined in Arvados class. #' -#' @usage arv$container_requests.delete(uuid) -#' @param uuid The UUID of the ContainerRequest in question. -#' @return ContainerRequest object. -#' @name container_requests.delete +#' @usage arv$api_clients.delete(uuid) +#' @param uuid The UUID of the ApiClient in question. +#' @return ApiClient object. +#' @name api_clients.delete NULL -#' container_requests.list is a method defined in Arvados class. +#' api_clients.list is a method defined in Arvados class. #' -#' @usage arv$container_requests.list(filters = NULL, +#' @usage arv$api_clients.list(filters = NULL, #' where = NULL, order = NULL, select = NULL, #' distinct = NULL, limit = "100", offset = "0", #' count = "exact") @@ -397,24 +436,24 @@ NULL #' @param limit #' @param offset #' @param count -#' @return ContainerRequestList object. -#' @name container_requests.list +#' @return ApiClientList object. +#' @name api_clients.list NULL -#' container_requests.show is a method defined in Arvados class. +#' api_clients.show is a method defined in Arvados class. #' -#' @usage arv$container_requests.show(uuid) +#' @usage arv$api_clients.show(uuid) #' @param uuid -#' @return ContainerRequest object. -#' @name container_requests.show +#' @return ApiClient object. +#' @name api_clients.show NULL -#' container_requests.destroy is a method defined in Arvados class. +#' api_clients.destroy is a method defined in Arvados class. #' -#' @usage arv$container_requests.destroy(uuid) +#' @usage arv$api_clients.destroy(uuid) #' @param uuid -#' @return ContainerRequest object. -#' @name container_requests.destroy +#' @return ApiClient object. +#' @name api_clients.destroy NULL #' authorized_keys.get is a method defined in Arvados class. @@ -505,20 +544,20 @@ NULL #' @name authorized_keys.destroy NULL -#' collections.get is a method defined in Arvados class. +#' container_requests.get is a method defined in Arvados class. #' -#' @usage arv$collections.get(uuid) -#' @param uuid The UUID of the Collection in question. -#' @return Collection object. -#' @name collections.get +#' @usage arv$container_requests.get(uuid) +#' @param uuid The UUID of the ContainerRequest in question. +#' @return ContainerRequest object. +#' @name container_requests.get NULL -#' collections.index is a method defined in Arvados class. +#' container_requests.index is a method defined in Arvados class. #' -#' @usage arv$collections.index(filters = NULL, +#' @usage arv$container_requests.index(filters = NULL, #' where = NULL, order = NULL, select = NULL, #' distinct = NULL, limit = "100", offset = "0", -#' count = "exact", include_trash = NULL) +#' count = "exact") #' @param filters #' @param where #' @param order @@ -527,77 +566,44 @@ NULL #' @param limit #' @param offset #' @param count -#' @param include_trash Include collections whose is_trashed attribute is true. -#' @return CollectionList object. -#' @name collections.index +#' @return ContainerRequestList object. +#' @name container_requests.index NULL -#' collections.create is a method defined in Arvados class. +#' container_requests.create is a method defined in Arvados class. #' -#' @usage arv$collections.create(collection, +#' @usage arv$container_requests.create(containerrequest, #' ensure_unique_name = "false") -#' @param collection Collection object. +#' @param containerRequest ContainerRequest object. #' @param ensure_unique_name Adjust name to ensure uniqueness instead of returning an error on (owner_uuid, name) collision. -#' @return Collection object. -#' @name collections.create +#' @return ContainerRequest object. +#' @name container_requests.create NULL -#' collections.update is a method defined in Arvados class. +#' container_requests.update is a method defined in Arvados class. #' -#' @usage arv$collections.update(collection, +#' @usage arv$container_requests.update(containerrequest, #' uuid) -#' @param collection Collection object. -#' @param uuid The UUID of the Collection in question. -#' @return Collection object. -#' @name collections.update -NULL - -#' collections.delete is a method defined in Arvados class. -#' -#' @usage arv$collections.delete(uuid) -#' @param uuid The UUID of the Collection in question. -#' @return Collection object. -#' @name collections.delete -NULL - -#' collections.provenance is a method defined in Arvados class. -#' -#' @usage arv$collections.provenance(uuid) -#' @param uuid -#' @return Collection object. -#' @name collections.provenance -NULL - -#' collections.used_by is a method defined in Arvados class. -#' -#' @usage arv$collections.used_by(uuid) -#' @param uuid -#' @return Collection object. -#' @name collections.used_by -NULL - -#' collections.trash is a method defined in Arvados class. -#' -#' @usage arv$collections.trash(uuid) -#' @param uuid -#' @return Collection object. -#' @name collections.trash +#' @param containerRequest ContainerRequest object. +#' @param uuid The UUID of the ContainerRequest in question. +#' @return ContainerRequest object. +#' @name container_requests.update NULL -#' collections.untrash is a method defined in Arvados class. +#' container_requests.delete is a method defined in Arvados class. #' -#' @usage arv$collections.untrash(uuid) -#' @param uuid -#' @return Collection object. -#' @name collections.untrash +#' @usage arv$container_requests.delete(uuid) +#' @param uuid The UUID of the ContainerRequest in question. +#' @return ContainerRequest object. +#' @name container_requests.delete NULL -#' collections.list is a method defined in Arvados class. +#' container_requests.list is a method defined in Arvados class. #' -#' @usage arv$collections.list(filters = NULL, +#' @usage arv$container_requests.list(filters = NULL, #' where = NULL, order = NULL, select = NULL, #' distinct = NULL, limit = "100", offset = "0", -#' count = "exact", include_trash = NULL) +#' count = "exact") #' @param filters #' @param where #' @param order @@ -606,41 +612,40 @@ NULL #' @param limit #' @param offset #' @param count -#' @param include_trash Include collections whose is_trashed attribute is true. -#' @return CollectionList object. -#' @name collections.list +#' @return ContainerRequestList object. +#' @name container_requests.list NULL -#' collections.show is a method defined in Arvados class. +#' container_requests.show is a method defined in Arvados class. #' -#' @usage arv$collections.show(uuid) +#' @usage arv$container_requests.show(uuid) #' @param uuid -#' @return Collection object. -#' @name collections.show +#' @return ContainerRequest object. +#' @name container_requests.show NULL -#' collections.destroy is a method defined in Arvados class. +#' container_requests.destroy is a method defined in Arvados class. #' -#' @usage arv$collections.destroy(uuid) +#' @usage arv$container_requests.destroy(uuid) #' @param uuid -#' @return Collection object. -#' @name collections.destroy +#' @return ContainerRequest object. +#' @name container_requests.destroy NULL -#' containers.get is a method defined in Arvados class. +#' collections.get is a method defined in Arvados class. #' -#' @usage arv$containers.get(uuid) -#' @param uuid The UUID of the Container in question. -#' @return Container object. -#' @name containers.get +#' @usage arv$collections.get(uuid) +#' @param uuid The UUID of the Collection in question. +#' @return Collection object. +#' @name collections.get NULL -#' containers.index is a method defined in Arvados class. +#' collections.index is a method defined in Arvados class. #' -#' @usage arv$containers.index(filters = NULL, +#' @usage arv$collections.index(filters = NULL, #' where = NULL, order = NULL, select = NULL, #' distinct = NULL, limit = "100", offset = "0", -#' count = "exact") +#' count = "exact", include_trash = NULL) #' @param filters #' @param where #' @param order @@ -649,75 +654,77 @@ NULL #' @param limit #' @param offset #' @param count -#' @return ContainerList object. -#' @name containers.index +#' @param include_trash Include collections whose is_trashed attribute is true. +#' @return CollectionList object. +#' @name collections.index NULL -#' containers.create is a method defined in Arvados class. +#' collections.create is a method defined in Arvados class. #' -#' @usage arv$containers.create(container, +#' @usage arv$collections.create(collection, #' ensure_unique_name = "false") -#' @param container Container object. +#' @param collection Collection object. #' @param ensure_unique_name Adjust name to ensure uniqueness instead of returning an error on (owner_uuid, name) collision. -#' @return Container object. -#' @name containers.create +#' @return Collection object. +#' @name collections.create NULL -#' containers.update is a method defined in Arvados class. +#' collections.update is a method defined in Arvados class. #' -#' @usage arv$containers.update(container, +#' @usage arv$collections.update(collection, #' uuid) -#' @param container Container object. -#' @param uuid The UUID of the Container in question. -#' @return Container object. -#' @name containers.update +#' @param collection Collection object. +#' @param uuid The UUID of the Collection in question. +#' @return Collection object. +#' @name collections.update NULL -#' containers.delete is a method defined in Arvados class. +#' collections.delete is a method defined in Arvados class. #' -#' @usage arv$containers.delete(uuid) -#' @param uuid The UUID of the Container in question. -#' @return Container object. -#' @name containers.delete +#' @usage arv$collections.delete(uuid) +#' @param uuid The UUID of the Collection in question. +#' @return Collection object. +#' @name collections.delete NULL -#' containers.auth is a method defined in Arvados class. +#' collections.provenance is a method defined in Arvados class. #' -#' @usage arv$containers.auth(uuid) +#' @usage arv$collections.provenance(uuid) #' @param uuid -#' @return Container object. -#' @name containers.auth +#' @return Collection object. +#' @name collections.provenance NULL -#' containers.lock is a method defined in Arvados class. +#' collections.used_by is a method defined in Arvados class. #' -#' @usage arv$containers.lock(uuid) +#' @usage arv$collections.used_by(uuid) #' @param uuid -#' @return Container object. -#' @name containers.lock +#' @return Collection object. +#' @name collections.used_by NULL -#' containers.unlock is a method defined in Arvados class. +#' collections.trash is a method defined in Arvados class. #' -#' @usage arv$containers.unlock(uuid) +#' @usage arv$collections.trash(uuid) #' @param uuid -#' @return Container object. -#' @name containers.unlock +#' @return Collection object. +#' @name collections.trash NULL -#' containers.current is a method defined in Arvados class. +#' collections.untrash is a method defined in Arvados class. #' -#' @usage arv$containers.current(NULL) -#' @return Container object. -#' @name containers.current +#' @usage arv$collections.untrash(uuid) +#' @param uuid +#' @return Collection object. +#' @name collections.untrash NULL -#' containers.list is a method defined in Arvados class. +#' collections.list is a method defined in Arvados class. #' -#' @usage arv$containers.list(filters = NULL, +#' @usage arv$collections.list(filters = NULL, #' where = NULL, order = NULL, select = NULL, #' distinct = NULL, limit = "100", offset = "0", -#' count = "exact") +#' count = "exact", include_trash = NULL) #' @param filters #' @param where #' @param order @@ -726,24 +733,25 @@ NULL #' @param limit #' @param offset #' @param count -#' @return ContainerList object. -#' @name containers.list +#' @param include_trash Include collections whose is_trashed attribute is true. +#' @return CollectionList object. +#' @name collections.list NULL -#' containers.show is a method defined in Arvados class. +#' collections.show is a method defined in Arvados class. #' -#' @usage arv$containers.show(uuid) +#' @usage arv$collections.show(uuid) #' @param uuid -#' @return Container object. -#' @name containers.show +#' @return Collection object. +#' @name collections.show NULL -#' containers.destroy is a method defined in Arvados class. +#' collections.destroy is a method defined in Arvados class. #' -#' @usage arv$containers.destroy(uuid) +#' @usage arv$collections.destroy(uuid) #' @param uuid -#' @return Container object. -#' @name containers.destroy +#' @return Collection object. +#' @name collections.destroy NULL #' humans.get is a method defined in Arvados class. @@ -2435,6 +2443,38 @@ Arvados <- R6::R6Class( }, + project.get = function(uuid) + { + self$groups.get(uuid) + }, + + project.create = function(group, ensure_unique_name = "false") + { + group <- c("group_class" = "project", group) + self$groups.create(group, ensure_unique_name) + }, + + project.update = function(group, uuid) + { + group <- c("group_class" = "project", group) + self$groups.update(group, uuid) + }, + + project.list = function(filters = NULL, where = NULL, + order = NULL, select = NULL, distinct = NULL, + limit = "100", offset = "0", count = "exact", + include_trash = NULL) + { + filters[[length(filters) + 1]] <- list("group_class", "=", "project") + self$groups.list(filters, where, order, select, distinct, + limit, offset, count, include_trash) + }, + + project.delete = function(uuid) + { + self$groups.delete(uuid) + }, + users.get = function(uuid) { endPoint <- stringr::str_interp("users/${uuid}") @@ -2954,9 +2994,9 @@ Arvados <- R6::R6Class( resource }, - api_clients.get = function(uuid) + containers.get = function(uuid) { - endPoint <- stringr::str_interp("api_clients/${uuid}") + endPoint <- stringr::str_interp("containers/${uuid}") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") @@ -2974,12 +3014,12 @@ Arvados <- R6::R6Class( resource }, - api_clients.index = function(filters = NULL, + containers.index = function(filters = NULL, where = NULL, order = NULL, select = NULL, distinct = NULL, limit = "100", offset = "0", count = "exact") { - endPoint <- stringr::str_interp("api_clients") + endPoint <- stringr::str_interp("containers") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") @@ -2999,16 +3039,16 @@ Arvados <- R6::R6Class( resource }, - api_clients.create = function(apiclient, ensure_unique_name = "false") + containers.create = function(container, ensure_unique_name = "false") { - endPoint <- stringr::str_interp("api_clients") + endPoint <- stringr::str_interp("containers") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") queryArgs <- list(ensure_unique_name = ensure_unique_name) - if(length(apiclient) > 0) - body <- jsonlite::toJSON(list(apiclient = apiclient), + if(length(container) > 0) + body <- jsonlite::toJSON(list(container = container), auto_unbox = TRUE) else body <- NULL @@ -3023,16 +3063,16 @@ Arvados <- R6::R6Class( resource }, - api_clients.update = function(apiclient, uuid) + containers.update = function(container, uuid) { - endPoint <- stringr::str_interp("api_clients/${uuid}") + endPoint <- stringr::str_interp("containers/${uuid}") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") queryArgs <- NULL - if(length(apiclient) > 0) - body <- jsonlite::toJSON(list(apiclient = apiclient), + if(length(container) > 0) + body <- jsonlite::toJSON(list(container = container), auto_unbox = TRUE) else body <- NULL @@ -3047,9 +3087,109 @@ Arvados <- R6::R6Class( resource }, - api_clients.delete = function(uuid) + containers.delete = function(uuid) { - endPoint <- stringr::str_interp("api_clients/${uuid}") + endPoint <- stringr::str_interp("containers/${uuid}") + url <- paste0(private$host, endPoint) + headers <- list(Authorization = paste("OAuth2", private$token), + "Content-Type" = "application/json") + queryArgs <- NULL + + body <- NULL + + response <- private$REST$http$exec("DELETE", url, headers, body, + queryArgs, private$numRetries) + resource <- private$REST$httpParser$parseJSONResponse(response) + + if(!is.null(resource$errors)) + stop(resource$errors) + + resource + }, + + containers.auth = function(uuid) + { + endPoint <- stringr::str_interp("containers/${uuid}/auth") + url <- paste0(private$host, endPoint) + headers <- list(Authorization = paste("OAuth2", private$token), + "Content-Type" = "application/json") + queryArgs <- NULL + + body <- NULL + + response <- private$REST$http$exec("GET", url, headers, body, + queryArgs, private$numRetries) + resource <- private$REST$httpParser$parseJSONResponse(response) + + if(!is.null(resource$errors)) + stop(resource$errors) + + resource + }, + + containers.lock = function(uuid) + { + endPoint <- stringr::str_interp("containers/${uuid}/lock") + url <- paste0(private$host, endPoint) + headers <- list(Authorization = paste("OAuth2", private$token), + "Content-Type" = "application/json") + queryArgs <- NULL + + body <- NULL + + response <- private$REST$http$exec("POST", url, headers, body, + queryArgs, private$numRetries) + resource <- private$REST$httpParser$parseJSONResponse(response) + + if(!is.null(resource$errors)) + stop(resource$errors) + + resource + }, + + containers.unlock = function(uuid) + { + endPoint <- stringr::str_interp("containers/${uuid}/unlock") + url <- paste0(private$host, endPoint) + headers <- list(Authorization = paste("OAuth2", private$token), + "Content-Type" = "application/json") + queryArgs <- NULL + + body <- NULL + + response <- private$REST$http$exec("POST", url, headers, body, + queryArgs, private$numRetries) + resource <- private$REST$httpParser$parseJSONResponse(response) + + if(!is.null(resource$errors)) + stop(resource$errors) + + resource + }, + + containers.secret_mounts = function(uuid) + { + endPoint <- stringr::str_interp("containers/${uuid}/secret_mounts") + url <- paste0(private$host, endPoint) + headers <- list(Authorization = paste("OAuth2", private$token), + "Content-Type" = "application/json") + queryArgs <- NULL + + body <- NULL + + response <- private$REST$http$exec("GET", url, headers, body, + queryArgs, private$numRetries) + resource <- private$REST$httpParser$parseJSONResponse(response) + + if(!is.null(resource$errors)) + stop(resource$errors) + + resource + }, + + containers.current = function() + { + endPoint <- stringr::str_interp("containers/current") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") @@ -3057,7 +3197,7 @@ Arvados <- R6::R6Class( body <- NULL - response <- private$REST$http$exec("DELETE", url, headers, body, + response <- private$REST$http$exec("GET", url, headers, body, queryArgs, private$numRetries) resource <- private$REST$httpParser$parseJSONResponse(response) @@ -3067,12 +3207,12 @@ Arvados <- R6::R6Class( resource }, - api_clients.list = function(filters = NULL, + containers.list = function(filters = NULL, where = NULL, order = NULL, select = NULL, distinct = NULL, limit = "100", offset = "0", count = "exact") { - endPoint <- stringr::str_interp("api_clients") + endPoint <- stringr::str_interp("containers") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") @@ -3092,9 +3232,9 @@ Arvados <- R6::R6Class( resource }, - api_clients.show = function(uuid) + containers.show = function(uuid) { - endPoint <- stringr::str_interp("api_clients/${uuid}") + endPoint <- stringr::str_interp("containers/${uuid}") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") @@ -3112,9 +3252,9 @@ Arvados <- R6::R6Class( resource }, - api_clients.destroy = function(uuid) + containers.destroy = function(uuid) { - endPoint <- stringr::str_interp("api_clients/${uuid}") + endPoint <- stringr::str_interp("containers/${uuid}") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") @@ -3132,9 +3272,9 @@ Arvados <- R6::R6Class( resource }, - container_requests.get = function(uuid) + api_clients.get = function(uuid) { - endPoint <- stringr::str_interp("container_requests/${uuid}") + endPoint <- stringr::str_interp("api_clients/${uuid}") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") @@ -3152,12 +3292,12 @@ Arvados <- R6::R6Class( resource }, - container_requests.index = function(filters = NULL, + api_clients.index = function(filters = NULL, where = NULL, order = NULL, select = NULL, distinct = NULL, limit = "100", offset = "0", count = "exact") { - endPoint <- stringr::str_interp("container_requests") + endPoint <- stringr::str_interp("api_clients") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") @@ -3177,17 +3317,16 @@ Arvados <- R6::R6Class( resource }, - container_requests.create = function(containerrequest, - ensure_unique_name = "false") + api_clients.create = function(apiclient, ensure_unique_name = "false") { - endPoint <- stringr::str_interp("container_requests") + endPoint <- stringr::str_interp("api_clients") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") queryArgs <- list(ensure_unique_name = ensure_unique_name) - if(length(containerrequest) > 0) - body <- jsonlite::toJSON(list(containerrequest = containerrequest), + if(length(apiclient) > 0) + body <- jsonlite::toJSON(list(apiclient = apiclient), auto_unbox = TRUE) else body <- NULL @@ -3202,16 +3341,16 @@ Arvados <- R6::R6Class( resource }, - container_requests.update = function(containerrequest, uuid) + api_clients.update = function(apiclient, uuid) { - endPoint <- stringr::str_interp("container_requests/${uuid}") + endPoint <- stringr::str_interp("api_clients/${uuid}") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") queryArgs <- NULL - if(length(containerrequest) > 0) - body <- jsonlite::toJSON(list(containerrequest = containerrequest), + if(length(apiclient) > 0) + body <- jsonlite::toJSON(list(apiclient = apiclient), auto_unbox = TRUE) else body <- NULL @@ -3226,9 +3365,9 @@ Arvados <- R6::R6Class( resource }, - container_requests.delete = function(uuid) + api_clients.delete = function(uuid) { - endPoint <- stringr::str_interp("container_requests/${uuid}") + endPoint <- stringr::str_interp("api_clients/${uuid}") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") @@ -3246,12 +3385,12 @@ Arvados <- R6::R6Class( resource }, - container_requests.list = function(filters = NULL, + api_clients.list = function(filters = NULL, where = NULL, order = NULL, select = NULL, distinct = NULL, limit = "100", offset = "0", count = "exact") { - endPoint <- stringr::str_interp("container_requests") + endPoint <- stringr::str_interp("api_clients") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") @@ -3271,9 +3410,9 @@ Arvados <- R6::R6Class( resource }, - container_requests.show = function(uuid) + api_clients.show = function(uuid) { - endPoint <- stringr::str_interp("container_requests/${uuid}") + endPoint <- stringr::str_interp("api_clients/${uuid}") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") @@ -3291,9 +3430,9 @@ Arvados <- R6::R6Class( resource }, - container_requests.destroy = function(uuid) + api_clients.destroy = function(uuid) { - endPoint <- stringr::str_interp("container_requests/${uuid}") + endPoint <- stringr::str_interp("api_clients/${uuid}") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") @@ -3490,9 +3629,9 @@ Arvados <- R6::R6Class( resource }, - collections.get = function(uuid) + container_requests.get = function(uuid) { - endPoint <- stringr::str_interp("collections/${uuid}") + endPoint <- stringr::str_interp("container_requests/${uuid}") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") @@ -3510,19 +3649,18 @@ Arvados <- R6::R6Class( resource }, - collections.index = function(filters = NULL, + container_requests.index = function(filters = NULL, where = NULL, order = NULL, select = NULL, distinct = NULL, limit = "100", offset = "0", - count = "exact", include_trash = NULL) + count = "exact") { - endPoint <- stringr::str_interp("collections") + endPoint <- stringr::str_interp("container_requests") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") queryArgs <- list(filters = filters, where = where, order = order, select = select, distinct = distinct, - limit = limit, offset = offset, count = count, - include_trash = include_trash) + limit = limit, offset = offset, count = count) body <- NULL @@ -3536,16 +3674,17 @@ Arvados <- R6::R6Class( resource }, - collections.create = function(collection, ensure_unique_name = "false") + container_requests.create = function(containerrequest, + ensure_unique_name = "false") { - endPoint <- stringr::str_interp("collections") + endPoint <- stringr::str_interp("container_requests") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") queryArgs <- list(ensure_unique_name = ensure_unique_name) - if(length(collection) > 0) - body <- jsonlite::toJSON(list(collection = collection), + if(length(containerrequest) > 0) + body <- jsonlite::toJSON(list(containerrequest = containerrequest), auto_unbox = TRUE) else body <- NULL @@ -3560,16 +3699,16 @@ Arvados <- R6::R6Class( resource }, - collections.update = function(collection, uuid) + container_requests.update = function(containerrequest, uuid) { - endPoint <- stringr::str_interp("collections/${uuid}") + endPoint <- stringr::str_interp("container_requests/${uuid}") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") queryArgs <- NULL - if(length(collection) > 0) - body <- jsonlite::toJSON(list(collection = collection), + if(length(containerrequest) > 0) + body <- jsonlite::toJSON(list(containerrequest = containerrequest), auto_unbox = TRUE) else body <- NULL @@ -3584,9 +3723,9 @@ Arvados <- R6::R6Class( resource }, - collections.delete = function(uuid) + container_requests.delete = function(uuid) { - endPoint <- stringr::str_interp("collections/${uuid}") + endPoint <- stringr::str_interp("container_requests/${uuid}") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") @@ -3604,99 +3743,18 @@ Arvados <- R6::R6Class( resource }, - collections.provenance = function(uuid) - { - endPoint <- stringr::str_interp("collections/${uuid}/provenance") - url <- paste0(private$host, endPoint) - headers <- list(Authorization = paste("OAuth2", private$token), - "Content-Type" = "application/json") - queryArgs <- NULL - - body <- NULL - - response <- private$REST$http$exec("GET", url, headers, body, - queryArgs, private$numRetries) - resource <- private$REST$httpParser$parseJSONResponse(response) - - if(!is.null(resource$errors)) - stop(resource$errors) - - resource - }, - - collections.used_by = function(uuid) - { - endPoint <- stringr::str_interp("collections/${uuid}/used_by") - url <- paste0(private$host, endPoint) - headers <- list(Authorization = paste("OAuth2", private$token), - "Content-Type" = "application/json") - queryArgs <- NULL - - body <- NULL - - response <- private$REST$http$exec("GET", url, headers, body, - queryArgs, private$numRetries) - resource <- private$REST$httpParser$parseJSONResponse(response) - - if(!is.null(resource$errors)) - stop(resource$errors) - - resource - }, - - collections.trash = function(uuid) - { - endPoint <- stringr::str_interp("collections/${uuid}/trash") - url <- paste0(private$host, endPoint) - headers <- list(Authorization = paste("OAuth2", private$token), - "Content-Type" = "application/json") - queryArgs <- NULL - - body <- NULL - - response <- private$REST$http$exec("POST", url, headers, body, - queryArgs, private$numRetries) - resource <- private$REST$httpParser$parseJSONResponse(response) - - if(!is.null(resource$errors)) - stop(resource$errors) - - resource - }, - - collections.untrash = function(uuid) - { - endPoint <- stringr::str_interp("collections/${uuid}/untrash") - url <- paste0(private$host, endPoint) - headers <- list(Authorization = paste("OAuth2", private$token), - "Content-Type" = "application/json") - queryArgs <- NULL - - body <- NULL - - response <- private$REST$http$exec("POST", url, headers, body, - queryArgs, private$numRetries) - resource <- private$REST$httpParser$parseJSONResponse(response) - - if(!is.null(resource$errors)) - stop(resource$errors) - - resource - }, - - collections.list = function(filters = NULL, + container_requests.list = function(filters = NULL, where = NULL, order = NULL, select = NULL, distinct = NULL, limit = "100", offset = "0", - count = "exact", include_trash = NULL) + count = "exact") { - endPoint <- stringr::str_interp("collections") + endPoint <- stringr::str_interp("container_requests") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") queryArgs <- list(filters = filters, where = where, order = order, select = select, distinct = distinct, - limit = limit, offset = offset, count = count, - include_trash = include_trash) + limit = limit, offset = offset, count = count) body <- NULL @@ -3710,9 +3768,9 @@ Arvados <- R6::R6Class( resource }, - collections.show = function(uuid) + container_requests.show = function(uuid) { - endPoint <- stringr::str_interp("collections/${uuid}") + endPoint <- stringr::str_interp("container_requests/${uuid}") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") @@ -3730,9 +3788,9 @@ Arvados <- R6::R6Class( resource }, - collections.destroy = function(uuid) + container_requests.destroy = function(uuid) { - endPoint <- stringr::str_interp("collections/${uuid}") + endPoint <- stringr::str_interp("container_requests/${uuid}") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") @@ -3750,9 +3808,9 @@ Arvados <- R6::R6Class( resource }, - containers.get = function(uuid) + collections.get = function(uuid) { - endPoint <- stringr::str_interp("containers/${uuid}") + endPoint <- stringr::str_interp("collections/${uuid}") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") @@ -3770,18 +3828,19 @@ Arvados <- R6::R6Class( resource }, - containers.index = function(filters = NULL, + collections.index = function(filters = NULL, where = NULL, order = NULL, select = NULL, distinct = NULL, limit = "100", offset = "0", - count = "exact") + count = "exact", include_trash = NULL) { - endPoint <- stringr::str_interp("containers") + endPoint <- stringr::str_interp("collections") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") queryArgs <- list(filters = filters, where = where, order = order, select = select, distinct = distinct, - limit = limit, offset = offset, count = count) + limit = limit, offset = offset, count = count, + include_trash = include_trash) body <- NULL @@ -3795,16 +3854,16 @@ Arvados <- R6::R6Class( resource }, - containers.create = function(container, ensure_unique_name = "false") + collections.create = function(collection, ensure_unique_name = "false") { - endPoint <- stringr::str_interp("containers") + endPoint <- stringr::str_interp("collections") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") queryArgs <- list(ensure_unique_name = ensure_unique_name) - if(length(container) > 0) - body <- jsonlite::toJSON(list(container = container), + if(length(collection) > 0) + body <- jsonlite::toJSON(list(collection = collection), auto_unbox = TRUE) else body <- NULL @@ -3819,16 +3878,16 @@ Arvados <- R6::R6Class( resource }, - containers.update = function(container, uuid) + collections.update = function(collection, uuid) { - endPoint <- stringr::str_interp("containers/${uuid}") + endPoint <- stringr::str_interp("collections/${uuid}") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") queryArgs <- NULL - if(length(container) > 0) - body <- jsonlite::toJSON(list(container = container), + if(length(collection) > 0) + body <- jsonlite::toJSON(list(collection = collection), auto_unbox = TRUE) else body <- NULL @@ -3843,9 +3902,9 @@ Arvados <- R6::R6Class( resource }, - containers.delete = function(uuid) + collections.delete = function(uuid) { - endPoint <- stringr::str_interp("containers/${uuid}") + endPoint <- stringr::str_interp("collections/${uuid}") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") @@ -3863,9 +3922,9 @@ Arvados <- R6::R6Class( resource }, - containers.auth = function(uuid) + collections.provenance = function(uuid) { - endPoint <- stringr::str_interp("containers/${uuid}/auth") + endPoint <- stringr::str_interp("collections/${uuid}/provenance") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") @@ -3883,9 +3942,9 @@ Arvados <- R6::R6Class( resource }, - containers.lock = function(uuid) + collections.used_by = function(uuid) { - endPoint <- stringr::str_interp("containers/${uuid}/lock") + endPoint <- stringr::str_interp("collections/${uuid}/used_by") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") @@ -3893,7 +3952,7 @@ Arvados <- R6::R6Class( body <- NULL - response <- private$REST$http$exec("POST", url, headers, body, + response <- private$REST$http$exec("GET", url, headers, body, queryArgs, private$numRetries) resource <- private$REST$httpParser$parseJSONResponse(response) @@ -3903,9 +3962,9 @@ Arvados <- R6::R6Class( resource }, - containers.unlock = function(uuid) + collections.trash = function(uuid) { - endPoint <- stringr::str_interp("containers/${uuid}/unlock") + endPoint <- stringr::str_interp("collections/${uuid}/trash") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") @@ -3923,9 +3982,9 @@ Arvados <- R6::R6Class( resource }, - containers.current = function() + collections.untrash = function(uuid) { - endPoint <- stringr::str_interp("containers/current") + endPoint <- stringr::str_interp("collections/${uuid}/untrash") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") @@ -3933,7 +3992,7 @@ Arvados <- R6::R6Class( body <- NULL - response <- private$REST$http$exec("GET", url, headers, body, + response <- private$REST$http$exec("POST", url, headers, body, queryArgs, private$numRetries) resource <- private$REST$httpParser$parseJSONResponse(response) @@ -3943,18 +4002,19 @@ Arvados <- R6::R6Class( resource }, - containers.list = function(filters = NULL, + collections.list = function(filters = NULL, where = NULL, order = NULL, select = NULL, distinct = NULL, limit = "100", offset = "0", - count = "exact") + count = "exact", include_trash = NULL) { - endPoint <- stringr::str_interp("containers") + endPoint <- stringr::str_interp("collections") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") queryArgs <- list(filters = filters, where = where, order = order, select = select, distinct = distinct, - limit = limit, offset = offset, count = count) + limit = limit, offset = offset, count = count, + include_trash = include_trash) body <- NULL @@ -3968,9 +4028,9 @@ Arvados <- R6::R6Class( resource }, - containers.show = function(uuid) + collections.show = function(uuid) { - endPoint <- stringr::str_interp("containers/${uuid}") + endPoint <- stringr::str_interp("collections/${uuid}") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") @@ -3988,9 +4048,9 @@ Arvados <- R6::R6Class( resource }, - containers.destroy = function(uuid) + collections.destroy = function(uuid) { - endPoint <- stringr::str_interp("containers/${uuid}") + endPoint <- stringr::str_interp("collections/${uuid}") url <- paste0(private$host, endPoint) headers <- list(Authorization = paste("OAuth2", private$token), "Content-Type" = "application/json") diff --git a/sdk/R/R/autoGenAPI.R b/sdk/R/R/autoGenAPI.R index 4636be0855..8dadd75cda 100644 --- a/sdk/R/R/autoGenAPI.R +++ b/sdk/R/R/autoGenAPI.R @@ -17,11 +17,13 @@ generateAPI <- function() doc <- generateMethodsDocumentation(methodResources, resourceNames) arvadosAPIHeader <- generateAPIClassHeader() + arvadosProjectMethods <- generateProjectMethods() arvadosClassMethods <- generateClassContent(methodResources, resourceNames) arvadosAPIFooter <- generateAPIClassFooter() arvadosClass <- c(doc, arvadosAPIHeader, + arvadosProjectMethods, arvadosClassMethods, arvadosAPIFooter) @@ -66,6 +68,42 @@ generateAPIClassHeader <- function() "\t\t},\n") } +generateProjectMethods <- function() +{ + c("\t\tproject.get = function(uuid)", + "\t\t{", + "\t\t\tself$groups.get(uuid)", + "\t\t},", + "", + "\t\tproject.create = function(group, ensure_unique_name = \"false\")", + "\t\t{", + "\t\t\tgroup <- c(\"group_class\" = \"project\", group)", + "\t\t\tself$groups.create(group, ensure_unique_name)", + "\t\t},", + "", + "\t\tproject.update = function(group, uuid)", + "\t\t{", + "\t\t\tgroup <- c(\"group_class\" = \"project\", group)", + "\t\t\tself$groups.update(group, uuid)", + "\t\t},", + "", + "\t\tproject.list = function(filters = NULL, where = NULL,", + "\t\t\torder = NULL, select = NULL, distinct = NULL,", + "\t\t\tlimit = \"100\", offset = \"0\", count = \"exact\",", + "\t\t\tinclude_trash = NULL)", + "\t\t{", + "\t\t\tfilters[[length(filters) + 1]] <- list(\"group_class\", \"=\", \"project\")", + "\t\t\tself$groups.list(filters, where, order, select, distinct,", + "\t\t\t limit, offset, count, include_trash)", + "\t\t},", + "", + "\t\tproject.delete = function(uuid)", + "\t\t{", + "\t\t\tself$groups.delete(uuid)", + "\t\t},", + "") +} + generateClassContent <- function(methodResources, resourceNames) { arvadosMethods <- Map(function(resource, resourceName) @@ -118,8 +156,6 @@ createMethod <- function(name, methodMetaData) "\t\t},\n") } -#TODO: Make sure that arguments that are required always go first. -# This is not the case if request$required is false. getMethodArguments <- function(methodMetaData) { request <- methodMetaData$request @@ -181,7 +217,7 @@ getMethodBody <- function(methodMetaData) request <- getRequest(methodMetaData) response <- getResponse(methodMetaData) errorCheck <- getErrorCheckingCode() - returnStatement <- getReturnObjectValidationCode() + returnStatement <- getReturnObject() body <- c(url, headers, @@ -265,7 +301,7 @@ getErrorCheckingCode <- function() "\tstop(resource$errors)") } -getReturnObjectValidationCode <- function() +getReturnObject <- function() { "resource" } @@ -348,6 +384,8 @@ getMethodDescription <- function(methodMetaData) #NOTE: Utility functions: +# This function is used to split very long lines of code into smaller chunks. +# This is usually the case when we pass a lot of named argumets to a function. formatArgs <- function(prependAtStart, prependToEachSplit, args, appendAtEnd, lineLength) { -- 2.30.2