Documentation ¶
Index ¶
- Constants
- Variables
- func ApplyUpdate(ctx context.Context, p *UpdatePackage, dryRun bool, pgChan chan float64, ...)
- func BuildParams(source []string, targetFolder string, targetParent bool) string
- func CheckKeyring() error
- func CleanURL(input string) (string, error)
- func ClearKeyring(c *CecConfig) error
- func ConfigFromKeyring(ctx context.Context, conf *CecConfig) error
- func ConfigToKeyring(conf *CecConfig) error
- func CopyParams(source []string, targetFolder string) string
- func DefaultConfigDirPath() string
- func DefaultConfigFilePath() string
- func GetConfigFilePath() string
- func IsDebugEnabled() bool
- func IsForbiddenError(err error) bool
- func IsInfoEnabled() bool
- func MoveParams(source []string, targetFolder string) string
- func RandString(n int) string
- func RenameParams(source []string, targetFolder string) string
- func RetrieveRemoteServerVersion(sdkConfig *cellsSdk.SdkConfig) (*common.ServerVersion, error)
- func RetrieveSessionLogin(currConf *CecConfig) (string, error)
- func RetryCallback(callback func() error, number int, interval time.Duration) error
- func SetConfigFilePath(confPath string)
- func SetLogger(level zapcore.Level) (logger *zap.Logger)
- func StandardizeLink(sdkConfig *cellsSdk.SdkConfig, old string) string
- func Unique(length int) string
- func UpdateConfig(newConf *CecConfig) error
- func UserAgent() string
- func ValidURL(input string) error
- type BarsPool
- type CecConfig
- type CellsConfigStore
- type ConfigList
- func (list *ConfigList) GetActiveConfig(ctx context.Context) (*CecConfig, error)
- func (list *ConfigList) GetStoredConfig(ctx context.Context, id string) (*CecConfig, error)
- func (list *ConfigList) Remove(id string) error
- func (list *ConfigList) SaveConfigFile() error
- func (list *ConfigList) SetActiveConfig(id string) error
- type CrawlNode
- func NewCrawler(ctx context.Context, sdkClient *SdkClient, basePath string, isLocal bool) (*CrawlNode, error)
- func NewLocalBaseNode(sdkClient *SdkClient, absPath string, i os.FileInfo) *CrawlNode
- func NewLocalNode(sdkClient *SdkClient, absPath, relPath string, i os.FileInfo) *CrawlNode
- func NewRemoteNode(sdkClient *SdkClient, t *models.TreeNode) *CrawlNode
- func NewTarget(sdkClient *SdkClient, target string, isLocal, isDir, merge bool) *CrawlNode
- func (c *CrawlNode) CreateFolders(_ context.Context, target *CrawlNode, dd []*CrawlNode, pool *BarsPool) error
- func (c *CrawlNode) DeleteForMerge(ctx context.Context, dd []*CrawlNode, pool *BarsPool) error
- func (c *CrawlNode) TransferAll(ctx context.Context, dd []*CrawlNode, pool *BarsPool) (errs []error)
- func (c *CrawlNode) Walk(ctx context.Context, target *CrawlNode) (toTransfer, toCreate, toDelete []*CrawlNode, err error)
- type ReaderWithProgress
- type SdkClient
- func (client *SdkClient) ConfigureS3Logger(ctx context.Context, s3Flags string) error
- func (client *SdkClient) CopyJob(ctx context.Context, jsonParams string) (string, error)
- func (client *SdkClient) CreateSimpleFolderLink(ctx context.Context, targetNodeUuid, label string) (*models.RestShareLink, error)
- func (client *SdkClient) DeleteNodes(ctx context.Context, paths []string, permanently ...bool) (jobUUIDs []string, e error)
- func (client *SdkClient) GetAllBulkMeta(ctx context.Context, path string) (nodes []*models.TreeNode, err error)
- func (client *SdkClient) GetApiClient() *client.PydioCellsRestAPI
- func (client *SdkClient) GetBucketName() string
- func (client *SdkClient) GetCecConfig() *CecConfig
- func (client *SdkClient) GetConfig() *cellsSdk.SdkConfig
- func (client *SdkClient) GetCurrentJobStatus(ctx context.Context, jobID string) (status models.JobsTaskStatus, msg string, pg float32, e error)
- func (client *SdkClient) GetFile(ctx context.Context, pathToFile string) (io.Reader, int, error)
- func (client *SdkClient) GetS3Client() *s3.Client
- func (client *SdkClient) GetStore() cellsSdk.ConfigRefresher
- func (client *SdkClient) GetTaskStatusForJob(ctx context.Context, jobID string) (status models.JobsTaskStatus, msg string, pg float32, e error)
- func (client *SdkClient) ListNodesPath(ctx context.Context, path string) ([]string, error)
- func (client *SdkClient) MonitorJob(ctx context.Context, jobID string) (err error)
- func (client *SdkClient) MoveJob(ctx context.Context, jsonParams string) (string, error)
- func (client *SdkClient) PutFile(ctx context.Context, pathToFile string, content io.ReadSeeker, ...) (*s3.PutObjectOutput, error)
- func (client *SdkClient) RunJob(ctx context.Context, jobName string, jsonParams string) (string, error)
- func (client *SdkClient) Setup(ctx context.Context)
- func (client *SdkClient) StatNode(ctx context.Context, pathToFile string) (*models.TreeNode, bool)
- func (client *SdkClient) Teardown()
- type UpdatePackage
- type UpdateRequest
- type UpdateResponse
Constants ¶
const ( TransferRetryMaxAttemptsDefault = 3 TransferRetryMaxBackoffDefault = 3 * time.Second )
const ( // NoKeyringMsg warns end user when no keyring is found NoKeyringMsg = "" /* 132-byte string literal not displayed */ )
Variables ¶
var ( UploadSwitchMultipart = int64(100) UploadDefaultPartSize = int64(50) UploadMaxPartsNumber = int64(5000) TransferRetryMaxAttempts = TransferRetryMaxAttemptsDefault TransferRetryMaxBackoff = TransferRetryMaxBackoffDefault UploadPartsConcurrency = 3 S3RequestTimeout = int64(-1) UploadSkipMD5 = false )
var ( DryRun bool PoolSize = 3 )
var (
Log *zap.SugaredLogger
)
Functions ¶
func ApplyUpdate ¶
func CheckKeyring ¶
func CheckKeyring() error
CheckKeyring simply tries a write followed by a read in the local keyring and returns nothing if it works or an error otherwise.
func ClearKeyring ¶
ClearKeyring removes sensitive info from the local keychain, if they are present.
func ConfigFromKeyring ¶
ConfigFromKeyring tries to find sensitive info inside local keychain and feed the conf.
func ConfigToKeyring ¶
ConfigToKeyring stores sensitive information in local keyring if any and removes it from current SDK config.
func CopyParams ¶
func DefaultConfigDirPath ¶
func DefaultConfigDirPath() string
func DefaultConfigFilePath ¶
func DefaultConfigFilePath() string
func GetConfigFilePath ¶
func GetConfigFilePath() string
func IsDebugEnabled ¶ added in v4.2.0
func IsDebugEnabled() bool
func IsForbiddenError ¶
func IsInfoEnabled ¶ added in v4.2.0
func IsInfoEnabled() bool
func MoveParams ¶
func RandString ¶
func RenameParams ¶
func RetrieveRemoteServerVersion ¶
func RetrieveRemoteServerVersion(sdkConfig *cellsSdk.SdkConfig) (*common.ServerVersion, error)
RetrieveRemoteServerVersion gets the version info from the distant server. User must be authenticated (and admin ?).
func RetrieveSessionLogin ¶ added in v4.1.0
RetrieveSessionLogin tries to get the registry of the server defined by the passed configuration and parse the result to get current user login. Typically useful when using PAT auth.
func RetryCallback ¶
RetryCallback implements boilerplate code to easily call the same function until it succeeds or a time-out is reached.
func SetConfigFilePath ¶
func SetConfigFilePath(confPath string)
func UpdateConfig ¶
Types ¶
type BarsPool ¶
type BarsPool struct { *uiprogress.Progress // contains filtered or unexported fields }
func NewBarsPool ¶
type CecConfig ¶
type CecConfig struct { *cellsSdk.SdkConfig Label string `json:"label"` SkipKeyring bool `json:"skipKeyring"` CreatedAtVersion string `json:"createdAtVersion"` }
CecConfig extends the default SdkConfig with custom parameters.
func CloneConfig ¶ added in v4.0.1
func DefaultCecConfig ¶ added in v4.1.0
func DefaultCecConfig() *CecConfig
DefaultCecConfig simply creates a new configuration struct.
type CellsConfigStore ¶ added in v4.1.0
type CellsConfigStore struct {
// contains filtered or unexported fields
}
CellsConfigStore implements a Cells Client specific ConfigRefresher, that also securely stores credentials: It wraps a keyring if such a tool is correctly configured and can be reached by the client.
func (*CellsConfigStore) RefreshIfRequired ¶ added in v4.1.0
func (store *CellsConfigStore) RefreshIfRequired(ctx context.Context, sdkConfig *cellsSdk.SdkConfig) (bool, error)
RefreshIfRequired retrieves latest config from the store and launches a refresh if necessary.
type ConfigList ¶
func GetConfigList ¶
func GetConfigList() (*ConfigList, error)
GetConfigList retrieves configuration stored in the config.json file.
func (*ConfigList) GetActiveConfig ¶
func (list *ConfigList) GetActiveConfig(ctx context.Context) (*CecConfig, error)
func (*ConfigList) GetStoredConfig ¶ added in v4.1.0
func (*ConfigList) Remove ¶
func (list *ConfigList) Remove(id string) error
Remove unregisters a config from the list of available configurations by its ID.
func (*ConfigList) SaveConfigFile ¶
func (list *ConfigList) SaveConfigFile() error
SaveConfigFile saves inside the config file.
func (*ConfigList) SetActiveConfig ¶
func (list *ConfigList) SetActiveConfig(id string) error
type CrawlNode ¶
type CrawlNode struct { IsLocal bool IsDir bool FullPath string RelPath string MTime time.Time Size int64 NewFileName string os.FileInfo models.TreeNode // contains filtered or unexported fields }
CrawlNode enables processing the scp command step by step.
func NewCrawler ¶
func NewLocalBaseNode ¶ added in v4.2.0
NewLocalBaseNode creates the base node for crawling in case of an upload.
func NewLocalNode ¶
NewLocalNode creates while crawling local tree before transfer.
func NewRemoteNode ¶
NewRemoteNode creates the base node for crawling in case of a download.
func (*CrawlNode) CreateFolders ¶ added in v4.2.0
func (c *CrawlNode) CreateFolders(_ context.Context, target *CrawlNode, dd []*CrawlNode, pool *BarsPool) error
CreateFolders prepares a recursive scp by first creating all necessary folders under the target root folder.
func (*CrawlNode) DeleteForMerge ¶ added in v4.2.0
DeleteForMerge first explicitly delete problematic targets before creating folders and transferring files.
type ReaderWithProgress ¶ added in v4.2.0
func (*ReaderWithProgress) CreateErrorChan ¶ added in v4.2.0
func (r *ReaderWithProgress) CreateErrorChan() (chan error, chan struct{})
type SdkClient ¶ added in v4.2.0
type SdkClient struct {
// contains filtered or unexported fields
}
SdkClient wraps the APi Client and exposes convenient methods to be called by implementing layers.
func NewSdkClient ¶ added in v4.2.0
NewSdkClient creates a new client based on the given config. TODO It has the responsibility to do the token refresh procedure when needed in case of OAuth credentials.
func (*SdkClient) ConfigureS3Logger ¶ added in v4.2.0
ConfigureS3Logger reset the current s3 client that is hold in the SDK client, adding a logger that is configured via the passed flags.
func (*SdkClient) CreateSimpleFolderLink ¶ added in v4.2.0
func (*SdkClient) DeleteNodes ¶ added in v4.2.0
func (*SdkClient) GetAllBulkMeta ¶ added in v4.2.0
func (*SdkClient) GetApiClient ¶ added in v4.2.0
func (client *SdkClient) GetApiClient() *client.PydioCellsRestAPI
GetApiClient simply exposes the Cells REST API client that is hold by the current SDKClient.
func (*SdkClient) GetBucketName ¶ added in v4.2.0
GetBucketName returns the default buck name to be used with the s3 client.
func (*SdkClient) GetCecConfig ¶ added in v4.2.0
GetCecConfig simply exposes the current CecConfig
func (*SdkClient) GetCurrentJobStatus ¶ added in v4.2.0
func (client *SdkClient) GetCurrentJobStatus(ctx context.Context, jobID string) (status models.JobsTaskStatus, msg string, pg float32, e error)
GetCurrentJobStatus retrieves the current task status, progress and message.
func (*SdkClient) GetFile ¶ added in v4.2.0
GetFile retrieves a file from the server in one big download (**no** multipart download for the time being).
func (*SdkClient) GetS3Client ¶ added in v4.2.0
GetS3Client simply exposes the S3 client that is hold by the current SDKClient.
func (*SdkClient) GetStore ¶ added in v4.2.0
func (client *SdkClient) GetStore() cellsSdk.ConfigRefresher
GetStore simply exposes the store that centralize credentials (and performs OAuth refresh).
func (*SdkClient) GetTaskStatusForJob ¶ added in v4.2.0
func (client *SdkClient) GetTaskStatusForJob(ctx context.Context, jobID string) (status models.JobsTaskStatus, msg string, pg float32, e error)
GetTaskStatusForJob retrieves the task status, progress and message.
func (*SdkClient) ListNodesPath ¶ added in v4.2.0
func (*SdkClient) MonitorJob ¶ added in v4.2.0
MonitorJob monitors a job status every second.
func (*SdkClient) PutFile ¶ added in v4.2.0
func (client *SdkClient) PutFile( ctx context.Context, pathToFile string, content io.ReadSeeker, checkExists bool, errChan ...chan error, ) (*s3.PutObjectOutput, error)
PutFile upload a local file to the server without using multipart upload.
func (*SdkClient) RunJob ¶ added in v4.2.0
func (client *SdkClient) RunJob(ctx context.Context, jobName string, jsonParams string) (string, error)
RunJob runs a job.
func (*SdkClient) Setup ¶ added in v4.2.0
Setup prepare the client after it has been created, especially refreshes the token in case of OAuth
type UpdatePackage ¶
type UpdatePackage struct { // Name of the application PackageName string `json:"PackageName,omitempty"` // Version of this new binary Version string `json:"Version,omitempty"` // Release date of the binary ReleaseDate int32 `json:"ReleaseDate,omitempty"` // Short human-readable description Label string `json:"Label,omitempty"` // Long human-readable description (markdown) Description string `json:"Description,omitempty"` // List or public URL of change logs ChangeLog string `json:"ChangeLog,omitempty"` // License of this package License string `json:"License,omitempty"` // Https URL where to download the binary BinaryURL string `json:"BinaryURL,omitempty"` // Checksum of the binary to verify its integrity BinaryChecksum string `json:"BinaryChecksum,omitempty"` // Signature of the binary BinarySignature string `json:"BinarySignature,omitempty"` // Hash type used for the signature BinaryHashType string `json:"BinaryHashType,omitempty"` // Size of the binary to download // BinarySize int64 `json:"BinarySize,omitempty"` BinarySize string `json:"BinarySize,omitempty"` // GOOS value used at build time BinaryOS string `json:"BinaryOS,omitempty"` // GOARCH value used at build time BinaryArch string `json:"BinaryArch,omitempty"` // Not used : if binary is a patch IsPatch bool `json:"IsPatch,omitempty"` // Not used : if a patch, how to patch (bsdiff support) PatchAlgorithm string `json:"PatchAlgorithm,omitempty"` }
func LoadUpdates ¶
func LoadUpdates(ctx context.Context, channel string) ([]*UpdatePackage, error)
type UpdateRequest ¶
type UpdateRequest struct { // Channel name. Channel string `json:"Channel,omitempty"` // PackageName is the technical name of the currently running application. PackageName string `json:"PackageName,omitempty"` // Current version of the application CurrentVersion string `json:"CurrentVersion,omitempty"` // Current GOOS GOOS string `json:"GOOS,omitempty"` // Current GOARCH GOARCH string `json:"GOARCH,omitempty"` // Not Used : specific service to get updates for ServiceName string `json:"ServiceName,omitempty"` // For enterprise version, info about the current license LicenseInfo map[string]string `json:"LicenseInfo,omitempty"` }
type UpdateResponse ¶
type UpdateResponse struct { Channel string `json:"Channel,omitempty"` // List of available binaries AvailableBinaries []*UpdatePackage `json:"AvailableBinaries,omitempty"` }