| Auth | R Documentation |
Authentication object with methods for accessing 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.
This is the main object for authentication to platforms powered by Seven Bridges.
fromAuthentication method.
platformThe platform to use.
urlBase URL for API.
sysenv_urlName of the system environment variable storing the API base URL.
sysenv_tokenName of the system environment variable storing the auth token.
config_fileLocation of the user configuration file.
profile_nameProfile name in the user configuration file.
fsFS (FileSystem) object, for mounting and unmounting the file system.
authorizationIs the token an API
authentication token (FALSE) or an access token from the
Seven Bridges single sign-on (TRUE)?
projectsProjects object, for accessing projects resources on the platform.
filesFiles object, for accessing files resources on the platform.
appsApps object, for accessing apps resources on the platform.
volumesVolumes object, for accessing volumes resources on the platform.
tasksTasks object, for accessing tasks resources on the platform.
importsStorage imports object, for accessing volume imports resources on the platform.
exportsStorage exports object, for accessing volume exports resources on the platform.
invoicesInvoices object, for accessing invoice resources on the platform.
billing_groupsBilling_groups object, for accessing billing groups resources on the platform.
divisionsDivisions object, for accessing divisions resources on the platform.
teamsTeams object, for accessing teams resources on the platform.
new()Create a new Seven Bridges API Authentication object. All methods can be accessed through this object.
Auth$new(
from = c("direct", "env", "file"),
platform = NA,
url = NA,
token = NA,
sysenv_url = NA,
sysenv_token = NA,
config_file = NA,
profile_name = NA,
fs = NA,
authorization = FALSE
)fromAuthentication 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".
platformThe platform to use.
If neither platform nor url is 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.
urlBase URL for API. Please only use this when you
want to specify a platform that is not in the platform list
above, while leaving platform unspecified.
tokenAPI 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_urlName of the system environment variable storing
the API base URL. By default: "SB_API_ENDPOINT".
sysenv_tokenName of the system environment variable storing
the auth token. By default: "SB_AUTH_TOKEN".
config_fileLocation of the user configuration file.
By default: "~/.sevenbridges/credentials".
profile_nameProfile name in the user configuration file.
The default value is "default".
fsFS (FileSystem) object, for mount and unmount file system.
authorizationIs the token an API
authentication token (FALSE) or an access token from the
Seven Bridges single sign-on (TRUE)?
Auth class object.
\dontrun{
# 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")
}
get_token()Returns the authentication token read from system environment variable.
Auth$get_token()
An API authentication token in form of a string.
\dontrun{
# Authenticate using authentication token
a <- Auth$new(
token = "<your_token>",
platform = "aws-us"
)
# Get that same token
a$get_token()
}
api()This method returns all API paths and
pass arguments to core api() function.
Auth$api(
...,
limit = getOption("sevenbridges2")$limit,
offset = getOption("sevenbridges2")$offset,
fields = "_all"
)...Other arguments passed to core api() function, like path,
query parameters or full url to some resource.
limitThe 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.
offsetThe 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.
fieldsSelector 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.
\dontrun{
# Authenticate using authentication token
a <- Auth$new(
token = "<your_token>",
platform = "aws-us"
)
# Create API request using request parameters directly
a$api(params)
}
user()Get details about the authenticated user.
Auth$user(username = NULL)
usernameThe username of a user for whom you want to get basic account information. If not provided, information about the currently authenticated user will be returned.
User class object.
\dontrun{
# Authenticate using authentication token
a <- Auth$new(
token = "<your_token>",
platform = "aws-us"
)
# Get information about the currently authenticated user
a$user()
}
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.
Auth$rate_limit()
\dontrun{
# Authenticate using authentication token
a <- Auth$new(
token = "<your_token>",
platform = "aws-us"
)
# Get current rate limit
a$rate_limit()
}
upload()This method allows you to upload a single file from your local computer to the Platform.
Auth$upload(
path,
project = NULL,
parent = NULL,
filename = NULL,
overwrite = FALSE,
part_size = getOption("sevenbridges2")$RECOMMENDED_PART_SIZE,
init = FALSE
)pathFile path on local disk.
projectProject 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.
parentParent 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.
filenameOptional 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.
overwriteIn 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_sizeThe 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.
initIf TRUE, the method will initialize and return the Upload
object and stop. If FALSE, the method will return the Upload object
and start the upload process immediately.
\dontrun{
# 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
)
}
list_ongoing_uploads()This method returns the list of all ongoing uploads.
Auth$list_ongoing_uploads()
\dontrun{
# Authenticate using authentication token
a <- Auth$new(
token = "<your_token>",
platform = "aws-us"
)
# List ongoing uploads
a$list_ongoing_uploads()
}
upload_abort()This call aborts an ongoing multipart upload.
Auth$upload_abort(upload_id)
upload_idUpload object or ID of the upload process that you want to abort.
\dontrun{
# 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>")
}
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.
Auth$send_feedback(
text,
type = c("idea", "thought", "problem"),
referrer = NULL
)textSpecifies the content for the feedback i.e. feedback text.
typeSpecifies the type of feedback. The following are available:
idea, thought and problem.
referrerThe name of the person submitting the feedback.
\dontrun{
# 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"
)
}
clone()The objects of this class are cloneable with this method.
Auth$clone(deep = FALSE)
deepWhether to make a deep clone.
## ------------------------------------------------
## Method `Auth$new`
## ------------------------------------------------
## Not run:
# 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")
## End(Not run)
## ------------------------------------------------
## Method `Auth$get_token`
## ------------------------------------------------
## Not run:
# Authenticate using authentication token
a <- Auth$new(
token = "<your_token>",
platform = "aws-us"
)
# Get that same token
a$get_token()
## End(Not run)
## ------------------------------------------------
## Method `Auth$api`
## ------------------------------------------------
## Not run:
# Authenticate using authentication token
a <- Auth$new(
token = "<your_token>",
platform = "aws-us"
)
# Create API request using request parameters directly
a$api(params)
## End(Not run)
## ------------------------------------------------
## Method `Auth$user`
## ------------------------------------------------
## Not run:
# Authenticate using authentication token
a <- Auth$new(
token = "<your_token>",
platform = "aws-us"
)
# Get information about the currently authenticated user
a$user()
## End(Not run)
## ------------------------------------------------
## Method `Auth$rate_limit`
## ------------------------------------------------
## Not run:
# Authenticate using authentication token
a <- Auth$new(
token = "<your_token>",
platform = "aws-us"
)
# Get current rate limit
a$rate_limit()
## End(Not run)
## ------------------------------------------------
## Method `Auth$upload`
## ------------------------------------------------
## Not run:
# 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
)
## End(Not run)
## ------------------------------------------------
## Method `Auth$list_ongoing_uploads`
## ------------------------------------------------
## Not run:
# Authenticate using authentication token
a <- Auth$new(
token = "<your_token>",
platform = "aws-us"
)
# List ongoing uploads
a$list_ongoing_uploads()
## End(Not run)
## ------------------------------------------------
## Method `Auth$upload_abort`
## ------------------------------------------------
## Not run:
# 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>")
## End(Not run)
## ------------------------------------------------
## Method `Auth$send_feedback`
## ------------------------------------------------
## Not run:
# 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"
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.