Implement copy method, update move method and remove trailing
authorFuad Muhic <fmuhic@capeannenterprises.com>
Wed, 25 Jul 2018 09:54:08 +0000 (11:54 +0200)
committerFuad Muhic <fmuhic@capeannenterprises.com>
Wed, 25 Jul 2018 09:54:08 +0000 (11:54 +0200)
whitespace in Arvados.R.

Arvados-DCO-1.1-Signed-off-by: Fuad Muhic <fmuhic@capeannenterprises.com>

68 files changed:
sdk/R/R/Arvados.R
sdk/R/R/ArvadosFile.R
sdk/R/R/Collection.R
sdk/R/R/CollectionTree.R
sdk/R/R/HttpRequest.R
sdk/R/R/RESTService.R
sdk/R/R/Subcollection.R
sdk/R/README.Rmd
sdk/R/man/Arvados.Rd
sdk/R/man/ArvadosFile.Rd
sdk/R/man/Subcollection.Rd
sdk/R/man/api_client_authorizations.create_system_auth.Rd
sdk/R/man/api_client_authorizations.list.Rd
sdk/R/man/api_clients.list.Rd
sdk/R/man/authorized_keys.list.Rd
sdk/R/man/collections.list.Rd
sdk/R/man/collections.provenance.Rd
sdk/R/man/collections.trash.Rd
sdk/R/man/collections.untrash.Rd
sdk/R/man/collections.used_by.Rd
sdk/R/man/container_requests.list.Rd
sdk/R/man/containers.auth.Rd
sdk/R/man/containers.list.Rd
sdk/R/man/containers.lock.Rd
sdk/R/man/containers.secret_mounts.Rd
sdk/R/man/containers.unlock.Rd
sdk/R/man/groups.contents.Rd
sdk/R/man/groups.list.Rd
sdk/R/man/groups.trash.Rd
sdk/R/man/groups.untrash.Rd
sdk/R/man/humans.list.Rd
sdk/R/man/job_tasks.list.Rd
sdk/R/man/jobs.cancel.Rd
sdk/R/man/jobs.create.Rd
sdk/R/man/jobs.list.Rd
sdk/R/man/jobs.lock.Rd
sdk/R/man/jobs.queue.Rd
sdk/R/man/keep_disks.list.Rd
sdk/R/man/keep_disks.ping.Rd
sdk/R/man/keep_services.list.Rd
sdk/R/man/links.get_permissions.Rd
sdk/R/man/links.list.Rd
sdk/R/man/logs.list.Rd
sdk/R/man/nodes.list.Rd
sdk/R/man/nodes.ping.Rd
sdk/R/man/pipeline_instances.cancel.Rd
sdk/R/man/pipeline_instances.list.Rd
sdk/R/man/pipeline_templates.list.Rd
sdk/R/man/projects.list.Rd
sdk/R/man/repositories.list.Rd
sdk/R/man/specimens.list.Rd
sdk/R/man/traits.list.Rd
sdk/R/man/user_agreements.list.Rd
sdk/R/man/users.activate.Rd
sdk/R/man/users.list.Rd
sdk/R/man/users.merge.Rd [new file with mode: 0644]
sdk/R/man/users.setup.Rd
sdk/R/man/users.unsetup.Rd
sdk/R/man/users.update_uuid.Rd
sdk/R/man/virtual_machines.list.Rd
sdk/R/man/virtual_machines.logins.Rd
sdk/R/man/workflows.list.Rd
sdk/R/tests/testthat/fakes/FakeHttpRequest.R
sdk/R/tests/testthat/fakes/FakeRESTService.R
sdk/R/tests/testthat/test-ArvadosFile.R
sdk/R/tests/testthat/test-Collection.R
sdk/R/tests/testthat/test-RESTService.R
sdk/R/tests/testthat/test-Subcollection.R

index 4b65546912393b52b4e05a4d1ecd21b83f44bd28..de2aade4adf77c2f6e088c2ca5cb85fa2ec33e2e 100644 (file)
@@ -1,7 +1,3 @@
-# Copyright (C) The Arvados Authors. All rights reserved.
-#
-# SPDX-License-Identifier: Apache-2.0
-
 #' users.get
 #'
 #' users.get is a method defined in Arvados class.
@@ -108,6 +104,19 @@ NULL
 #' @name users.update_uuid
 NULL
 
+#' users.merge
+#'
+#' users.merge is a method defined in Arvados class.
+#'
+#' @usage arv$users.merge(new_owner_uuid,
+#'     new_user_token, redirect_to_new_user = NULL)
+#' @param new_owner_uuid
+#' @param new_user_token
+#' @param redirect_to_new_user
+#' @return User object.
+#' @name users.merge
+NULL
+
 #' users.list
 #'
 #' users.list is a method defined in Arvados class.
@@ -390,55 +399,55 @@ NULL
 #' @name api_clients.list
 NULL
 
-#' authorized_keys.get
+#' container_requests.get
 #'
-#' authorized_keys.get is a method defined in Arvados class.
+#' container_requests.get is a method defined in Arvados class.
 #'
-#' @usage arv$authorized_keys.get(uuid)
-#' @param uuid The UUID of the AuthorizedKey in question.
-#' @return AuthorizedKey object.
-#' @name authorized_keys.get
+#' @usage arv$container_requests.get(uuid)
+#' @param uuid The UUID of the ContainerRequest in question.
+#' @return ContainerRequest object.
+#' @name container_requests.get
 NULL
 
-#' authorized_keys.create
+#' container_requests.create
 #'
-#' authorized_keys.create is a method defined in Arvados class.
+#' container_requests.create is a method defined in Arvados class.
 #'
-#' @usage arv$authorized_keys.create(authorizedkey,
+#' @usage arv$container_requests.create(containerrequest,
 #'     ensure_unique_name = "false")
-#' @param authorizedKey AuthorizedKey object.
+#' @param containerRequest ContainerRequest object.
 #' @param ensure_unique_name Adjust name to ensure uniqueness instead of returning an error on (owner_uuid, name) collision.
-#' @return AuthorizedKey object.
-#' @name authorized_keys.create
+#' @return ContainerRequest object.
+#' @name container_requests.create
 NULL
 
-#' authorized_keys.update
+#' container_requests.update
 #'
-#' authorized_keys.update is a method defined in Arvados class.
+#' container_requests.update is a method defined in Arvados class.
 #'
-#' @usage arv$authorized_keys.update(authorizedkey,
+#' @usage arv$container_requests.update(containerrequest,
 #'     uuid)
-#' @param authorizedKey AuthorizedKey object.
-#' @param uuid The UUID of the AuthorizedKey in question.
-#' @return AuthorizedKey object.
-#' @name authorized_keys.update
+#' @param containerRequest ContainerRequest object.
+#' @param uuid The UUID of the ContainerRequest in question.
+#' @return ContainerRequest object.
+#' @name container_requests.update
 NULL
 
-#' authorized_keys.delete
+#' container_requests.delete
 #'
-#' authorized_keys.delete is a method defined in Arvados class.
+#' container_requests.delete is a method defined in Arvados class.
 #'
-#' @usage arv$authorized_keys.delete(uuid)
-#' @param uuid The UUID of the AuthorizedKey in question.
-#' @return AuthorizedKey object.
-#' @name authorized_keys.delete
+#' @usage arv$container_requests.delete(uuid)
+#' @param uuid The UUID of the ContainerRequest in question.
+#' @return ContainerRequest object.
+#' @name container_requests.delete
 NULL
 
-#' authorized_keys.list
+#' container_requests.list
 #'
-#' authorized_keys.list is a method defined in Arvados class.
+#' container_requests.list is a method defined in Arvados class.
 #'
-#' @usage arv$authorized_keys.list(filters = NULL,
+#' @usage arv$container_requests.list(filters = NULL,
 #'     where = NULL, order = NULL, select = NULL,
 #'     distinct = NULL, limit = "100", offset = "0",
 #'     count = "exact")
@@ -450,59 +459,59 @@ NULL
 #' @param limit
 #' @param offset
 #' @param count
-#' @return AuthorizedKeyList object.
-#' @name authorized_keys.list
+#' @return ContainerRequestList object.
+#' @name container_requests.list
 NULL
 
-#' container_requests.get
+#' authorized_keys.get
 #'
-#' container_requests.get is a method defined in Arvados class.
+#' authorized_keys.get is a method defined in Arvados class.
 #'
-#' @usage arv$container_requests.get(uuid)
-#' @param uuid The UUID of the ContainerRequest in question.
-#' @return ContainerRequest object.
-#' @name container_requests.get
+#' @usage arv$authorized_keys.get(uuid)
+#' @param uuid The UUID of the AuthorizedKey in question.
+#' @return AuthorizedKey object.
+#' @name authorized_keys.get
 NULL
 
-#' container_requests.create
+#' authorized_keys.create
 #'
-#' container_requests.create is a method defined in Arvados class.
+#' authorized_keys.create is a method defined in Arvados class.
 #'
-#' @usage arv$container_requests.create(containerrequest,
+#' @usage arv$authorized_keys.create(authorizedkey,
 #'     ensure_unique_name = "false")
-#' @param containerRequest ContainerRequest object.
+#' @param authorizedKey AuthorizedKey object.
 #' @param ensure_unique_name Adjust name to ensure uniqueness instead of returning an error on (owner_uuid, name) collision.
-#' @return ContainerRequest object.
-#' @name container_requests.create
+#' @return AuthorizedKey object.
+#' @name authorized_keys.create
 NULL
 
-#' container_requests.update
+#' authorized_keys.update
 #'
-#' container_requests.update is a method defined in Arvados class.
+#' authorized_keys.update is a method defined in Arvados class.
 #'
-#' @usage arv$container_requests.update(containerrequest,
+#' @usage arv$authorized_keys.update(authorizedkey,
 #'     uuid)
-#' @param containerRequest ContainerRequest object.
-#' @param uuid The UUID of the ContainerRequest in question.
-#' @return ContainerRequest object.
-#' @name container_requests.update
+#' @param authorizedKey AuthorizedKey object.
+#' @param uuid The UUID of the AuthorizedKey in question.
+#' @return AuthorizedKey object.
+#' @name authorized_keys.update
 NULL
 
-#' container_requests.delete
+#' authorized_keys.delete
 #'
-#' container_requests.delete is a method defined in Arvados class.
+#' authorized_keys.delete is a method defined in Arvados class.
 #'
-#' @usage arv$container_requests.delete(uuid)
-#' @param uuid The UUID of the ContainerRequest in question.
-#' @return ContainerRequest object.
-#' @name container_requests.delete
+#' @usage arv$authorized_keys.delete(uuid)
+#' @param uuid The UUID of the AuthorizedKey in question.
+#' @return AuthorizedKey object.
+#' @name authorized_keys.delete
 NULL
 
-#' container_requests.list
+#' authorized_keys.list
 #'
-#' container_requests.list is a method defined in Arvados class.
+#' authorized_keys.list is a method defined in Arvados class.
 #'
-#' @usage arv$container_requests.list(filters = NULL,
+#' @usage arv$authorized_keys.list(filters = NULL,
 #'     where = NULL, order = NULL, select = NULL,
 #'     distinct = NULL, limit = "100", offset = "0",
 #'     count = "exact")
@@ -514,8 +523,8 @@ NULL
 #' @param limit
 #' @param offset
 #' @param count
-#' @return ContainerRequestList object.
-#' @name container_requests.list
+#' @return AuthorizedKeyList object.
+#' @name authorized_keys.list
 NULL
 
 #' collections.get
@@ -747,78 +756,6 @@ NULL
 #' @name job_tasks.list
 NULL
 
-#' links.get
-#'
-#' links.get is a method defined in Arvados class.
-#'
-#' @usage arv$links.get(uuid)
-#' @param uuid The UUID of the Link in question.
-#' @return Link object.
-#' @name links.get
-NULL
-
-#' links.create
-#'
-#' links.create is a method defined in Arvados class.
-#'
-#' @usage arv$links.create(link, ensure_unique_name = "false")
-#' @param link Link object.
-#' @param ensure_unique_name Adjust name to ensure uniqueness instead of returning an error on (owner_uuid, name) collision.
-#' @return Link object.
-#' @name links.create
-NULL
-
-#' links.update
-#'
-#' links.update is a method defined in Arvados class.
-#'
-#' @usage arv$links.update(link, uuid)
-#' @param link Link object.
-#' @param uuid The UUID of the Link in question.
-#' @return Link object.
-#' @name links.update
-NULL
-
-#' links.delete
-#'
-#' links.delete is a method defined in Arvados class.
-#'
-#' @usage arv$links.delete(uuid)
-#' @param uuid The UUID of the Link in question.
-#' @return Link object.
-#' @name links.delete
-NULL
-
-#' links.list
-#'
-#' links.list is a method defined in Arvados class.
-#'
-#' @usage arv$links.list(filters = NULL,
-#'     where = NULL, order = NULL, select = NULL,
-#'     distinct = NULL, limit = "100", offset = "0",
-#'     count = "exact")
-#' @param filters
-#' @param where
-#' @param order
-#' @param select
-#' @param distinct
-#' @param limit
-#' @param offset
-#' @param count
-#' @return LinkList object.
-#' @name links.list
-NULL
-
-#' links.get_permissions
-#'
-#' links.get_permissions is a method defined in Arvados class.
-#'
-#' @usage arv$links.get_permissions(uuid)
-#' @param uuid
-#' @return Link object.
-#' @name links.get_permissions
-NULL
-
 #' jobs.get
 #'
 #' jobs.get is a method defined in Arvados class.
@@ -1017,53 +954,201 @@ NULL
 #' @name keep_disks.list
 NULL
 
-#' keep_services.get
+#' nodes.get
 #'
-#' keep_services.get is a method defined in Arvados class.
+#' nodes.get is a method defined in Arvados class.
 #'
-#' @usage arv$keep_services.get(uuid)
-#' @param uuid The UUID of the KeepService in question.
-#' @return KeepService object.
-#' @name keep_services.get
+#' @usage arv$nodes.get(uuid)
+#' @param uuid The UUID of the Node in question.
+#' @return Node object.
+#' @name nodes.get
 NULL
 
-#' keep_services.create
+#' nodes.create
 #'
-#' keep_services.create is a method defined in Arvados class.
+#' nodes.create is a method defined in Arvados class.
 #'
-#' @usage arv$keep_services.create(keepservice,
-#'     ensure_unique_name = "false")
-#' @param keepService KeepService object.
+#' @usage arv$nodes.create(node, ensure_unique_name = "false",
+#'     assign_slot = NULL)
+#' @param node Node object.
 #' @param ensure_unique_name Adjust name to ensure uniqueness instead of returning an error on (owner_uuid, name) collision.
-#' @return KeepService object.
-#' @name keep_services.create
+#' @param assign_slot assign slot and hostname
+#' @return Node object.
+#' @name nodes.create
 NULL
 
-#' keep_services.update
+#' nodes.update
 #'
-#' keep_services.update is a method defined in Arvados class.
+#' nodes.update is a method defined in Arvados class.
 #'
-#' @usage arv$keep_services.update(keepservice,
-#'     uuid)
-#' @param keepService KeepService object.
-#' @param uuid The UUID of the KeepService in question.
-#' @return KeepService object.
-#' @name keep_services.update
+#' @usage arv$nodes.update(node, uuid, assign_slot = NULL)
+#' @param node Node object.
+#' @param uuid The UUID of the Node in question.
+#' @param assign_slot assign slot and hostname
+#' @return Node object.
+#' @name nodes.update
 NULL
 
-#' keep_services.delete
+#' nodes.delete
 #'
-#' keep_services.delete is a method defined in Arvados class.
+#' nodes.delete is a method defined in Arvados class.
 #'
-#' @usage arv$keep_services.delete(uuid)
-#' @param uuid The UUID of the KeepService in question.
-#' @return KeepService object.
-#' @name keep_services.delete
+#' @usage arv$nodes.delete(uuid)
+#' @param uuid The UUID of the Node in question.
+#' @return Node object.
+#' @name nodes.delete
 NULL
 
-#' keep_services.accessible
+#' nodes.ping
 #'
-#' keep_services.accessible is a method defined in Arvados class.
+#' nodes.ping is a method defined in Arvados class.
+#'
+#' @usage arv$nodes.ping(uuid, ping_secret)
+#' @param uuid
+#' @param ping_secret
+#' @return Node object.
+#' @name nodes.ping
+NULL
+
+#' nodes.list
+#'
+#' nodes.list is a method defined in Arvados class.
+#'
+#' @usage arv$nodes.list(filters = NULL,
+#'     where = NULL, order = NULL, select = NULL,
+#'     distinct = NULL, limit = "100", offset = "0",
+#'     count = "exact")
+#' @param filters
+#' @param where
+#' @param order
+#' @param select
+#' @param distinct
+#' @param limit
+#' @param offset
+#' @param count
+#' @return NodeList object.
+#' @name nodes.list
+NULL
+
+#' links.get
+#'
+#' links.get is a method defined in Arvados class.
+#'
+#' @usage arv$links.get(uuid)
+#' @param uuid The UUID of the Link in question.
+#' @return Link object.
+#' @name links.get
+NULL
+
+#' links.create
+#'
+#' links.create is a method defined in Arvados class.
+#'
+#' @usage arv$links.create(link, ensure_unique_name = "false")
+#' @param link Link object.
+#' @param ensure_unique_name Adjust name to ensure uniqueness instead of returning an error on (owner_uuid, name) collision.
+#' @return Link object.
+#' @name links.create
+NULL
+
+#' links.update
+#'
+#' links.update is a method defined in Arvados class.
+#'
+#' @usage arv$links.update(link, uuid)
+#' @param link Link object.
+#' @param uuid The UUID of the Link in question.
+#' @return Link object.
+#' @name links.update
+NULL
+
+#' links.delete
+#'
+#' links.delete is a method defined in Arvados class.
+#'
+#' @usage arv$links.delete(uuid)
+#' @param uuid The UUID of the Link in question.
+#' @return Link object.
+#' @name links.delete
+NULL
+
+#' links.list
+#'
+#' links.list is a method defined in Arvados class.
+#'
+#' @usage arv$links.list(filters = NULL,
+#'     where = NULL, order = NULL, select = NULL,
+#'     distinct = NULL, limit = "100", offset = "0",
+#'     count = "exact")
+#' @param filters
+#' @param where
+#' @param order
+#' @param select
+#' @param distinct
+#' @param limit
+#' @param offset
+#' @param count
+#' @return LinkList object.
+#' @name links.list
+NULL
+
+#' links.get_permissions
+#'
+#' links.get_permissions is a method defined in Arvados class.
+#'
+#' @usage arv$links.get_permissions(uuid)
+#' @param uuid
+#' @return Link object.
+#' @name links.get_permissions
+NULL
+
+#' keep_services.get
+#'
+#' keep_services.get is a method defined in Arvados class.
+#'
+#' @usage arv$keep_services.get(uuid)
+#' @param uuid The UUID of the KeepService in question.
+#' @return KeepService object.
+#' @name keep_services.get
+NULL
+
+#' keep_services.create
+#'
+#' keep_services.create is a method defined in Arvados class.
+#'
+#' @usage arv$keep_services.create(keepservice,
+#'     ensure_unique_name = "false")
+#' @param keepService KeepService object.
+#' @param ensure_unique_name Adjust name to ensure uniqueness instead of returning an error on (owner_uuid, name) collision.
+#' @return KeepService object.
+#' @name keep_services.create
+NULL
+
+#' keep_services.update
+#'
+#' keep_services.update is a method defined in Arvados class.
+#'
+#' @usage arv$keep_services.update(keepservice,
+#'     uuid)
+#' @param keepService KeepService object.
+#' @param uuid The UUID of the KeepService in question.
+#' @return KeepService object.
+#' @name keep_services.update
+NULL
+
+#' keep_services.delete
+#'
+#' keep_services.delete is a method defined in Arvados class.
+#'
+#' @usage arv$keep_services.delete(uuid)
+#' @param uuid The UUID of the KeepService in question.
+#' @return KeepService object.
+#' @name keep_services.delete
+NULL
+
+#' keep_services.accessible
+#'
+#' keep_services.accessible is a method defined in Arvados class.
 #'
 #' @usage arv$keep_services.accessible(NULL)
 #' @return KeepService object.
@@ -1228,82 +1313,6 @@ NULL
 #' @name pipeline_instances.list
 NULL
 
-#' nodes.get
-#'
-#' nodes.get is a method defined in Arvados class.
-#'
-#' @usage arv$nodes.get(uuid)
-#' @param uuid The UUID of the Node in question.
-#' @return Node object.
-#' @name nodes.get
-NULL
-
-#' nodes.create
-#'
-#' nodes.create is a method defined in Arvados class.
-#'
-#' @usage arv$nodes.create(node, ensure_unique_name = "false",
-#'     assign_slot = NULL)
-#' @param node Node object.
-#' @param ensure_unique_name Adjust name to ensure uniqueness instead of returning an error on (owner_uuid, name) collision.
-#' @param assign_slot assign slot and hostname
-#' @return Node object.
-#' @name nodes.create
-NULL
-
-#' nodes.update
-#'
-#' nodes.update is a method defined in Arvados class.
-#'
-#' @usage arv$nodes.update(node, uuid, assign_slot = NULL)
-#' @param node Node object.
-#' @param uuid The UUID of the Node in question.
-#' @param assign_slot assign slot and hostname
-#' @return Node object.
-#' @name nodes.update
-NULL
-
-#' nodes.delete
-#'
-#' nodes.delete is a method defined in Arvados class.
-#'
-#' @usage arv$nodes.delete(uuid)
-#' @param uuid The UUID of the Node in question.
-#' @return Node object.
-#' @name nodes.delete
-NULL
-
-#' nodes.ping
-#'
-#' nodes.ping is a method defined in Arvados class.
-#'
-#' @usage arv$nodes.ping(uuid, ping_secret)
-#' @param uuid
-#' @param ping_secret
-#' @return Node object.
-#' @name nodes.ping
-NULL
-
-#' nodes.list
-#'
-#' nodes.list is a method defined in Arvados class.
-#'
-#' @usage arv$nodes.list(filters = NULL,
-#'     where = NULL, order = NULL, select = NULL,
-#'     distinct = NULL, limit = "100", offset = "0",
-#'     count = "exact")
-#' @param filters
-#' @param where
-#' @param order
-#' @param select
-#' @param distinct
-#' @param limit
-#' @param offset
-#' @param count
-#' @return NodeList object.
-#' @name nodes.list
-NULL
-
 #' repositories.get
 #'
 #' repositories.get is a method defined in Arvados class.
@@ -2130,6 +2139,7 @@ NULL
 #'     \item{}{\code{\link{users.delete}}}
 #'     \item{}{\code{\link{users.get}}}
 #'     \item{}{\code{\link{users.list}}}
+#'     \item{}{\code{\link{users.merge}}}
 #'     \item{}{\code{\link{users.setup}}}
 #'     \item{}{\code{\link{users.system}}}
 #'     \item{}{\code{\link{users.unsetup}}}
@@ -2444,6 +2454,28 @@ Arvados <- R6::R6Class(
                        resource
                },
 
+               users.merge = function(new_owner_uuid, new_user_token,
+                       redirect_to_new_user = NULL)
+               {
+                       endPoint <- stringr::str_interp("users/merge")
+                       url <- paste0(private$host, endPoint)
+                       headers <- list(Authorization = paste("OAuth2", private$token),
+                                       "Content-Type" = "application/json")
+                       queryArgs <- list(new_owner_uuid = new_owner_uuid,
+                                                         new_user_token = new_user_token, redirect_to_new_user = redirect_to_new_user)
+
+                       body <- NULL
+
+                       response <- private$REST$http$exec("POST", url, headers, body,
+                                                          queryArgs, private$numRetries)
+                       resource <- private$REST$httpParser$parseJSONResponse(response)
+
+                       if(!is.null(resource$errors))
+                               stop(resource$errors)
+
+                       resource
+               },
+
                users.list = function(filters = NULL, where = NULL,
                        order = NULL, select = NULL, distinct = NULL,
                        limit = "100", offset = "0", count = "exact")
@@ -2949,9 +2981,9 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               authorized_keys.get = function(uuid)
+               container_requests.get = function(uuid)
                {
-                       endPoint <- stringr::str_interp("authorized_keys/${uuid}")
+                       endPoint <- stringr::str_interp("container_requests/${uuid}")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
@@ -2969,17 +3001,17 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               authorized_keys.create = function(authorizedkey,
+               container_requests.create = function(containerrequest,
                        ensure_unique_name = "false")
                {
-                       endPoint <- stringr::str_interp("authorized_keys")
+                       endPoint <- stringr::str_interp("container_requests")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
                        queryArgs <- list(ensure_unique_name = ensure_unique_name)
 
-                       if(length(authorizedkey) > 0)
-                               body <- jsonlite::toJSON(list(authorizedkey = authorizedkey),
+                       if(length(containerrequest) > 0)
+                               body <- jsonlite::toJSON(list(containerrequest = containerrequest),
                                                         auto_unbox = TRUE)
                        else
                                body <- NULL
@@ -2994,16 +3026,16 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               authorized_keys.update = function(authorizedkey, uuid)
+               container_requests.update = function(containerrequest, uuid)
                {
-                       endPoint <- stringr::str_interp("authorized_keys/${uuid}")
+                       endPoint <- stringr::str_interp("container_requests/${uuid}")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
                        queryArgs <- NULL
 
-                       if(length(authorizedkey) > 0)
-                               body <- jsonlite::toJSON(list(authorizedkey = authorizedkey),
+                       if(length(containerrequest) > 0)
+                               body <- jsonlite::toJSON(list(containerrequest = containerrequest),
                                                         auto_unbox = TRUE)
                        else
                                body <- NULL
@@ -3018,9 +3050,9 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               authorized_keys.delete = function(uuid)
+               container_requests.delete = function(uuid)
                {
-                       endPoint <- stringr::str_interp("authorized_keys/${uuid}")
+                       endPoint <- stringr::str_interp("container_requests/${uuid}")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
@@ -3038,12 +3070,12 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               authorized_keys.list = function(filters = NULL,
+               container_requests.list = function(filters = NULL,
                        where = NULL, order = NULL, select = NULL,
                        distinct = NULL, limit = "100", offset = "0",
                        count = "exact")
                {
-                       endPoint <- stringr::str_interp("authorized_keys")
+                       endPoint <- stringr::str_interp("container_requests")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
@@ -3063,9 +3095,9 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               container_requests.get = function(uuid)
+               authorized_keys.get = function(uuid)
                {
-                       endPoint <- stringr::str_interp("container_requests/${uuid}")
+                       endPoint <- stringr::str_interp("authorized_keys/${uuid}")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
@@ -3083,17 +3115,17 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               container_requests.create = function(containerrequest,
+               authorized_keys.create = function(authorizedkey,
                        ensure_unique_name = "false")
                {
-                       endPoint <- stringr::str_interp("container_requests")
+                       endPoint <- stringr::str_interp("authorized_keys")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
                        queryArgs <- list(ensure_unique_name = ensure_unique_name)
 
-                       if(length(containerrequest) > 0)
-                               body <- jsonlite::toJSON(list(containerrequest = containerrequest),
+                       if(length(authorizedkey) > 0)
+                               body <- jsonlite::toJSON(list(authorizedkey = authorizedkey),
                                                         auto_unbox = TRUE)
                        else
                                body <- NULL
@@ -3108,16 +3140,16 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               container_requests.update = function(containerrequest, uuid)
+               authorized_keys.update = function(authorizedkey, uuid)
                {
-                       endPoint <- stringr::str_interp("container_requests/${uuid}")
+                       endPoint <- stringr::str_interp("authorized_keys/${uuid}")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
                        queryArgs <- NULL
 
-                       if(length(containerrequest) > 0)
-                               body <- jsonlite::toJSON(list(containerrequest = containerrequest),
+                       if(length(authorizedkey) > 0)
+                               body <- jsonlite::toJSON(list(authorizedkey = authorizedkey),
                                                         auto_unbox = TRUE)
                        else
                                body <- NULL
@@ -3132,9 +3164,9 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               container_requests.delete = function(uuid)
+               authorized_keys.delete = function(uuid)
                {
-                       endPoint <- stringr::str_interp("container_requests/${uuid}")
+                       endPoint <- stringr::str_interp("authorized_keys/${uuid}")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
@@ -3152,12 +3184,12 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               container_requests.list = function(filters = NULL,
+               authorized_keys.list = function(filters = NULL,
                        where = NULL, order = NULL, select = NULL,
                        distinct = NULL, limit = "100", offset = "0",
                        count = "exact")
                {
-                       endPoint <- stringr::str_interp("container_requests")
+                       endPoint <- stringr::str_interp("authorized_keys")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
@@ -3596,9 +3628,9 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               links.get = function(uuid)
+               jobs.get = function(uuid)
                {
-                       endPoint <- stringr::str_interp("links/${uuid}")
+                       endPoint <- stringr::str_interp("jobs/${uuid}")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
@@ -3616,16 +3648,21 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               links.create = function(link, ensure_unique_name = "false")
+               jobs.create = function(job, ensure_unique_name = "false",
+                       find_or_create = "false", filters = NULL,
+                       minimum_script_version = NULL, exclude_script_versions = NULL)
                {
-                       endPoint <- stringr::str_interp("links")
+                       endPoint <- stringr::str_interp("jobs")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
-                       queryArgs <- list(ensure_unique_name = ensure_unique_name)
+                       queryArgs <- list(ensure_unique_name = ensure_unique_name,
+                                                         find_or_create = find_or_create, filters = filters,
+                                                         minimum_script_version = minimum_script_version,
+                                                         exclude_script_versions = exclude_script_versions)
 
-                       if(length(link) > 0)
-                               body <- jsonlite::toJSON(list(link = link),
+                       if(length(job) > 0)
+                               body <- jsonlite::toJSON(list(job = job),
                                                         auto_unbox = TRUE)
                        else
                                body <- NULL
@@ -3640,16 +3677,16 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               links.update = function(link, uuid)
+               jobs.update = function(job, uuid)
                {
-                       endPoint <- stringr::str_interp("links/${uuid}")
+                       endPoint <- stringr::str_interp("jobs/${uuid}")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
                        queryArgs <- NULL
 
-                       if(length(link) > 0)
-                               body <- jsonlite::toJSON(list(link = link),
+                       if(length(job) > 0)
+                               body <- jsonlite::toJSON(list(job = job),
                                                         auto_unbox = TRUE)
                        else
                                body <- NULL
@@ -3664,9 +3701,9 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               links.delete = function(uuid)
+               jobs.delete = function(uuid)
                {
-                       endPoint <- stringr::str_interp("links/${uuid}")
+                       endPoint <- stringr::str_interp("jobs/${uuid}")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
@@ -3684,11 +3721,11 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               links.list = function(filters = NULL, where = NULL,
+               jobs.queue = function(filters = NULL, where = NULL,
                        order = NULL, select = NULL, distinct = NULL,
                        limit = "100", offset = "0", count = "exact")
                {
-                       endPoint <- stringr::str_interp("links")
+                       endPoint <- stringr::str_interp("jobs/queue")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
@@ -3708,9 +3745,9 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               links.get_permissions = function(uuid)
+               jobs.queue_size = function()
                {
-                       endPoint <- stringr::str_interp("permissions/${uuid}")
+                       endPoint <- stringr::str_interp("jobs/queue_size")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
@@ -3728,9 +3765,9 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               jobs.get = function(uuid)
+               jobs.cancel = function(uuid)
                {
-                       endPoint <- stringr::str_interp("jobs/${uuid}")
+                       endPoint <- stringr::str_interp("jobs/${uuid}/cancel")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
@@ -3738,7 +3775,7 @@ Arvados <- R6::R6Class(
 
                        body <- NULL
 
-                       response <- private$REST$http$exec("GET", url, headers, body,
+                       response <- private$REST$http$exec("POST", url, headers, body,
                                                           queryArgs, private$numRetries)
                        resource <- private$REST$httpParser$parseJSONResponse(response)
 
@@ -3748,24 +3785,15 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               jobs.create = function(job, ensure_unique_name = "false",
-                       find_or_create = "false", filters = NULL,
-                       minimum_script_version = NULL, exclude_script_versions = NULL)
+               jobs.lock = function(uuid)
                {
-                       endPoint <- stringr::str_interp("jobs")
+                       endPoint <- stringr::str_interp("jobs/${uuid}/lock")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
-                       queryArgs <- list(ensure_unique_name = ensure_unique_name,
-                                                         find_or_create = find_or_create, filters = filters,
-                                                         minimum_script_version = minimum_script_version,
-                                                         exclude_script_versions = exclude_script_versions)
+                       queryArgs <- NULL
 
-                       if(length(job) > 0)
-                               body <- jsonlite::toJSON(list(job = job),
-                                                        auto_unbox = TRUE)
-                       else
-                               body <- NULL
+                       body <- NULL
 
                        response <- private$REST$http$exec("POST", url, headers, body,
                                                           queryArgs, private$numRetries)
@@ -3777,21 +3805,21 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               jobs.update = function(job, uuid)
+               jobs.list = function(filters = NULL, where = NULL,
+                       order = NULL, select = NULL, distinct = NULL,
+                       limit = "100", offset = "0", count = "exact")
                {
-                       endPoint <- stringr::str_interp("jobs/${uuid}")
+                       endPoint <- stringr::str_interp("jobs")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
-                       queryArgs <- NULL
+                       queryArgs <- list(filters = filters, where = where,
+                                                         order = order, select = select, distinct = distinct,
+                                                         limit = limit, offset = offset, count = count)
 
-                       if(length(job) > 0)
-                               body <- jsonlite::toJSON(list(job = job),
-                                                        auto_unbox = TRUE)
-                       else
-                               body <- NULL
+                       body <- NULL
 
-                       response <- private$REST$http$exec("PUT", url, headers, body,
+                       response <- private$REST$http$exec("GET", url, headers, body,
                                                           queryArgs, private$numRetries)
                        resource <- private$REST$httpParser$parseJSONResponse(response)
 
@@ -3801,9 +3829,9 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               jobs.delete = function(uuid)
+               keep_disks.get = function(uuid)
                {
-                       endPoint <- stringr::str_interp("jobs/${uuid}")
+                       endPoint <- stringr::str_interp("keep_disks/${uuid}")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
@@ -3811,7 +3839,7 @@ Arvados <- R6::R6Class(
 
                        body <- NULL
 
-                       response <- private$REST$http$exec("DELETE", url, headers, body,
+                       response <- private$REST$http$exec("GET", url, headers, body,
                                                           queryArgs, private$numRetries)
                        resource <- private$REST$httpParser$parseJSONResponse(response)
 
@@ -3821,21 +3849,21 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               jobs.queue = function(filters = NULL, where = NULL,
-                       order = NULL, select = NULL, distinct = NULL,
-                       limit = "100", offset = "0", count = "exact")
+               keep_disks.create = function(keepdisk, ensure_unique_name = "false")
                {
-                       endPoint <- stringr::str_interp("jobs/queue")
+                       endPoint <- stringr::str_interp("keep_disks")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
-                       queryArgs <- list(filters = filters, where = where,
-                                                         order = order, select = select, distinct = distinct,
-                                                         limit = limit, offset = offset, count = count)
+                       queryArgs <- list(ensure_unique_name = ensure_unique_name)
 
-                       body <- NULL
+                       if(length(keepdisk) > 0)
+                               body <- jsonlite::toJSON(list(keepdisk = keepdisk),
+                                                        auto_unbox = TRUE)
+                       else
+                               body <- NULL
 
-                       response <- private$REST$http$exec("GET", url, headers, body,
+                       response <- private$REST$http$exec("POST", url, headers, body,
                                                           queryArgs, private$numRetries)
                        resource <- private$REST$httpParser$parseJSONResponse(response)
 
@@ -3845,17 +3873,21 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               jobs.queue_size = function()
+               keep_disks.update = function(keepdisk, uuid)
                {
-                       endPoint <- stringr::str_interp("jobs/queue_size")
+                       endPoint <- stringr::str_interp("keep_disks/${uuid}")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
                        queryArgs <- NULL
 
-                       body <- NULL
+                       if(length(keepdisk) > 0)
+                               body <- jsonlite::toJSON(list(keepdisk = keepdisk),
+                                                        auto_unbox = TRUE)
+                       else
+                               body <- NULL
 
-                       response <- private$REST$http$exec("GET", url, headers, body,
+                       response <- private$REST$http$exec("PUT", url, headers, body,
                                                           queryArgs, private$numRetries)
                        resource <- private$REST$httpParser$parseJSONResponse(response)
 
@@ -3865,9 +3897,9 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               jobs.cancel = function(uuid)
+               keep_disks.delete = function(uuid)
                {
-                       endPoint <- stringr::str_interp("jobs/${uuid}/cancel")
+                       endPoint <- stringr::str_interp("keep_disks/${uuid}")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
@@ -3875,7 +3907,7 @@ Arvados <- R6::R6Class(
 
                        body <- NULL
 
-                       response <- private$REST$http$exec("POST", url, headers, body,
+                       response <- private$REST$http$exec("DELETE", url, headers, body,
                                                           queryArgs, private$numRetries)
                        resource <- private$REST$httpParser$parseJSONResponse(response)
 
@@ -3885,13 +3917,18 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               jobs.lock = function(uuid)
+               keep_disks.ping = function(uuid = NULL, ping_secret,
+                       node_uuid = NULL, filesystem_uuid = NULL,
+                       service_host = NULL, service_port, service_ssl_flag)
                {
-                       endPoint <- stringr::str_interp("jobs/${uuid}/lock")
+                       endPoint <- stringr::str_interp("keep_disks/ping")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
-                       queryArgs <- NULL
+                       queryArgs <- list(uuid = uuid, ping_secret = ping_secret,
+                                                         node_uuid = node_uuid, filesystem_uuid = filesystem_uuid,
+                                                         service_host = service_host, service_port = service_port,
+                                                         service_ssl_flag = service_ssl_flag)
 
                        body <- NULL
 
@@ -3905,11 +3942,12 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               jobs.list = function(filters = NULL, where = NULL,
-                       order = NULL, select = NULL, distinct = NULL,
-                       limit = "100", offset = "0", count = "exact")
+               keep_disks.list = function(filters = NULL,
+                       where = NULL, order = NULL, select = NULL,
+                       distinct = NULL, limit = "100", offset = "0",
+                       count = "exact")
                {
-                       endPoint <- stringr::str_interp("jobs")
+                       endPoint <- stringr::str_interp("keep_disks")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
@@ -3929,9 +3967,9 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               keep_disks.get = function(uuid)
+               nodes.get = function(uuid)
                {
-                       endPoint <- stringr::str_interp("keep_disks/${uuid}")
+                       endPoint <- stringr::str_interp("nodes/${uuid}")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
@@ -3949,16 +3987,18 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               keep_disks.create = function(keepdisk, ensure_unique_name = "false")
+               nodes.create = function(node, ensure_unique_name = "false",
+                       assign_slot = NULL)
                {
-                       endPoint <- stringr::str_interp("keep_disks")
+                       endPoint <- stringr::str_interp("nodes")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
-                       queryArgs <- list(ensure_unique_name = ensure_unique_name)
+                       queryArgs <- list(ensure_unique_name = ensure_unique_name,
+                                                         assign_slot = assign_slot)
 
-                       if(length(keepdisk) > 0)
-                               body <- jsonlite::toJSON(list(keepdisk = keepdisk),
+                       if(length(node) > 0)
+                               body <- jsonlite::toJSON(list(node = node),
                                                         auto_unbox = TRUE)
                        else
                                body <- NULL
@@ -3973,16 +4013,16 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               keep_disks.update = function(keepdisk, uuid)
+               nodes.update = function(node, uuid, assign_slot = NULL)
                {
-                       endPoint <- stringr::str_interp("keep_disks/${uuid}")
+                       endPoint <- stringr::str_interp("nodes/${uuid}")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
-                       queryArgs <- NULL
+                       queryArgs <- list(assign_slot = assign_slot)
 
-                       if(length(keepdisk) > 0)
-                               body <- jsonlite::toJSON(list(keepdisk = keepdisk),
+                       if(length(node) > 0)
+                               body <- jsonlite::toJSON(list(node = node),
                                                         auto_unbox = TRUE)
                        else
                                body <- NULL
@@ -3997,9 +4037,9 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               keep_disks.delete = function(uuid)
+               nodes.delete = function(uuid)
                {
-                       endPoint <- stringr::str_interp("keep_disks/${uuid}")
+                       endPoint <- stringr::str_interp("nodes/${uuid}")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
@@ -4017,18 +4057,13 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               keep_disks.ping = function(uuid = NULL, ping_secret,
-                       node_uuid = NULL, filesystem_uuid = NULL,
-                       service_host = NULL, service_port, service_ssl_flag)
+               nodes.ping = function(uuid, ping_secret)
                {
-                       endPoint <- stringr::str_interp("keep_disks/ping")
+                       endPoint <- stringr::str_interp("nodes/${uuid}/ping")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
-                       queryArgs <- list(uuid = uuid, ping_secret = ping_secret,
-                                                         node_uuid = node_uuid, filesystem_uuid = filesystem_uuid,
-                                                         service_host = service_host, service_port = service_port,
-                                                         service_ssl_flag = service_ssl_flag)
+                       queryArgs <- list(ping_secret = ping_secret)
 
                        body <- NULL
 
@@ -4042,12 +4077,11 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               keep_disks.list = function(filters = NULL,
-                       where = NULL, order = NULL, select = NULL,
-                       distinct = NULL, limit = "100", offset = "0",
-                       count = "exact")
+               nodes.list = function(filters = NULL, where = NULL,
+                       order = NULL, select = NULL, distinct = NULL,
+                       limit = "100", offset = "0", count = "exact")
                {
-                       endPoint <- stringr::str_interp("keep_disks")
+                       endPoint <- stringr::str_interp("nodes")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
@@ -4067,9 +4101,9 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               keep_services.get = function(uuid)
+               links.get = function(uuid)
                {
-                       endPoint <- stringr::str_interp("keep_services/${uuid}")
+                       endPoint <- stringr::str_interp("links/${uuid}")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
@@ -4087,17 +4121,16 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               keep_services.create = function(keepservice,
-                       ensure_unique_name = "false")
+               links.create = function(link, ensure_unique_name = "false")
                {
-                       endPoint <- stringr::str_interp("keep_services")
+                       endPoint <- stringr::str_interp("links")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
                        queryArgs <- list(ensure_unique_name = ensure_unique_name)
 
-                       if(length(keepservice) > 0)
-                               body <- jsonlite::toJSON(list(keepservice = keepservice),
+                       if(length(link) > 0)
+                               body <- jsonlite::toJSON(list(link = link),
                                                         auto_unbox = TRUE)
                        else
                                body <- NULL
@@ -4112,16 +4145,16 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               keep_services.update = function(keepservice, uuid)
+               links.update = function(link, uuid)
                {
-                       endPoint <- stringr::str_interp("keep_services/${uuid}")
+                       endPoint <- stringr::str_interp("links/${uuid}")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
                        queryArgs <- NULL
 
-                       if(length(keepservice) > 0)
-                               body <- jsonlite::toJSON(list(keepservice = keepservice),
+                       if(length(link) > 0)
+                               body <- jsonlite::toJSON(list(link = link),
                                                         auto_unbox = TRUE)
                        else
                                body <- NULL
@@ -4136,9 +4169,9 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               keep_services.delete = function(uuid)
+               links.delete = function(uuid)
                {
-                       endPoint <- stringr::str_interp("keep_services/${uuid}")
+                       endPoint <- stringr::str_interp("links/${uuid}")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
@@ -4156,13 +4189,17 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               keep_services.accessible = function()
+               links.list = function(filters = NULL, where = NULL,
+                       order = NULL, select = NULL, distinct = NULL,
+                       limit = "100", offset = "0", count = "exact")
                {
-                       endPoint <- stringr::str_interp("keep_services/accessible")
+                       endPoint <- stringr::str_interp("links")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
-                       queryArgs <- NULL
+                       queryArgs <- list(filters = filters, where = where,
+                                                         order = order, select = select, distinct = distinct,
+                                                         limit = limit, offset = offset, count = count)
 
                        body <- NULL
 
@@ -4176,18 +4213,13 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               keep_services.list = function(filters = NULL,
-                       where = NULL, order = NULL, select = NULL,
-                       distinct = NULL, limit = "100", offset = "0",
-                       count = "exact")
+               links.get_permissions = function(uuid)
                {
-                       endPoint <- stringr::str_interp("keep_services")
+                       endPoint <- stringr::str_interp("permissions/${uuid}")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
-                       queryArgs <- list(filters = filters, where = where,
-                                                         order = order, select = select, distinct = distinct,
-                                                         limit = limit, offset = offset, count = count)
+                       queryArgs <- NULL
 
                        body <- NULL
 
@@ -4201,9 +4233,9 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               pipeline_templates.get = function(uuid)
+               keep_services.get = function(uuid)
                {
-                       endPoint <- stringr::str_interp("pipeline_templates/${uuid}")
+                       endPoint <- stringr::str_interp("keep_services/${uuid}")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
@@ -4221,17 +4253,17 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               pipeline_templates.create = function(pipelinetemplate,
+               keep_services.create = function(keepservice,
                        ensure_unique_name = "false")
                {
-                       endPoint <- stringr::str_interp("pipeline_templates")
+                       endPoint <- stringr::str_interp("keep_services")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
                        queryArgs <- list(ensure_unique_name = ensure_unique_name)
 
-                       if(length(pipelinetemplate) > 0)
-                               body <- jsonlite::toJSON(list(pipelinetemplate = pipelinetemplate),
+                       if(length(keepservice) > 0)
+                               body <- jsonlite::toJSON(list(keepservice = keepservice),
                                                         auto_unbox = TRUE)
                        else
                                body <- NULL
@@ -4246,16 +4278,16 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               pipeline_templates.update = function(pipelinetemplate, uuid)
+               keep_services.update = function(keepservice, uuid)
                {
-                       endPoint <- stringr::str_interp("pipeline_templates/${uuid}")
+                       endPoint <- stringr::str_interp("keep_services/${uuid}")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
                        queryArgs <- NULL
 
-                       if(length(pipelinetemplate) > 0)
-                               body <- jsonlite::toJSON(list(pipelinetemplate = pipelinetemplate),
+                       if(length(keepservice) > 0)
+                               body <- jsonlite::toJSON(list(keepservice = keepservice),
                                                         auto_unbox = TRUE)
                        else
                                body <- NULL
@@ -4270,9 +4302,9 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               pipeline_templates.delete = function(uuid)
+               keep_services.delete = function(uuid)
                {
-                       endPoint <- stringr::str_interp("pipeline_templates/${uuid}")
+                       endPoint <- stringr::str_interp("keep_services/${uuid}")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
@@ -4290,18 +4322,13 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               pipeline_templates.list = function(filters = NULL,
-                       where = NULL, order = NULL, select = NULL,
-                       distinct = NULL, limit = "100", offset = "0",
-                       count = "exact")
+               keep_services.accessible = function()
                {
-                       endPoint <- stringr::str_interp("pipeline_templates")
+                       endPoint <- stringr::str_interp("keep_services/accessible")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
-                       queryArgs <- list(filters = filters, where = where,
-                                                         order = order, select = select, distinct = distinct,
-                                                         limit = limit, offset = offset, count = count)
+                       queryArgs <- NULL
 
                        body <- NULL
 
@@ -4315,13 +4342,18 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               pipeline_instances.get = function(uuid)
+               keep_services.list = function(filters = NULL,
+                       where = NULL, order = NULL, select = NULL,
+                       distinct = NULL, limit = "100", offset = "0",
+                       count = "exact")
                {
-                       endPoint <- stringr::str_interp("pipeline_instances/${uuid}")
+                       endPoint <- stringr::str_interp("keep_services")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
-                       queryArgs <- NULL
+                       queryArgs <- list(filters = filters, where = where,
+                                                         order = order, select = select, distinct = distinct,
+                                                         limit = limit, offset = offset, count = count)
 
                        body <- NULL
 
@@ -4335,22 +4367,17 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               pipeline_instances.create = function(pipelineinstance,
-                       ensure_unique_name = "false")
+               pipeline_templates.get = function(uuid)
                {
-                       endPoint <- stringr::str_interp("pipeline_instances")
+                       endPoint <- stringr::str_interp("pipeline_templates/${uuid}")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
-                       queryArgs <- list(ensure_unique_name = ensure_unique_name)
+                       queryArgs <- NULL
 
-                       if(length(pipelineinstance) > 0)
-                               body <- jsonlite::toJSON(list(pipelineinstance = pipelineinstance),
-                                                        auto_unbox = TRUE)
-                       else
-                               body <- NULL
+                       body <- NULL
 
-                       response <- private$REST$http$exec("POST", url, headers, body,
+                       response <- private$REST$http$exec("GET", url, headers, body,
                                                           queryArgs, private$numRetries)
                        resource <- private$REST$httpParser$parseJSONResponse(response)
 
@@ -4360,21 +4387,22 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               pipeline_instances.update = function(pipelineinstance, uuid)
+               pipeline_templates.create = function(pipelinetemplate,
+                       ensure_unique_name = "false")
                {
-                       endPoint <- stringr::str_interp("pipeline_instances/${uuid}")
+                       endPoint <- stringr::str_interp("pipeline_templates")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
-                       queryArgs <- NULL
+                       queryArgs <- list(ensure_unique_name = ensure_unique_name)
 
-                       if(length(pipelineinstance) > 0)
-                               body <- jsonlite::toJSON(list(pipelineinstance = pipelineinstance),
+                       if(length(pipelinetemplate) > 0)
+                               body <- jsonlite::toJSON(list(pipelinetemplate = pipelinetemplate),
                                                         auto_unbox = TRUE)
                        else
                                body <- NULL
 
-                       response <- private$REST$http$exec("PUT", url, headers, body,
+                       response <- private$REST$http$exec("POST", url, headers, body,
                                                           queryArgs, private$numRetries)
                        resource <- private$REST$httpParser$parseJSONResponse(response)
 
@@ -4384,17 +4412,21 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               pipeline_instances.delete = function(uuid)
+               pipeline_templates.update = function(pipelinetemplate, uuid)
                {
-                       endPoint <- stringr::str_interp("pipeline_instances/${uuid}")
+                       endPoint <- stringr::str_interp("pipeline_templates/${uuid}")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
                        queryArgs <- NULL
 
-                       body <- NULL
+                       if(length(pipelinetemplate) > 0)
+                               body <- jsonlite::toJSON(list(pipelinetemplate = pipelinetemplate),
+                                                        auto_unbox = TRUE)
+                       else
+                               body <- NULL
 
-                       response <- private$REST$http$exec("DELETE", url, headers, body,
+                       response <- private$REST$http$exec("PUT", url, headers, body,
                                                           queryArgs, private$numRetries)
                        resource <- private$REST$httpParser$parseJSONResponse(response)
 
@@ -4404,9 +4436,9 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               pipeline_instances.cancel = function(uuid)
+               pipeline_templates.delete = function(uuid)
                {
-                       endPoint <- stringr::str_interp("pipeline_instances/${uuid}/cancel")
+                       endPoint <- stringr::str_interp("pipeline_templates/${uuid}")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
@@ -4414,7 +4446,7 @@ Arvados <- R6::R6Class(
 
                        body <- NULL
 
-                       response <- private$REST$http$exec("POST", url, headers, body,
+                       response <- private$REST$http$exec("DELETE", url, headers, body,
                                                           queryArgs, private$numRetries)
                        resource <- private$REST$httpParser$parseJSONResponse(response)
 
@@ -4424,12 +4456,12 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               pipeline_instances.list = function(filters = NULL,
+               pipeline_templates.list = function(filters = NULL,
                        where = NULL, order = NULL, select = NULL,
                        distinct = NULL, limit = "100", offset = "0",
                        count = "exact")
                {
-                       endPoint <- stringr::str_interp("pipeline_instances")
+                       endPoint <- stringr::str_interp("pipeline_templates")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
@@ -4449,9 +4481,9 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               nodes.get = function(uuid)
+               pipeline_instances.get = function(uuid)
                {
-                       endPoint <- stringr::str_interp("nodes/${uuid}")
+                       endPoint <- stringr::str_interp("pipeline_instances/${uuid}")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
@@ -4469,18 +4501,17 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               nodes.create = function(node, ensure_unique_name = "false",
-                       assign_slot = NULL)
+               pipeline_instances.create = function(pipelineinstance,
+                       ensure_unique_name = "false")
                {
-                       endPoint <- stringr::str_interp("nodes")
+                       endPoint <- stringr::str_interp("pipeline_instances")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
-                       queryArgs <- list(ensure_unique_name = ensure_unique_name,
-                                                         assign_slot = assign_slot)
+                       queryArgs <- list(ensure_unique_name = ensure_unique_name)
 
-                       if(length(node) > 0)
-                               body <- jsonlite::toJSON(list(node = node),
+                       if(length(pipelineinstance) > 0)
+                               body <- jsonlite::toJSON(list(pipelineinstance = pipelineinstance),
                                                         auto_unbox = TRUE)
                        else
                                body <- NULL
@@ -4495,16 +4526,16 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               nodes.update = function(node, uuid, assign_slot = NULL)
+               pipeline_instances.update = function(pipelineinstance, uuid)
                {
-                       endPoint <- stringr::str_interp("nodes/${uuid}")
+                       endPoint <- stringr::str_interp("pipeline_instances/${uuid}")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
-                       queryArgs <- list(assign_slot = assign_slot)
+                       queryArgs <- NULL
 
-                       if(length(node) > 0)
-                               body <- jsonlite::toJSON(list(node = node),
+                       if(length(pipelineinstance) > 0)
+                               body <- jsonlite::toJSON(list(pipelineinstance = pipelineinstance),
                                                         auto_unbox = TRUE)
                        else
                                body <- NULL
@@ -4519,9 +4550,9 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               nodes.delete = function(uuid)
+               pipeline_instances.delete = function(uuid)
                {
-                       endPoint <- stringr::str_interp("nodes/${uuid}")
+                       endPoint <- stringr::str_interp("pipeline_instances/${uuid}")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
@@ -4539,13 +4570,13 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               nodes.ping = function(uuid, ping_secret)
+               pipeline_instances.cancel = function(uuid)
                {
-                       endPoint <- stringr::str_interp("nodes/${uuid}/ping")
+                       endPoint <- stringr::str_interp("pipeline_instances/${uuid}/cancel")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
-                       queryArgs <- list(ping_secret = ping_secret)
+                       queryArgs <- NULL
 
                        body <- NULL
 
@@ -4559,11 +4590,12 @@ Arvados <- R6::R6Class(
                        resource
                },
 
-               nodes.list = function(filters = NULL, where = NULL,
-                       order = NULL, select = NULL, distinct = NULL,
-                       limit = "100", offset = "0", count = "exact")
+               pipeline_instances.list = function(filters = NULL,
+                       where = NULL, order = NULL, select = NULL,
+                       distinct = NULL, limit = "100", offset = "0",
+                       count = "exact")
                {
-                       endPoint <- stringr::str_interp("nodes")
+                       endPoint <- stringr::str_interp("pipeline_instances")
                        url <- paste0(private$host, endPoint)
                        headers <- list(Authorization = paste("OAuth2", private$token),
                                        "Content-Type" = "application/json")
index 1071302892690a659370d41afaa4336316678362..2257d99bfe9a8ed9d42d18a026fe6974eb20a76c 100644 (file)
@@ -26,7 +26,8 @@ source("./R/util.R")
 #'   \item{flush()}{Write connections content to a file (override current content of the file).}
 #'   \item{remove(name)}{Removes ArvadosFile or Subcollection specified by name from the subcollection.}
 #'   \item{getSizeInBytes()}{Returns file size in bytes.}
-#'   \item{move(newLocation)}{Moves file to a new location inside collection.}
+#'   \item{move(destination)}{Moves file to a new location inside collection.}
+#'   \item{copy(destination)}{Copies file to a new location inside collection.}
 #' }
 #'
 #' @name ArvadosFile
@@ -49,6 +50,7 @@ source("./R/util.R")
 #' mytable <- read.table(arvConnection)
 #'
 #' myFile$move("newFolder/myFile")
+#' myFile$copy("newFolder/myFile")
 #' }
 NULL
 
@@ -83,7 +85,6 @@ ArvadosFile <- R6::R6Class(
 
             fileSize <- REST$getResourceSize(self$getRelativePath(),
                                              private$collection$uuid)
-
             fileSize
         },
 
@@ -99,7 +100,7 @@ ArvadosFile <- R6::R6Class(
 
         getCollection = function() private$collection,
 
-        setCollection = function(collection)
+        setCollection = function(collection, setRecursively = TRUE)
         {
             private$collection <- collection
         },
@@ -176,20 +177,18 @@ ArvadosFile <- R6::R6Class(
             writeResult
         },
 
-        move = function(newLocation)
+        move = function(destination)
         {
             if(is.null(private$collection))
-                stop("ArvadosFile doesn't belong to any collection")
+                stop("ArvadosFile doesn't belong to any collection.")
 
-            newLocation <- trimFromEnd(newLocation, "/")
-            nameAndPath <- splitToPathAndName(newLocation)
+            destination <- trimFromEnd(destination, "/")
+            nameAndPath <- splitToPathAndName(destination)
 
             newParent <- private$collection$get(nameAndPath$path)
 
             if(is.null(newParent))
-            {
-                stop("Unable to get destination subcollection")
-            }
+                stop("Unable to get destination subcollection.")
 
             childWithSameName <- newParent$get(nameAndPath$name)
 
@@ -202,11 +201,50 @@ ArvadosFile <- R6::R6Class(
                       private$collection$uuid)
 
             private$dettachFromCurrentParent()
-            private$attachToNewParent(newParent)
+            private$attachToNewParent(self, newParent)
 
+            private$parent <- newParent
             private$name <- nameAndPath$name
 
-            "Content moved successfully."
+            self
+        },
+
+        copy = function(destination)
+        {
+            if(is.null(private$collection))
+                stop("ArvadosFile doesn't belong to any collection.")
+
+            destination <- trimFromEnd(destination, "/")
+            nameAndPath <- splitToPathAndName(destination)
+
+            newParent <- private$collection$get(nameAndPath$path)
+
+            if(is.null(newParent))
+                stop("Unable to get destination subcollection.")
+
+            childWithSameName <- newParent$get(nameAndPath$name)
+
+            if(!is.null(childWithSameName))
+                stop("Destination already contains content with same name.")
+
+            REST <- private$collection$getRESTService()
+            REST$copy(self$getRelativePath(),
+                      paste0(newParent$getRelativePath(), "/", nameAndPath$name),
+                      private$collection$uuid)
+
+            newFile <- self$duplicate(nameAndPath$name)
+            newFile$setCollection(self$getCollection())
+            private$attachToNewParent(newFile, newParent)
+            newFile$setParent(newParent)
+
+            newFile
+        },
+
+        duplicate = function(newName = NULL)
+        {
+            name <- if(!is.null(newName)) newName else private$name
+            newFile <- ArvadosFile$new(name)
+            newFile
         }
     ),
 
@@ -218,30 +256,24 @@ ArvadosFile <- R6::R6Class(
         collection = NULL,
         buffer     = NULL,
 
-        attachToNewParent = function(newParent)
+        attachToNewParent = function(content, newParent)
         {
             #Note: We temporary set parents collection to NULL. This will ensure that
-            #      add method doesn't post file on REST.
+            #      add method doesn't post this file on REST.
             parentsCollection <- newParent$getCollection()
             newParent$setCollection(NULL, setRecursively = FALSE)
-
-            newParent$add(self)
-
+            newParent$add(content)
             newParent$setCollection(parentsCollection, setRecursively = FALSE)
-
-            private$parent <- newParent
         },
 
         dettachFromCurrentParent = function()
         {
             #Note: We temporary set parents collection to NULL. This will ensure that
-            #      remove method doesn't remove this subcollection from REST.
+            #      remove method doesn't remove this file from REST.
             parent <- private$parent
             parentsCollection <- parent$getCollection()
             parent$setCollection(NULL, setRecursively = FALSE)
-
             parent$remove(private$name)
-
             parent$setCollection(parentsCollection, setRecursively = FALSE)
         }
     ),
@@ -267,8 +299,8 @@ print.ArvadosFile = function(x, ...)
         relativePath <- paste0("/", relativePath)
     }
 
-    cat(paste0("Type:          ", "\"", "ArvadosFile",         "\""), sep = "\n")
-    cat(paste0("Name:          ", "\"", x$getName(),           "\""), sep = "\n")
-    cat(paste0("Relative path: ", "\"", relativePath,          "\""), sep = "\n")
-    cat(paste0("Collection:    ", "\"", collection,            "\""), sep = "\n")
+    cat(paste0("Type:          ", "\"", "ArvadosFile", "\""), sep = "\n")
+    cat(paste0("Name:          ", "\"", x$getName(),   "\""), sep = "\n")
+    cat(paste0("Relative path: ", "\"", relativePath,  "\""), sep = "\n")
+    cat(paste0("Collection:    ", "\"", collection,    "\""), sep = "\n")
 }
index 833b833c80f367ef59d4ca82ef78784e278cf73d..f88eb0e7cdfd36a097cf79494a4d298b5d199d35 100644 (file)
@@ -58,23 +58,17 @@ Collection <- R6::R6Class(
     public = list(
 
                uuid = NULL,
-        # api  = NULL,
 
                initialize = function(api, uuid)
         {
-            # self$api <- api
             private$REST <- api$getRESTService()
-
             self$uuid <- uuid
-
-            private$fileContent <- private$REST$getCollectionContent(uuid)
-            private$tree <- CollectionTree$new(private$fileContent, self)
         },
 
         add = function(content, relativePath = "")
         {
             if(is.null(private$tree))
-                private$genereateCollectionTreeStructure()
+                private$generateCollectionTreeStructure()
 
             if(relativePath == ""  ||
                relativePath == "." ||
@@ -111,7 +105,7 @@ Collection <- R6::R6Class(
         create = function(fileNames, relativePath = "")
         {
             if(is.null(private$tree))
-                private$genereateCollectionTreeStructure()
+                private$generateCollectionTreeStructure()
 
             if(relativePath == ""  ||
                relativePath == "." ||
@@ -159,7 +153,7 @@ Collection <- R6::R6Class(
         remove = function(paths)
         {
             if(is.null(private$tree))
-                private$genereateCollectionTreeStructure()
+                private$generateCollectionTreeStructure()
 
             if(is.character(paths))
             {
@@ -189,10 +183,10 @@ Collection <- R6::R6Class(
             }
         },
 
-        move = function(content, newLocation)
+        move = function(content, destination)
         {
             if(is.null(private$tree))
-                private$genereateCollectionTreeStructure()
+                private$generateCollectionTreeStructure()
 
             content <- trimFromEnd(content, "/")
 
@@ -201,13 +195,34 @@ Collection <- R6::R6Class(
             if(is.null(elementToMove))
                 stop("Content you want to move doesn't exist in the collection.")
 
-            elementToMove$move(newLocation)
+            elementToMove$move(destination)
+        },
+
+        copy = function(content, destination)
+        {
+            if(is.null(private$tree))
+                private$generateCollectionTreeStructure()
+
+            content <- trimFromEnd(content, "/")
+
+            elementToCopy <- self$get(content)
+
+            if(is.null(elementToCopy))
+                stop("Content you want to copy doesn't exist in the collection.")
+
+            elementToCopy$copy(destination)
+        },
+
+        refresh = function()
+        {
+            private$tree$getTree()$setCollection(NULL, setRecursively = TRUE)
+            private$tree <- NULL
         },
 
         getFileListing = function()
         {
             if(is.null(private$tree))
-                private$genereateCollectionTreeStructure()
+                private$generateCollectionTreeStructure()
 
             content <- private$REST$getCollectionContent(self$uuid)
             content[order(tolower(content))]
@@ -216,32 +231,11 @@ Collection <- R6::R6Class(
         get = function(relativePath)
         {
             if(is.null(private$tree))
-                private$genereateCollectionTreeStructure()
+                private$generateCollectionTreeStructure()
 
             private$tree$getElement(relativePath)
         },
 
-               toJSON = function()
-        {
-                       fields <- sapply(private$classFields, function(field)
-                       {
-                               self[[field]]
-                       }, USE.NAMES = TRUE)
-
-                       jsonlite::toJSON(list("collection" =
-                     Filter(Negate(is.null), fields)), auto_unbox = TRUE)
-               },
-
-               isEmpty = function() {
-                       fields <- sapply(private$classFields,
-                                        function(field) self[[field]])
-
-                       if(any(sapply(fields, function(field) !is.null(field) && field != "")))
-                               FALSE
-                       else
-                               TRUE
-               },
-
         getRESTService = function() private$REST,
         setRESTService = function(newRESTService) private$REST <- newRESTService
     ),
@@ -251,9 +245,8 @@ Collection <- R6::R6Class(
         REST        = NULL,
         tree        = NULL,
         fileContent = NULL,
-        classFields = NULL,
 
-        genereateCollectionTreeStructure = function()
+        generateCollectionTreeStructure = function()
         {
             if(is.null(self$uuid))
                 stop("Collection uuid is not defined.")
index 8b2f8876b0f91a0d86e148f81f1d29d87ab2f479..2d4af094aa1c96b98b585cba059085c95b537f8c 100644 (file)
@@ -121,3 +121,24 @@ CollectionTree <- R6::R6Class(
         }
     )
 )
+
+# deepCopyArvadosComposite = function(composite) 
+# {
+    # if("ArvadosFile" %in% class(content))
+    # {
+        # newFile <- ArvadosFile$new(content$name)
+        # newFile$setCollection(content$getCollection())
+
+        # return(newFile)
+    # }
+    # else if("Subcollection" %in% class(content))
+    # {
+        # root <- Subcollection$new(content$name)
+        # root$setCollection(content$getCollection())
+    # }
+    # else
+        # stop("Arvados composite is corrupted. It can contain only ArvadosFile or Subcollection.")
+    
+    
+
+# }
index 4595fef662c1c9422af13dc0222a10bd9a9df48a..07defca90f4c99e8be9f8a73f7412f398ab1a701 100644 (file)
@@ -16,7 +16,7 @@ HttpRequest <- R6::R6Class(
         initialize = function()
         {
             self$validContentTypes <- c("text", "raw")
-            self$validVerbs <- c("GET", "POST", "PUT", "DELETE", "PROPFIND", "MOVE")
+            self$validVerbs <- c("GET", "POST", "PUT", "DELETE", "PROPFIND", "MOVE", "COPY")
         },
 
         exec = function(verb, url, headers = NULL, body = NULL, queryParams = NULL,
index 867665299f49899909167c4fd838bc9ae1371dd8..78b2c35e32fa117190f033075e1ea5ee2a3805e3 100644 (file)
@@ -81,10 +81,10 @@ RESTService <- R6::R6Class(
         {
             collectionURL <- paste0(self$getWebDavHostName(), "c=", uuid, "/")
             fromURL <- paste0(collectionURL, from)
-            toURL <- paste0(collectionURL, to)
+            toURL <- paste0(collectionURL, trimFromStart(to, "/"))
 
             headers <- list("Authorization" = paste("OAuth2", self$token),
-                           "Destination" = toURL)
+                            "Destination" = toURL)
 
             serverResponse <- self$http$exec("MOVE", fromURL, headers,
                                              retryTimes = self$numRetries)
@@ -95,6 +95,24 @@ RESTService <- R6::R6Class(
             serverResponse
         },
 
+        copy = function(from, to, uuid)
+        {
+            collectionURL <- paste0(self$getWebDavHostName(), "c=", uuid, "/")
+            fromURL <- paste0(collectionURL, from)
+            toURL <- paste0(collectionURL, trimFromStart(to, "/"))
+
+            headers <- list("Authorization" = paste("OAuth2", self$token),
+                            "Destination" = toURL)
+
+            serverResponse <- self$http$exec("COPY", fromURL, headers,
+                                             retryTimes = self$numRetries)
+
+            if(serverResponse$status_code < 200 || serverResponse$status_code >= 300)
+                stop(paste("Server code:", serverResponse$status_code))
+
+            serverResponse
+        },
+
         getCollectionContent = function(uuid)
         {
             collectionURL <- URLencode(paste0(self$getWebDavHostName(),
index 45fe34347903192bed1d8618e14aceedf73a18f2..5fd21c192ac9928fce674d1ba3c17bbe258e9513 100644 (file)
@@ -26,7 +26,8 @@ source("./R/util.R")
 #'   \item{get(relativePath)}{If relativePath is valid, returns ArvadosFile or Subcollection specified by relativePath, else returns NULL.}
 #'   \item{getFileListing()}{Returns subcollections file content as character vector.}
 #'   \item{getSizeInBytes()}{Returns subcollections content size in bytes.}
-#'   \item{move(newLocation)}{Moves subcollection to a new location inside collection.}
+#'   \item{move(destination)}{Moves subcollection to a new location inside collection.}
+#'   \item{copy(destination)}{Copies subcollection to a new location inside collection.}
 #' }
 #'
 #' @name Subcollection
@@ -40,6 +41,7 @@ source("./R/util.R")
 #' myFolder$remove("myFile")
 #'
 #' myFolder$move("newLocation/myFolder")
+#' myFolder$copy("newLocation/myFolder")
 #' }
 NULL
 
@@ -161,20 +163,18 @@ Subcollection <- R6::R6Class(
             return(sum(fileSizes))
         },
 
-        move = function(newLocation)
+        move = function(destination)
         {
             if(is.null(private$collection))
-                stop("Subcollection doesn't belong to any collection")
+                stop("Subcollection doesn't belong to any collection.")
 
-            newLocation <- trimFromEnd(newLocation, "/")
-            nameAndPath <- splitToPathAndName(newLocation)
+            destination <- trimFromEnd(destination, "/")
+            nameAndPath <- splitToPathAndName(destination)
 
             newParent <- private$collection$get(nameAndPath$path)
 
             if(is.null(newParent))
-            {
-                stop("Unable to get destination subcollection")
-            }
+                stop("Unable to get destination subcollection.")
 
             childWithSameName <- newParent$get(nameAndPath$name)
 
@@ -187,11 +187,53 @@ Subcollection <- R6::R6Class(
                       private$collection$uuid)
 
             private$dettachFromCurrentParent()
-            private$attachToNewParent(newParent)
+            private$attachToNewParent(self, newParent)
 
+            private$parent <- newParent
             private$name <- nameAndPath$name
 
-            "Content moved successfully."
+            self
+        },
+
+        copy = function(destination)
+        {
+            if(is.null(private$collection))
+                stop("Subcollection doesn't belong to any collection.")
+
+            destination <- trimFromEnd(destination, "/")
+            nameAndPath <- splitToPathAndName(destination)
+
+            newParent <- private$collection$get(nameAndPath$path)
+
+            if(is.null(newParent) || !("Subcollection" %in% class(newParent)))
+                stop("Unable to get destination subcollection.")
+
+            childWithSameName <- newParent$get(nameAndPath$name)
+
+            if(!is.null(childWithSameName))
+                stop("Destination already contains content with same name.")
+
+            REST <- private$collection$getRESTService()
+            REST$copy(self$getRelativePath(),
+                      paste0(newParent$getRelativePath(), "/", nameAndPath$name),
+                      private$collection$uuid)
+
+            newContent <- self$duplicate(nameAndPath$name)
+            newContent$setCollection(self$getCollection(), setRecursively = TRUE)
+            newContent$setParent(newParent)
+            private$attachToNewParent(newContent, newParent)
+
+            newContent
+        },
+
+        duplicate = function(newName = NULL)
+        {
+            name <- if(!is.null(newName)) newName else private$name
+            root <- Subcollection$new(name)
+            for(child in private$children)
+                root$add(child$duplicate())
+
+            root
         },
 
         get = function(name)
@@ -254,18 +296,14 @@ Subcollection <- R6::R6Class(
             }
         },
 
-        attachToNewParent = function(newParent)
+        attachToNewParent = function(content, newParent)
         {
             #Note: We temporary set parents collection to NULL. This will ensure that
-            #      add method doesn't post file on REST.
+            #      add method doesn't post this file on REST.
             parentsCollection <- newParent$getCollection()
             newParent$setCollection(NULL, setRecursively = FALSE)
-
-            newParent$add(self)
-
+            newParent$add(content)
             newParent$setCollection(parentsCollection, setRecursively = FALSE)
-
-            private$parent <- newParent
         },
 
         dettachFromCurrentParent = function()
@@ -275,9 +313,7 @@ Subcollection <- R6::R6Class(
             parent <- private$parent
             parentsCollection <- parent$getCollection()
             parent$setCollection(NULL, setRecursively = FALSE)
-
             parent$remove(private$name)
-
             parent$setCollection(parentsCollection, setRecursively = FALSE)
         },
 
index be34b2fdb1dabd3531ca74e696a8240528418520..001a3efc13b8cf9afcd01ffb6e28fa4b5e19d1ce 100644 (file)
@@ -259,6 +259,28 @@ subcollection$move("newDestination/folder")
 Make sure to include new file name in destination.
 In second example file$move("newDestination/") will not work.
 
+* Copy file or folder inside collection:
+
+Directley from collection
+
+```{r}
+collection$copy("folder/file.cpp", "file.cpp")
+```
+
+Or from file
+
+```{r}
+file <- collection$get("location/to/my/file.cpp")
+file$copy("destination/file.cpp")
+```
+
+Or from subcollection
+
+```{r}
+subcollection <- collection$get("location/to/folder")
+subcollection$copy("destination/folder")
+```
+
 #### Working with Aravdos projects
 
 * Get a project:
index 95a2e5561fa9ce21b1d5bd236489595b8c2c034d..51f98d81dcd4de28b9e5faca303ee87a5da7a58d 100644 (file)
@@ -166,6 +166,7 @@ Arvados class gives users ability to access Arvados REST API.
        \item{}{\code{\link{users.delete}}}
        \item{}{\code{\link{users.get}}}
        \item{}{\code{\link{users.list}}}
+       \item{}{\code{\link{users.merge}}}
        \item{}{\code{\link{users.setup}}}
        \item{}{\code{\link{users.system}}}
        \item{}{\code{\link{users.unsetup}}}
index b7840dc16ff4cbbd15dd7383b9fcde0c59416606..514e9e846df958548bacefa670b35e69814d0767 100644 (file)
@@ -29,7 +29,8 @@ ArvadosFile class represents a file inside Arvados collection.
   \item{flush()}{Write connections content to a file (override current content of the file).}
   \item{remove(name)}{Removes ArvadosFile or Subcollection specified by name from the subcollection.}
   \item{getSizeInBytes()}{Returns file size in bytes.}
-  \item{move(newLocation)}{Moves file to a new location inside collection.}
+  \item{move(destination)}{Moves file to a new location inside collection.}
+  \item{copy(destination)}{Copies file to a new location inside collection.}
 }
 }
 
@@ -40,7 +41,7 @@ myFile <- ArvadosFile$new("myFile")
 myFile$write("This is new file content")
 fileContent <- myFile$read()
 fileContent <- myFile$read("text")
-fileContent <- myFile$read("raw", offset = 8, length = 4) 
+fileContent <- myFile$read("raw", offset = 8, length = 4)
 
 #Write a table:
 arvConnection <- myFile$connection("w")
@@ -52,5 +53,6 @@ arvConnection <- myFile$connection("r")
 mytable <- read.table(arvConnection)
 
 myFile$move("newFolder/myFile")
+myFile$copy("newFolder/myFile")
 }
 }
index df0970b30fd4ef843b595f8db52efbafd9b140a4..0b27a8bc4389d134b5f360bf012cd17d7934d77f 100644 (file)
@@ -5,7 +5,7 @@
 \title{Subcollection}
 \description{
 Subcollection class represents a folder inside Arvados collection.
-It is essentially a composite of ArvadosFiles and other Subcollections.
+It is essentially a composite of arvadosFiles and other subcollections.
 }
 \section{Usage}{
 
@@ -29,7 +29,8 @@ It is essentially a composite of ArvadosFiles and other Subcollections.
   \item{get(relativePath)}{If relativePath is valid, returns ArvadosFile or Subcollection specified by relativePath, else returns NULL.}
   \item{getFileListing()}{Returns subcollections file content as character vector.}
   \item{getSizeInBytes()}{Returns subcollections content size in bytes.}
-  \item{move(newLocation)}{Moves subcollection to a new location inside collection.}
+  \item{move(destination)}{Moves subcollection to a new location inside collection.}
+  \item{copy(destination)}{Copies subcollection to a new location inside collection.}
 }
 }
 
@@ -43,5 +44,6 @@ myFolder$get("myFile")
 myFolder$remove("myFile")
 
 myFolder$move("newLocation/myFolder")
+myFolder$copy("newLocation/myFolder")
 }
 }
index 3eb172aabf0741f0b81dd228dd2878cc505bc526..5bef96f9c5e9f53d5d01d53a7a84b4a490eecd1b 100644 (file)
@@ -7,11 +7,6 @@
 arv$api_client_authorizations.create_system_auth(api_client_id = NULL,
        scopes = NULL)
 }
-\arguments{
-\item{api_client_id}{}
-
-\item{scopes}{}
-}
 \value{
 ApiClientAuthorization object.
 }
index 7c8ae69cd5073ab47d0a942c99381a03dcaf614c..983bf4478d18cda7dae733167997ed9eb4c50ea7 100644 (file)
@@ -9,23 +9,6 @@ arv$api_client_authorizations.list(filters = NULL,
        distinct = NULL, limit = "100", offset = "0",
        count = "exact")
 }
-\arguments{
-\item{filters}{}
-
-\item{where}{}
-
-\item{order}{}
-
-\item{select}{}
-
-\item{distinct}{}
-
-\item{limit}{}
-
-\item{offset}{}
-
-\item{count}{}
-}
 \value{
 ApiClientAuthorizationList object.
 }
index 0679c9c12ef826e7b3628e0ed239ad007f836cc9..21523096d0a7ca6d8e31cc0578b5a2af9f4f4f5d 100644 (file)
@@ -9,23 +9,6 @@ arv$api_clients.list(filters = NULL,
        distinct = NULL, limit = "100", offset = "0",
        count = "exact")
 }
-\arguments{
-\item{filters}{}
-
-\item{where}{}
-
-\item{order}{}
-
-\item{select}{}
-
-\item{distinct}{}
-
-\item{limit}{}
-
-\item{offset}{}
-
-\item{count}{}
-}
 \value{
 ApiClientList object.
 }
index cd19bc60c011254b37077e61d5caa77641bd9020..c477b54a9281e56e89ade13a654ba473b272a249 100644 (file)
@@ -9,23 +9,6 @@ arv$authorized_keys.list(filters = NULL,
        distinct = NULL, limit = "100", offset = "0",
        count = "exact")
 }
-\arguments{
-\item{filters}{}
-
-\item{where}{}
-
-\item{order}{}
-
-\item{select}{}
-
-\item{distinct}{}
-
-\item{limit}{}
-
-\item{offset}{}
-
-\item{count}{}
-}
 \value{
 AuthorizedKeyList object.
 }
index 87f6f78e3393555cf236fb4f7c51a5ecc20cffa1..cc5badebe40a64f187acbf240f5330591ceb2cdb 100644 (file)
@@ -10,22 +10,6 @@ arv$collections.list(filters = NULL,
        count = "exact", include_trash = NULL)
 }
 \arguments{
-\item{filters}{}
-
-\item{where}{}
-
-\item{order}{}
-
-\item{select}{}
-
-\item{distinct}{}
-
-\item{limit}{}
-
-\item{offset}{}
-
-\item{count}{}
-
 \item{include_trash}{Include collections whose is_trashed attribute is true.}
 }
 \value{
index 001a7b47c7e997a48d572d260bfedeefcabd542e..72b164e50ed9d54dfc9353a4dd5b8855a6443fcd 100644 (file)
@@ -6,9 +6,6 @@
 \usage{
 arv$collections.provenance(uuid)
 }
-\arguments{
-\item{uuid}{}
-}
 \value{
 Collection object.
 }
index 4862109b9f6a7c13031893c3715639ac7e092d02..f01c191db0c0ab00da92d6214e6ab985a8781e8a 100644 (file)
@@ -6,9 +6,6 @@
 \usage{
 arv$collections.trash(uuid)
 }
-\arguments{
-\item{uuid}{}
-}
 \value{
 Collection object.
 }
index c41bc3d9046ec0383a1838b93fbdc8de44859356..6e63fd4f378817078585435dfedd60734172d86f 100644 (file)
@@ -6,9 +6,6 @@
 \usage{
 arv$collections.untrash(uuid)
 }
-\arguments{
-\item{uuid}{}
-}
 \value{
 Collection object.
 }
index 53b8e493f7218534638b09a7bcbf870d75c5e44e..0ea0dc3240036407ffc3bc40eb3f75d8261250ce 100644 (file)
@@ -6,9 +6,6 @@
 \usage{
 arv$collections.used_by(uuid)
 }
-\arguments{
-\item{uuid}{}
-}
 \value{
 Collection object.
 }
index 9c2412beedcf62c3c4f4304896967bce9d4f7008..b0ce4de0d961cc2da262f42d3c1c89b09462abec 100644 (file)
@@ -9,23 +9,6 @@ arv$container_requests.list(filters = NULL,
        distinct = NULL, limit = "100", offset = "0",
        count = "exact")
 }
-\arguments{
-\item{filters}{}
-
-\item{where}{}
-
-\item{order}{}
-
-\item{select}{}
-
-\item{distinct}{}
-
-\item{limit}{}
-
-\item{offset}{}
-
-\item{count}{}
-}
 \value{
 ContainerRequestList object.
 }
index a594d2f19606843577647a66755260b283fa518c..2aa51caccef8c17c5a3f3458852057431bf3a2e3 100644 (file)
@@ -6,9 +6,6 @@
 \usage{
 arv$containers.auth(uuid)
 }
-\arguments{
-\item{uuid}{}
-}
 \value{
 Container object.
 }
index d4457961352f0f14abb6d38266fd2f6683a35295..7b3d2fccc5cf2cef47238b6a667058da59ee4495 100644 (file)
@@ -9,23 +9,6 @@ arv$containers.list(filters = NULL,
        distinct = NULL, limit = "100", offset = "0",
        count = "exact")
 }
-\arguments{
-\item{filters}{}
-
-\item{where}{}
-
-\item{order}{}
-
-\item{select}{}
-
-\item{distinct}{}
-
-\item{limit}{}
-
-\item{offset}{}
-
-\item{count}{}
-}
 \value{
 ContainerList object.
 }
index 72bcdf0f81f4b14a5433688f54c1042095da145a..b8d7c08650f0d759bf209a56885ee75e5be43ff6 100644 (file)
@@ -6,9 +6,6 @@
 \usage{
 arv$containers.lock(uuid)
 }
-\arguments{
-\item{uuid}{}
-}
 \value{
 Container object.
 }
index d0f8444fa4db39f89b7bbf57bb338e2e81048660..2cccba3aaa463cedc394ff126d08529f939662ec 100644 (file)
@@ -6,9 +6,6 @@
 \usage{
 arv$containers.secret_mounts(uuid)
 }
-\arguments{
-\item{uuid}{}
-}
 \value{
 Container object.
 }
index 5c41f2059a9ba5ec033fbb4fd6d27dbe7a8318f9..2bba7ee5a92218ab4e4f75c0dad0415d431e013c 100644 (file)
@@ -6,9 +6,6 @@
 \usage{
 arv$containers.unlock(uuid)
 }
-\arguments{
-\item{uuid}{}
-}
 \value{
 Container object.
 }
index 26647df4f7f85e0315b4ee1f58e5fa7194e4d9b9..1273f445d50837895e3febcb7d498b2b56442c47 100644 (file)
@@ -10,24 +10,8 @@ arv$groups.contents(filters = NULL,
        include_trash = NULL, uuid = NULL, recursive = NULL)
 }
 \arguments{
-\item{filters}{}
-
-\item{where}{}
-
-\item{order}{}
-
-\item{distinct}{}
-
-\item{limit}{}
-
-\item{offset}{}
-
-\item{count}{}
-
 \item{include_trash}{Include items whose is_trashed attribute is true.}
 
-\item{uuid}{}
-
 \item{recursive}{Include contents from child groups recursively.}
 }
 \value{
index 7699f3ef4bacdcd00df214dfe9909ddc43089c66..c76a27ad9e74288a2105dc4b93aec2eec000626b 100644 (file)
@@ -10,22 +10,6 @@ arv$groups.list(filters = NULL,
        count = "exact", include_trash = NULL)
 }
 \arguments{
-\item{filters}{}
-
-\item{where}{}
-
-\item{order}{}
-
-\item{select}{}
-
-\item{distinct}{}
-
-\item{limit}{}
-
-\item{offset}{}
-
-\item{count}{}
-
 \item{include_trash}{Include items whose is_trashed attribute is true.}
 }
 \value{
index c529618f71d9e585159149dd8b623a03e85116d3..ecd2b10c86c8c01b554f46ca9f170097c6b5e881 100644 (file)
@@ -6,9 +6,6 @@
 \usage{
 arv$groups.trash(uuid)
 }
-\arguments{
-\item{uuid}{}
-}
 \value{
 Group object.
 }
index 014190c8feacdfce7666bb94f7ebef03e9a7da86..ef1f19a1067ae774b77d19c66ecbc1906ce2b8e5 100644 (file)
@@ -6,9 +6,6 @@
 \usage{
 arv$groups.untrash(uuid)
 }
-\arguments{
-\item{uuid}{}
-}
 \value{
 Group object.
 }
index a8db4c7f69696c0eb015676161ea5f198be036a7..c9fad5fd324538e85ed0d82e3e8052f8247b792c 100644 (file)
@@ -9,23 +9,6 @@ arv$humans.list(filters = NULL,
        distinct = NULL, limit = "100", offset = "0",
        count = "exact")
 }
-\arguments{
-\item{filters}{}
-
-\item{where}{}
-
-\item{order}{}
-
-\item{select}{}
-
-\item{distinct}{}
-
-\item{limit}{}
-
-\item{offset}{}
-
-\item{count}{}
-}
 \value{
 HumanList object.
 }
index 51c4b4942c8dd29ad44105fe626cd9dfdf251d2b..2184d9655ee8a5051f7b9fffd98e1c79baf3c0cf 100644 (file)
@@ -9,23 +9,6 @@ arv$job_tasks.list(filters = NULL,
        distinct = NULL, limit = "100", offset = "0",
        count = "exact")
 }
-\arguments{
-\item{filters}{}
-
-\item{where}{}
-
-\item{order}{}
-
-\item{select}{}
-
-\item{distinct}{}
-
-\item{limit}{}
-
-\item{offset}{}
-
-\item{count}{}
-}
 \value{
 JobTaskList object.
 }
index 7399d28a8de8b648232e4d167d135af410b6152f..16cda4aa6ad0cffb1002d8549724c027cdaf2f6d 100644 (file)
@@ -6,9 +6,6 @@
 \usage{
 arv$jobs.cancel(uuid)
 }
-\arguments{
-\item{uuid}{}
-}
 \value{
 Job object.
 }
index 4c4d61ae765bd2dc69a393fa6c1ca0117b42bd4c..d8e52d4f940423b6180456458e02518b59687142 100644 (file)
@@ -12,14 +12,6 @@ arv$jobs.create(job, ensure_unique_name = "false",
 \item{job}{Job object.}
 
 \item{ensure_unique_name}{Adjust name to ensure uniqueness instead of returning an error on (owner_uuid, name) collision.}
-
-\item{find_or_create}{}
-
-\item{filters}{}
-
-\item{minimum_script_version}{}
-
-\item{exclude_script_versions}{}
 }
 \value{
 Job object.
index 53055f5878b4fb73a0bcb598f645872b7dd4f84d..33840b0a498df7211a3ff93f6524c51d3b0d0ae0 100644 (file)
@@ -8,23 +8,6 @@ arv$jobs.list(filters = NULL, where = NULL,
        order = NULL, select = NULL, distinct = NULL,
        limit = "100", offset = "0", count = "exact")
 }
-\arguments{
-\item{filters}{}
-
-\item{where}{}
-
-\item{order}{}
-
-\item{select}{}
-
-\item{distinct}{}
-
-\item{limit}{}
-
-\item{offset}{}
-
-\item{count}{}
-}
 \value{
 JobList object.
 }
index 3c2e2328096d8ca74cbf62940d1774a4fb898fb6..51500fc44d90f724d30ae28685b22f1655df0f4b 100644 (file)
@@ -6,9 +6,6 @@
 \usage{
 arv$jobs.lock(uuid)
 }
-\arguments{
-\item{uuid}{}
-}
 \value{
 Job object.
 }
index a9deaa971cb989e6f35df00bc8564b39ef4a28c6..e92d01063f6a9a4394cad7abf83e5e8e541c8e8f 100644 (file)
@@ -9,23 +9,6 @@ arv$jobs.queue(filters = NULL,
        distinct = NULL, limit = "100", offset = "0",
        count = "exact")
 }
-\arguments{
-\item{filters}{}
-
-\item{where}{}
-
-\item{order}{}
-
-\item{select}{}
-
-\item{distinct}{}
-
-\item{limit}{}
-
-\item{offset}{}
-
-\item{count}{}
-}
 \value{
 Job object.
 }
index fdb599f70fed149c16a42e24ec62e72a6e1589eb..79d7b0a636efc89cd9de1f3c719eef89d2c6015c 100644 (file)
@@ -9,23 +9,6 @@ arv$keep_disks.list(filters = NULL,
        distinct = NULL, limit = "100", offset = "0",
        count = "exact")
 }
-\arguments{
-\item{filters}{}
-
-\item{where}{}
-
-\item{order}{}
-
-\item{select}{}
-
-\item{distinct}{}
-
-\item{limit}{}
-
-\item{offset}{}
-
-\item{count}{}
-}
 \value{
 KeepDiskList object.
 }
index 6ae55955f6c8b57a08a12ede405a76bc78f3a335..2952c31e129fab1d6dec4f96b5d8441d8b76f45e 100644 (file)
@@ -8,21 +8,6 @@ arv$keep_disks.ping(uuid = NULL,
        ping_secret, node_uuid = NULL, filesystem_uuid = NULL,
        service_host = NULL, service_port, service_ssl_flag)
 }
-\arguments{
-\item{uuid}{}
-
-\item{ping_secret}{}
-
-\item{node_uuid}{}
-
-\item{filesystem_uuid}{}
-
-\item{service_host}{}
-
-\item{service_port}{}
-
-\item{service_ssl_flag}{}
-}
 \value{
 KeepDisk object.
 }
index 22aa3aa1073b691c382a43459e9fd7e491725bfa..73f5fb854af5a0527f9d8152ea0913e44f1646e6 100644 (file)
@@ -9,23 +9,6 @@ arv$keep_services.list(filters = NULL,
        distinct = NULL, limit = "100", offset = "0",
        count = "exact")
 }
-\arguments{
-\item{filters}{}
-
-\item{where}{}
-
-\item{order}{}
-
-\item{select}{}
-
-\item{distinct}{}
-
-\item{limit}{}
-
-\item{offset}{}
-
-\item{count}{}
-}
 \value{
 KeepServiceList object.
 }
index 982dbb9691cad266f8eba807475d2e35cd49b280..457c38e149898ddc9415530b1c912ad3320c278e 100644 (file)
@@ -6,9 +6,6 @@
 \usage{
 arv$links.get_permissions(uuid)
 }
-\arguments{
-\item{uuid}{}
-}
 \value{
 Link object.
 }
index 540fdc1683454df4582daff74b39b98aaf69599f..a3fc988a3809b188c464578fb7812937d8860dba 100644 (file)
@@ -9,23 +9,6 @@ arv$links.list(filters = NULL,
        distinct = NULL, limit = "100", offset = "0",
        count = "exact")
 }
-\arguments{
-\item{filters}{}
-
-\item{where}{}
-
-\item{order}{}
-
-\item{select}{}
-
-\item{distinct}{}
-
-\item{limit}{}
-
-\item{offset}{}
-
-\item{count}{}
-}
 \value{
 LinkList object.
 }
index 58dbdb71ea02c4d9703a504e09acd04d7fdca86e..88c8bbdc7c54d3e117d59b81c667da01d131b4db 100644 (file)
@@ -8,23 +8,6 @@ arv$logs.list(filters = NULL, where = NULL,
        order = NULL, select = NULL, distinct = NULL,
        limit = "100", offset = "0", count = "exact")
 }
-\arguments{
-\item{filters}{}
-
-\item{where}{}
-
-\item{order}{}
-
-\item{select}{}
-
-\item{distinct}{}
-
-\item{limit}{}
-
-\item{offset}{}
-
-\item{count}{}
-}
 \value{
 LogList object.
 }
index 7ccfad6d934f4b03cd3cf467b6a30189681fad90..6074a38a65f8058d02f9f4d1137c3c8735f74ae6 100644 (file)
@@ -9,23 +9,6 @@ arv$nodes.list(filters = NULL,
        distinct = NULL, limit = "100", offset = "0",
        count = "exact")
 }
-\arguments{
-\item{filters}{}
-
-\item{where}{}
-
-\item{order}{}
-
-\item{select}{}
-
-\item{distinct}{}
-
-\item{limit}{}
-
-\item{offset}{}
-
-\item{count}{}
-}
 \value{
 NodeList object.
 }
index e77d2b5b89b4e11237f5efab680c050a088fb996..b8775a2e0d1722131fa94e51d98fb395f0d00217 100644 (file)
@@ -6,11 +6,6 @@
 \usage{
 arv$nodes.ping(uuid, ping_secret)
 }
-\arguments{
-\item{uuid}{}
-
-\item{ping_secret}{}
-}
 \value{
 Node object.
 }
index 026de816fbc9cebc347427ba33575045a5d71a67..6de31340549b23b6a7914e16daec02e784277d4f 100644 (file)
@@ -6,9 +6,6 @@
 \usage{
 arv$pipeline_instances.cancel(uuid)
 }
-\arguments{
-\item{uuid}{}
-}
 \value{
 PipelineInstance object.
 }
index 407f94446d2bac06dd915b52b0797551c495b8d5..74b5db2bb9f7e4cad6448a926d953877c2151d65 100644 (file)
@@ -9,23 +9,6 @@ arv$pipeline_instances.list(filters = NULL,
        distinct = NULL, limit = "100", offset = "0",
        count = "exact")
 }
-\arguments{
-\item{filters}{}
-
-\item{where}{}
-
-\item{order}{}
-
-\item{select}{}
-
-\item{distinct}{}
-
-\item{limit}{}
-
-\item{offset}{}
-
-\item{count}{}
-}
 \value{
 PipelineInstanceList object.
 }
index c6c7413d5e7c407f7281d22058143224d152dcfa..846008e4d164a2d190dcafe98a106c9ce3bea16f 100644 (file)
@@ -9,23 +9,6 @@ arv$pipeline_templates.list(filters = NULL,
        distinct = NULL, limit = "100", offset = "0",
        count = "exact")
 }
-\arguments{
-\item{filters}{}
-
-\item{where}{}
-
-\item{order}{}
-
-\item{select}{}
-
-\item{distinct}{}
-
-\item{limit}{}
-
-\item{offset}{}
-
-\item{count}{}
-}
 \value{
 PipelineTemplateList object.
 }
index ff4c1c9edb8dcc21dc0b7b30061cd15711a2c0d3..22b5175ceb4e97bbb91e01d6cba194f4d891d243 100644 (file)
@@ -10,24 +10,8 @@ arv$projects.list(filters = NULL,
        include_trash = NULL, uuid = NULL, recursive = NULL)
 }
 \arguments{
-\item{filters}{}
-
-\item{where}{}
-
-\item{order}{}
-
-\item{distinct}{}
-
-\item{limit}{}
-
-\item{offset}{}
-
-\item{count}{}
-
 \item{include_trash}{Include items whose is_trashed attribute is true.}
 
-\item{uuid}{}
-
 \item{recursive}{Include contents from child groups recursively.}
 }
 \value{
index d1f4772e74305823a729378b7f6518da06c338f1..e19c87c6caf707dea65766180ec2b6eb243af2c7 100644 (file)
@@ -9,23 +9,6 @@ arv$repositories.list(filters = NULL,
        distinct = NULL, limit = "100", offset = "0",
        count = "exact")
 }
-\arguments{
-\item{filters}{}
-
-\item{where}{}
-
-\item{order}{}
-
-\item{select}{}
-
-\item{distinct}{}
-
-\item{limit}{}
-
-\item{offset}{}
-
-\item{count}{}
-}
 \value{
 RepositoryList object.
 }
index 4e07f4ab28214b61122881c632f93b7e05dd6188..c05ce5f26ceba4b3e61894d237db0f55d629ded5 100644 (file)
@@ -9,23 +9,6 @@ arv$specimens.list(filters = NULL,
        distinct = NULL, limit = "100", offset = "0",
        count = "exact")
 }
-\arguments{
-\item{filters}{}
-
-\item{where}{}
-
-\item{order}{}
-
-\item{select}{}
-
-\item{distinct}{}
-
-\item{limit}{}
-
-\item{offset}{}
-
-\item{count}{}
-}
 \value{
 SpecimenList object.
 }
index e91b9299491b887d1833efe8d3323f219941298a..77a13cae38e51b8d7e4edcaf2bf188fca85f9a00 100644 (file)
@@ -9,23 +9,6 @@ arv$traits.list(filters = NULL,
        distinct = NULL, limit = "100", offset = "0",
        count = "exact")
 }
-\arguments{
-\item{filters}{}
-
-\item{where}{}
-
-\item{order}{}
-
-\item{select}{}
-
-\item{distinct}{}
-
-\item{limit}{}
-
-\item{offset}{}
-
-\item{count}{}
-}
 \value{
 TraitList object.
 }
index 5e6986189d8c8027007f3ed007a68a430dff8c2f..c9914d5f16f822557c3cab6b26353d1fda9db296 100644 (file)
@@ -9,23 +9,6 @@ arv$user_agreements.list(filters = NULL,
        distinct = NULL, limit = "100", offset = "0",
        count = "exact")
 }
-\arguments{
-\item{filters}{}
-
-\item{where}{}
-
-\item{order}{}
-
-\item{select}{}
-
-\item{distinct}{}
-
-\item{limit}{}
-
-\item{offset}{}
-
-\item{count}{}
-}
 \value{
 UserAgreementList object.
 }
index 201caf4c89283fff9fed78537f5f1176556d178e..bba8162322e42dfdf87832e8778d6d4ae3063da4 100644 (file)
@@ -6,9 +6,6 @@
 \usage{
 arv$users.activate(uuid)
 }
-\arguments{
-\item{uuid}{}
-}
 \value{
 User object.
 }
index 71319433b8e16e14fc6aa648bde5f3b9cc530933..98fa2141a3a32145799084b35b1f1060ecd0d088 100644 (file)
@@ -9,23 +9,6 @@ arv$users.list(filters = NULL,
        distinct = NULL, limit = "100", offset = "0",
        count = "exact")
 }
-\arguments{
-\item{filters}{}
-
-\item{where}{}
-
-\item{order}{}
-
-\item{select}{}
-
-\item{distinct}{}
-
-\item{limit}{}
-
-\item{offset}{}
-
-\item{count}{}
-}
 \value{
 UserList object.
 }
diff --git a/sdk/R/man/users.merge.Rd b/sdk/R/man/users.merge.Rd
new file mode 100644 (file)
index 0000000..ee97244
--- /dev/null
@@ -0,0 +1,15 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/Arvados.R
+\name{users.merge}
+\alias{users.merge}
+\title{users.merge}
+\usage{
+arv$users.merge(new_owner_uuid,
+       new_user_token, redirect_to_new_user = NULL)
+}
+\value{
+User object.
+}
+\description{
+users.merge is a method defined in Arvados class.
+}
index 869403d3ed965832e2dbb3484d7412b15794ba90..764bc525969661bcea8253f5a8a5125f10fe1bd5 100644 (file)
@@ -7,17 +7,6 @@
 arv$users.setup(user = NULL, openid_prefix = NULL,
        repo_name = NULL, vm_uuid = NULL, send_notification_email = "false")
 }
-\arguments{
-\item{user}{}
-
-\item{openid_prefix}{}
-
-\item{repo_name}{}
-
-\item{vm_uuid}{}
-
-\item{send_notification_email}{}
-}
 \value{
 User object.
 }
index 85de6f9782d0852eed394e8e2be92df2239199cd..0753a34d2330c9c1316387ccba706c29a2d093ed 100644 (file)
@@ -6,9 +6,6 @@
 \usage{
 arv$users.unsetup(uuid)
 }
-\arguments{
-\item{uuid}{}
-}
 \value{
 User object.
 }
index af62c2c825d3da2efa26a555d78d7fc480e30d9e..591599dfe8f5ae7300213819bbd018ce35e0d71f 100644 (file)
@@ -6,11 +6,6 @@
 \usage{
 arv$users.update_uuid(uuid, new_uuid)
 }
-\arguments{
-\item{uuid}{}
-
-\item{new_uuid}{}
-}
 \value{
 User object.
 }
index 42ed58b0e1e09264896e764d2073e8524c992560..0f3b440b821d7109c208f51b97465cdbb2592b23 100644 (file)
@@ -9,23 +9,6 @@ arv$virtual_machines.list(filters = NULL,
        distinct = NULL, limit = "100", offset = "0",
        count = "exact")
 }
-\arguments{
-\item{filters}{}
-
-\item{where}{}
-
-\item{order}{}
-
-\item{select}{}
-
-\item{distinct}{}
-
-\item{limit}{}
-
-\item{offset}{}
-
-\item{count}{}
-}
 \value{
 VirtualMachineList object.
 }
index 7e25110aa4dc1bcb336c7b0aa78c339b9c21cad1..bb6d21ed914c150d33f96e5e241410f67083a298 100644 (file)
@@ -6,9 +6,6 @@
 \usage{
 arv$virtual_machines.logins(uuid)
 }
-\arguments{
-\item{uuid}{}
-}
 \value{
 VirtualMachine object.
 }
index e24b74d0307e146a72d696479a08e693235acc97..b8a6a03ec7799912a3cf148c8bd31c1e09c0626c 100644 (file)
@@ -9,23 +9,6 @@ arv$workflows.list(filters = NULL,
        distinct = NULL, limit = "100", offset = "0",
        count = "exact")
 }
-\arguments{
-\item{filters}{}
-
-\item{where}{}
-
-\item{order}{}
-
-\item{select}{}
-
-\item{distinct}{}
-
-\item{limit}{}
-
-\item{offset}{}
-
-\item{count}{}
-}
 \value{
 WorkflowList object.
 }
index 2ebcda2e4d671dc91cef9ca6ca0cdcb6a2707e18..7734e0d9284d6bde09b478ab30171e687ea75a2c 100644 (file)
@@ -27,6 +27,7 @@ FakeHttpRequest <- R6::R6Class(
         numberOfPUTRequests        = NULL,
         numberOfPOSTRequests       = NULL,
         numberOfMOVERequests       = NULL,
+        numberOfCOPYRequests       = NULL,
         numberOfgetConnectionCalls = NULL,
 
         initialize = function(expectedURL      = NULL,
@@ -57,6 +58,7 @@ FakeHttpRequest <- R6::R6Class(
             self$numberOfPUTRequests    <- 0
             self$numberOfPOSTRequests   <- 0
             self$numberOfMOVERequests   <- 0
+            self$numberOfCOPYRequests   <- 0
 
             self$numberOfgetConnectionCalls <- 0
 
@@ -81,6 +83,8 @@ FakeHttpRequest <- R6::R6Class(
                 self$numberOfDELETERequests <- self$numberOfDELETERequests + 1
             else if(verb == "MOVE")
                 self$numberOfMOVERequests <- self$numberOfMOVERequests + 1
+            else if(verb == "COPY")
+                self$numberOfCOPYRequests <- self$numberOfCOPYRequests + 1
             else if(verb == "PROPFIND")
             {
                 return(self$content)
index 048013f566a3c737188dc04f876bee6d9ae8dd90..a91da04fd1295edf5332b54b61da47ab2ea4687d 100644 (file)
@@ -18,6 +18,7 @@ FakeRESTService <- R6::R6Class(
         createCallCount               = NULL,
         deleteCallCount               = NULL,
         moveCallCount                 = NULL,
+        copyCallCount                 = NULL,
         getCollectionContentCallCount = NULL,
         getResourceSizeCallCount      = NULL,
         readCallCount                 = NULL,
@@ -31,7 +32,7 @@ FakeRESTService <- R6::R6Class(
         collectionContent = NULL,
         returnContent     = NULL,
 
-        initialize = function(collectionContent = NULL, returnContent = NULL, 
+        initialize = function(collectionContent = NULL, returnContent = NULL,
                               expectedFilterContent = NULL)
         {
             self$getResourceCallCount    <- 0
@@ -44,6 +45,7 @@ FakeRESTService <- R6::R6Class(
             self$createCallCount               <- 0
             self$deleteCallCount               <- 0
             self$moveCallCount                 <- 0
+            self$copyCallCount                 <- 0
             self$getCollectionContentCallCount <- 0
             self$getResourceSizeCallCount      <- 0
             self$readCallCount                 <- 0
@@ -135,6 +137,12 @@ FakeRESTService <- R6::R6Class(
             self$returnContent
         },
 
+        copy = function(from, to, uuid)
+        {
+            self$copyCallCount <- self$copyCallCount + 1
+            self$returnContent
+        },
+
         getCollectionContent = function(uuid)
         {
             self$getCollectionContentCallCount <- self$getCollectionContentCallCount + 1
@@ -146,7 +154,7 @@ FakeRESTService <- R6::R6Class(
             self$getResourceSizeCallCount <- self$getResourceSizeCallCount + 1
             self$returnContent
         },
-        
+
         read = function(relativePath, uuid, contentType = "text", offset = 0, length = 0)
         {
             self$readCallCount <- self$readCallCount + 1
index 1f559e999c52be207317b1f9f6f17332ab287ac0..e3457c993f7c88cee4a963ca7006a90c6078f478 100644 (file)
@@ -81,7 +81,6 @@ test_that("read raises exception if file doesn't belong to a collection", {
 
 test_that("read raises exception offset or length is negative number", {
 
-
     collectionContent <- c("animal", "animal/fish")
     fakeREST <- FakeRESTService$new(collectionContent)
 
@@ -156,7 +155,6 @@ test_that(paste("connection returns textConnection opened",
 
 test_that("flush sends data stored in a connection to a REST server", {
 
-
     collectionContent <- c("animal", "animal/fish")
     fakeREST <- FakeRESTService$new(collectionContent)
 
@@ -204,13 +202,12 @@ test_that(paste("move raises exception if arvados file",
     animal <- ArvadosFile$new("animal")
 
     expect_that(animal$move("new/location"),
-                throws_error("ArvadosFile doesn't belong to any collection"))
+                throws_error("ArvadosFile doesn't belong to any collection."))
 })
 
 test_that(paste("move raises exception if newLocationInCollection",
                 "parameter is invalid"), {
 
-
     collectionContent <- c("animal",
                            "animal/fish",
                            "animal/dog",
@@ -226,7 +223,7 @@ test_that(paste("move raises exception if newLocationInCollection",
     dog <- collection$get("animal/dog")
 
     expect_that(dog$move("objects/dog"),
-                throws_error("Unable to get destination subcollection"))
+                throws_error("Unable to get destination subcollection."))
 })
 
 test_that("move raises exception if new location contains content with the same name", {
@@ -252,7 +249,6 @@ test_that("move raises exception if new location contains content with the same
 
 test_that("move moves arvados file inside collection tree", {
 
-
     collectionContent <- c("animal",
                            "animal/fish",
                            "animal/dog",
@@ -273,3 +269,85 @@ test_that("move moves arvados file inside collection tree", {
     expect_that(dogIsNullOnOldLocation, is_true())
     expect_that(dogExistsOnNewLocation, is_true())
 })
+
+test_that(paste("copy raises exception if arvados file",
+                "doesn't belong to any collection"), {
+
+    animal <- ArvadosFile$new("animal")
+
+    expect_that(animal$copy("new/location"),
+                throws_error("ArvadosFile doesn't belong to any collection."))
+})
+
+test_that(paste("copy raises exception if location parameter is invalid"), {
+
+    collectionContent <- c("animal",
+                           "animal/fish",
+                           "animal/dog",
+                           "animal/fish/shark",
+                           "ball")
+
+    fakeREST <- FakeRESTService$new(collectionContent)
+
+    api <- Arvados$new("myToken", "myHostName")
+    api$setRESTService(fakeREST)
+
+    collection <- Collection$new(api, "myUUID")
+    dog <- collection$get("animal/dog")
+
+    expect_that(dog$copy("objects/dog"),
+                throws_error("Unable to get destination subcollection."))
+})
+
+test_that("copy raises exception if new location contains content with the same name", {
+
+
+    collectionContent <- c("animal",
+                           "animal/fish",
+                           "animal/dog",
+                           "animal/fish/shark",
+                           "dog")
+
+    fakeREST <- FakeRESTService$new(collectionContent)
+
+    api <- Arvados$new("myToken", "myHostName")
+    api$setRESTService(fakeREST)
+    collection <- Collection$new(api, "myUUID")
+    dog <- collection$get("animal/dog")
+
+    expect_that(dog$copy("dog"),
+                throws_error("Destination already contains content with same name."))
+
+})
+
+test_that("copy copies arvados file inside collection tree", {
+
+    collectionContent <- c("animal",
+                           "animal/fish",
+                           "animal/dog",
+                           "animal/fish/shark",
+                           "ball")
+
+    fakeREST <- FakeRESTService$new(collectionContent)
+
+    api <- Arvados$new("myToken", "myHostName")
+    api$setRESTService(fakeREST)
+    collection <- Collection$new(api, "myUUID")
+    dog <- collection$get("animal/dog")
+
+    dog$copy("dog")
+    dogExistsOnOldLocation <- !is.null(collection$get("animal/dog"))
+    dogExistsOnNewLocation <- !is.null(collection$get("dog"))
+
+    expect_that(dogExistsOnOldLocation, is_true())
+    expect_that(dogExistsOnNewLocation, is_true())
+})
+
+test_that("duplicate performs deep cloning of Arvados file", {
+    arvFile <- ArvadosFile$new("foo")
+    newFile1 <- arvFile$duplicate()
+    newFile2 <- arvFile$duplicate("bar")
+
+    expect_that(newFile1$getFileListing(), equals(arvFile$getFileListing()))
+    expect_that(newFile2$getFileListing(), equals(c("bar")))
+})
index af5fabeb73c82c99cfee67e935a1ebfa8e61fd2c..76668c2eb05eaef2c8e2f977e1d62bc858a7bbf3 100644 (file)
@@ -262,3 +262,37 @@ test_that("get returns arvados file or subcollection from internal tree structur
     expect_that(fishIsNotNull, is_true())
     expect_that(fish$getName(), equals("fish"))
 })
+
+test_that(paste("copy copies content to a new location inside file tree",
+                "and on REST service"), {
+
+    collectionContent <- c("animal", "animal/dog", "ball")
+    fakeREST <- FakeRESTService$new(collectionContent)
+
+    api <- Arvados$new("myToken", "myHostName")
+    api$setRESTService(fakeREST)
+    collection <- Collection$new(api, "myUUID")
+
+    collection$copy("animal/dog", "dog")
+
+    dogExistsOnOldLocation <- !is.null(collection$get("animal/dog"))
+    dogExistsOnNewLocation <- !is.null(collection$get("dog"))
+
+    expect_that(dogExistsOnOldLocation, is_true())
+    expect_that(dogExistsOnNewLocation, is_true())
+    expect_that(fakeREST$copyCallCount, equals(1))
+})
+
+test_that("copy raises exception if new location is not valid", {
+
+    collectionContent <- c("animal", "animal/fish", "ball")
+    fakeREST <- FakeRESTService$new(collectionContent)
+
+    api <- Arvados$new("myToken", "myHostName")
+    api$setRESTService(fakeREST)
+    collection <- Collection$new(api, "myUUID")
+
+    expect_that(collection$copy("fish", "object"),
+                throws_error("Content you want to copy doesn't exist in the collection.",
+                             fixed = TRUE))
+})
index 26f459b17355903640676b7d4a717bd2c9052890..64988e33db2c3c4614112d2eb993687d6e169199 100644 (file)
@@ -135,6 +135,40 @@ test_that("move raises exception if server response code is not between 200 and
                 throws_error("Server code: 404"))
 })
 
+test_that("copy calls REST service properly", {
+
+    uuid <- "aaaaa-j7d0g-ccccccccccccccc"
+    expectedURL <- "https://webDavHost/c=aaaaa-j7d0g-ccccccccccccccc/file"
+    fakeHttp <- FakeHttpRequest$new(expectedURL)
+    fakeHttpParser <- FakeHttpParser$new()
+
+    REST <- RESTService$new("token", "https://host/",
+                            fakeHttp, fakeHttpParser,
+                            0, "https://webDavHost/")
+
+    REST$copy("file", "newDestination/file", uuid)
+
+    expect_that(fakeHttp$URLIsProperlyConfigured, is_true())
+    expect_that(fakeHttp$requestHeaderContainsAuthorizationField, is_true())
+    expect_that(fakeHttp$requestHeaderContainsDestinationField, is_true())
+    expect_that(fakeHttp$numberOfCOPYRequests, equals(1))
+})
+
+test_that("copy raises exception if server response code is not between 200 and 300", {
+
+    uuid <- "aaaaa-j7d0g-ccccccccccccccc"
+    response <- list()
+    response$status_code <- 404
+    fakeHttp <- FakeHttpRequest$new(serverResponse = response)
+
+    REST <- RESTService$new("token", "https://host/",
+                            fakeHttp, HttpParser$new(),
+                            0, "https://webDavHost/")
+
+    expect_that(REST$copy("file", "newDestination/file", uuid),
+                throws_error("Server code: 404"))
+})
+
 test_that("getCollectionContent retreives correct content from WebDAV server", {
 
     uuid <- "aaaaa-j7d0g-ccccccccccccccc"
index 6845801e59abb8155736fddcf4d92595ef67f018..a6e420962bce9777d56d69c4ded58c015986b288 100644 (file)
@@ -309,7 +309,7 @@ test_that(paste("move raises exception if newLocationInCollection",
     fish <- collection$get("animal/fish")
 
     expect_that(fish$move("objects/dog"),
-                throws_error("Unable to get destination subcollection"))
+                throws_error("Unable to get destination subcollection."))
 })
 
 test_that("move moves subcollection inside collection tree", {
@@ -358,3 +358,87 @@ test_that(paste("getSizeInBytes delegates size calculation",
 
     expect_that(resourceSize, equals(100))
 })
+
+#########################
+test_that(paste("copy raises exception if subcollection",
+                "doesn't belong to any collection"), {
+
+    animal <- Subcollection$new("animal")
+
+    expect_that(animal$copy("new/location"),
+                throws_error("Subcollection doesn't belong to any collection."))
+})
+
+test_that("copy raises exception if new location contains content with the same name", {
+
+    collectionContent <- c("animal",
+                           "animal/fish",
+                           "animal/dog",
+                           "animal/fish/shark",
+                           "fish")
+    fakeREST <- FakeRESTService$new(collectionContent)
+
+    api <- Arvados$new("myToken", "myHostName")
+    api$setRESTService(fakeREST)
+    collection <- Collection$new(api, "myUUID")
+    fish <- collection$get("animal/fish")
+
+    expect_that(fish$copy("fish"),
+                throws_error("Destination already contains content with same name."))
+
+})
+
+test_that(paste("copy raises exception if location parameter is invalid"), {
+
+    collectionContent <- c("animal",
+                           "animal/fish",
+                           "animal/dog",
+                           "animal/fish/shark",
+                           "ball")
+    fakeREST <- FakeRESTService$new(collectionContent)
+
+    api <- Arvados$new("myToken", "myHostName")
+    api$setRESTService(fakeREST)
+
+    collection <- Collection$new(api, "myUUID")
+    fish <- collection$get("animal/fish")
+
+    expect_that(fish$copy("objects/dog"),
+                throws_error("Unable to get destination subcollection."))
+})
+
+test_that("copy copies subcollection inside collection tree", {
+
+    collectionContent <- c("animal",
+                           "animal/fish",
+                           "animal/dog",
+                           "animal/fish/shark",
+                           "ball")
+    fakeREST <- FakeRESTService$new(collectionContent)
+
+    api <- Arvados$new("myToken", "myHostName")
+    api$setRESTService(fakeREST)
+    collection <- Collection$new(api, "myUUID")
+    fish <- collection$get("animal/fish")
+
+    fish$copy("fish")
+    fishExistsOnOldLocation <- !is.null(collection$get("animal/fish"))
+    fishExistsOnNewLocation <- !is.null(collection$get("fish"))
+
+    expect_that(fishExistsOnOldLocation, is_true())
+    expect_that(fishExistsOnNewLocation, is_true())
+})
+
+test_that("duplicate performs deep cloning of Subcollection", {
+    foo <- ArvadosFile$new("foo")
+    bar <- ArvadosFile$new("bar")
+    sub <- Subcollection$new("qux")
+    sub$add(foo)
+    sub$add(bar)
+
+    newSub1 <- sub$duplicate()
+    newSub2 <- sub$duplicate("quux")
+
+    expect_that(newSub1$getFileListing(), equals(sub$getFileListing()))
+    expect_that(sort(newSub2$getFileListing()), equals(c("quux/bar", "quux/foo")))
+})