Volume {sevenbridges2}R Documentation

R6 Class representing a Volume

Description

R6 Class representing a resource for managing volumes.

Super class

sevenbridges2::Item -> Volume

Public fields

URL

List of URL endpoints for this resource.

id

Volume ID, constructed from {division}/{volume_name} or {volume_owner}/{volume_name}.

name

The name of the volume. It must be unique from all other volumes for this user. Required if from_path parameter is not provided.

description

The description of the volume.

access_mode

Signifies whether this volume should be used for read-write (RW) or read-only (RO) operations. The access mode is consulted independently of the credentials granted to Seven Bridges when the volume was created, so it is possible to use a read-write credentials to register both read-write and read-only volumes using it. Default: "RW".

service

This object in form of string more closely describes the mapping of the volume to the cloud service where the data is stored.

created_on

The date and time this volume was created.

modified_on

The date and time this volume was last modified.

active

If a volume is deactivated, this field will be set to FALSE.

Methods

Public methods


Method new()

Create a new Volume object.

Usage
Volume$new(res = NA, ...)
Arguments
res

Response containing Volume object info.

...

Other response arguments.


Method print()

Print method for Volume class.

Usage
Volume$print()
Examples
\dontrun{
# x is API response when volume is requested
volume_object <- Volume$new(
                    res = x,
                    href = x$href,
                    auth = auth,
                    response = attr(x, "response")
                   )

 # Print volume object
 volume_object$print()
}


Method reload()

Reload Volume object information.

Usage
Volume$reload(...)
Arguments
...

Other arguments that can be passed to core api() function like 'fields', etc.

Returns

Volume object.

Examples
\dontrun{
# x is API response when volume is requested
volume_object <- Volume$new(
                    res = x,
                    href = x$href,
                    auth = auth,
                    response = attr(x, "response")
                   )

 # Reload volume object
 volume_object$reload()
}


Method update()

Update a volume. This function updates the details of a specific volume.

Usage
Volume$update(description = NULL, access_mode = NULL, service = NULL)
Arguments
description

The new description of the volume.

access_mode

Signifies whether this volume should be used for read-write (RW) or read-only (RO) operations. The access mode is consulted independently of the credentials granted to Seven Bridges when the volume was created, so it is possible to use a read-write credentials to register both read-write and read-only volumes using it. Default: "RW".

service

This object in form of string more closely describes the mapping of the volume to the cloud service where the data is stored.

Returns

Volume object.

Examples
\dontrun{
# x is API response when volume is requested
volume_object <- Volume$new(
                    res = x,
                    href = x$href,
                    auth = auth,
                    response = attr(x, "response")
                   )

 # Update volume object
 volume_object$update(description = description)
}


Method deactivate()

Deactivate volume. Once deactivated, you cannot import from, export to, or browse within a volume. As such, the content of the files imported from this volume will no longer be accessible on the Platform. However, you can update the volume and manage members.
Note that you cannot deactivate the volume if you have running imports or exports unless you force the operation using the query parameter force=TRUE. Note that to delete a volume, first you must deactivate it and delete all files which have been imported from the volume to the Platform.

Usage
Volume$deactivate(...)
Arguments
...

Other query parameters or arguments that can be passed to core api() function like 'force'. Use it within query parameter, like query = list(force = TRUE).

Examples
\dontrun{
# x is API response when volume is requested
volume_object <- Volume$new(
                    res = x,
                    href = x$href,
                    auth = auth,
                    response = attr(x, "response")
                   )

 # Deactivate volume
 volume_object$deactivate()
}


Method reactivate()

Reactivate volume. This function reactivates the previously deactivated volume by updating the active field of the volume to TRUE.

Usage
Volume$reactivate(...)
Arguments
...

Other query parameters or arguments that can be passed to core api() function like 'force'. Use it within query parameter, like query = list(force = TRUE).

Returns

Volume object.

Examples
\dontrun{
# x is API response when volume is requested
volume_object <- Volume$new(
                    res = x,
                    href = x$href,
                    auth = auth,
                    response = attr(x, "response")
                   )

 # Deactivate volume
 volume_object$deactivate()

 # Reactivate volume
 volume_object$reactivate()
}


Method delete()

Delete volume. This call deletes a volume you've created to refer to storage on Amazon Web Services, Google Cloud Storage, Azure or Ali cloud. To be able to delete a volume, you first need to deactivate it and then delete all files on the Platform that were previously imported from the volume.

Usage
Volume$delete()
Examples
\dontrun{
# x is API response when volume is requested
volume_object <- Volume$new(
                    res = x,
                    href = x$href,
                    auth = auth,
                    response = attr(x, "response")
                   )

 # Delete volume
 volume_object$delete()
}


Method list_contents()

List volume contents. This call lists the contents of a specific volume.

Usage
Volume$list_contents(
  prefix = NULL,
  limit = getOption("sevenbridges2")$limit,
  link = NULL,
  continuation_token = NULL,
  ...
)
Arguments
prefix

This is parent parameter in volume context. If specified, the content of the parent directory on the current volume is listed.

limit

The maximum number of collection items to return for a single request. Minimum value is 1. The maximum value is 100 and the default value is 50. This is a pagination-specific attribute.

link

Link to use in the next chunk of results. Contains limit and continuation_token. If provided it will overwrite other arguments' values passed.

continuation_token

Continuation token received to use for next chunk of results. Behaves similarly like offset parameter.

...

Other arguments that can be passed to core api() function like 'fields' for example. With fields parameter you can specify a subset of fields to include in the response. You can use: href, location, volume, type, metadata, ⁠_all⁠. Default: ⁠_all⁠.

Returns

VolumeContentCollection object containing list of VolumeFile and VolumePrefix objects.

Examples
\dontrun{
# x is API response when volume is requested
volume_object <- Volume$new(
                    res = x,
                    href = x$href,
                    auth = auth,
                    response = attr(x, "response")
                   )

 # List volume contents
 volume_object$list_contents()
}


Method get_file()

Get volume file information. This function returns the specific Volume File.

Usage
Volume$get_file(location = NULL, link = NULL, ...)
Arguments
location

Volume file id, which is represented as file location.

link

Link to the file resource received from listing volume's contents. Cannot be used together with location.

...

Other arguments that can be passed to core api() function like 'fields', etc.

Returns

VolumeFile object.

Examples
\dontrun{
# x is API response when volume is requested
volume_object <- Volume$new(
                    res = x,
                    href = x$href,
                    auth = auth,
                    response = attr(x, "response")
                   )

 # Get volume file
 volume_object$get_file(location = location)
}


Method list_members()

List members of a volume. This function returns the members of a specific volume.

Usage
Volume$list_members(
  limit = getOption("sevenbridges2")$limit,
  offset = getOption("sevenbridges2")$offset,
  ...
)
Arguments
limit

The maximum number of collection items to return for a single request. Minimum value is 1. The maximum value is 100 and the default value is 50. This is a pagination-specific attribute.

offset

The zero-based starting index in the entire collection of the first item to return. The default value is 0. This is a pagination-specific attribute.

...

Other parameters that can be passed to core api() function like 'fields', etc.

Returns

Collection containing Member objects.

Examples
\dontrun{
# x is API response when volume is requested
volume_object <- Volume$new(
                    res = x,
                    href = x$href,
                    auth = auth,
                    response = attr(x, "response")
                   )

 # List volume members
 volume_object$list_members()
}


Method add_member()

Add member to a volume. This function adds members to the specified volume.

Usage
Volume$add_member(
  user,
  permissions = list(read = TRUE, copy = FALSE, write = FALSE, admin = FALSE)
)
Arguments
user

The Seven Bridges Platform username of the person you want to add to the volume or object of class Member containing user's username.

permissions

List of permissions granted to the user being added. Permissions include listing the contents of a volume, importing files from the volume to the Platform, exporting files from the Platform to the volume, and admin privileges.
It can contain fields: 'read', 'copy', 'write' and 'admin' with logical fields - TRUE if certain permission is allowed to the user, or FALSE if it's not. Example:

  permissions = list(read = TRUE, copy = TRUE, write = FALSE,
  admin = FALSE)
Returns

Member object.

Examples
\dontrun{
# x is API response when volume is requested
volume_object <- Volume$new(
                    res = x,
                    href = x$href,
                    auth = auth,
                    response = attr(x, "response")
                   )

 # Add volume member
 volume_object$add_member(
                user = user,
                permissions = list(read = TRUE, copy = FALSE)
              )
}


Method remove_member()

Remove member from a volume. This function removes members from the specified volume.

Usage
Volume$remove_member(user)
Arguments
user

The Seven Bridges Platform username of the person you want to remove from the volume or object of class Member containing user's username.

Examples
\dontrun{
# x is API response when volume is requested
volume_object <- Volume$new(
                    res = x,
                    href = x$href,
                    auth = auth,
                    response = attr(x, "response")
                   )

 # Remove volume member
 volume_object$remove_member(user = user)
}


Method get_member()

Get member's details. This function returns member's information.

Usage
Volume$get_member(user, ...)
Arguments
user

The Seven Bridges Platform username of the person you want to get information about or object of class Member containing user's username.

...

Other arguments that can be passed to core api() function like 'fields', etc.

Returns

Member object.

Examples
\dontrun{
# x is API response when volume is requested
volume_object <- Volume$new(
                    res = x,
                    href = x$href,
                    auth = auth,
                    response = attr(x, "response")
                   )

 # Get volume member
 volume_object$get_member(user = user)
}


Method modify_member_permissions()

Modify volume member's permissions. This function modifies the permissions for a member of a specific volume. Note that this does not overwrite all previously set permissions for the member.

Usage
Volume$modify_member_permissions(
  user,
  permissions = list(read = TRUE, copy = FALSE, write = FALSE, admin = FALSE)
)
Arguments
user

The Seven Bridges Platform username of the person you want to modify permissions for or object of class Member containing user's username.

permissions

List of specific (or all) permissions you want to update for the member of the volume. Permissions include listing the contents of a volume, importing files from the volume to the Platform, exporting files from the Platform to the volume, and admin privileges. It can contain fields: 'read', 'copy', 'write' and 'admin' with logical fields - TRUE if certain permission is allowed to the user, or FALSE if it's not. Example:

  permissions = list(read = TRUE, copy = TRUE, write = FALSE,
  admin = FALSE)
Returns

Permission object.

Examples
\dontrun{
# x is API response when volume is requested
volume_object <- Volume$new(
                    res = x,
                    href = x$href,
                    auth = auth,
                    response = attr(x, "response")
                   )

 # Modify volume member permissions
 volume_object$modify_member_permissions(
                    user = user,
                    permission = list(read = TRUE, copy = TRUE)
                  )
}


Method list_imports()

This call lists import jobs initiated by particular user from this volume.

Usage
Volume$list_imports(
  project = NULL,
  state = NULL,
  limit = getOption("sevenbridges2")$limit,
  offset = getOption("sevenbridges2")$offset,
  ...
)
Arguments
project

String project id or Project object. List all volume imports to this project. Optional.

state

String. The state of the import job. Possible values are:

  • PENDING: the import is queued;

  • RUNNING: the import is running;

  • COMPLETED: the import has completed successfully;

  • FAILED: the import has failed.

Example: state = c("RUNNING", "FAILED")

limit

The maximum number of collection items to return for a single request. Minimum value is 1. The maximum value is 100 and the default value is 50. This is a pagination-specific attribute.

offset

The zero-based starting index in the entire collection of the first item to return. The default value is 0. This is a pagination-specific attribute.

...

Other arguments that can be passed to core api() function like 'fields', etc.

Returns

Collection containing list of Import job objects.

Examples
\dontrun{
# x is API response when volume is requested
volume_object <- Volume$new(
                    res = x,
                    href = x$href,
                    auth = auth,
                    response = attr(x, "response")
                   )

 # List volume imports
 volume_object$list_imports(
                    project = project,
                    state = c("RUNNING", "FAILED")
                  )
}


Method list_exports()

This call lists export jobs initiated by a user into this volume. Note that when you export a file from a project on the Platform into a volume, you write to your cloud storage bucket.

Usage
Volume$list_exports(
  state = NULL,
  limit = getOption("sevenbridges2")$limit,
  offset = getOption("sevenbridges2")$offset,
  ...
)
Arguments
state

The state of the export job. Possible values are:

  • PENDING: the export is queued;

  • RUNNING: the export is running;

  • COMPLETED: the export has completed successfully;

  • FAILED: the export has failed.

Example: state = c("RUNNING", "FAILED")

limit

The maximum number of collection items to return for a single request. Minimum value is 1. The maximum value is 100 and the default value is 50. This is a pagination-specific attribute.

offset

The zero-based starting index in the entire collection of the first item to return. The default value is 0. This is a pagination-specific attribute.

...

Other arguments that can be passed to core api() function like 'fields', etc.

Returns

Collection containing list of Export job objects.

Examples
\dontrun{
# x is API response when volume is requested
volume_object <- Volume$new(
                    res = x,
                    href = x$href,
                    auth = auth,
                    response = attr(x, "response")
                   )

 # List volume exports
 volume_object$list_exports(state = c("RUNNING", "FAILED"))
}


Method clone()

The objects of this class are cloneable with this method.

Usage
Volume$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples


## ------------------------------------------------
## Method `Volume$print`
## ------------------------------------------------

## Not run: 
# x is API response when volume is requested
volume_object <- Volume$new(
                    res = x,
                    href = x$href,
                    auth = auth,
                    response = attr(x, "response")
                   )

 # Print volume object
 volume_object$print()

## End(Not run)


## ------------------------------------------------
## Method `Volume$reload`
## ------------------------------------------------

## Not run: 
# x is API response when volume is requested
volume_object <- Volume$new(
                    res = x,
                    href = x$href,
                    auth = auth,
                    response = attr(x, "response")
                   )

 # Reload volume object
 volume_object$reload()

## End(Not run)


## ------------------------------------------------
## Method `Volume$update`
## ------------------------------------------------

## Not run: 
# x is API response when volume is requested
volume_object <- Volume$new(
                    res = x,
                    href = x$href,
                    auth = auth,
                    response = attr(x, "response")
                   )

 # Update volume object
 volume_object$update(description = description)

## End(Not run)


## ------------------------------------------------
## Method `Volume$deactivate`
## ------------------------------------------------

## Not run: 
# x is API response when volume is requested
volume_object <- Volume$new(
                    res = x,
                    href = x$href,
                    auth = auth,
                    response = attr(x, "response")
                   )

 # Deactivate volume
 volume_object$deactivate()

## End(Not run)


## ------------------------------------------------
## Method `Volume$reactivate`
## ------------------------------------------------

## Not run: 
# x is API response when volume is requested
volume_object <- Volume$new(
                    res = x,
                    href = x$href,
                    auth = auth,
                    response = attr(x, "response")
                   )

 # Deactivate volume
 volume_object$deactivate()

 # Reactivate volume
 volume_object$reactivate()

## End(Not run)


## ------------------------------------------------
## Method `Volume$delete`
## ------------------------------------------------

## Not run: 
# x is API response when volume is requested
volume_object <- Volume$new(
                    res = x,
                    href = x$href,
                    auth = auth,
                    response = attr(x, "response")
                   )

 # Delete volume
 volume_object$delete()

## End(Not run)


## ------------------------------------------------
## Method `Volume$list_contents`
## ------------------------------------------------

## Not run: 
# x is API response when volume is requested
volume_object <- Volume$new(
                    res = x,
                    href = x$href,
                    auth = auth,
                    response = attr(x, "response")
                   )

 # List volume contents
 volume_object$list_contents()

## End(Not run)


## ------------------------------------------------
## Method `Volume$get_file`
## ------------------------------------------------

## Not run: 
# x is API response when volume is requested
volume_object <- Volume$new(
                    res = x,
                    href = x$href,
                    auth = auth,
                    response = attr(x, "response")
                   )

 # Get volume file
 volume_object$get_file(location = location)

## End(Not run)


## ------------------------------------------------
## Method `Volume$list_members`
## ------------------------------------------------

## Not run: 
# x is API response when volume is requested
volume_object <- Volume$new(
                    res = x,
                    href = x$href,
                    auth = auth,
                    response = attr(x, "response")
                   )

 # List volume members
 volume_object$list_members()

## End(Not run)


## ------------------------------------------------
## Method `Volume$add_member`
## ------------------------------------------------

## Not run: 
# x is API response when volume is requested
volume_object <- Volume$new(
                    res = x,
                    href = x$href,
                    auth = auth,
                    response = attr(x, "response")
                   )

 # Add volume member
 volume_object$add_member(
                user = user,
                permissions = list(read = TRUE, copy = FALSE)
              )

## End(Not run)


## ------------------------------------------------
## Method `Volume$remove_member`
## ------------------------------------------------

## Not run: 
# x is API response when volume is requested
volume_object <- Volume$new(
                    res = x,
                    href = x$href,
                    auth = auth,
                    response = attr(x, "response")
                   )

 # Remove volume member
 volume_object$remove_member(user = user)

## End(Not run)


## ------------------------------------------------
## Method `Volume$get_member`
## ------------------------------------------------

## Not run: 
# x is API response when volume is requested
volume_object <- Volume$new(
                    res = x,
                    href = x$href,
                    auth = auth,
                    response = attr(x, "response")
                   )

 # Get volume member
 volume_object$get_member(user = user)

## End(Not run)


## ------------------------------------------------
## Method `Volume$modify_member_permissions`
## ------------------------------------------------

## Not run: 
# x is API response when volume is requested
volume_object <- Volume$new(
                    res = x,
                    href = x$href,
                    auth = auth,
                    response = attr(x, "response")
                   )

 # Modify volume member permissions
 volume_object$modify_member_permissions(
                    user = user,
                    permission = list(read = TRUE, copy = TRUE)
                  )

## End(Not run)


## ------------------------------------------------
## Method `Volume$list_imports`
## ------------------------------------------------

## Not run: 
# x is API response when volume is requested
volume_object <- Volume$new(
                    res = x,
                    href = x$href,
                    auth = auth,
                    response = attr(x, "response")
                   )

 # List volume imports
 volume_object$list_imports(
                    project = project,
                    state = c("RUNNING", "FAILED")
                  )

## End(Not run)


## ------------------------------------------------
## Method `Volume$list_exports`
## ------------------------------------------------

## Not run: 
# x is API response when volume is requested
volume_object <- Volume$new(
                    res = x,
                    href = x$href,
                    auth = auth,
                    response = attr(x, "response")
                   )

 # List volume exports
 volume_object$list_exports(state = c("RUNNING", "FAILED"))

## End(Not run)


[Package sevenbridges2 version 0.1.0 Index]