cmd

package
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2020 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MAXRETRY = 5

MAXRETRY defines number of times to try upload data to storj before throwing error

Functions

func ConnectToPydio

func ConnectToPydio(configPydioRest ConfigPydioRest) ([]string, string)

ConnectToPydio will connect to a Pydio Cells instance, based on the read property from an external file. It returns list of workspaces in the Pydio Cells instance and the backup prefix path name

func ConnectToStorj

func ConnectToStorj(fullFileName string, configStorj ConfigStorj, accesskey bool) (*uplink.Access, *uplink.Project)

ConnectToStorj reads Storj configuration from given file and connects to the desired Storj network. It then reads data property from an external file.

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func GetApiClient

func GetApiClient(sdkConfig *cells_sdk.SdkConfig, anonymous ...bool) (context.Context, *client.PydioCellsRest, error)

GetApiClient connects to the Pydio Cells server defined by this config, by sending an authentication request to the OIDC service to get a valid JWT (or taking the JWT from cache). Also returns a context to be used in subsequent requests.

func GetFile

func GetFile(pathToFile string) (io.Reader, int, error)

GetFile returns the io.Reader implementor for a file path in Pydio Cells

func GetFileNames

func GetFileNames(configPydioRest ConfigPydioRest, workspaces []string) []string

GetFileNames will return all the file names in the Pydio Cells instance

func GetS3Client

func GetS3Client() (*s3.S3, string, error)

GetS3Client returns the Pydio Cells S3 Client which is required for getting io.Reader implementor from GetFile function

func ShareAccess

func ShareAccess(access *uplink.Access, configStorj ConfigStorj)

ShareAccess generates and prints the shareable serialized access as per the restrictions provided by the user.

func UploadData

func UploadData(project *uplink.Project, configStorj ConfigStorj, uploadPathName string, objectReader io.Reader)

UploadData uploads the backup file to storj network.

Types

type ConfigPydioRest

type ConfigPydioRest = *cells_sdk.SdkConfig

ConfigPydioRest type alias for cells_sdk

func LoadPydioProperty

func LoadPydioProperty(fullFileName string) ConfigPydioRest

LoadPydioProperty reads and parses the JSON file that contains a Pydio Cells instance's property and returns all the properties as REST object

type ConfigPydioS3

type ConfigPydioS3 = *cells_sdk.S3Config

ConfigPydioS3 type alias for cells_sdk

type ConfigStorj

type ConfigStorj struct {
	APIKey               string `json:"apikey"`
	Satellite            string `json:"satellite"`
	Bucket               string `json:"bucket"`
	UploadPath           string `json:"uploadPath"`
	EncryptionPassphrase string `json:"encryptionpassphrase"`
	SerializedAccess     string `json:"serializedAccess"`
	AllowDownload        string `json:"allowDownload"`
	AllowUpload          string `json:"allowUpload"`
	AllowList            string `json:"allowList"`
	AllowDelete          string `json:"allowDelete"`
	NotBefore            string `json:"notBefore"`
	NotAfter             string `json:"notAfter"`
}

ConfigStorj depicts keys to search for within the stroj_config.json file.

func LoadStorjConfiguration

func LoadStorjConfiguration(fullFileName string) ConfigStorj

LoadStorjConfiguration reads and parses the JSON file that contain Storj configuration information.

type Stack

type Stack []string

Stack type alias for LIFO data structure implementation

func (*Stack) IsEmpty

func (s *Stack) IsEmpty() bool

IsEmpty checks if the stack is empty

func (*Stack) Pop

func (s *Stack) Pop() (string, bool)

Pop removes and returns top element of stack. Returns false if stack is empty.

func (*Stack) Push

func (s *Stack) Push(str string)

Push a new value onto the stack

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL