Authentication object with methods to access API endpoints.
Every object could be requested from this Auth object and any action
could start from this object using cascading style. Please check
vignette("Authentication_and_Billing", package = "sevenbridges2")
for more information.
Public fields
from
Authentication method.
platform
The platform to use.
url
Base URL for API.
sysenv_url
Name of the system environment variable storing the API base URL.
sysenv_token
Name of the system environment variable storing the auth token.
config_file
Location of the user configuration file.
profile_name
Profile name in the user configuration file.
fs
FS (FileSystem) object, for mount and unmount file system.
authorization
Is the
token
an API authentication token (FALSE
) or an access token from the Seven Bridges single sign-on (TRUE
)?projects
Projects object, for accessing projects resources on the platform.
files
Files object, for accessing files resources on the platform.
apps
Apps object, for accessing apps resources on the platform.
volumes
Volumes object, for accessing volumes resources on the platform.
tasks
Tasks object, for accessing volumes resources on the platform.
imports
Storage imports object, for accessing volume imports resources on the platform.
exports
Storage exports object, for accessing volume exports resources on the platform.
invoices
Invoices object, for accessing invoice resources on the platform.
billing_groups
Billing_groups object, for accessing billing groups resources on the platform.
Methods
Method new()
Create a new Seven Bridges API Authentication object. All methods can be accessed through this object.
Arguments
from
Authentication method. Could be:
"direct"
- pass the credential information to the arguments directly,"env"
- read from pre-set system environment variables, or"file"
- read configurations from a credentials file.
Default is
"direct"
.platform
The platform to use. If
platform
andurl
are both not specified, the default is"aws-us"
(Seven Bridges Platform - US). Other possible values include:"aws-eu"
- Seven Bridges Platform - EU,"cgc"
- Cancer Genomics Cloud,"ali-cn"
- Seven Bridges Platform - China,"cavatica"
- Cavatica, and"f4c"
- BioData Catalyst Powered by Seven Bridges.
url
Base URL for API. Please only use this when you want to specify a platform that is not in the
platform
list above, and also leavingplatform
unspecified.token
API authentication token or
access_token
for Seven Bridges single sign-on. Authentication token uniquely identifies you on the Seven Bridges Platform and has all your data access, app management and task execution permissions. Read more about its usage here.sysenv_url
Name of the system environment variable storing the API base URL. By default:
"SB_API_ENDPOINT"
.sysenv_token
Name of the system environment variable storing the auth token. By default:
"SB_AUTH_TOKEN"
.config_file
Location of the user configuration file.
By default:"~/.sevenbridges/credentials"
.profile_name
Profile name in the user configuration file. The default value is
"default"
.fs
FS (FileSystem) object, for mount and unmount file system.
authorization
Is the
token
an API authentication token (FALSE
) or an access token from the Seven Bridges single sign-on (TRUE
)?
Method api()
This method returns all API paths and
pass arguments to core api()
function.
Arguments
...
Other arguments passed to core
api()
function, likepath
,query
parameters or fullurl
to some resource.limit
The maximum number of collection items to return for a single request. Minimum value is
1
. The maximum value is100
and the default value is50
. 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.fields
Selector specifying a subset of fields to include in the response. This parameter enables you to specify the fields you want to be returned when listing resources (e.g. all your projects) or getting details of a specific resource (e.g. a given project).
For example,fields="id,name,size"
to return the fields id, name and size for files. Default value is set to_all
, so all fields are always returned for each resource. More details please check general API documentation.
Method user()
Get details about the authenticated user.
Method rate_limit()
Get information about current rate limit.
This call returns information about your current rate limit. This is the
number of API calls you can make in one hour. This call also returns
information about your current instance limit.
Method upload()
This method allows you to upload a single file from your local computer to the Platform.
Usage
Auth$upload(
path,
project = NULL,
parent = NULL,
filename = NULL,
overwrite = FALSE,
part_size = getOption("sevenbridges2")$RECOMMENDED_PART_SIZE,
init = FALSE
)
Arguments
path
File path on local disk.
project
Project
object or its ID. Project should not be used together with parent. If parent is used, the call will upload the file to the specified Platform folder, within the project to which the folder belongs. If project is used, the call will upload the file to the root of the project's files.parent
Parent folder object (of
File
class) or its ID. Should not be used together with project. If parent is used, the call will upload the file to the specified Platform folder, within the project to which the folder belongs. If project is used, the call will upload the file to the root of the project's files.filename
Optional new file name. By default the uploaded file will have the same name as the original file provided with the
path
parameter. If its name will not change, omit this key.overwrite
In case there is already a file with the same name in the selected platform project or folder, this option allows you to control whether that file will be overwritten or not. If overwrite is set to
TRUE
and a file already exists under the name specified in the request, the existing file will be deleted and a new one created in its place.part_size
The preferred size for upload parts in bytes. If omitted or set to a value that is incompatible with the cloud storage provider, a default value will be used.
init
If
TRUE
, the method will initialize and return the Upload object and stop. IfFALSE
, the method will return the Upload object and start the upload process immediately.
Method send_feedback()
Send feedback to Seven Bridges.
Send feedback on ideas, thoughts, and problems via the sevenbridges2 API
package with three available types: idea
, thought
, and problem
.
You can send one feedback item per minute.
Usage
Auth$send_feedback(
text,
type = c("idea", "thought", "problem"),
referrer = NULL
)
Examples
## ------------------------------------------------
## Method `Auth$new`
## ------------------------------------------------
if (FALSE) {
# Multiple ways to create Auth object
# Using authentication token
a <- Auth$new(
token = "<your_token>",
platform = "aws-us"
)
# Authenticate using environment variables
a <- Auth$new(from = "env")
# Authenticate using file configuration
a <- Auth$new(from = "file")
}
## ------------------------------------------------
## Method `Auth$get_token`
## ------------------------------------------------
if (FALSE) {
# Authenticate using authentication token
a <- Auth$new(
token = "<your_token>",
platform = "aws-us"
)
# Get that same token
a$get_token()
}
## ------------------------------------------------
## Method `Auth$api`
## ------------------------------------------------
if (FALSE) {
# Authenticate using authentication token
a <- Auth$new(
token = "<your_token>",
platform = "aws-us"
)
# Create API request using request parameters directly
a$api(params)
}
## ------------------------------------------------
## Method `Auth$user`
## ------------------------------------------------
if (FALSE) {
# Authenticate using authentication token
a <- Auth$new(
token = "<your_token>",
platform = "aws-us"
)
# Get information about the currently authenticated user
a$user()
}
## ------------------------------------------------
## Method `Auth$rate_limit`
## ------------------------------------------------
if (FALSE) {
# Authenticate using authentication token
a <- Auth$new(
token = "<your_token>",
platform = "aws-us"
)
# Get current rate limit
a$rate_limit()
}
## ------------------------------------------------
## Method `Auth$upload`
## ------------------------------------------------
if (FALSE) {
# Authenticate using authentication token
a <- Auth$new(
token = "<your_token>",
platform = "aws-us"
)
# Create upload job and set destination project
upload_job <- a$upload(
path = "/path/to/your/file.txt",
project = destination_project,
overwrite = TRUE,
init = TRUE
)
}
## ------------------------------------------------
## Method `Auth$list_ongoing_uploads`
## ------------------------------------------------
if (FALSE) {
# Authenticate using authentication token
a <- Auth$new(
token = "<your_token>",
platform = "aws-us"
)
# List ongoing uploads
a$list_ongoing_uploads()
}
## ------------------------------------------------
## Method `Auth$upload_abort`
## ------------------------------------------------
if (FALSE) {
# Authenticate using authentication token
a <- Auth$new(
token = "<your_token>",
platform = "aws-us"
)
# Abort upload
a$abort_upload(upload_id = "<id_of_the_upload_process>")
}
## ------------------------------------------------
## Method `Auth$send_feedback`
## ------------------------------------------------
if (FALSE) {
# Authenticate using authentication token
a <- Auth$new(
token = "<your_token>",
platform = "aws-us"
)
# Send feedback
a$send_feedback(
"This is a test for sending feedback via API.",
type = "thought"
)
}