clients.rclone #
a sal to work with rclone
Rclone is this incredible swiss army knive to deal with S3 storage servers.
Example
import freeflowuniverse.herolib.osal.rclone
fn main() {
do() or { panic(err) }
}
fn do() ! {
mut z:=rclone.new()!
// name string @[required]
// cmd string @[required]
// cmd_file bool //if we wanna force to run it as a file which is given to bash -c (not just a cmd in rclone)
// test string
// test_file bool
// after []string
// env map[string]string
// oneshot bool
p:=z.new(
name:'test'
cmd:'/bin/bash'
)!
}
protocol defined in
sal on top of https://github.com/threefoldtech/rclone/tree/master
https://github.com/threefoldtech/rclone/blob/master/docs/protocol.md
Constants #
const version = '0.0.0'
fn check_installed #
fn check_installed() bool
check_installed checks if rclone is installed
fn configure #
fn configure() !
will look for personal configuration file in ~/hero/config . this file is in heroscript format and will have all required info to configure rclone
!!config.s3server_define
name:'tf_write_1'
description:'ThreeFold Read Write Repo 1
keyid:'003e2a7be6357fb0000000001'
keyname:'tfrw'
appkey:'K003UsdrYOZou2ulBHA8p4KLa/dL2n4'
url:''
fn get #
fn get(args_ ArgsGet) !&RCloneClient
fn heroscript_default #
fn heroscript_default() !string
fn new #
fn new(name string) !RCloneClient
new creates a new RCloneClient instance
fn play #
fn play(args_ PlayArgs) !
fn switch #
fn switch(name string)
switch instance to be used for rclone
struct ArgsGet #
@[params]
struct ArgsGet {
pub mut:
name string = 'default'
}
///////FACTORY
struct PlayArgs #
@[params]
struct PlayArgs {
pub mut:
name string = 'default'
heroscript string // if filled in then plbook will be made out of it
plbook ?playbook.PlayBook
reset bool
start bool
stop bool
restart bool
delete bool
configure bool // make sure there is at least one installed
}
struct RCloneClient #
@[heap]
struct RCloneClient {
pub mut:
name string = 'default'
type_ string = 's3' // remote type (s3, sftp, etc)
provider string = 'aws' // provider for s3 (aws, minio, etc)
access_key string // access key for authentication
secret_key string // secret key for authentication
region string = 'us-east-1' // region for s3
endpoint string // custom endpoint URL if needed
}
fn (RCloneClient) download #
fn (mut r RCloneClient) download(remote_path string, local_path string) !
download downloads a file or directory from the remote
fn (RCloneClient) list #
fn (mut r RCloneClient) list(remote_path string) !string
list lists contents of a remote path
fn (RCloneClient) mount #
fn (mut r RCloneClient) mount(remote_path string, local_path string) !
mount mounts a remote at the specified path
fn (RCloneClient) unmount #
fn (mut r RCloneClient) unmount(local_path string) !
unmount unmounts a mounted remote
fn (RCloneClient) upload #
fn (mut r RCloneClient) upload(local_path string, remote_path string) !
upload uploads a file or directory to the remote