## ----include = FALSE---------------------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>", eval = FALSE ) ## ----------------------------------------------------------------------------- # # Authenticate # a <- Auth$new(platform = "aws-us", token = "") # # # Get the desired project to upload to # destination_project <- a$projects$get(project = "") # # # Create upload job and set destination project # upload_job <- a$upload( # path = "/path/to/your/file.txt", # project = destination_project, # overwrite = TRUE, # init = TRUE # ) ## ----------------------------------------------------------------------------- # # Get destination folder object # destination_folder <- a$files$get(id = "") # # up <- a$upload( # path = "/path/to/your/file.txt", # parent = destination_folder, # overwrite = TRUE, # init = TRUE # ) ## ----------------------------------------------------------------------------- # up$print() ## ----------------------------------------------------------------------------- # # Start upload # up$start() ## ----------------------------------------------------------------------------- # # Create upload job and start it immediately # up <- a$upload( # path = "/path/to/your/file.txt", # project = destination_project, # overwrite = TRUE, # init = FALSE # ) ## ----------------------------------------------------------------------------- # # Get upload progress info # up$info() ## ----------------------------------------------------------------------------- # # List ongoing uploads # a$list_ongoing_uploads() ## ----------------------------------------------------------------------------- # # Abort upload # a$abort_upload(upload_id = "") ## ----------------------------------------------------------------------------- # # Query volumes # a$volumes$query() ## ----------------------------------------------------------------------------- # # Get volume # a$volumes$get(id = "/") ## ----------------------------------------------------------------------------- # # Create AWS volume using IAM User authentication type # aws_iam_user_volume <- a$volumes$create_s3_using_iam_user( # name = "my_new_aws_user_volume", # bucket = "", # description = "AWS IAM User volume", # access_key_id = "", # secret_access_key = "" # ) # # aws_iam_user_volume_from_path <- a$volumes$create_s3_using_iam_user( # from_path = "path/to/my/json/file.json" # ) # # # # Create AWS volume using IAM Role authentication type # aws_iam_role_volume <- a$volumes$create_s3_using_iam_role( # name = "my_new_aws_role_volume", # bucket = "", # description = "AWS IAM Role volume", # role_arn = "", # external_id = "" # ) # # aws_iam_role_volume_from_path <- a$volumes$create_s3_using_iam_role( # from_path = "path/to/my/json/file.json" # ) # # # Create Google Cloud volume using IAM User authentication type # gc_iam_user_volume <- a$volumes$create_google_using_iam_user( # name = "my_new_gc_user_volume", # access_mode = "RW", # bucket = "", # description = "GC IAM User volume", # client_email = "", # private_key = "" # ) # # gc_iam_user_volume_from_path <- a$volumes$create_google_using_iam_user( # from_path = "path/to/my/json/file.json" # ) # # # Create Google Cloud volume using IAM Role authentication type # # by passing configuration parameter as named list # gc_iam_role_volume <- a$volumes$create_google_using_iam_role( # name = "my_new_gc_role_volume", # access_mode = "RO", # bucket = "", # description = "GC IAM Role volume", # configuration = list( # type = "", # audience = "", # subject_token_type = "", # service_account_impersonation_url = "", # token_url = "", # credential_source = list( # environment_id = "", # region_url = "", # url = "", # regional_cred_verification_url = "" # ) # ) # ) # # # Create Google Cloud volume using IAM Role authentication type # # by passing configuration parameter as string path to configuration file # gc_iam_role_volume_config_file <- a$volumes$create_google_using_iam_role( # name = "my_new_gc_role_volume_cnf_file", # access_mode = "RO", # bucket = "", # description = "GC IAM Role volume - using config file", # configuration = "path/to/config/file.json" # ) # # # Create Google Cloud volume using IAM Role authentication type # # using from_path parameter # gc_iam_role_volume_from_path <- a$volumes$create_google_using_iam_role( # from_path = "path/to/full/config/file.json" # ) # # # Create Azure volume # azure_volume <- a$volumes$create_azure( # name = "my_new_azure_volume", # description = "Azure volume", # endpoint = "", # container = "") # # # Remove member using the Member object # members <- aws_iam_user_volume$list_members() # aws_iam_user_volume$remove_member(members$items[[3]]) ## ----------------------------------------------------------------------------- # # Add member via username # aws_iam_user_volume$add_member(user = "", permissions = list( # read = TRUE, copy = TRUE, write = FALSE, admin = FALSE # )) # # # Add member via Member object # aws_iam_user_volume$add_member( # user = Member$new( # username = "", # id = "" # ), # permissions = list( # read = TRUE, copy = TRUE, write = FALSE, # admin = FALSE # ) # ) ## ----------------------------------------------------------------------------- # # Modify member permissions # aws_iam_user_volume$modify_member_permissions( # user = "", # permissions = list(write = TRUE) # ) ## ----------------------------------------------------------------------------- # # Deactivate volume # aws_iam_user_volume$deactivate() # # # Reactivate volume # aws_iam_user_volume$reactivate() ## ----------------------------------------------------------------------------- # # Deactivate volume # aws_iam_user_volume$deactivate() # # # Delete volume # aws_iam_user_volume$delete() ## ----------------------------------------------------------------------------- # # List imports # all_imports <- a$imports$query() # # # Limit results to 5 # imp_limit5 <- a$imports$query(limit = 5) # # # Load next page of 5 results # imp_limit5$next_page(advance_access = TRUE) # # # Load all results at once until last page # imp_limit5$all(advance_access = TRUE) ## ----------------------------------------------------------------------------- # # List imports with state being RUNNING or FAILED # imp_states <- auth$imports$query(state = c("RUNNING", "FAILED")) # # # List imports to the specific project # imp_project <- auth$imports$query(project = "") ## ----------------------------------------------------------------------------- # ## Get the volume from which you want to list all imports # vol1 <- auth$volumes$get(id = "/") # vol1$list_imports() # # ## Get the project object for which you want to list imports # test_proj <- auth$projects$get("") # test_proj$list_imports() ## ----------------------------------------------------------------------------- # # Get single import # imp_obj <- a$imports$get(id = "") ## ----------------------------------------------------------------------------- # # Get details of multiple import jobs # import_jobs <- a$imports$bulk_get( # imports = list("", "") # ) ## ----------------------------------------------------------------------------- # ## First, get the volume you want to import files from # vol1 <- a$volumes$get(id = "/") # # ## Then, get the project object/id where you want to import files # test_proj <- a$projects$get("") # # ## List all volume files on the volume # vol1_content <- vol1$list_contents() # # ## Select one of the volume files # volume_file_import <- vol1_content$items[[3]] # # ## Perform a file import # imp_job1 <- a$imports$submit_import( # source_location = volume_file_import$location, # destination_project = test_proj, # autorename = TRUE # ) # # # Alternatively you can also call import() directly on the VolumeFile object # imp_job1 <- volume_file_import$import( # destination_project = test_proj, # autorename = TRUE # ) ## ----------------------------------------------------------------------------- # # Print Import object # print(imp_job1) ## ----------------------------------------------------------------------------- # # Select one of the volume folders to import # volume_folder_import <- vol1_content$prefixes[[1]] # # # Perform a folder import # imp_job2 <- a$imports$submit_import( # source_location = volume_folder_import$prefix, # destination_project = test_proj, # overwrite = TRUE, # preserve_folder_structure = TRUE # ) # # # Alternatively you can also call import() directly on the VolumePrefix object # imp_job2 <- volume_folder_import$import( # destination_project = test_proj, # overwrite = TRUE, # preserve_folder_structure = TRUE # ) # # # Print Import object # print(imp_job2) ## ----------------------------------------------------------------------------- # # Reload import object # imp_job1$reload() ## ----------------------------------------------------------------------------- # ## First, get the volume you want to import files from # vol1 <- a$volumes$get(id = "/") # # ## Then, get the project object or the ID of the project into which you want # # to import files # test_proj <- a$projects$get("") # # ## List all volume files # vol1_content <- vol1$list_contents() # # ## Preview the content and select one VolumeFile object and two VolumePrefix # ## objects (folders) for the purpose of this example # volume_file_import <- vol1_content$items[[1, 2]] # volume_file_import # # volume_folder_import <- vol1_content$prefixes[[1]] # volume_folder_import # # ## Construct the inputs list by filling the necessary information for each # # file/folder to import # to_import <- list( # list( # source_volume = "rfranklin/my-volume", # source_location = "chimeras.html.gz", # destination_project = "rfranklin/my-project" # ), # list( # source_volume = vol1, # source_location = "my-folder/", # destination_project = test_proj, # autorename = TRUE, # preserve_folder_structure = TRUE # ), # list( # source_volume = "rfranklin/my-volume", # source_location = "my-volume-folder/", # destination_parent = "parent-id", # name = "new-folder-name", # autorename = TRUE, # preserve_folder_structure = FALSE # ) # ) # bulk_import_jobs <- a$imports$bulk_submit_import(items = to_import) # # # Preview the results # bulk_import_jobs # # # Get updated status by fetching details with bulk_get() and by passing the # # list of import jobs created in the previous step # a$imports$bulk_get(imports = bulk_import_jobs$items) ## ----------------------------------------------------------------------------- # ## First, get the volume you want to import files from # vol1 <- a$volumes$get(id = "/") # # ## Then, get the project object or the ID of the project into which you want # # to import files # test_proj <- a$projects$get("") # # ## List all volume files # vol1_content <- vol1$list_contents() # # ## Select two VolumeFile objects # volume_file_1_import <- vol1_content$items[[1]] # volume_file_2_import <- vol1_content$items[[2]] # # volume_files_to_import <- list(volume_file_1_import, volume_file_2_import) # # ## Construct the inputs list using the prepare_items_for_bulk_import() utility # # function # to_import <- prepare_items_for_bulk_import( # volume_items = volume_files_to_import, # destination_project = test_proj # ) # # bulk_import_jobs <- a$imports$bulk_submit_import(items = to_import) # # # Preview the results # bulk_import_jobs # # # Get updated status by fetching details with bulk_get() and by passing the # # list of import jobs created in the previous step # a$imports$bulk_get(imports = bulk_import_jobs$items) ## ----------------------------------------------------------------------------- # # List exports # all_exports <- a$exports$query() # # # Limit results to 5 # exp_limit5 <- a$exports$query(limit = 5) # # # Load next page of 5 results # exp_limit5$next_page(advance_access = TRUE) # # # List all results until last page # exp_limit5$all() ## ----------------------------------------------------------------------------- # # List exports with status RUNNING or FAILED # exp_states <- a$exports$query(state = c("RUNNING", "FAILED")) # # # List exports into a specific volume # exp_volume <- a$exports$query( # volume = "/" # volume object or id # ) ## ----------------------------------------------------------------------------- # # Get the volume for which you want to list all exports # vol1 <- a$volumes$get(id = "/") # # # List exports # vol1$list_exports() ## ----------------------------------------------------------------------------- # # Get a single export # exp_obj <- auth$exports$get(id = "") ## ----------------------------------------------------------------------------- # # Get details of multiple export jobs # export_jobs <- a$exports$bulk_get( # exports = list("", "") # ) ## ----------------------------------------------------------------------------- # # First, get the volume you want to export files to # vol1 <- a$volumes$get(id = "/") # # # Get the File object/id you want to export from the platform # test_file <- a$files$get("") # # # Perform a file export # exp_job1 <- a$exports$submit_export( # source_file = test_file, # destination_volume = vol1, # destination_location = "new_volume_file.txt" # new name # ) ## ----------------------------------------------------------------------------- # # Print export job info # print(exp_job1) ## ----------------------------------------------------------------------------- # # Export file into the folder 'test_folder' # exp_job2 <- a$exports$submit_export( # source_file = test_file, # destination_volume = vol1, # destination_location = "test_folder/new_volume_file.txt" # new name # ) # # # Print export job info # print(exp_job2) ## ----------------------------------------------------------------------------- # # Reload export object # exp_job1$reload() ## ----------------------------------------------------------------------------- # ## First, get the project and files you want to export # test_proj <- a$projects$get("") # proj_files <- test_proj$list_files() # # ## Choose the first 3 files to export # files_to_export <- proj_files$items[1:3] # # ## Then, get the volume you want to export files into # vol1 <- a$volumes$get(id = "/") # # ## Construct the inputs list by filling the necessary information for each # # file to export # to_export <- list( # list( # source_file = files_to_export[[1]], # destination_volume = vol1, # destination_location = files_to_export[[1]]$name # ), # list( # source_file = "second-file-id", # destination_volume = vol1, # destination_location = "my-folder/exported_second_file.txt", # overwrite = TRUE # ), # list( # source_file = files_to_export[[3]], # destination_volume = vol1, # destination_location = files_to_export[[3]]$name, # overwrite = FALSE, # properties = list( # sse_algorithm = "AES256" # ) # ), # copy_only = FALSE # ) # bulk_export_jobs <- a$exports$bulk_submit_export(items = to_export) # # # Preview the results # bulk_export_jobs # # # Get updated status by fetching details with bulk_get() and by passing the # # list of export jobs created in the previous step # a$exports$bulk_get(exports = bulk_export_jobs$items) ## ----------------------------------------------------------------------------- # ## First, get the project and files you want to export # test_proj <- a$projects$get("") # proj_files <- test_proj$list_files() # # ## Then, get the volume you want to export files into # vol1 <- a$volumes$get(id = "/") # # ## Select two File objects # file_1_export <- proj_files[[1]] # file_2_export <- proj_files[[2]] # # files_to_export <- list(file_1_export, file_2_export) # # ## Construct the inputs list using the prepare_items_for_bulk_export() utility # # function # to_export <- prepare_items_for_bulk_export( # files = files_to_export, # destination_volume = vol1, # destination_location_prefix = "my-folder/" # ) # # bulk_export_jobs <- a$exports$bulk_submit_export(items = to_export) # # # Preview the results # bulk_export_jobs # # # Get updated status by fetching details with bulk_get() and by passing the # # list of export jobs created in the previous step # a$exports$bulk_get(exports = bulk_export_jobs$items)