21700: Install Bundler system-wide in Rails postinst
[arvados.git] / sdk / R / R / Arvados.R
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: Apache-2.0
4
5 #' R6 Class Representing a Arvados
6 #'
7 #' @description
8 #' Arvados class gives users ability to access Arvados REST API. It also allowes user to manipulate collections (and projects?)
9
10 #' @export Arvados
11 Arvados <- R6::R6Class(
12
13     "Arvados",
14
15     public = list(
16
17         #' @description
18         #' Initialize new enviroment.
19         #' @param authToken ARVADOS_API_TOKEN from 'Get API Token' on Arvados.
20         #' @param hostName ARVADOS_API_HOST from 'Get API Token' on Arvados.
21         #' @param numRetries Specify number of times to retry failed service requests.
22         #' @return A new `Arvados` object.
23         #' @examples
24         #' arv <- Arvados$new(authToken = "ARVADOS_API_TOKEN", hostName = "ARVADOS_API_HOST", numRetries = 3)
25         initialize = function(authToken = NULL, hostName = NULL, numRetries = 0)
26         {
27             if(!is.null(hostName))
28                 Sys.setenv(ARVADOS_API_HOST = hostName)
29
30             if(!is.null(authToken))
31                 Sys.setenv(ARVADOS_API_TOKEN = authToken)
32
33             hostName <- Sys.getenv("ARVADOS_API_HOST")
34             token    <- Sys.getenv("ARVADOS_API_TOKEN")
35
36             if(hostName == "" | token == "")
37                 stop(paste("Please provide host name and authentification token",
38                            "or set ARVADOS_API_HOST and ARVADOS_API_TOKEN",
39                            "environment variables."))
40
41             private$token <- token
42             private$host  <- paste0("https://", hostName, "/arvados/v1/")
43             private$numRetries <- numRetries
44             private$REST <- RESTService$new(token, hostName,
45                                             HttpRequest$new(), HttpParser$new(),
46                                             numRetries)
47
48         },
49
50         #' @description
51         #' project_exist enables checking if the project with such a UUID exist.
52         #' @param uuid The UUID of a project or a file.
53         #' @examples
54         #' \dontrun{
55         #' arv$project_exist(uuid = "projectUUID")
56         #' }
57         project_exist = function(uuid)
58         {
59             proj <- self$project_list(list(list("uuid", '=', uuid)))
60             value <- length(proj$items)
61
62             if (value == 1){
63                 cat(format('TRUE'))
64             } else {
65                 cat(format('FALSE'))
66             }
67         },
68
69         #' @description
70         #' project_get returns the demanded project.
71         #' @param uuid The UUID of the Group in question.
72         #' @examples
73         #' \dontrun{
74         #' project <- arv$project_get(uuid = 'projectUUID')
75         #' }
76         project_get = function(uuid)
77         {
78             self$groups_get(uuid)
79         },
80
81         #' @description
82         #' project_create creates a new project of a given name and description.
83         #' @param name Name of the project.
84         #' @param description Description of the project.
85         #' @param ownerUUID The UUID of the maternal project to created one.
86         #' @param properties List of the properties of the project.
87         #' @param ensureUniqueName Adjust name to ensure uniqueness instead of returning an error.
88         #' @examples
89         #' \dontrun{
90         #' Properties <- list() # should contain a list of new properties to be added
91         #' new_project <- arv$project_create(name = "project name", description = "project description", owner_uuid = "project UUID", properties = NULL, ensureUniqueName = "false")
92         #' }
93         project_create = function(name, description, ownerUUID, properties = NULL, ensureUniqueName = "false")
94         {
95             group <- list(name = name, description = description, owner_uuid = ownerUUID, properties = properties)
96             group <- c("group_class" = "project", group)
97             self$groups_create(group, ensureUniqueName =  ensureUniqueName)
98         },
99
100         #' @description
101         #' project_properties_set is a method defined in Arvados class that enables setting properties. Allows to set or overwrite the properties. In case there are set already it overwrites them.
102         #' @param listProperties List of new properties.
103         #' @param uuid The UUID of a project or a file.
104         #' @examples
105         #' \dontrun{
106         #' Properties <- list() # should contain a list of new properties to be added
107         #' arv$project_properties_set(Properties, uuid)
108         #' }
109         project_properties_set = function(listProperties, uuid)
110         {
111             group <- c("group_class" = "project", list("properties" = listProperties))
112             self$groups_update(group, uuid)
113
114         },
115
116         #' @description
117         #' project_properties_append is a method defined in Arvados class that enables appending properties. Allows to add new properties.
118         #' @param properties List of new properties.
119         #' @param uuid The UUID of a project or a file.
120         #' @examples
121         #' \dontrun{
122         #' newProperties <- list() # should contain a list of new properties to be added
123         #' arv$project_properties_append(properties = newProperties, uuid)
124         #' }
125         project_properties_append = function(properties, uuid)
126         {
127             proj <- self$project_list(list(list('uuid', '=', uuid)))
128             projProp <- proj$items[[1]]$properties
129
130             newListOfProperties <- c(projProp, properties)
131             uniqueProperties <- unique(unlist(newListOfProperties))
132             newListOfProperties <- suppressWarnings(newListOfProperties[which(newListOfProperties == uniqueProperties)])
133
134             group <- c("group_class" = "project", list("properties" = newListOfProperties))
135             self$groups_update(group, uuid);
136
137         },
138
139         #' @description
140         #' project_properties_get is a method defined in Arvados class that returns properties.
141         #' @param uuid The UUID of a project or a file.
142         #' @examples
143         #' \dontrun{
144         #' arv$project_properties_get(projectUUID)
145         #' }
146         project_properties_get = function(uuid)
147         {
148             proj <- self$project_list(list(list('uuid', '=', uuid)))
149             proj$items[[1]]$properties
150         },
151
152         #' @description
153         #' project_properties_delete is a method defined in Arvados class that deletes list of properties.
154         #' @param oneProp Property to be deleted.
155         #' @param uuid The UUID of a project or a file.
156         #' @examples
157         #' \dontrun{
158         #' Properties <- list() # should contain a list of new properties to be added
159         #' arv$project_properties_delete(Properties,  projectUUID)
160         #' }
161         project_properties_delete = function(oneProp, uuid)
162         {
163             proj <- self$project_list(list(list('uuid', '=', uuid))) # find project
164             projProp <- proj$items[[1]]$properties
165             for (i in 1:length(projProp)){
166                 solution <- identical(projProp[i],oneProp)
167                 if (solution == TRUE) {
168                     projProp <- projProp[names(projProp) != names(oneProp)]
169                     self$project_properties_set(projProp, uuid)
170                 }
171             }
172         },
173
174         #' @description
175         #' project_update enables updating project. New name, description and properties may be given.
176         #' @param ... Feature to be updated (name, description, properties).
177         #' @param uuid The UUID of a project in question.
178         #' @examples
179         #' \dontrun{
180         #' newProperties <- list() # should contain a list of new properties to be added
181         #' arv$project_update(name = "new project name", properties = newProperties, uuid = projectUUID)
182         #' }
183         project_update = function(..., uuid) {
184             vec <- list(...)
185             for (i in 1:length(vec))
186             {
187                 if (names(vec[i]) == 'properties') {
188                     solution <- self$project_properties_append(vec$properties, uuid = uuid)
189                 }
190             }
191             vecNew <- vec[names(vec) != "properties"]
192             vecNew <- c("group_class" = "project", vecNew)
193             z <- self$groups_update(vecNew, uuid)
194         },
195
196         #' @description
197         #' project_list enables listing project by its name, uuid, properties, permissions.
198         #' @param filters
199         #' @param where
200         #' @param order
201         #' @param distinct
202         #' @param limit
203         #' @param offset
204         #' @param count
205         #' @param includeTrash Include items whose is_trashed attribute is true.
206         #' @param uuid The UUID of a project in question.
207         #' @param recursive Include contents from child groups recursively.
208         #' @examples
209         #' \dontrun{
210         #' listOfprojects <- arv$project_list(list(list("owner_uuid", "=", projectUUID))) # Sample query which show projects within the project of a given UUID
211         #' }
212         project_list = function(filters = NULL, where = NULL,
213                                 order = NULL, select = NULL, distinct = NULL,
214                                 limit = "100", offset = "0", count = "exact",
215                                 includeTrash = NULL)
216         {
217             filters[[length(filters) + 1]] <- list("group_class", "=", "project")
218             self$groups_list(filters, where, order, select, distinct,
219                              limit, offset, count, includeTrash)
220         },
221
222         #' @description
223         #' project_delete trashes project of a given uuid. It can be restored from trash or deleted permanently.
224         #' @param uuid The UUID of the Group in question.
225         #' @examples
226         #' \dontrun{
227         #' arv$project_delete(uuid = 'projectUUID')
228         #' }
229         project_delete = function(uuid)
230         {
231             self$groups_delete(uuid)
232         },
233
234         #' @description
235         #' api_clients_get is a method defined in Arvados class.
236         #' @param uuid The UUID of the apiClient in question.
237         api_clients_get = function(uuid)
238         {
239             endPoint <- stringr::str_interp("api_clients/${uuid}")
240             url <- paste0(private$host, endPoint)
241             headers <- list(Authorization = paste("Bearer", private$token),
242                             "Content-Type" = "application/json")
243             queryArgs <- NULL
244
245             body <- NULL
246
247             response <- private$REST$http$exec("GET", url, headers, body,
248                                                queryArgs, private$numRetries)
249             resource <- private$REST$httpParser$parseJSONResponse(response)
250
251             if(!is.null(resource$errors))
252                 stop(resource$errors)
253
254             resource
255         },
256
257         #' @description
258         #' api_clients_create is a method defined in Arvados class.
259         #' @param apiClient apiClient object.
260         #' @param ensureUniqueName Adjust name to ensure uniqueness instead of returning an error.
261         #' @param clusterID Create object on a remote federated cluster instead of the current one.
262         api_clients_create = function(apiClient,
263                                       ensureUniqueName = "false", clusterID = NULL)
264         {
265             endPoint <- stringr::str_interp("api_clients")
266             url <- paste0(private$host, endPoint)
267             headers <- list(Authorization = paste("Bearer", private$token),
268                             "Content-Type" = "application/json")
269             queryArgs <- list(ensureUniqueName = ensureUniqueName,
270                               clusterID = clusterID)
271
272             if(length(apiClient) > 0)
273                 body <- jsonlite::toJSON(list(apiClient = apiClient),
274                                          auto_unbox = TRUE)
275             else
276                 body <- NULL
277
278             response <- private$REST$http$exec("POST", url, headers, body,
279                                                queryArgs, private$numRetries)
280             resource <- private$REST$httpParser$parseJSONResponse(response)
281
282             if(!is.null(resource$errors))
283                 stop(resource$errors)
284
285             resource
286         },
287
288         #' @description
289         #' api_clients_update is a method defined in Arvados class.
290         #' @param apiClient apiClient object.
291         #' @param uuid The UUID of the apiClient in question.
292         api_clients_update = function(apiClient, uuid)
293         {
294             endPoint <- stringr::str_interp("api_clients/${uuid}")
295             url <- paste0(private$host, endPoint)
296             headers <- list(Authorization = paste("Bearer", private$token),
297                             "Content-Type" = "application/json")
298             queryArgs <- NULL
299
300             if(length(apiClient) > 0)
301                 body <- jsonlite::toJSON(list(apiClient = apiClient),
302                                          auto_unbox = TRUE)
303             else
304                 body <- NULL
305
306             response <- private$REST$http$exec("PUT", url, headers, body,
307                                                queryArgs, private$numRetries)
308             resource <- private$REST$httpParser$parseJSONResponse(response)
309
310             if(!is.null(resource$errors))
311                 stop(resource$errors)
312
313             resource
314         },
315
316         #' @description
317         #' api_clients_delete is a method defined in Arvados class.
318         #' @param uuid The UUID of the apiClient in question.
319         api_clients_delete = function(uuid)
320         {
321             endPoint <- stringr::str_interp("api_clients/${uuid}")
322             url <- paste0(private$host, endPoint)
323             headers <- list(Authorization = paste("Bearer", private$token),
324                             "Content-Type" = "application/json")
325             queryArgs <- NULL
326
327             body <- NULL
328
329             response <- private$REST$http$exec("DELETE", url, headers, body,
330                                                queryArgs, private$numRetries)
331             resource <- private$REST$httpParser$parseJSONResponse(response)
332
333             if(!is.null(resource$errors))
334                 stop(resource$errors)
335
336             resource
337         },
338
339         #' @description
340         #' api_clients_list is a method defined in Arvados class.
341         #' @param filters
342         #' @param where
343         #' @param order
344         #' @param select
345         #' @param distinct
346         #' @param limit
347         #' @param offset
348         #' @param count
349         #' @param clusterID List objects on a remote federated cluster instead of the current one.
350         #' @param bypassFederation Bypass federation behavior, list items from local instance database only.
351         api_clients_list = function(filters = NULL,
352                                     where = NULL, order = NULL, select = NULL,
353                                     distinct = NULL, limit = "100", offset = "0",
354                                     count = "exact", clusterID = NULL, bypassFederation = NULL)
355         {
356             endPoint <- stringr::str_interp("api_clients")
357             url <- paste0(private$host, endPoint)
358             headers <- list(Authorization = paste("Bearer", private$token),
359                             "Content-Type" = "application/json")
360             queryArgs <- list(filters = filters, where = where,
361                               order = order, select = select, distinct = distinct,
362                               limit = limit, offset = offset, count = count,
363                               clusterID = clusterID, bypassFederation = bypassFederation)
364
365             body <- NULL
366
367             response <- private$REST$http$exec("GET", url, headers, body,
368                                                queryArgs, private$numRetries)
369             resource <- private$REST$httpParser$parseJSONResponse(response)
370
371             if(!is.null(resource$errors))
372                 stop(resource$errors)
373
374             resource
375         },
376
377         #' @description
378         #' api_client_authorizations_get is a method defined in Arvados class.
379         #' @param uuid The UUID of the apiClientAuthorization in question.
380         api_client_authorizations_get = function(uuid)
381         {
382             endPoint <- stringr::str_interp("api_client_authorizations/${uuid}")
383             url <- paste0(private$host, endPoint)
384             headers <- list(Authorization = paste("Bearer", private$token),
385                             "Content-Type" = "application/json")
386             queryArgs <- NULL
387
388             body <- NULL
389
390             response <- private$REST$http$exec("GET", url, headers, body,
391                                                queryArgs, private$numRetries)
392             resource <- private$REST$httpParser$parseJSONResponse(response)
393
394             if(!is.null(resource$errors))
395                 stop(resource$errors)
396
397             resource
398         },
399
400         #' @description
401         #' api_client_authorizations_create is a method defined in Arvados class.
402         #' @param apiClientAuthorization apiClientAuthorization object.
403         #' @param ensureUniqueName Adjust name to ensure uniqueness instead of returning an error on (ownerUUID, name) collision_
404         #' @param clusterID Create object on a remote federated cluster instead of the current one.
405         api_client_authorizations_create = function(apiClientAuthorization,
406                                                     ensureUniqueName = "false", clusterID = NULL)
407         {
408             endPoint <- stringr::str_interp("api_client_authorizations")
409             url <- paste0(private$host, endPoint)
410             headers <- list(Authorization = paste("Bearer", private$token),
411                             "Content-Type" = "application/json")
412             queryArgs <- list(ensureUniqueName = ensureUniqueName,
413                               clusterID = clusterID)
414
415             if(length(apiClientAuthorization) > 0)
416                 body <- jsonlite::toJSON(list(apiClientAuthorization = apiClientAuthorization),
417                                          auto_unbox = TRUE)
418             else
419                 body <- NULL
420
421             response <- private$REST$http$exec("POST", url, headers, body,
422                                                queryArgs, private$numRetries)
423             resource <- private$REST$httpParser$parseJSONResponse(response)
424
425             if(!is.null(resource$errors))
426                 stop(resource$errors)
427
428             resource
429         },
430
431         #' @description
432         #' api_client_authorizations_update is a method defined in Arvados class.
433         #' @param apiClientAuthorization apiClientAuthorization object.
434         #' @param uuid The UUID of the apiClientAuthorization in question.
435         api_client_authorizations_update = function(apiClientAuthorization, uuid)
436         {
437             endPoint <- stringr::str_interp("api_client_authorizations/${uuid}")
438             url <- paste0(private$host, endPoint)
439             headers <- list(Authorization = paste("Bearer", private$token),
440                             "Content-Type" = "application/json")
441             queryArgs <- NULL
442
443             if(length(apiClientAuthorization) > 0)
444                 body <- jsonlite::toJSON(list(apiClientAuthorization = apiClientAuthorization),
445                                          auto_unbox = TRUE)
446             else
447                 body <- NULL
448
449             response <- private$REST$http$exec("PUT", url, headers, body,
450                                                queryArgs, private$numRetries)
451             resource <- private$REST$httpParser$parseJSONResponse(response)
452
453             if(!is.null(resource$errors))
454                 stop(resource$errors)
455
456             resource
457         },
458
459         #' @description
460         #' api_client_authorizations_delete is a method defined in Arvados class.
461         #' @param uuid The UUID of the apiClientAuthorization in question.
462         api_client_authorizations_delete = function(uuid)
463         {
464             endPoint <- stringr::str_interp("api_client_authorizations/${uuid}")
465             url <- paste0(private$host, endPoint)
466             headers <- list(Authorization = paste("Bearer", private$token),
467                             "Content-Type" = "application/json")
468             queryArgs <- NULL
469
470             body <- NULL
471
472             response <- private$REST$http$exec("DELETE", url, headers, body,
473                                                queryArgs, private$numRetries)
474             resource <- private$REST$httpParser$parseJSONResponse(response)
475
476             if(!is.null(resource$errors))
477                 stop(resource$errors)
478
479             resource
480         },
481
482         #' @description
483         #' api_client_authorizations_create_system_auth is a method defined in Arvados class.
484         #' @param apiClientID
485         #' @param scopes
486         api_client_authorizations_create_system_auth = function(apiClientID = NULL, scopes = NULL)
487         {
488             endPoint <- stringr::str_interp("api_client_authorizations/create_system_auth")
489             url <- paste0(private$host, endPoint)
490             headers <- list(Authorization = paste("Bearer", private$token),
491                             "Content-Type" = "application/json")
492             queryArgs <- list(apiClientID = apiClientID,
493                               scopes = scopes)
494
495             body <- NULL
496
497             response <- private$REST$http$exec("POST", url, headers, body,
498                                                queryArgs, private$numRetries)
499             resource <- private$REST$httpParser$parseJSONResponse(response)
500
501             if(!is.null(resource$errors))
502                 stop(resource$errors)
503
504             resource
505         },
506
507         #' @description
508         #' api_client_authorizations_current is a method defined in Arvados class.
509         api_client_authorizations_current = function()
510         {
511             endPoint <- stringr::str_interp("api_client_authorizations/current")
512             url <- paste0(private$host, endPoint)
513             headers <- list(Authorization = paste("Bearer", private$token),
514                             "Content-Type" = "application/json")
515             queryArgs <- NULL
516
517             body <- NULL
518
519             response <- private$REST$http$exec("GET", url, headers, body,
520                                                queryArgs, private$numRetries)
521             resource <- private$REST$httpParser$parseJSONResponse(response)
522
523             if(!is.null(resource$errors))
524                 stop(resource$errors)
525
526             resource
527         },
528
529         #' @description
530         #' api_client_authorizations_list is a method defined in Arvados class.
531         #' @param filters
532         #' @param where
533         #' @param order
534         #' @param select
535         #' @param distinct
536         #' @param limit
537         #' @param offset
538         #' @param count
539         #' @param clusterID List objects on a remote federated cluster instead of the current one.
540         #' @param bypassFederation Bypass federation behavior, list items from local instance database only.
541         api_client_authorizations_list = function(filters = NULL,
542                                                   where = NULL, order = NULL, select = NULL,
543                                                   distinct = NULL, limit = "100", offset = "0",
544                                                   count = "exact", clusterID = NULL, bypassFederation = NULL)
545         {
546             endPoint <- stringr::str_interp("api_client_authorizations")
547             url <- paste0(private$host, endPoint)
548             headers <- list(Authorization = paste("Bearer", private$token),
549                             "Content-Type" = "application/json")
550             queryArgs <- list(filters = filters, where = where,
551                               order = order, select = select, distinct = distinct,
552                               limit = limit, offset = offset, count = count,
553                               clusterID = clusterID, bypassFederation = bypassFederation)
554
555             body <- NULL
556
557             response <- private$REST$http$exec("GET", url, headers, body,
558                                                queryArgs, private$numRetries)
559             resource <- private$REST$httpParser$parseJSONResponse(response)
560
561             if(!is.null(resource$errors))
562                 stop(resource$errors)
563
564             resource
565         },
566
567         #' @description
568         #' authorized_keys_get is a method defined in Arvados class.
569         #' @param uuid The UUID of the authorizedKey in question.
570         authorized_keys_get = function(uuid)
571         {
572             endPoint <- stringr::str_interp("authorized_keys/${uuid}")
573             url <- paste0(private$host, endPoint)
574             headers <- list(Authorization = paste("Bearer", private$token),
575                             "Content-Type" = "application/json")
576             queryArgs <- NULL
577
578             body <- NULL
579
580             response <- private$REST$http$exec("GET", url, headers, body,
581                                                queryArgs, private$numRetries)
582             resource <- private$REST$httpParser$parseJSONResponse(response)
583
584             if(!is.null(resource$errors))
585                 stop(resource$errors)
586
587             resource
588         },
589
590         #' @description
591         #' authorized_keys_create is a method defined in Arvados class.
592         #' @param authorizedKey authorizedKey object.
593         #' @param ensureUniqueName Adjust name to ensure uniqueness instead of returning an error.
594         #' @param clusterID Create object on a remote federated cluster instead of the current one.
595         authorized_keys_create = function(authorizedKey,
596                                           ensureUniqueName = "false", clusterID = NULL)
597         {
598             endPoint <- stringr::str_interp("authorized_keys")
599             url <- paste0(private$host, endPoint)
600             headers <- list(Authorization = paste("Bearer", private$token),
601                             "Content-Type" = "application/json")
602             queryArgs <- list(ensureUniqueName = ensureUniqueName,
603                               clusterID = clusterID)
604
605             if(length(authorizedKey) > 0)
606                 body <- jsonlite::toJSON(list(authorizedKey = authorizedKey),
607                                          auto_unbox = TRUE)
608             else
609                 body <- NULL
610
611             response <- private$REST$http$exec("POST", url, headers, body,
612                                                queryArgs, private$numRetries)
613             resource <- private$REST$httpParser$parseJSONResponse(response)
614
615             if(!is.null(resource$errors))
616                 stop(resource$errors)
617
618             resource
619         },
620
621         #' @description
622         #' authorized_keys_update is a method defined in Arvados class.
623         #' @param authorizedKey authorizedKey object.
624         #' @param uuid The UUID of the authorizedKey in question.
625         authorized_keys_update = function(authorizedKey, uuid)
626         {
627             endPoint <- stringr::str_interp("authorized_keys/${uuid}")
628             url <- paste0(private$host, endPoint)
629             headers <- list(Authorization = paste("Bearer", private$token),
630                             "Content-Type" = "application/json")
631             queryArgs <- NULL
632
633             if(length(authorizedKey) > 0)
634                 body <- jsonlite::toJSON(list(authorizedKey = authorizedKey),
635                                          auto_unbox = TRUE)
636             else
637                 body <- NULL
638
639             response <- private$REST$http$exec("PUT", url, headers, body,
640                                                queryArgs, private$numRetries)
641             resource <- private$REST$httpParser$parseJSONResponse(response)
642
643             if(!is.null(resource$errors))
644                 stop(resource$errors)
645
646             resource
647         },
648
649         #' @description
650         #' authorized_keys_delete is a method defined in Arvados class.
651         #' @param uuid The UUID of the authorizedKey in question.
652         authorized_keys_delete = function(uuid)
653         {
654             endPoint <- stringr::str_interp("authorized_keys/${uuid}")
655             url <- paste0(private$host, endPoint)
656             headers <- list(Authorization = paste("Bearer", private$token),
657                             "Content-Type" = "application/json")
658             queryArgs <- NULL
659
660             body <- NULL
661
662             response <- private$REST$http$exec("DELETE", url, headers, body,
663                                                queryArgs, private$numRetries)
664             resource <- private$REST$httpParser$parseJSONResponse(response)
665
666             if(!is.null(resource$errors))
667                 stop(resource$errors)
668
669             resource
670         },
671
672         #' @description
673         #' authorized_keys_list is a method defined in Arvados class.
674         #' @param filters
675         #' @param where
676         #' @param order
677         #' @param select
678         #' @param distinct
679         #' @param limit
680         #' @param offset
681         #' @param count
682         #' @param clusterID List objects on a remote federated cluster instead of the current one.
683         #' @param bypassFederation Bypass federation behavior, list items from local instance database only.
684         authorized_keys_list = function(filters = NULL,
685                                         where = NULL, order = NULL, select = NULL,
686                                         distinct = NULL, limit = "100", offset = "0",
687                                         count = "exact", clusterID = NULL, bypassFederation = NULL)
688         {
689             endPoint <- stringr::str_interp("authorized_keys")
690             url <- paste0(private$host, endPoint)
691             headers <- list(Authorization = paste("Bearer", private$token),
692                             "Content-Type" = "application/json")
693             queryArgs <- list(filters = filters, where = where,
694                               order = order, select = select, distinct = distinct,
695                               limit = limit, offset = offset, count = count,
696                               clusterID = clusterID, bypassFederation = bypassFederation)
697
698             body <- NULL
699
700             response <- private$REST$http$exec("GET", url, headers, body,
701                                                queryArgs, private$numRetries)
702             resource <- private$REST$httpParser$parseJSONResponse(response)
703
704             if(!is.null(resource$errors))
705                 stop(resource$errors)
706
707             resource
708         },
709
710         #' @description
711         #' collections_get is a method defined in Arvados class.
712         #' @param uuid The UUID of the Collection in question.
713         #' @examples
714         #' \dontrun{
715         #' collection <- arv$collections_get(uuid = collectionUUID)
716         #' }
717         collections_get = function(uuid)
718         {
719             endPoint <- stringr::str_interp("collections/${uuid}")
720             url <- paste0(private$host, endPoint)
721             headers <- list(Authorization = paste("Bearer", private$token),
722                             "Content-Type" = "application/json")
723             queryArgs <- NULL
724
725             body <- NULL
726
727             response <- private$REST$http$exec("GET", url, headers, body,
728                                                queryArgs, private$numRetries)
729             resource <- private$REST$httpParser$parseJSONResponse(response)
730
731             if(!is.null(resource$errors))
732                 stop(resource$errors)
733
734             resource
735         },
736
737         #' @description
738         #' collections_create is a method defined in Arvados class that enables collections creation.
739         #' @param name Name of the collection.
740         #' @param description Description of the collection.
741         #' @param ownerUUID UUID of the maternal project to created one.
742         #' @param properties Properties of the collection.
743         #' @param ensureUniqueName Adjust name to ensure uniqueness instead of returning an error.
744         #' @param clusterID Create object on a remote federated cluster instead of the current one.
745         #' @examples
746         #' \dontrun{
747         #' Properties <- list() # should contain a list of new properties to be added
748         #' arv$collections_create(name = "collectionTitle", description = "collectionDescription", ownerUUID = "collectionOwner", properties = Properties)
749         #' }
750         collections_create = function(name, description, ownerUUID = NULL, properties = NULL, # name and description are obligatory
751                                       ensureUniqueName = "false", clusterID = NULL)
752         {
753             endPoint <- stringr::str_interp("collections")
754             url <- paste0(private$host, endPoint)
755             headers <- list(Authorization = paste("Bearer", private$token),
756                             "Content-Type" = "application/json")
757             queryArgs <- list(ensureUniqueName = ensureUniqueName,
758                               clusterID = clusterID)
759
760             collection <- list(name = name, description = description, owner_uuid = ownerUUID, properties = properties)
761             if(length(collection) > 0)
762                 body <- jsonlite::toJSON(list(collection = collection),
763                                          auto_unbox = TRUE)
764             else
765                 body <- NULL
766
767             response <- private$REST$http$exec("POST", url, headers, body,
768                                                queryArgs, private$numRetries)
769             resource <- private$REST$httpParser$parseJSONResponse(response)
770
771             if(!is.null(resource$errors)){
772                 if(identical(sub('Entity:.*',"", resource$errors), "//railsapi.internal/arvados/v1/collections: 422 Unprocessable ")){
773                     resource <- cat(format("A collection with the given name already exists in this projects. If you want to update it use collections_update() instead"))
774                 }else{
775                     stop(resource$errors)
776                 }
777             }
778
779             resource
780         },
781
782         #' @description
783         #' collections_update is a method defined in Arvados class.
784         #' @param name New name of the collection.
785         #' @param description New description of the collection.
786         #' @param ownerUUID UUID of the maternal project to created one.
787         #' @param properties New list of properties of the collection.
788         #' @param uuid The UUID of the Collection in question.
789         #' @examples
790         #' \dontrun{
791         #' collection <- arv$collections_update(name = "newCollectionTitle", description = "newCollectionDescription", ownerUUID = "collectionOwner", properties = NULL, uuid = "collectionUUID")
792         #' }
793         collections_update = function(name, description, ownerUUID = NULL, properties = NULL, uuid)
794         {
795             endPoint <- stringr::str_interp("collections/${uuid}")
796             url <- paste0(private$host, endPoint)
797             headers <- list(Authorization = paste("Bearer", private$token),
798                             "Content-Type" = "application/json")
799             queryArgs <- NULL
800
801             collection <- list(name = name, description = description, ownerUUID = ownerUUID, properties = properties)
802             if(length(collection) > 0)
803                 body <- jsonlite::toJSON(list(collection = collection),
804                                          auto_unbox = TRUE)
805             else
806                 body <- NULL
807
808             response <- private$REST$http$exec("PUT", url, headers, body,
809                                                queryArgs, private$numRetries)
810             resource <- private$REST$httpParser$parseJSONResponse(response)
811
812             if(!is.null(resource$errors))
813                 stop(resource$errors)
814
815             resource
816         },
817
818         #' @description
819         #' collections_delete is a method defined in Arvados class.
820         #' @param uuid The UUID of the Collection in question.
821         #' @examples
822         #' \dontrun{
823         #' arv$collection_delete(collectionUUID)
824         #' }
825         collections_delete = function(uuid)
826         {
827             endPoint <- stringr::str_interp("collections/${uuid}")
828             url <- paste0(private$host, endPoint)
829             headers <- list(Authorization = paste("Bearer", private$token),
830                             "Content-Type" = "application/json")
831             queryArgs <- NULL
832
833             body <- NULL
834
835             response <- private$REST$http$exec("DELETE", url, headers, body,
836                                                queryArgs, private$numRetries)
837             resource <- private$REST$httpParser$parseJSONResponse(response)
838
839             if(!is.null(resource$errors))
840                 stop(resource$errors)
841
842             resource
843         },
844
845         #' @description
846         #' collections_provenance is a method defined in Arvados class, it returns the collection by uuid.
847         #' @param uuid The UUID of the Collection in question.
848         #' @examples
849         #' \dontrun{
850         #' collection <- arv$collections_provenance(collectionUUID)
851         #' }
852         collections_provenance = function(uuid)
853         {
854             endPoint <- stringr::str_interp("collections/${uuid}/provenance")
855             url <- paste0(private$host, endPoint)
856             headers <- list(Authorization = paste("Bearer", private$token),
857                             "Content-Type" = "application/json")
858             queryArgs <- NULL
859
860             body <- NULL
861
862             response <- private$REST$http$exec("GET", url, headers, body,
863                                                queryArgs, private$numRetries)
864             resource <- private$REST$httpParser$parseJSONResponse(response)
865
866             if(!is.null(resource$errors))
867                 stop(resource$errors)
868
869             resource
870         },
871
872         #' @description
873         #' collections_used_by is a method defined in Arvados class, it returns collection by portable_data_hash.
874         #' @param uuid The UUID of the Collection in question.
875         collections_used_by = function(uuid)
876         {
877             endPoint <- stringr::str_interp("collections/${uuid}/used_by")
878             url <- paste0(private$host, endPoint)
879             headers <- list(Authorization = paste("Bearer", private$token),
880                             "Content-Type" = "application/json")
881             queryArgs <- NULL
882
883             body <- NULL
884
885             response <- private$REST$http$exec("GET", url, headers, body,
886                                                queryArgs, private$numRetries)
887             resource <- private$REST$httpParser$parseJSONResponse(response)
888
889             if(!is.null(resource$errors))
890                 stop(resource$errors)
891
892             resource
893         },
894
895         #' @description
896         #' collections_trash is a method defined in Arvados class, it moves collection to trash.
897         #' @param uuid The UUID of the Collection in question.
898         #' @examples
899         #' \dontrun{
900         #' arv$collections_trash(collectionUUID)
901         #' }
902         collections_trash = function(uuid)
903         {
904             endPoint <- stringr::str_interp("collections/${uuid}/trash")
905             url <- paste0(private$host, endPoint)
906             headers <- list(Authorization = paste("Bearer", private$token),
907                             "Content-Type" = "application/json")
908             queryArgs <- NULL
909
910             body <- NULL
911
912             response <- private$REST$http$exec("POST", url, headers, body,
913                                                queryArgs, private$numRetries)
914             resource <- private$REST$httpParser$parseJSONResponse(response)
915
916             if(!is.null(resource$errors))
917                 stop(resource$errors)
918
919             resource
920         },
921
922         #' @description
923         #' collections_untrash is a method defined in Arvados class, it moves collection from trash to project.
924         #' @param uuid The UUID of the Collection in question.
925         #' @examples
926         #' \dontrun{
927         #' arv$collections_untrash(collectionUUID)
928         #' }
929         collections_untrash = function(uuid)
930         {
931             endPoint <- stringr::str_interp("collections/${uuid}/untrash")
932             url <- paste0(private$host, endPoint)
933             headers <- list(Authorization = paste("Bearer", private$token),
934                             "Content-Type" = "application/json")
935             queryArgs <- NULL
936
937             body <- NULL
938
939             response <- private$REST$http$exec("POST", url, headers, body,
940                                                queryArgs, private$numRetries)
941             resource <- private$REST$httpParser$parseJSONResponse(response)
942
943             if(!is.null(resource$errors))
944                 stop(resource$errors)
945
946             resource
947         },
948
949         #' @description
950         #' collections_list is a method defined in Arvados class.
951         #' @param filters
952         #' @param where
953         #' @param order
954         #' @param select
955         #' @param distinct
956         #' @param limit
957         #' @param offset
958         #' @param count
959         #' @param clusterID List objects on a remote federated cluster instead of the current one.
960         #' @param bypassFederation Bypass federation behavior, list items from local instance database only.
961         #' @param includeTrash Include collections whose is_trashed attribute is true.
962         #' @param includeOldVersions Include past collection versions.
963         #' @examples
964         #' \dontrun{
965         #' collectionList <- arv$collections_list(list(list("name", "=", "Example")))
966         #' }
967         collections_list = function(filters = NULL,
968                                     where = NULL, order = NULL, select = NULL,
969                                     distinct = NULL, limit = "100", offset = "0",
970                                     count = "exact", clusterID = NULL, bypassFederation = NULL,
971                                     includeTrash = NULL, includeOldVersions = NULL)
972         {
973             endPoint <- stringr::str_interp("collections")
974             url <- paste0(private$host, endPoint)
975             headers <- list(Authorization = paste("Bearer", private$token),
976                             "Content-Type" = "application/json")
977             queryArgs <- list(filters = filters, where = where,
978                               order = order, select = select, distinct = distinct,
979                               limit = limit, offset = offset, count = count,
980                               clusterID = clusterID, bypassFederation = bypassFederation,
981                               includeTrash = includeTrash, includeOldVersions = includeOldVersions)
982
983             body <- NULL
984
985             response <- private$REST$http$exec("GET", url, headers, body,
986                                                queryArgs, private$numRetries)
987             resource <- private$REST$httpParser$parseJSONResponse(response)
988
989             if(!is.null(resource$errors))
990                 stop(resource$errors)
991
992             resource
993         },
994
995         #' @description
996         #' containers_get is a method defined in Arvados class.
997         #' @param uuid The UUID of the Container in question.
998         containers_get = function(uuid)
999         {
1000             endPoint <- stringr::str_interp("containers/${uuid}")
1001             url <- paste0(private$host, endPoint)
1002             headers <- list(Authorization = paste("Bearer", private$token),
1003                             "Content-Type" = "application/json")
1004             queryArgs <- NULL
1005
1006             body <- NULL
1007
1008             response <- private$REST$http$exec("GET", url, headers, body,
1009                                                queryArgs, private$numRetries)
1010             resource <- private$REST$httpParser$parseJSONResponse(response)
1011
1012             if(!is.null(resource$errors))
1013                 stop(resource$errors)
1014
1015             resource
1016         },
1017
1018         #' @description
1019         #' containers_create is a method defined in Arvados class.
1020         #' @param container Container object.
1021         #' @param ensureUniqueName Adjust name to ensure uniqueness instead of returning an error.
1022         #' @param clusterID Create object on a remote federated cluster instead of the current one.
1023         containers_create = function(container, ensureUniqueName = "false",
1024                                      clusterID = NULL)
1025         {
1026             endPoint <- stringr::str_interp("containers")
1027             url <- paste0(private$host, endPoint)
1028             headers <- list(Authorization = paste("Bearer", private$token),
1029                             "Content-Type" = "application/json")
1030             queryArgs <- list(ensureUniqueName = ensureUniqueName,
1031                               clusterID = clusterID)
1032
1033             if(length(container) > 0)
1034                 body <- jsonlite::toJSON(list(container = container),
1035                                          auto_unbox = TRUE)
1036             else
1037                 body <- NULL
1038
1039             response <- private$REST$http$exec("POST", url, headers, body,
1040                                                queryArgs, private$numRetries)
1041             resource <- private$REST$httpParser$parseJSONResponse(response)
1042
1043             if(!is.null(resource$errors))
1044                 stop(resource$errors)
1045
1046             resource
1047         },
1048
1049         #' @description
1050         #' containers_update is a method defined in Arvados class.
1051         #' @param container Container object.
1052         #' @param uuid The UUID of the Container in question.
1053         containers_update = function(container, uuid)
1054         {
1055             endPoint <- stringr::str_interp("containers/${uuid}")
1056             url <- paste0(private$host, endPoint)
1057             headers <- list(Authorization = paste("Bearer", private$token),
1058                             "Content-Type" = "application/json")
1059             queryArgs <- NULL
1060
1061             if(length(container) > 0)
1062                 body <- jsonlite::toJSON(list(container = container),
1063                                          auto_unbox = TRUE)
1064             else
1065                 body <- NULL
1066
1067             response <- private$REST$http$exec("PUT", url, headers, body,
1068                                                queryArgs, private$numRetries)
1069             resource <- private$REST$httpParser$parseJSONResponse(response)
1070
1071             if(!is.null(resource$errors))
1072                 stop(resource$errors)
1073
1074             resource
1075         },
1076
1077         #' @description
1078         #' containers_delete is a method defined in Arvados class.
1079         #' @param uuid The UUID of the Container in question.
1080         containers_delete = function(uuid)
1081         {
1082             endPoint <- stringr::str_interp("containers/${uuid}")
1083             url <- paste0(private$host, endPoint)
1084             headers <- list(Authorization = paste("Bearer", private$token),
1085                             "Content-Type" = "application/json")
1086             queryArgs <- NULL
1087
1088             body <- NULL
1089
1090             response <- private$REST$http$exec("DELETE", url, headers, body,
1091                                                queryArgs, private$numRetries)
1092             resource <- private$REST$httpParser$parseJSONResponse(response)
1093
1094             if(!is.null(resource$errors))
1095                 stop(resource$errors)
1096
1097             resource
1098         },
1099
1100         #' @description
1101         #' containers_auth is a method defined in Arvados class.
1102         #' @param uuid The UUID of the Container in question.
1103         containers_auth = function(uuid)
1104         {
1105             endPoint <- stringr::str_interp("containers/${uuid}/auth")
1106             url <- paste0(private$host, endPoint)
1107             headers <- list(Authorization = paste("Bearer", private$token),
1108                             "Content-Type" = "application/json")
1109             queryArgs <- NULL
1110
1111             body <- NULL
1112
1113             response <- private$REST$http$exec("GET", url, headers, body,
1114                                                queryArgs, private$numRetries)
1115             resource <- private$REST$httpParser$parseJSONResponse(response)
1116
1117             if(!is.null(resource$errors))
1118                 stop(resource$errors)
1119
1120             resource
1121         },
1122
1123         #' @description
1124         #' containers_lock is a method defined in Arvados class.
1125         #' @param uuid The UUID of the Container in question.
1126         containers_lock = function(uuid)
1127         {
1128             endPoint <- stringr::str_interp("containers/${uuid}/lock")
1129             url <- paste0(private$host, endPoint)
1130             headers <- list(Authorization = paste("Bearer", private$token),
1131                             "Content-Type" = "application/json")
1132             queryArgs <- NULL
1133
1134             body <- NULL
1135
1136             response <- private$REST$http$exec("POST", url, headers, body,
1137                                                queryArgs, private$numRetries)
1138             resource <- private$REST$httpParser$parseJSONResponse(response)
1139
1140             if(!is.null(resource$errors))
1141                 stop(resource$errors)
1142
1143             resource
1144         },
1145
1146         #' @description
1147         #' containers_unlock is a method defined in Arvados class.
1148         #' @param uuid The UUID of the Container in question.
1149         containers_unlock = function(uuid)
1150         {
1151             endPoint <- stringr::str_interp("containers/${uuid}/unlock")
1152             url <- paste0(private$host, endPoint)
1153             headers <- list(Authorization = paste("Bearer", private$token),
1154                             "Content-Type" = "application/json")
1155             queryArgs <- NULL
1156
1157             body <- NULL
1158
1159             response <- private$REST$http$exec("POST", url, headers, body,
1160                                                queryArgs, private$numRetries)
1161             resource <- private$REST$httpParser$parseJSONResponse(response)
1162
1163             if(!is.null(resource$errors))
1164                 stop(resource$errors)
1165
1166             resource
1167         },
1168
1169         #' @description
1170         #' containers_secret_mounts is a method defined in Arvados class.
1171         #' @param uuid The UUID of the Container in question.
1172         containers_secret_mounts = function(uuid)
1173         {
1174             endPoint <- stringr::str_interp("containers/${uuid}/secret_mounts")
1175             url <- paste0(private$host, endPoint)
1176             headers <- list(Authorization = paste("Bearer", private$token),
1177                             "Content-Type" = "application/json")
1178             queryArgs <- NULL
1179
1180             body <- NULL
1181
1182             response <- private$REST$http$exec("GET", url, headers, body,
1183                                                queryArgs, private$numRetries)
1184             resource <- private$REST$httpParser$parseJSONResponse(response)
1185
1186             if(!is.null(resource$errors))
1187                 stop(resource$errors)
1188
1189             resource
1190         },
1191
1192         #' @description
1193         #' containers_current is a method defined in Arvados class.
1194         containers_current = function()
1195         {
1196             endPoint <- stringr::str_interp("containers/current")
1197             url <- paste0(private$host, endPoint)
1198             headers <- list(Authorization = paste("Bearer", private$token),
1199                             "Content-Type" = "application/json")
1200             queryArgs <- NULL
1201
1202             body <- NULL
1203
1204             response <- private$REST$http$exec("GET", url, headers, body,
1205                                                queryArgs, private$numRetries)
1206             resource <- private$REST$httpParser$parseJSONResponse(response)
1207
1208             if(!is.null(resource$errors))
1209                 stop(resource$errors)
1210
1211             resource
1212         },
1213
1214         #' @description
1215         #' containers_list is a method defined in Arvados class.
1216         #' @param filters
1217         #' @param where
1218         #' @param order
1219         #' @param select
1220         #' @param distinct
1221         #' @param limit
1222         #' @param offset
1223         #' @param count
1224         #' @param clusterID List objects on a remote federated cluster instead of the current one.
1225         #' @param bypassFederation Bypass federation behavior, list items from local instance database only.
1226         containers_list = function(filters = NULL,
1227                                    where = NULL, order = NULL, select = NULL,
1228                                    distinct = NULL, limit = "100", offset = "0",
1229                                    count = "exact", clusterID = NULL, bypassFederation = NULL)
1230         {
1231             endPoint <- stringr::str_interp("containers")
1232             url <- paste0(private$host, endPoint)
1233             headers <- list(Authorization = paste("Bearer", private$token),
1234                             "Content-Type" = "application/json")
1235             queryArgs <- list(filters = filters, where = where,
1236                               order = order, select = select, distinct = distinct,
1237                               limit = limit, offset = offset, count = count,
1238                               clusterID = clusterID, bypassFederation = bypassFederation)
1239
1240             body <- NULL
1241
1242             response <- private$REST$http$exec("GET", url, headers, body,
1243                                                queryArgs, private$numRetries)
1244             resource <- private$REST$httpParser$parseJSONResponse(response)
1245
1246             if(!is.null(resource$errors))
1247                 stop(resource$errors)
1248
1249             resource
1250         },
1251
1252         #' @description
1253         #' container_requests_get is a method defined in Arvados class.
1254         #' @param uuid The UUID of the containerRequest in question.
1255         container_requests_get = function(uuid)
1256         {
1257             endPoint <- stringr::str_interp("container_requests/${uuid}")
1258             url <- paste0(private$host, endPoint)
1259             headers <- list(Authorization = paste("Bearer", private$token),
1260                             "Content-Type" = "application/json")
1261             queryArgs <- NULL
1262
1263             body <- NULL
1264
1265             response <- private$REST$http$exec("GET", url, headers, body,
1266                                                queryArgs, private$numRetries)
1267             resource <- private$REST$httpParser$parseJSONResponse(response)
1268
1269             if(!is.null(resource$errors))
1270                 stop(resource$errors)
1271
1272             resource
1273         },
1274
1275         #' @description
1276         #' container_requests_create is a method defined in Arvados class.
1277         #' @param containerRequest containerRequest object.
1278         #' @param ensureUniqueName Adjust name to ensure uniqueness instead of returning an error.
1279         #' @param clusterID Create object on a remote federated cluster instead of the current one.
1280         container_requests_create = function(containerRequest,
1281                                              ensureUniqueName = "false", clusterID = NULL)
1282         {
1283             endPoint <- stringr::str_interp("container_requests")
1284             url <- paste0(private$host, endPoint)
1285             headers <- list(Authorization = paste("Bearer", private$token),
1286                             "Content-Type" = "application/json")
1287             queryArgs <- list(ensureUniqueName = ensureUniqueName,
1288                               clusterID = clusterID)
1289
1290             if(length(containerRequest) > 0)
1291                 body <- jsonlite::toJSON(list(containerRequest = containerRequest),
1292                                          auto_unbox = TRUE)
1293             else
1294                 body <- NULL
1295
1296             response <- private$REST$http$exec("POST", url, headers, body,
1297                                                queryArgs, private$numRetries)
1298             resource <- private$REST$httpParser$parseJSONResponse(response)
1299
1300             if(!is.null(resource$errors))
1301                 stop(resource$errors)
1302
1303             resource
1304         },
1305
1306         #' @description
1307         #' container_requests_update is a method defined in Arvados class.
1308         #' @param containerRequest containerRequest object.
1309         #' @param uuid The UUID of the containerRequest in question.
1310         container_requests_update = function(containerRequest, uuid)
1311         {
1312             endPoint <- stringr::str_interp("container_requests/${uuid}")
1313             url <- paste0(private$host, endPoint)
1314             headers <- list(Authorization = paste("Bearer", private$token),
1315                             "Content-Type" = "application/json")
1316             queryArgs <- NULL
1317
1318             if(length(containerRequest) > 0)
1319                 body <- jsonlite::toJSON(list(containerRequest = containerRequest),
1320                                          auto_unbox = TRUE)
1321             else
1322                 body <- NULL
1323
1324             response <- private$REST$http$exec("PUT", url, headers, body,
1325                                                queryArgs, private$numRetries)
1326             resource <- private$REST$httpParser$parseJSONResponse(response)
1327
1328             if(!is.null(resource$errors))
1329                 stop(resource$errors)
1330
1331             resource
1332         },
1333
1334         #' @description
1335         #' container_requests_delete is a method defined in Arvados class.
1336         #' @param uuid The UUID of the containerRequest in question.
1337         container_requests_delete = function(uuid)
1338         {
1339             endPoint <- stringr::str_interp("container_requests/${uuid}")
1340             url <- paste0(private$host, endPoint)
1341             headers <- list(Authorization = paste("Bearer", private$token),
1342                             "Content-Type" = "application/json")
1343             queryArgs <- NULL
1344
1345             body <- NULL
1346
1347             response <- private$REST$http$exec("DELETE", url, headers, body,
1348                                                queryArgs, private$numRetries)
1349             resource <- private$REST$httpParser$parseJSONResponse(response)
1350
1351             if(!is.null(resource$errors))
1352                 stop(resource$errors)
1353
1354             resource
1355         },
1356
1357         #' @description
1358         #' container_requests_list is a method defined in Arvados class.
1359         #' @param filters
1360         #' @param where
1361         #' @param order
1362         #' @param select
1363         #' @param distinct
1364         #' @param limit
1365         #' @param offset
1366         #' @param count
1367         #' @param clusterID List objects on a remote federated cluster instead of the current one.
1368         #' @param bypassFederation bypass federation behavior, list items from local instance database only
1369         #' @param includeTrash Include container requests whose owner project is trashed.
1370         container_requests_list = function(filters = NULL,
1371                                            where = NULL, order = NULL, select = NULL,
1372                                            distinct = NULL, limit = "100", offset = "0",
1373                                            count = "exact", clusterID = NULL, bypassFederation = NULL,
1374                                            includeTrash = NULL)
1375         {
1376             endPoint <- stringr::str_interp("container_requests")
1377             url <- paste0(private$host, endPoint)
1378             headers <- list(Authorization = paste("Bearer", private$token),
1379                             "Content-Type" = "application/json")
1380             queryArgs <- list(filters = filters, where = where,
1381                               order = order, select = select, distinct = distinct,
1382                               limit = limit, offset = offset, count = count,
1383                               clusterID = clusterID, bypassFederation = bypassFederation,
1384                               includeTrash = includeTrash)
1385
1386             body <- NULL
1387
1388             response <- private$REST$http$exec("GET", url, headers, body,
1389                                                queryArgs, private$numRetries)
1390             resource <- private$REST$httpParser$parseJSONResponse(response)
1391
1392             if(!is.null(resource$errors))
1393                 stop(resource$errors)
1394
1395             resource
1396         },
1397
1398         #' @description
1399         #' groups_get is a method defined in Arvados class.
1400         #' @param uuid The UUID of the Group in question.
1401         groups_get = function(uuid)
1402         {
1403             endPoint <- stringr::str_interp("groups/${uuid}")
1404             url <- paste0(private$host, endPoint)
1405             headers <- list(Authorization = paste("Bearer", private$token),
1406                             "Content-Type" = "application/json")
1407
1408             queryArgs <- NULL
1409
1410             body <- NULL
1411
1412             response <- private$REST$http$exec("GET", url, headers, body,
1413                                                queryArgs, private$numRetries)
1414             resource <- private$REST$httpParser$parseJSONResponse(response)
1415
1416             if(!is.null(resource$errors))
1417                 stop(resource$errors)
1418
1419             resource
1420         },
1421
1422         #' @description
1423         #' groups_create is a method defined in Arvados class that supports project creation.
1424         #' @param group Group object.
1425         #' @param ensureUniqueName Adjust name to ensure uniqueness instead of returning an error.
1426         #' @param clusterID Create object on a remote federated cluster instead of the current one.
1427         #' @param async Defer permissions update.
1428         groups_create = function(group, ensureUniqueName = "false",
1429                                  clusterID = NULL, async = "false")
1430         {
1431             endPoint <- stringr::str_interp("groups")
1432             url <- paste0(private$host, endPoint)
1433             headers <- list(Authorization = paste("Bearer", private$token),
1434                             "Content-Type" = "application/json")
1435
1436             queryArgs <- list(ensureUniqueName = ensureUniqueName,
1437                               clusterID = clusterID, async = async)
1438
1439             if(length(group) > 0)
1440                 body <- jsonlite::toJSON(list(group = group),
1441                                          auto_unbox = TRUE)
1442             else
1443                 body <- NULL
1444
1445             response <- private$REST$http$exec("POST", url, headers, body,
1446                                                queryArgs, private$numRetries)
1447
1448             resource <- private$REST$httpParser$parseJSONResponse(response)
1449
1450             if(!is.null(resource$errors)){
1451                 if (identical(sub('#.*', "", resource$errors), "//railsapi.internal/arvados/v1/groups: 422 Unprocessable Entity: ")) {
1452                 #if (identical(sub('P.*', "", resource$errors), "//railsapi.internal/arvados/v1/groups: 422 Unprocessable Entity: #\u003cActiveRecord::RecordNotUnique: ")) {
1453                     resource <- cat(format("Project of that name already exist. If you want to update it use project_update() instead"))
1454                 }else{
1455                     stop(resource$errors)
1456                 }
1457             }
1458
1459             return(resource)
1460         },
1461
1462         #' @description
1463         #' groups_update is a method defined in Arvados class.
1464         #' @param group Group object.
1465         #' @param uuid The UUID of the Group in question.
1466         #' @param async Defer permissions update.
1467         groups_update = function(group, uuid, async = "false")
1468         {
1469             endPoint <- stringr::str_interp("groups/${uuid}")
1470             url <- paste0(private$host, endPoint)
1471             headers <- list(Authorization = paste("Bearer", private$token),
1472                             "Content-Type" = "application/json")
1473
1474             queryArgs <- list(async = async)
1475
1476             if(length(group) > 0)
1477                 body <- jsonlite::toJSON(list(group = group),
1478                                          auto_unbox = TRUE)
1479             else
1480                 body <- NULL
1481
1482             response <- private$REST$http$exec("PUT", url, headers, body,
1483                                                queryArgs, private$numRetries)
1484             resource <- private$REST$httpParser$parseJSONResponse(response)
1485
1486             if(!is.null(resource$errors))
1487                 stop(resource$errors)
1488
1489             resource
1490         },
1491
1492         #' @description
1493         #' groups_delete is a method defined in Arvados class.
1494         #' @param uuid The UUID of the Group in question.
1495         groups_delete = function(uuid)
1496         {
1497             endPoint <- stringr::str_interp("groups/${uuid}")
1498             url <- paste0(private$host, endPoint)
1499             headers <- list(Authorization = paste("Bearer", private$token),
1500                             "Content-Type" = "application/json")
1501
1502             queryArgs <- NULL
1503
1504             body <- NULL
1505
1506             response <- private$REST$http$exec("DELETE", url, headers, body,
1507                                                queryArgs, private$numRetries)
1508             resource <- private$REST$httpParser$parseJSONResponse(response)
1509
1510             if(!is.null(resource$errors))
1511                 stop(resource$errors)
1512
1513             dataTime <- gsub("T.*", "", resource$delete_at)
1514             cat("The content will be deleted permanently at", dataTime)
1515
1516             resource
1517         },
1518
1519         #' @description
1520         #' groups_contents is a method defined in Arvados class.
1521         #' @param filters
1522         #' @param where
1523         #' @param order
1524         #' @param distinct
1525         #' @param limit
1526         #' @param offset
1527         #' @param count
1528         #' @param clusterID List objects on a remote federated cluster instead of the current one.
1529         #' @param bypassFederation Bypass federation behavior, list items from local instance database only.
1530         #' @param includeTrash Include items whose is_trashed attribute is true.
1531         #' @param uuid
1532         #' @param recursive Include contents from child groups recursively.
1533         #' @param include Include objects referred to by listed field in "included" (only ownerUUID).
1534         groups_contents = function(filters = NULL,
1535                                    where = NULL, order = NULL, distinct = NULL,
1536                                    limit = "100", offset = "0", count = "exact",
1537                                    clusterID = NULL, bypassFederation = NULL,
1538                                    includeTrash = NULL, uuid = NULL, recursive = NULL,
1539                                    include = NULL)
1540         {
1541             endPoint <- stringr::str_interp("groups/contents")
1542             url <- paste0(private$host, endPoint)
1543             headers <- list(Authorization = paste("Bearer", private$token),
1544                             "Content-Type" = "application/json")
1545
1546             queryArgs <- list(filters = filters, where = where,
1547                               order = order, distinct = distinct, limit = limit,
1548                               offset = offset, count = count, clusterID = clusterID,
1549                               bypassFederation = bypassFederation, includeTrash = includeTrash,
1550                               uuid = uuid, recursive = recursive, include = include)
1551
1552             body <- NULL
1553
1554             response <- private$REST$http$exec("GET", url, headers, body,
1555                                                queryArgs, private$numRetries)
1556             resource <- private$REST$httpParser$parseJSONResponse(response)
1557
1558             if(!is.null(resource$errors))
1559                 stop(resource$errors)
1560
1561             resource
1562         },
1563
1564         #' @description
1565         #' groups_shared is a method defined in Arvados class.
1566         #' @param filters
1567         #' @param where
1568         #' @param order
1569         #' @param select
1570         #' @param distinct
1571         #' @param limit
1572         #' @param offset
1573         #' @param count
1574         #' @param clusterID List objects on a remote federated cluster instead of the current one.
1575         #' @param bypassFederation Bypass federation behavior, list items from local instance database only.
1576         #' @param includeTrash Include items whose is_trashed attribute is true.
1577         #' @param include
1578         groups_shared = function(filters = NULL,
1579                                  where = NULL, order = NULL, select = NULL,
1580                                  distinct = NULL, limit = "100", offset = "0",
1581                                  count = "exact", clusterID = NULL, bypassFederation = NULL,
1582                                  includeTrash = NULL, include = NULL)
1583         {
1584             endPoint <- stringr::str_interp("groups/shared")
1585             url <- paste0(private$host, endPoint)
1586             headers <- list(Authorization = paste("Bearer", private$token),
1587                             "Content-Type" = "application/json")
1588
1589             queryArgs <- list(filters = filters, where = where,
1590                               order = order, select = select, distinct = distinct,
1591                               limit = limit, offset = offset, count = count,
1592                               clusterID = clusterID, bypassFederation = bypassFederation,
1593                               includeTrash = includeTrash, include = include)
1594
1595             body <- NULL
1596
1597             response <- private$REST$http$exec("GET", url, headers, body,
1598                                                queryArgs, private$numRetries)
1599             resource <- private$REST$httpParser$parseJSONResponse(response)
1600
1601             if(!is.null(resource$errors))
1602                 stop(resource$errors)
1603
1604             resource
1605         },
1606
1607         #' @description
1608         #' groups_trash is a method defined in Arvados class.
1609         #' @param uuid The UUID of the Group in question.
1610         groups_trash = function(uuid)
1611         {
1612             endPoint <- stringr::str_interp("groups/${uuid}/trash")
1613             url <- paste0(private$host, endPoint)
1614             headers <- list(Authorization = paste("Bearer", private$token),
1615                             "Content-Type" = "application/json")
1616
1617             queryArgs <- NULL
1618
1619             body <- NULL
1620
1621             response <- private$REST$http$exec("POST", url, headers, body,
1622                                                queryArgs, private$numRetries)
1623             resource <- private$REST$httpParser$parseJSONResponse(response)
1624
1625             if(!is.null(resource$errors))
1626                 stop(resource$errors)
1627
1628             resource
1629         },
1630
1631         #' @description
1632         #' groups_untrash is a method defined in Arvados class.
1633         #' @param uuid The UUID of the Group in question.
1634         groups_untrash = function(uuid)
1635         {
1636             endPoint <- stringr::str_interp("groups/${uuid}/untrash")
1637             url <- paste0(private$host, endPoint)
1638             headers <- list(Authorization = paste("Bearer", private$token),
1639                             "Content-Type" = "application/json")
1640
1641             queryArgs <- NULL
1642
1643             body <- NULL
1644
1645             response <- private$REST$http$exec("POST", url, headers, body,
1646                                                queryArgs, private$numRetries)
1647             resource <- private$REST$httpParser$parseJSONResponse(response)
1648
1649             if(!is.null(resource$errors))
1650                 stop(resource$errors)
1651
1652             resource
1653         },
1654
1655         #' @description
1656         #' groups_list is a method defined in Arvados class.
1657         #' @param filters
1658         #' @param where
1659         #' @param order
1660         #' @param select
1661         #' @param distinct
1662         #' @param limit
1663         #' @param offset
1664         #' @param count
1665         #' @param clusterID List objects on a remote federated cluster instead of the current one.
1666         #' @param bypassFederation Bypass federation behavior, list items from local instance database only.
1667         #' @param includeTrash Include items whose is_trashed attribute is true.
1668         groups_list = function(filters = NULL, where = NULL,
1669                                order = NULL, select = NULL, distinct = NULL,
1670                                limit = "100", offset = "0", count = "exact",
1671                                clusterID = NULL, bypassFederation = NULL,
1672                                includeTrash = NULL)
1673         {
1674             endPoint <- stringr::str_interp("groups")
1675             url <- paste0(private$host, endPoint)
1676             headers <- list(Authorization = paste("Bearer", private$token),
1677                             "Content-Type" = "application/json")
1678
1679             queryArgs <- list(filters = filters, where = where,
1680                               order = order, select = select, distinct = distinct,
1681                               limit = limit, offset = offset, count = count,
1682                               clusterID = clusterID, bypassFederation = bypassFederation,
1683                               includeTrash = includeTrash)
1684
1685             body <- NULL
1686
1687             response <- private$REST$http$exec("GET", url, headers, body,
1688                                                queryArgs, private$numRetries)
1689             resource <- private$REST$httpParser$parseJSONResponse(response)
1690
1691             if(!is.null(resource$errors))
1692                 stop(resource$errors)
1693
1694             resource
1695         },
1696
1697         #' @description
1698         #' keep_services_get is a method defined in Arvados class.
1699         #' @param uuid The UUID of the keepService in question.
1700         keep_services_get = function(uuid)
1701         {
1702             endPoint <- stringr::str_interp("keep_services/${uuid}")
1703             url <- paste0(private$host, endPoint)
1704             headers <- list(Authorization = paste("Bearer", private$token),
1705                             "Content-Type" = "application/json")
1706             queryArgs <- NULL
1707
1708             body <- NULL
1709
1710             response <- private$REST$http$exec("GET", url, headers, body,
1711                                                queryArgs, private$numRetries)
1712             resource <- private$REST$httpParser$parseJSONResponse(response)
1713
1714             if(!is.null(resource$errors))
1715                 stop(resource$errors)
1716
1717             resource
1718         },
1719
1720         #' @description
1721         #' keep_services_create is a method defined in Arvados class.
1722         #' @param keepService keepService object.
1723         #' @param ensureUniqueName Adjust name to ensure uniqueness instead of returning an error.
1724         #' @param clusterID Create object on a remote federated cluster instead of the current one.
1725         keep_services_create = function(keepService,
1726                                         ensureUniqueName = "false", clusterID = NULL)
1727         {
1728             endPoint <- stringr::str_interp("keep_services")
1729             url <- paste0(private$host, endPoint)
1730             headers <- list(Authorization = paste("Bearer", private$token),
1731                             "Content-Type" = "application/json")
1732             queryArgs <- list(ensureUniqueName = ensureUniqueName,
1733                               clusterID = clusterID)
1734
1735             if(length(keepService) > 0)
1736                 body <- jsonlite::toJSON(list(keepService = keepService),
1737                                          auto_unbox = TRUE)
1738             else
1739                 body <- NULL
1740
1741             response <- private$REST$http$exec("POST", url, headers, body,
1742                                                queryArgs, private$numRetries)
1743             resource <- private$REST$httpParser$parseJSONResponse(response)
1744
1745             if(!is.null(resource$errors))
1746                 stop(resource$errors)
1747
1748             resource
1749         },
1750
1751         #' @description
1752         #' keep_services_update is a method defined in Arvados class.
1753         #' @param keepService keepService object.
1754         #' @param uuid The UUID of the keepService in question.
1755         keep_services_update = function(keepService, uuid)
1756         {
1757             endPoint <- stringr::str_interp("keep_services/${uuid}")
1758             url <- paste0(private$host, endPoint)
1759             headers <- list(Authorization = paste("Bearer", private$token),
1760                             "Content-Type" = "application/json")
1761             queryArgs <- NULL
1762
1763             if(length(keepService) > 0)
1764                 body <- jsonlite::toJSON(list(keepService = keepService),
1765                                          auto_unbox = TRUE)
1766             else
1767                 body <- NULL
1768
1769             response <- private$REST$http$exec("PUT", url, headers, body,
1770                                                queryArgs, private$numRetries)
1771             resource <- private$REST$httpParser$parseJSONResponse(response)
1772
1773             if(!is.null(resource$errors))
1774                 stop(resource$errors)
1775
1776             resource
1777         },
1778
1779         #' @description
1780         #' keep_services_delete is a method defined in Arvados class.
1781         #' @param uuid The UUID of the keepService in question.
1782         keep_services_delete = function(uuid)
1783         {
1784             endPoint <- stringr::str_interp("keep_services/${uuid}")
1785             url <- paste0(private$host, endPoint)
1786             headers <- list(Authorization = paste("Bearer", private$token),
1787                             "Content-Type" = "application/json")
1788             queryArgs <- NULL
1789
1790             body <- NULL
1791
1792             response <- private$REST$http$exec("DELETE", url, headers, body,
1793                                                queryArgs, private$numRetries)
1794             resource <- private$REST$httpParser$parseJSONResponse(response)
1795
1796             if(!is.null(resource$errors))
1797                 stop(resource$errors)
1798
1799             resource
1800         },
1801
1802         #' @description
1803         #' keep_services_accessible is a method defined in Arvados class.
1804         keep_services_accessible = function()
1805         {
1806             endPoint <- stringr::str_interp("keep_services/accessible")
1807             url <- paste0(private$host, endPoint)
1808             headers <- list(Authorization = paste("Bearer", private$token),
1809                             "Content-Type" = "application/json")
1810             queryArgs <- NULL
1811
1812             body <- NULL
1813
1814             response <- private$REST$http$exec("GET", url, headers, body,
1815                                                queryArgs, private$numRetries)
1816             resource <- private$REST$httpParser$parseJSONResponse(response)
1817
1818             if(!is.null(resource$errors))
1819                 stop(resource$errors)
1820
1821             resource
1822         },
1823
1824         #' @description
1825         #' keep_services_list is a method defined in Arvados class.
1826         #' @param filters
1827         #' @param where
1828         #' @param order
1829         #' @param select
1830         #' @param distinct
1831         #' @param limit
1832         #' @param offset
1833         #' @param count
1834         #' @param clusterID List objects on a remote federated cluster instead of the current one.
1835         #' @param bypassFederation Bypass federation behavior, list items from local instance database only.
1836         keep_services_list = function(filters = NULL,
1837                                       where = NULL, order = NULL, select = NULL,
1838                                       distinct = NULL, limit = "100", offset = "0",
1839                                       count = "exact", clusterID = NULL, bypassFederation = NULL)
1840         {
1841             endPoint <- stringr::str_interp("keep_services")
1842             url <- paste0(private$host, endPoint)
1843             headers <- list(Authorization = paste("Bearer", private$token),
1844                             "Content-Type" = "application/json")
1845             queryArgs <- list(filters = filters, where = where,
1846                               order = order, select = select, distinct = distinct,
1847                               limit = limit, offset = offset, count = count,
1848                               clusterID = clusterID, bypassFederation = bypassFederation)
1849
1850             body <- NULL
1851
1852             response <- private$REST$http$exec("GET", url, headers, body,
1853                                                queryArgs, private$numRetries)
1854             resource <- private$REST$httpParser$parseJSONResponse(response)
1855
1856             if(!is.null(resource$errors))
1857                 stop(resource$errors)
1858
1859             resource
1860         },
1861
1862         #' @description
1863         #' project_permission_give is a method defined in Arvados class that enables sharing files with another users.
1864         #' @param type Possible options are can_read or can_write or can_manage.
1865         #' @param uuid The UUID of a project or a file.
1866         #' @param user The UUID of the person that gets the permission.
1867         #' @examples
1868         #' \dontrun{
1869         #' arv$project_permission_give(type = "can_read", uuid = objectUUID, user = userUUID)
1870         #' }
1871         project_permission_give = function(type, uuid, user)
1872         {
1873             endPoint <- stringr::str_interp("links")
1874             url <- paste0(private$host, endPoint)
1875             headers <- list(Authorization = paste("Bearer", private$token),
1876                             "Content-Type" = "application/json")
1877             queryArgs <- NULL
1878
1879             # it is possible to make it as pasting a list to function, not a 3 arg. What's better?
1880             link <- list("link_class" = "permission", "name" = type, "head_uuid" = uuid, "tail_uuid" = user)
1881
1882             if(length(link) > 0)
1883                 body <- jsonlite::toJSON(list(link = link),
1884                                          auto_unbox = TRUE)
1885             else
1886                 body <- NULL
1887
1888             response <- private$REST$http$exec("POST", url, headers, body,
1889                                                queryArgs, private$numRetries)
1890             resource <- private$REST$httpParser$parseJSONResponse(response)
1891
1892             if(!is.null(resource$errors))
1893                 stop(resource$errors)
1894
1895             resource
1896         },
1897
1898         #' @description
1899         #' project_permission_refuse is a method defined in Arvados class that unables sharing files with another users.
1900         #' @param type Possible options are can_read or can_write or can_manage.
1901         #' @param uuid The UUID of a project or a file.
1902         #' @param user The UUID of a person that permissions are taken from.
1903         #' @examples
1904         #' \dontrun{
1905         #' arv$project_permission_refuse(type = "can_read", uuid = objectUUID, user = userUUID)
1906         #' }
1907         project_permission_refuse = function(type, uuid, user)
1908         {
1909             examples <- self$links_list(list(list("head_uuid","=", uuid)))
1910
1911             theUser <- examples[which(sapply(examples$items, "[[", "tail_uuid") == user)]
1912             theType <- theUser$items[which(sapply(theUser$items, "[[", "name") == type)]
1913             solution <- theType[which(sapply(theType, "[[", "link_class") == 'permission')]
1914
1915             if (length(solution) == 0) {
1916                 cat(format('No permission granted'))
1917             } else {
1918                 self$links_delete(solution[[1]]$uuid)
1919             }
1920
1921         },
1922
1923         #' @description
1924         #' project_permission_update is a method defined in Arvados class that enables updating permissions.
1925         #' @param typeNew New option like can_read or can_write or can_manage.
1926         #' @param typeOld Old option.
1927         #' @param uuid The UUID of a project or a file.
1928         #' @param user The UUID of the person that the permission is being updated.
1929         #' @examples
1930         #' \dontrun{
1931         #' arv$project_permission_update(typeOld = "can_read", typeNew = "can_write", uuid = objectUUID, user = userUUID)
1932         #' }
1933         project_permission_update = function(typeOld, typeNew, uuid, user)
1934         {
1935             link <- list("name" = typeNew)
1936
1937             examples <- self$links_list(list(list("head_uuid","=", uuid)))
1938
1939             theUser <- examples[which(sapply(examples$items, "[[", "tail_uuid") == user)]
1940             theType <- theUser$items[which(sapply(theUser$items, "[[", "name") == typeOld)]
1941             solution <- theType[which(sapply(theType, "[[", "link_class") == 'permission')]
1942
1943             if (length(solution) == 0) {
1944                 cat(format('No permission granted'))
1945             } else {
1946                 self$links_update(link, solution[[1]]$uuid)
1947             }
1948         },
1949
1950         #' @description
1951         #' project_permission_check is a method defined in Arvados class that enables checking file permissions.
1952         #' @param uuid The UUID of a project or a file.
1953         #' @param user The UUID of the person that the permission is being updated.
1954         #' @param type Possible options are can_read or can_write or can_manage.
1955         #' @examples
1956         #' \dontrun{
1957         #' arv$project_permission_check(type = "can_read", uuid = objectUUID, user = userUUID)
1958         #' }
1959         project_permission_check = function(uuid, user, type = NULL)
1960         {
1961             examples <- self$links_list(list(list("head_uuid","=", uuid)))
1962
1963             theUser <- examples[which(sapply(examples$items, "[[", "tail_uuid") == user)]
1964
1965             if (length(type) == 0 ){
1966                 theUser
1967             } else {
1968                 theType <- theUser$items[which(sapply(theUser$items, "[[", "name") == type)]
1969                 permisions <- theType[which(sapply(theType, "[[", "link_class") == 'permission')]
1970                 print(permisions[[1]]$name)
1971             }
1972         },
1973
1974         #' @description
1975         #' links_get is a method defined in Arvados class.
1976         #' @param uuid The UUID of the Link in question.
1977         links_get = function(uuid)
1978         {
1979             endPoint <- stringr::str_interp("links/${uuid}")
1980             url <- paste0(private$host, endPoint)
1981             headers <- list(Authorization = paste("Bearer", private$token),
1982                             "Content-Type" = "application/json")
1983             queryArgs <- NULL
1984
1985             body <- NULL
1986
1987             response <- private$REST$http$exec("GET", url, headers, body,
1988                                                queryArgs, private$numRetries)
1989             resource <- private$REST$httpParser$parseJSONResponse(response)
1990
1991             if(!is.null(resource$errors))
1992                 stop(resource$errors)
1993
1994             resource
1995         },
1996
1997         #' @description
1998         #' links_create is a method defined in Arvados class.
1999         #' @param link Link object.
2000         #' @param ensureUniqueName Adjust name to ensure uniqueness instead of returning an error.
2001         #' @param clusterID Create object on a remote federated cluster instead of the current one.
2002         links_create = function(link, ensureUniqueName = "false",
2003                                 clusterID = NULL)
2004         {
2005             endPoint <- stringr::str_interp("links")
2006             url <- paste0(private$host, endPoint)
2007             headers <- list(Authorization = paste("Bearer", private$token),
2008                             "Content-Type" = "application/json")
2009             queryArgs <- list(ensureUniqueName = ensureUniqueName,
2010                               clusterID = clusterID)
2011
2012             if(length(link) > 0)
2013                 body <- jsonlite::toJSON(list(link = link),
2014                                          auto_unbox = TRUE)
2015             else
2016                 body <- NULL
2017
2018             response <- private$REST$http$exec("POST", url, headers, body,
2019                                                queryArgs, private$numRetries)
2020             resource <- private$REST$httpParser$parseJSONResponse(response)
2021
2022             if(!is.null(resource$errors))
2023                 stop(resource$errors)
2024
2025             resource
2026         },
2027
2028         #' @description
2029         #' links_update is a method defined in Arvados class.
2030         #' @param link Link object.
2031         #' @param uuid The UUID of the Link in question.
2032         links_update = function(link, uuid, async = "false")
2033         {
2034             endPoint <- stringr::str_interp("links/${uuid}")
2035             url <- paste0(private$host, endPoint)
2036             headers <- list(Authorization = paste("Bearer", private$token),
2037                             "Content-Type" = "application/json")
2038             queryArgs <- list(async = async)
2039
2040             if(length(link) > 0)
2041                 body <- jsonlite::toJSON(list(link = link),
2042                                          auto_unbox = TRUE)
2043             else
2044                 body <- NULL
2045
2046             response <- private$REST$http$exec("PUT", url, headers, body,
2047                                                queryArgs, private$numRetries)
2048             resource <- private$REST$httpParser$parseJSONResponse(response)
2049
2050             if(!is.null(resource$errors))
2051                 stop(resource$errors)
2052
2053             resource
2054         },
2055
2056         #' @description
2057         #' links_delete is a method defined in Arvados class.
2058         #' @param uuid The UUID of the Link in question.
2059         links_delete = function(uuid)
2060         {
2061             endPoint <- stringr::str_interp("links/${uuid}")
2062             url <- paste0(private$host, endPoint)
2063             headers <- list(Authorization = paste("Bearer", private$token),
2064                             "Content-Type" = "application/json")
2065             queryArgs <- NULL
2066
2067             body <- NULL
2068
2069             response <- private$REST$http$exec("DELETE", url, headers, body,
2070                                                queryArgs, private$numRetries)
2071             resource <- private$REST$httpParser$parseJSONResponse(response)
2072
2073             if(!is.null(resource$errors))
2074                 stop(resource$errors)
2075
2076             resource
2077         },
2078
2079         #' @description
2080         #' links_list is a method defined in Arvados class.
2081         #' @param filters
2082         #' @param where
2083         #' @param order
2084         #' @param select
2085         #' @param distinct
2086         #' @param limit
2087         #' @param offset
2088         #' @param count
2089         #' @param clusterID List objects on a remote federated cluster instead of the current one.
2090         #' @param bypassFederation Bypass federation behavior, list items from local instance database only.
2091         links_list = function(filters = NULL, where = NULL,
2092                               order = NULL, select = NULL, distinct = NULL,
2093                               limit = "100", offset = "0", count = "exact",
2094                               clusterID = NULL, bypassFederation = NULL)
2095         {
2096             endPoint <- stringr::str_interp("links")
2097             url <- paste0(private$host, endPoint)
2098             headers <- list(Authorization = paste("Bearer", private$token),
2099                             "Content-Type" = "application/json")
2100             queryArgs <- list(filters = filters, where = where,
2101                               order = order, select = select, distinct = distinct,
2102                               limit = limit, offset = offset, count = count,
2103                               clusterID = clusterID, bypassFederation = bypassFederation)
2104
2105             body <- NULL
2106
2107             response <- private$REST$http$exec("GET", url, headers, body,
2108                                                queryArgs, private$numRetries)
2109             resource <- private$REST$httpParser$parseJSONResponse(response)
2110
2111             if(!is.null(resource$errors))
2112                 stop(resource$errors)
2113
2114             resource
2115         },
2116
2117         #' @description
2118         #' links_get_permissions is a method defined in Arvados class.
2119         #' @param uuid The UUID of the Log in question.
2120         links_get_permissions = function(uuid)
2121         {
2122             endPoint <- stringr::str_interp("permissions/${uuid}")
2123             url <- paste0(private$host, endPoint)
2124             headers <- list(Authorization = paste("Bearer", private$token),
2125                             "Content-Type" = "application/json")
2126             queryArgs <- NULL
2127
2128             body <- NULL
2129
2130             response <- private$REST$http$exec("GET", url, headers, body,
2131                                                queryArgs, private$numRetries)
2132             resource <- private$REST$httpParser$parseJSONResponse(response)
2133
2134             if(!is.null(resource$errors))
2135                 stop(resource$errors)
2136
2137             resource
2138         },
2139
2140         #' @description
2141         #' logs_get is a method defined in Arvados class.
2142         #' @param uuid The UUID of the Log in question.
2143         logs_get = function(uuid)
2144         {
2145             endPoint <- stringr::str_interp("logs/${uuid}")
2146             url <- paste0(private$host, endPoint)
2147             headers <- list(Authorization = paste("Bearer", private$token),
2148                             "Content-Type" = "application/json")
2149             queryArgs <- NULL
2150
2151             body <- NULL
2152
2153             response <- private$REST$http$exec("GET", url, headers, body,
2154                                                queryArgs, private$numRetries)
2155             resource <- private$REST$httpParser$parseJSONResponse(response)
2156
2157             if(!is.null(resource$errors))
2158                 stop(resource$errors)
2159
2160             resource
2161         },
2162
2163         #' @description
2164         #' logs_create is a method defined in Arvados class.
2165         #' @param log Log object.
2166         #' @param ensureUniqueName Adjust name to ensure uniqueness instead of returning an error.
2167         #' @param clusterID Create object on a remote federated cluster instead of the current one.
2168         logs_create = function(log, ensureUniqueName = "false",
2169                                clusterID = NULL)
2170         {
2171             endPoint <- stringr::str_interp("logs")
2172             url <- paste0(private$host, endPoint)
2173             headers <- list(Authorization = paste("Bearer", private$token),
2174                             "Content-Type" = "application/json")
2175             queryArgs <- list(ensureUniqueName = ensureUniqueName,
2176                               clusterID = clusterID)
2177
2178             if(length(log) > 0)
2179                 body <- jsonlite::toJSON(list(log = log),
2180                                          auto_unbox = TRUE)
2181             else
2182                 body <- NULL
2183
2184             response <- private$REST$http$exec("POST", url, headers, body,
2185                                                queryArgs, private$numRetries)
2186             resource <- private$REST$httpParser$parseJSONResponse(response)
2187
2188             if(!is.null(resource$errors))
2189                 stop(resource$errors)
2190
2191             resource
2192         },
2193
2194         #' @description
2195         #' logs_update is a method defined in Arvados class.
2196         #' @param log Log object.
2197         #' @param uuid The UUID of the Log in question.
2198         logs_update = function(log, uuid)
2199         {
2200             endPoint <- stringr::str_interp("logs/${uuid}")
2201             url <- paste0(private$host, endPoint)
2202             headers <- list(Authorization = paste("Bearer", private$token),
2203                             "Content-Type" = "application/json")
2204             queryArgs <- NULL
2205
2206             if(length(log) > 0)
2207                 body <- jsonlite::toJSON(list(log = log),
2208                                          auto_unbox = TRUE)
2209             else
2210                 body <- NULL
2211
2212             response <- private$REST$http$exec("PUT", url, headers, body,
2213                                                queryArgs, private$numRetries)
2214             resource <- private$REST$httpParser$parseJSONResponse(response)
2215
2216             if(!is.null(resource$errors))
2217                 stop(resource$errors)
2218
2219             resource
2220         },
2221
2222         #' @description
2223         #' logs_delete is a method defined in Arvados class.
2224         #' @param uuid The UUID of the Log in question.
2225         logs_delete = function(uuid)
2226         {
2227             endPoint <- stringr::str_interp("logs/${uuid}")
2228             url <- paste0(private$host, endPoint)
2229             headers <- list(Authorization = paste("Bearer", private$token),
2230                             "Content-Type" = "application/json")
2231             queryArgs <- NULL
2232
2233             body <- NULL
2234
2235             response <- private$REST$http$exec("DELETE", url, headers, body,
2236                                                queryArgs, private$numRetries)
2237             resource <- private$REST$httpParser$parseJSONResponse(response)
2238
2239             if(!is.null(resource$errors))
2240                 stop(resource$errors)
2241
2242             resource
2243         },
2244
2245         #' @description
2246         #' logs_list is a method defined in Arvados class.
2247         #' @param filters
2248         #' @param where
2249         #' @param order
2250         #' @param select
2251         #' @param distinct
2252         #' @param limit
2253         #' @param offset
2254         #' @param count
2255         #' @param clusterID List objects on a remote federated cluster instead of the current one.
2256         #' @param bypassFederation Bypass federation behavior, list items from local instance database only.
2257         logs_list = function(filters = NULL, where = NULL,
2258                              order = NULL, select = NULL, distinct = NULL,
2259                              limit = "100", offset = "0", count = "exact",
2260                              clusterID = NULL, bypassFederation = NULL)
2261         {
2262             endPoint <- stringr::str_interp("logs")
2263             url <- paste0(private$host, endPoint)
2264             headers <- list(Authorization = paste("Bearer", private$token),
2265                             "Content-Type" = "application/json")
2266             queryArgs <- list(filters = filters, where = where,
2267                               order = order, select = select, distinct = distinct,
2268                               limit = limit, offset = offset, count = count,
2269                               clusterID = clusterID, bypassFederation = bypassFederation)
2270
2271             body <- NULL
2272
2273             response <- private$REST$http$exec("GET", url, headers, body,
2274                                                queryArgs, private$numRetries)
2275             resource <- private$REST$httpParser$parseJSONResponse(response)
2276
2277             if(!is.null(resource$errors))
2278                 stop(resource$errors)
2279
2280             resource
2281         },
2282
2283         #' @description
2284         #' users_get is a method defined in Arvados class.
2285         #' @param uuid The UUID of the User in question.
2286         users_get = function(uuid)
2287         {
2288             endPoint <- stringr::str_interp("users/${uuid}")
2289             url <- paste0(private$host, endPoint)
2290             headers <- list(Authorization = paste("Bearer", private$token),
2291                             "Content-Type" = "application/json")
2292             queryArgs <- NULL
2293
2294             body <- NULL
2295
2296             response <- private$REST$http$exec("GET", url, headers, body,
2297                                                queryArgs, private$numRetries)
2298             resource <- private$REST$httpParser$parseJSONResponse(response)
2299
2300             if(!is.null(resource$errors))
2301                 stop(resource$errors)
2302
2303             resource
2304         },
2305
2306         #' @description
2307         #' users_create is a method defined in Arvados class.
2308         #' @param user User object.
2309         #' @param ensureUniqueName Adjust name to ensure uniqueness instead of returning an error.
2310         #' @param clusterID Create object on a remote federated cluster instead of the current one.
2311         users_create = function(user, ensureUniqueName = "false",
2312                                 clusterID = NULL)
2313         {
2314             endPoint <- stringr::str_interp("users")
2315             url <- paste0(private$host, endPoint)
2316             headers <- list(Authorization = paste("Bearer", private$token),
2317                             "Content-Type" = "application/json")
2318             queryArgs <- list(ensureUniqueName = ensureUniqueName,
2319                               clusterID = clusterID)
2320
2321             if(length(user) > 0)
2322                 body <- jsonlite::toJSON(list(user = user),
2323                                          auto_unbox = TRUE)
2324             else
2325                 body <- NULL
2326
2327             response <- private$REST$http$exec("POST", url, headers, body,
2328                                                queryArgs, private$numRetries)
2329             resource <- private$REST$httpParser$parseJSONResponse(response)
2330
2331             if(!is.null(resource$errors))
2332                 stop(resource$errors)
2333
2334             resource
2335         },
2336
2337         #' @description
2338         #' users_update is a method defined in Arvados class.
2339         #' @param user User object.
2340         #' @param uuid The UUID of the User in question.
2341         #' @param bypassFederation
2342         users_update = function(user, uuid, bypassFederation = NULL)
2343         {
2344             endPoint <- stringr::str_interp("users/${uuid}")
2345             url <- paste0(private$host, endPoint)
2346             headers <- list(Authorization = paste("Bearer", private$token),
2347                             "Content-Type" = "application/json")
2348             queryArgs <- list(bypassFederation = bypassFederation)
2349
2350             if(length(user) > 0)
2351                 body <- jsonlite::toJSON(list(user = user),
2352                                          auto_unbox = TRUE)
2353             else
2354                 body <- NULL
2355
2356             response <- private$REST$http$exec("PUT", url, headers, body,
2357                                                queryArgs, private$numRetries)
2358             resource <- private$REST$httpParser$parseJSONResponse(response)
2359
2360             if(!is.null(resource$errors))
2361                 stop(resource$errors)
2362
2363             resource
2364         },
2365
2366         #' @description
2367         #' users_delete is a method defined in Arvados class.
2368         #' @param uuid The UUID of the User in question.
2369         users_delete = function(uuid)
2370         {
2371             endPoint <- stringr::str_interp("users/${uuid}")
2372             url <- paste0(private$host, endPoint)
2373             headers <- list(Authorization = paste("Bearer", private$token),
2374                             "Content-Type" = "application/json")
2375             queryArgs <- NULL
2376
2377             body <- NULL
2378
2379             response <- private$REST$http$exec("DELETE", url, headers, body,
2380                                                queryArgs, private$numRetries)
2381             resource <- private$REST$httpParser$parseJSONResponse(response)
2382
2383             if(!is.null(resource$errors))
2384                 stop(resource$errors)
2385
2386             resource
2387         },
2388
2389         #' @description
2390         #' users_current is a method defined in Arvados class.
2391         users_current = function()
2392         {
2393             endPoint <- stringr::str_interp("users/current")
2394             url <- paste0(private$host, endPoint)
2395             headers <- list(Authorization = paste("Bearer", private$token),
2396                             "Content-Type" = "application/json")
2397             queryArgs <- NULL
2398
2399             body <- NULL
2400
2401             response <- private$REST$http$exec("GET", url, headers, body,
2402                                                queryArgs, private$numRetries)
2403             resource <- private$REST$httpParser$parseJSONResponse(response)
2404
2405             if(!is.null(resource$errors))
2406                 stop(resource$errors)
2407
2408             resource
2409         },
2410
2411         #' @description
2412         #' users_system is a method defined in Arvados class.
2413         users_system = function()
2414         {
2415             endPoint <- stringr::str_interp("users/system")
2416             url <- paste0(private$host, endPoint)
2417             headers <- list(Authorization = paste("Bearer", private$token),
2418                             "Content-Type" = "application/json")
2419             queryArgs <- NULL
2420
2421             body <- NULL
2422
2423             response <- private$REST$http$exec("GET", url, headers, body,
2424                                                queryArgs, private$numRetries)
2425             resource <- private$REST$httpParser$parseJSONResponse(response)
2426
2427             if(!is.null(resource$errors))
2428                 stop(resource$errors)
2429
2430             resource
2431         },
2432
2433         #' @description
2434         #' users_activate is a method defined in Arvados class.
2435         #' @param uuid The UUID of the User in question.
2436         users_activate = function(uuid)
2437         {
2438             endPoint <- stringr::str_interp("users/${uuid}/activate")
2439             url <- paste0(private$host, endPoint)
2440             headers <- list(Authorization = paste("Bearer", private$token),
2441                             "Content-Type" = "application/json")
2442             queryArgs <- NULL
2443
2444             body <- NULL
2445
2446             response <- private$REST$http$exec("POST", url, headers, body,
2447                                                queryArgs, private$numRetries)
2448             resource <- private$REST$httpParser$parseJSONResponse(response)
2449
2450             if(!is.null(resource$errors))
2451                 stop(resource$errors)
2452
2453             resource
2454         },
2455
2456         #' @description
2457         #' users_setup is a method defined in Arvados class.
2458         #' @param uuid
2459         #' @param user
2460         #' @param repo_name
2461         #' @param vm_uuid
2462         #' @param send_notification_email
2463         users_setup = function(uuid = NULL, user = NULL,
2464                                repo_name = NULL, vm_uuid = NULL, send_notification_email = "false")
2465         {
2466             endPoint <- stringr::str_interp("users/setup")
2467             url <- paste0(private$host, endPoint)
2468             headers <- list(Authorization = paste("Bearer", private$token),
2469                             "Content-Type" = "application/json")
2470             queryArgs <- list(uuid = uuid, user = user,
2471                               repo_name = repo_name, vm_uuid = vm_uuid,
2472                               send_notification_email = send_notification_email)
2473
2474             body <- NULL
2475
2476             response <- private$REST$http$exec("POST", url, headers, body,
2477                                                queryArgs, private$numRetries)
2478             resource <- private$REST$httpParser$parseJSONResponse(response)
2479
2480             if(!is.null(resource$errors))
2481                 stop(resource$errors)
2482
2483             resource
2484         },
2485
2486         #' @description
2487         #' users_unsetup is a method defined in Arvados class.
2488         #' @param uuid The UUID of the User in question.
2489         users_unsetup = function(uuid)
2490         {
2491             endPoint <- stringr::str_interp("users/${uuid}/unsetup")
2492             url <- paste0(private$host, endPoint)
2493             headers <- list(Authorization = paste("Bearer", private$token),
2494                             "Content-Type" = "application/json")
2495             queryArgs <- NULL
2496
2497             body <- NULL
2498
2499             response <- private$REST$http$exec("POST", url, headers, body,
2500                                                queryArgs, private$numRetries)
2501             resource <- private$REST$httpParser$parseJSONResponse(response)
2502
2503             if(!is.null(resource$errors))
2504                 stop(resource$errors)
2505
2506             resource
2507         },
2508
2509         #' @description
2510         #' users_merge is a method defined in Arvados class.
2511         #' @param newOwnerUUID
2512         #' @param newUserToken
2513         #' @param redirectToNewUser
2514         #' @param oldUserUUID
2515         #' @param newUserUUID
2516         users_merge = function(newOwnerUUID, newUserToken = NULL,
2517                                redirectToNewUser = NULL, oldUserUUID = NULL,
2518                                newUserUUID = NULL)
2519         {
2520             endPoint <- stringr::str_interp("users/merge")
2521             url <- paste0(private$host, endPoint)
2522             headers <- list(Authorization = paste("Bearer", private$token),
2523                             "Content-Type" = "application/json")
2524             queryArgs <- list(newOwnerUUID = newOwnerUUID,
2525                               newUserToken = newUserToken, redirectToNewUser = redirectToNewUser,
2526                               oldUserUUID = oldUserUUID, newUserUUID = newUserUUID)
2527
2528             body <- NULL
2529
2530             response <- private$REST$http$exec("POST", url, headers, body,
2531                                                queryArgs, private$numRetries)
2532             resource <- private$REST$httpParser$parseJSONResponse(response)
2533
2534             if(!is.null(resource$errors))
2535                 stop(resource$errors)
2536
2537             resource
2538         },
2539
2540         #' @description
2541         #' users_list is a method defined in Arvados class.
2542         #' @param filters
2543         #' @param where
2544         #' @param order
2545         #' @param select
2546         #' @param distinct
2547         #' @param limit
2548         #' @param offset
2549         #' @param count
2550         #' @param clusterID List objects on a remote federated cluster instead of the current one.
2551         #' @param bypassFederation Bypass federation behavior, list items from local instance database only.
2552         users_list = function(filters = NULL, where = NULL,
2553                               order = NULL, select = NULL, distinct = NULL,
2554                               limit = "100", offset = "0", count = "exact",
2555                               clusterID = NULL, bypassFederation = NULL)
2556         {
2557             endPoint <- stringr::str_interp("users")
2558             url <- paste0(private$host, endPoint)
2559             headers <- list(Authorization = paste("Bearer", private$token),
2560                             "Content-Type" = "application/json")
2561             queryArgs <- list(filters = filters, where = where,
2562                               order = order, select = select, distinct = distinct,
2563                               limit = limit, offset = offset, count = count,
2564                               clusterID = clusterID, bypassFederation = bypassFederation)
2565
2566             body <- NULL
2567
2568             response <- private$REST$http$exec("GET", url, headers, body,
2569                                                queryArgs, private$numRetries)
2570             resource <- private$REST$httpParser$parseJSONResponse(response)
2571
2572             if(!is.null(resource$errors))
2573                 stop(resource$errors)
2574
2575             resource
2576         },
2577
2578         #' @description
2579         #' repositories_get is a method defined in Arvados class.
2580         #' @param uuid The UUID of the Repository in question.
2581         repositories_get = function(uuid)
2582         {
2583             endPoint <- stringr::str_interp("repositories/${uuid}")
2584             url <- paste0(private$host, endPoint)
2585             headers <- list(Authorization = paste("Bearer", private$token),
2586                             "Content-Type" = "application/json")
2587             queryArgs <- NULL
2588
2589             body <- NULL
2590
2591             response <- private$REST$http$exec("GET", url, headers, body,
2592                                                queryArgs, private$numRetries)
2593             resource <- private$REST$httpParser$parseJSONResponse(response)
2594
2595             if(!is.null(resource$errors))
2596                 stop(resource$errors)
2597
2598             resource
2599         },
2600
2601         #' @description
2602         #' repositories_create is a method defined in Arvados class.
2603         #' @param repository Repository object.
2604         #' @param ensureUniqueName Adjust name to ensure uniqueness instead of returning an error.
2605         #' @param clusterID Create object on a remote federated cluster instead of the current one.
2606         repositories_create = function(repository,
2607                                        ensureUniqueName = "false", clusterID = NULL)
2608         {
2609             endPoint <- stringr::str_interp("repositories")
2610             url <- paste0(private$host, endPoint)
2611             headers <- list(Authorization = paste("Bearer", private$token),
2612                             "Content-Type" = "application/json")
2613             queryArgs <- list(ensureUniqueName = ensureUniqueName,
2614                               clusterID = clusterID)
2615
2616             if(length(repository) > 0)
2617                 body <- jsonlite::toJSON(list(repository = repository),
2618                                          auto_unbox = TRUE)
2619             else
2620                 body <- NULL
2621
2622             response <- private$REST$http$exec("POST", url, headers, body,
2623                                                queryArgs, private$numRetries)
2624             resource <- private$REST$httpParser$parseJSONResponse(response)
2625
2626             if(!is.null(resource$errors))
2627                 stop(resource$errors)
2628
2629             resource
2630         },
2631
2632         #' @description
2633         #' repositories_update is a method defined in Arvados class.
2634         #' @param repository Repository object.
2635         #' @param uuid The UUID of the Repository in question.
2636         repositories_update = function(repository, uuid)
2637         {
2638             endPoint <- stringr::str_interp("repositories/${uuid}")
2639             url <- paste0(private$host, endPoint)
2640             headers <- list(Authorization = paste("Bearer", private$token),
2641                             "Content-Type" = "application/json")
2642             queryArgs <- NULL
2643
2644             if(length(repository) > 0)
2645                 body <- jsonlite::toJSON(list(repository = repository),
2646                                          auto_unbox = TRUE)
2647             else
2648                 body <- NULL
2649
2650             response <- private$REST$http$exec("PUT", url, headers, body,
2651                                                queryArgs, private$numRetries)
2652             resource <- private$REST$httpParser$parseJSONResponse(response)
2653
2654             if(!is.null(resource$errors))
2655                 stop(resource$errors)
2656
2657             resource
2658         },
2659
2660         #' @description
2661         #' repositories_delete is a method defined in Arvados class.
2662         #' @param uuid The UUID of the Repository in question.
2663         repositories_delete = function(uuid)
2664         {
2665             endPoint <- stringr::str_interp("repositories/${uuid}")
2666             url <- paste0(private$host, endPoint)
2667             headers <- list(Authorization = paste("Bearer", private$token),
2668                             "Content-Type" = "application/json")
2669             queryArgs <- NULL
2670
2671             body <- NULL
2672
2673             response <- private$REST$http$exec("DELETE", url, headers, body,
2674                                                queryArgs, private$numRetries)
2675             resource <- private$REST$httpParser$parseJSONResponse(response)
2676
2677             if(!is.null(resource$errors))
2678                 stop(resource$errors)
2679
2680             resource
2681         },
2682
2683         #' @description
2684         #' repositories_get_all_permissions is a method defined in Arvados class.
2685         repositories_get_all_permissions = function()
2686         {
2687             endPoint <- stringr::str_interp("repositories/get_all_permissions")
2688             url <- paste0(private$host, endPoint)
2689             headers <- list(Authorization = paste("Bearer", private$token),
2690                             "Content-Type" = "application/json")
2691             queryArgs <- NULL
2692
2693             body <- NULL
2694
2695             response <- private$REST$http$exec("GET", url, headers, body,
2696                                                queryArgs, private$numRetries)
2697             resource <- private$REST$httpParser$parseJSONResponse(response)
2698
2699             if(!is.null(resource$errors))
2700                 stop(resource$errors)
2701
2702             resource
2703         },
2704
2705         #' @description
2706         #' repositories_list is a method defined in Arvados class.
2707         #' @param filters
2708         #' @param where
2709         #' @param order
2710         #' @param select
2711         #' @param distinct
2712         #' @param limit
2713         #' @param offset
2714         #' @param count
2715         #' @param clusterID List objects on a remote federated cluster instead of the current one.
2716         #' @param bypassFederation Bypass federation behavior, list items from local instance database only.
2717         repositories_list = function(filters = NULL,
2718                                      where = NULL, order = NULL, select = NULL,
2719                                      distinct = NULL, limit = "100", offset = "0",
2720                                      count = "exact", clusterID = NULL, bypassFederation = NULL)
2721         {
2722             endPoint <- stringr::str_interp("repositories")
2723             url <- paste0(private$host, endPoint)
2724             headers <- list(Authorization = paste("Bearer", private$token),
2725                             "Content-Type" = "application/json")
2726             queryArgs <- list(filters = filters, where = where,
2727                               order = order, select = select, distinct = distinct,
2728                               limit = limit, offset = offset, count = count,
2729                               clusterID = clusterID, bypassFederation = bypassFederation)
2730
2731             body <- NULL
2732
2733             response <- private$REST$http$exec("GET", url, headers, body,
2734                                                queryArgs, private$numRetries)
2735             resource <- private$REST$httpParser$parseJSONResponse(response)
2736
2737             if(!is.null(resource$errors))
2738                 stop(resource$errors)
2739
2740             resource
2741         },
2742
2743         #' @description
2744         #' virtual_machines_get is a method defined in Arvados class.
2745         #' @param uuid The UUID of the virtualMachine in question.
2746         virtual_machines_get = function(uuid)
2747         {
2748             endPoint <- stringr::str_interp("virtual_machines/${uuid}")
2749             url <- paste0(private$host, endPoint)
2750             headers <- list(Authorization = paste("Bearer", private$token),
2751                             "Content-Type" = "application/json")
2752             queryArgs <- NULL
2753
2754             body <- NULL
2755
2756             response <- private$REST$http$exec("GET", url, headers, body,
2757                                                queryArgs, private$numRetries)
2758             resource <- private$REST$httpParser$parseJSONResponse(response)
2759
2760             if(!is.null(resource$errors))
2761                 stop(resource$errors)
2762
2763             resource
2764         },
2765
2766         #' @description
2767         #' virtual_machines_create is a method defined in Arvados class.
2768         #' @param virtualMachine virtualMachine object.
2769         #' @param ensureUniqueName Adjust name to ensure uniqueness instead of returning an error.
2770         #' @param clusterID Create object on a remote federated cluster instead of the current one.
2771         virtual_machines_create = function(virtualMachine,
2772                                            ensureUniqueName = "false", clusterID = NULL)
2773         {
2774             endPoint <- stringr::str_interp("virtual_machines")
2775             url <- paste0(private$host, endPoint)
2776             headers <- list(Authorization = paste("Bearer", private$token),
2777                             "Content-Type" = "application/json")
2778             queryArgs <- list(ensureUniqueName = ensureUniqueName,
2779                               clusterID = clusterID)
2780
2781             if(length(virtualMachine) > 0)
2782                 body <- jsonlite::toJSON(list(virtualMachine = virtualMachine),
2783                                          auto_unbox = TRUE)
2784             else
2785                 body <- NULL
2786
2787             response <- private$REST$http$exec("POST", url, headers, body,
2788                                                queryArgs, private$numRetries)
2789             resource <- private$REST$httpParser$parseJSONResponse(response)
2790
2791             if(!is.null(resource$errors))
2792                 stop(resource$errors)
2793
2794             resource
2795         },
2796
2797         #' @description
2798         #' virtual_machines_update is a method defined in Arvados class.
2799         #' @param virtualMachine virtualMachine object.
2800         #' @param uuid The UUID of the virtualMachine in question.
2801         virtual_machines_update = function(virtualMachine, uuid)
2802         {
2803             endPoint <- stringr::str_interp("virtual_machines/${uuid}")
2804             url <- paste0(private$host, endPoint)
2805             headers <- list(Authorization = paste("Bearer", private$token),
2806                             "Content-Type" = "application/json")
2807             queryArgs <- NULL
2808
2809             if(length(virtualMachine) > 0)
2810                 body <- jsonlite::toJSON(list(virtualMachine = virtualMachine),
2811                                          auto_unbox = TRUE)
2812             else
2813                 body <- NULL
2814
2815             response <- private$REST$http$exec("PUT", url, headers, body,
2816                                                queryArgs, private$numRetries)
2817             resource <- private$REST$httpParser$parseJSONResponse(response)
2818
2819             if(!is.null(resource$errors))
2820                 stop(resource$errors)
2821
2822             resource
2823         },
2824
2825         #' @description
2826         #' virtual_machines_delete is a method defined in Arvados class.
2827         #' @param uuid The UUID of the virtualMachine in question.
2828         virtual_machines_delete = function(uuid)
2829         {
2830             endPoint <- stringr::str_interp("virtual_machines/${uuid}")
2831             url <- paste0(private$host, endPoint)
2832             headers <- list(Authorization = paste("Bearer", private$token),
2833                             "Content-Type" = "application/json")
2834             queryArgs <- NULL
2835
2836             body <- NULL
2837
2838             response <- private$REST$http$exec("DELETE", url, headers, body,
2839                                                queryArgs, private$numRetries)
2840             resource <- private$REST$httpParser$parseJSONResponse(response)
2841
2842             if(!is.null(resource$errors))
2843                 stop(resource$errors)
2844
2845             resource
2846         },
2847
2848         #' @description
2849         #' virtual_machines_logins is a method defined in Arvados class.
2850         #' @param uuid The UUID of the virtualMachine in question.
2851         virtual_machines_logins = function(uuid)
2852         {
2853             endPoint <- stringr::str_interp("virtual_machines/${uuid}/logins")
2854             url <- paste0(private$host, endPoint)
2855             headers <- list(Authorization = paste("Bearer", private$token),
2856                             "Content-Type" = "application/json")
2857             queryArgs <- NULL
2858
2859             body <- NULL
2860
2861             response <- private$REST$http$exec("GET", url, headers, body,
2862                                                queryArgs, private$numRetries)
2863             resource <- private$REST$httpParser$parseJSONResponse(response)
2864
2865             if(!is.null(resource$errors))
2866                 stop(resource$errors)
2867
2868             resource
2869         },
2870
2871         #' @description
2872         #' virtual_machines_get_all_logins is a method defined in Arvados class.
2873         virtual_machines_get_all_logins = function()
2874         {
2875             endPoint <- stringr::str_interp("virtual_machines/get_all_logins")
2876             url <- paste0(private$host, endPoint)
2877             headers <- list(Authorization = paste("Bearer", private$token),
2878                             "Content-Type" = "application/json")
2879             queryArgs <- NULL
2880
2881             body <- NULL
2882
2883             response <- private$REST$http$exec("GET", url, headers, body,
2884                                                queryArgs, private$numRetries)
2885             resource <- private$REST$httpParser$parseJSONResponse(response)
2886
2887             if(!is.null(resource$errors))
2888                 stop(resource$errors)
2889
2890             resource
2891         },
2892
2893         #' @description
2894         #' virtual_machines_list is a method defined in Arvados class.
2895         #' @param filters
2896         #' @param where
2897         #' @param order
2898         #' @param select
2899         #' @param distinct
2900         #' @param limit
2901         #' @param offset
2902         #' @param count
2903         #' @param clusterID List objects on a remote federated cluster instead of the current one.
2904         #' @param bypassFederation bypass federation behavior, list items from local instance database only
2905         virtual_machines_list = function(filters = NULL,
2906                                          where = NULL, order = NULL, select = NULL,
2907                                          distinct = NULL, limit = "100", offset = "0",
2908                                          count = "exact", clusterID = NULL, bypassFederation = NULL)
2909         {
2910             endPoint <- stringr::str_interp("virtual_machines")
2911             url <- paste0(private$host, endPoint)
2912             headers <- list(Authorization = paste("Bearer", private$token),
2913                             "Content-Type" = "application/json")
2914             queryArgs <- list(filters = filters, where = where,
2915                               order = order, select = select, distinct = distinct,
2916                               limit = limit, offset = offset, count = count,
2917                               clusterID = clusterID, bypassFederation = bypassFederation)
2918
2919             body <- NULL
2920
2921             response <- private$REST$http$exec("GET", url, headers, body,
2922                                                queryArgs, private$numRetries)
2923             resource <- private$REST$httpParser$parseJSONResponse(response)
2924
2925             if(!is.null(resource$errors))
2926                 stop(resource$errors)
2927
2928             resource
2929         },
2930
2931         #' @description
2932         #' workflows_get is a method defined in Arvados class.
2933         #' @param uuid The UUID of the Workflow in question.
2934         workflows_get = function(uuid)
2935         {
2936             endPoint <- stringr::str_interp("workflows/${uuid}")
2937             url <- paste0(private$host, endPoint)
2938             headers <- list(Authorization = paste("Bearer", private$token),
2939                             "Content-Type" = "application/json")
2940             queryArgs <- NULL
2941
2942             body <- NULL
2943
2944             response <- private$REST$http$exec("GET", url, headers, body,
2945                                                queryArgs, private$numRetries)
2946             resource <- private$REST$httpParser$parseJSONResponse(response)
2947
2948             if(!is.null(resource$errors))
2949                 stop(resource$errors)
2950
2951             resource
2952         },
2953
2954         #' @description
2955         #' workflows_create is a method defined in Arvados class.
2956         #' @param workflow Workflow object.
2957         #' @param ensureUniqueName Adjust name to ensure uniqueness instead of returning an error.
2958         #' @param clusterID Create object on a remote federated cluster instead of the current one.
2959         workflows_create = function(workflow, ensureUniqueName = "false",
2960                                     clusterID = NULL)
2961         {
2962             endPoint <- stringr::str_interp("workflows")
2963             url <- paste0(private$host, endPoint)
2964             headers <- list(Authorization = paste("Bearer", private$token),
2965                             "Content-Type" = "application/json")
2966             queryArgs <- list(ensureUniqueName = ensureUniqueName,
2967                               clusterID = clusterID)
2968
2969             if(length(workflow) > 0)
2970                 body <- jsonlite::toJSON(list(workflow = workflow),
2971                                          auto_unbox = TRUE)
2972             else
2973                 body <- NULL
2974
2975             response <- private$REST$http$exec("POST", url, headers, body,
2976                                                queryArgs, private$numRetries)
2977             resource <- private$REST$httpParser$parseJSONResponse(response)
2978
2979             if(!is.null(resource$errors))
2980                 stop(resource$errors)
2981
2982             resource
2983         },
2984
2985         #' @description
2986         #' workflows_update is a method defined in Arvados class.
2987         #' @param workflow Workflow object.
2988         #' @param uuid The UUID of the Workflow in question.
2989         workflows_update = function(workflow, uuid)
2990         {
2991             endPoint <- stringr::str_interp("workflows/${uuid}")
2992             url <- paste0(private$host, endPoint)
2993             headers <- list(Authorization = paste("Bearer", private$token),
2994                             "Content-Type" = "application/json")
2995             queryArgs <- NULL
2996
2997             if(length(workflow) > 0)
2998                 body <- jsonlite::toJSON(list(workflow = workflow),
2999                                          auto_unbox = TRUE)
3000             else
3001                 body <- NULL
3002
3003             response <- private$REST$http$exec("PUT", url, headers, body,
3004                                                queryArgs, private$numRetries)
3005             resource <- private$REST$httpParser$parseJSONResponse(response)
3006
3007             if(!is.null(resource$errors))
3008                 stop(resource$errors)
3009
3010             resource
3011         },
3012
3013         #' @description
3014         #' workflows_delete is a method defined in Arvados class.
3015         #' @param uuid The UUID of the Workflow in question.
3016         workflows_delete = function(uuid)
3017         {
3018             endPoint <- stringr::str_interp("workflows/${uuid}")
3019             url <- paste0(private$host, endPoint)
3020             headers <- list(Authorization = paste("Bearer", private$token),
3021                             "Content-Type" = "application/json")
3022             queryArgs <- NULL
3023
3024             body <- NULL
3025
3026             response <- private$REST$http$exec("DELETE", url, headers, body,
3027                                                queryArgs, private$numRetries)
3028             resource <- private$REST$httpParser$parseJSONResponse(response)
3029
3030             if(!is.null(resource$errors))
3031                 stop(resource$errors)
3032
3033             resource
3034         },
3035
3036         #' @description
3037         #' workflows_list is a method defined in Arvados class.
3038         #' @param filters
3039         #' @param where
3040         #' @param order
3041         #' @param select
3042         #' @param distinct
3043         #' @param limit
3044         #' @param offset
3045         #' @param count
3046         #' @param clusterID List objects on a remote federated cluster instead of the current one.
3047         #' @param bypassFederation Bypass federation behavior, list items from local instance database only.
3048         workflows_list = function(filters = NULL,
3049                                   where = NULL, order = NULL, select = NULL,
3050                                   distinct = NULL, limit = "100", offset = "0",
3051                                   count = "exact", clusterID = NULL, bypassFederation = NULL)
3052         {
3053             endPoint <- stringr::str_interp("workflows")
3054             url <- paste0(private$host, endPoint)
3055             headers <- list(Authorization = paste("Bearer", private$token),
3056                             "Content-Type" = "application/json")
3057             queryArgs <- list(filters = filters, where = where,
3058                               order = order, select = select, distinct = distinct,
3059                               limit = limit, offset = offset, count = count,
3060                               clusterID = clusterID, bypassFederation = bypassFederation)
3061
3062             body <- NULL
3063
3064             response <- private$REST$http$exec("GET", url, headers, body,
3065                                                queryArgs, private$numRetries)
3066             resource <- private$REST$httpParser$parseJSONResponse(response)
3067
3068             if(!is.null(resource$errors))
3069                 stop(resource$errors)
3070
3071             resource
3072         },
3073
3074         #' @description
3075         #' user_agreements_get is a method defined in Arvados class.
3076         #' @param uuid The UUID of the userAgreement in question.
3077         user_agreements_get = function(uuid)
3078         {
3079             endPoint <- stringr::str_interp("user_agreements/${uuid}")
3080             url <- paste0(private$host, endPoint)
3081             headers <- list(Authorization = paste("Bearer", private$token),
3082                             "Content-Type" = "application/json")
3083             queryArgs <- NULL
3084
3085             body <- NULL
3086
3087             response <- private$REST$http$exec("GET", url, headers, body,
3088                                                queryArgs, private$numRetries)
3089             resource <- private$REST$httpParser$parseJSONResponse(response)
3090
3091             if(!is.null(resource$errors))
3092                 stop(resource$errors)
3093
3094             resource
3095         },
3096
3097         #' @description
3098         #' user_agreements_create is a method defined in Arvados class.
3099         #' @param userAgreement userAgreement object.
3100         #' @param ensureUniqueName Adjust name to ensure uniqueness instead of returning an error.
3101         #' @param clusterID Create object on a remote federated cluster instead of the current one.
3102         user_agreements_create = function(userAgreement,
3103                                           ensureUniqueName = "false", clusterID = NULL)
3104         {
3105             endPoint <- stringr::str_interp("user_agreements")
3106             url <- paste0(private$host, endPoint)
3107             headers <- list(Authorization = paste("Bearer", private$token),
3108                             "Content-Type" = "application/json")
3109             queryArgs <- list(ensureUniqueName = ensureUniqueName,
3110                               clusterID = clusterID)
3111
3112             if(length(userAgreement) > 0)
3113                 body <- jsonlite::toJSON(list(userAgreement = userAgreement),
3114                                          auto_unbox = TRUE)
3115             else
3116                 body <- NULL
3117
3118             response <- private$REST$http$exec("POST", url, headers, body,
3119                                                queryArgs, private$numRetries)
3120             resource <- private$REST$httpParser$parseJSONResponse(response)
3121
3122             if(!is.null(resource$errors))
3123                 stop(resource$errors)
3124
3125             resource
3126         },
3127
3128         #' @description
3129         #' user_agreements_update is a method defined in Arvados class.
3130         #' @param userAgreement userAgreement object.
3131         #' @param uuid The UUID of the userAgreement in question.
3132         user_agreements_update = function(userAgreement, uuid)
3133         {
3134             endPoint <- stringr::str_interp("user_agreements/${uuid}")
3135             url <- paste0(private$host, endPoint)
3136             headers <- list(Authorization = paste("Bearer", private$token),
3137                             "Content-Type" = "application/json")
3138             queryArgs <- NULL
3139
3140             if(length(userAgreement) > 0)
3141                 body <- jsonlite::toJSON(list(userAgreement = userAgreement),
3142                                          auto_unbox = TRUE)
3143             else
3144                 body <- NULL
3145
3146             response <- private$REST$http$exec("PUT", url, headers, body,
3147                                                queryArgs, private$numRetries)
3148             resource <- private$REST$httpParser$parseJSONResponse(response)
3149
3150             if(!is.null(resource$errors))
3151                 stop(resource$errors)
3152
3153             resource
3154         },
3155
3156         #' @description
3157         #' user_agreements_delete is a method defined in Arvados class.
3158         #' @param uuid The UUID of the userAgreement in question.
3159         user_agreements_delete = function(uuid)
3160         {
3161             endPoint <- stringr::str_interp("user_agreements/${uuid}")
3162             url <- paste0(private$host, endPoint)
3163             headers <- list(Authorization = paste("Bearer", private$token),
3164                             "Content-Type" = "application/json")
3165             queryArgs <- NULL
3166
3167             body <- NULL
3168
3169             response <- private$REST$http$exec("DELETE", url, headers, body,
3170                                                queryArgs, private$numRetries)
3171             resource <- private$REST$httpParser$parseJSONResponse(response)
3172
3173             if(!is.null(resource$errors))
3174                 stop(resource$errors)
3175
3176             resource
3177         },
3178
3179         #' @description
3180         #' user_agreements_signatures is a method defined in Arvados class.
3181         user_agreements_signatures = function()
3182         {
3183             endPoint <- stringr::str_interp("user_agreements/signatures")
3184             url <- paste0(private$host, endPoint)
3185             headers <- list(Authorization = paste("Bearer", private$token),
3186                             "Content-Type" = "application/json")
3187             queryArgs <- NULL
3188
3189             body <- NULL
3190
3191             response <- private$REST$http$exec("GET", url, headers, body,
3192                                                queryArgs, private$numRetries)
3193             resource <- private$REST$httpParser$parseJSONResponse(response)
3194
3195             if(!is.null(resource$errors))
3196                 stop(resource$errors)
3197
3198             resource
3199         },
3200
3201         #' @description
3202         #' user_agreements_sign is a method defined in Arvados class.
3203         user_agreements_sign = function()
3204         {
3205             endPoint <- stringr::str_interp("user_agreements/sign")
3206             url <- paste0(private$host, endPoint)
3207             headers <- list(Authorization = paste("Bearer", private$token),
3208                             "Content-Type" = "application/json")
3209             queryArgs <- NULL
3210
3211             body <- NULL
3212
3213             response <- private$REST$http$exec("POST", url, headers, body,
3214                                                queryArgs, private$numRetries)
3215             resource <- private$REST$httpParser$parseJSONResponse(response)
3216
3217             if(!is.null(resource$errors))
3218                 stop(resource$errors)
3219
3220             resource
3221         },
3222
3223         #' @description
3224         #' user_agreements_list is a method defined in Arvados class.
3225         #' @param filters
3226         #' @param where
3227         #' @param order
3228         #' @param select
3229         #' @param distinct
3230         #' @param limit
3231         #' @param offset
3232         #' @param count
3233         #' @param clusterID List objects on a remote federated cluster instead of the current one.
3234         #' @param bypassFederation Bypass federation behavior, list items from local instance database only.
3235         user_agreements_list = function(filters = NULL,
3236                                         where = NULL, order = NULL, select = NULL,
3237                                         distinct = NULL, limit = "100", offset = "0",
3238                                         count = "exact", clusterID = NULL, bypassFederation = NULL)
3239         {
3240             endPoint <- stringr::str_interp("user_agreements")
3241             url <- paste0(private$host, endPoint)
3242             headers <- list(Authorization = paste("Bearer", private$token),
3243                             "Content-Type" = "application/json")
3244             queryArgs <- list(filters = filters, where = where,
3245                               order = order, select = select, distinct = distinct,
3246                               limit = limit, offset = offset, count = count,
3247                               clusterID = clusterID, bypassFederation = bypassFederation)
3248
3249             body <- NULL
3250
3251             response <- private$REST$http$exec("GET", url, headers, body,
3252                                                queryArgs, private$numRetries)
3253             resource <- private$REST$httpParser$parseJSONResponse(response)
3254
3255             if(!is.null(resource$errors))
3256                 stop(resource$errors)
3257
3258             resource
3259         },
3260
3261         #' @description
3262         #' user_agreements_new is a method defined in Arvados class.
3263         user_agreements_new = function()
3264         {
3265             endPoint <- stringr::str_interp("user_agreements/new")
3266             url <- paste0(private$host, endPoint)
3267             headers <- list(Authorization = paste("Bearer", private$token),
3268                             "Content-Type" = "application/json")
3269             queryArgs <- NULL
3270
3271             body <- NULL
3272
3273             response <- private$REST$http$exec("GET", url, headers, body,
3274                                                queryArgs, private$numRetries)
3275             resource <- private$REST$httpParser$parseJSONResponse(response)
3276
3277             if(!is.null(resource$errors))
3278                 stop(resource$errors)
3279
3280             resource
3281         },
3282
3283         #' @description
3284         #' configs_get is a method defined in Arvados class.
3285         configs_get = function()
3286         {
3287             endPoint <- stringr::str_interp("config")
3288             url <- paste0(private$host, endPoint)
3289             headers <- list(Authorization = paste("Bearer", private$token),
3290                             "Content-Type" = "application/json")
3291             queryArgs <- NULL=
3292
3293                 body <- NULL
3294
3295             response <- private$REST$http$exec("GET", url, headers, body,
3296                                                queryArgs, private$numRetries)
3297             resource <- private$REST$httpParser$parseJSONResponse(response)
3298
3299             if(!is.null(resource$errors))
3300                 stop(resource$errors)
3301
3302             resource
3303         },
3304
3305         getHostName = function() private$host,
3306         getToken = function() private$token,
3307         setRESTService = function(newREST) private$REST <- newREST,
3308         getRESTService = function() private$REST
3309     ),
3310
3311     private = list(
3312
3313         token = NULL,
3314         host = NULL,
3315         REST = NULL,
3316         numRetries = NULL
3317     ),
3318
3319     cloneable = FALSE
3320 )
3321
3322