lib

package
v1.7.18 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: MIT Imports: 41 Imported by: 6

Documentation

Index

Constants

View Source
const (
	GroupTypeNormalCommand string = "\nCommands:\n"

	GroupTypeAdditionalCommand string = "\nAdditional Commands:\n"

	GroupTypeDeprecatedCommand string = "\nDeprecated Commands:\n"
)

group spec text of all commands

View Source
const (
	CREDSection string = "Credentials"

	BucketEndpointSection string = "Bucket-Endpoint"

	BucketCnameSection string = "Bucket-Cname"

	AkServiceSection string = "AkService"

	DefaultSection string = "Default"
)

sections in config file

View Source
const (
	OptionConfigFile          string = "configFile"
	OptionEndpoint                   = "endpoint"
	OptionAccessKeyID                = "accessKeyID"
	OptionAccessKeySecret            = "accessKeySecret"
	OptionSTSToken                   = "stsToken"
	OptionACL                        = "acl"
	OptionShortFormat                = "shortFormat"
	OptionLimitedNum                 = "limitedNum"
	OptionMarker                     = "marker"
	OptionUploadIDMarker             = "uploadIDMarker"
	OptionDirectory                  = "directory"
	OptionMultipart                  = "multipart"
	OptionAllType                    = "allType"
	OptionRecursion                  = "recursive"
	OptionBucket                     = "bucket"
	OptionStorageClass               = "storageClass"
	OptionForce                      = "force"
	OptionUpdate                     = "update"
	OptionDelete                     = "delete"
	OptionContinue                   = "continue"
	OptionOutputDir                  = "outputDir"
	OptionBigFileThreshold           = "bigfileThreshold"
	OptionCheckpointDir              = "checkpointDir"
	OptionSnapshotPath               = "snapshotPath"
	OptionRetryTimes                 = "retryTimes"
	OptionRoutines                   = "routines"
	OptionParallel                   = "parallel"
	OptionRange                      = "range"
	OptionEncodingType               = "encodingType"
	OptionLanguage                   = "language"
	OptionHashType                   = "hashType"
	OptionVersion                    = "version"
	OptionPartSize                   = "partSize"
	OptionDisableCRC64               = "disableCRC64"
	OptionTimeout                    = "timeout"
	OptionInclude                    = "include"
	OptionExclude                    = "exclude"
	OptionMeta                       = "meta"
	OptionRequestPayer               = "payer"
	OptionLogLevel                   = "loglevel"
	OptionMaxUpSpeed                 = "maxupspeed"
	OptionMaxDownSpeed               = "maxdownspeed"
	OptionUpload                     = "upload"
	OptionDownload                   = "download"
	OptionUrl                        = "url"
	OptionBucketName                 = "bucketname"
	OptionObject                     = "object"
	OptionAddr                       = "addr"
	OptionUpMode                     = "upmode"
	OptionDisableEmptyReferer        = "disableEmptyReferer"
	OptionMethod                     = "method"
	OptionOrigin                     = "origin"
	OptionPartitionDownload          = "partitionDownload"
	OptionSSEAlgorithm               = "SSEAlgorithm"
	OptionKMSMasterKeyID             = "KMSMasterKeyID"
	OptionKMSDataEncryption          = "KMSDataEncryption"
	OptionAcrHeaders                 = "acrHeaders"
	OptionAcrMethod                  = "acrMethod"
	OptionVersionId                  = "versionId"
	OptionAllversions                = "allVersions"
	OptionVersionIdMarker            = "versionIdMarker"
	OptionTrafficLimit               = "trafficLimit"
	OptionProxyHost                  = "proxyHost"
	OptionProxyUser                  = "proxyUser"
	OptionProxyPwd                   = "proxyPwd"
	OptionLocalHost                  = "localHost"
	OptionEnableSymlinkDir           = "enableSymlinkDir"
	OptionOnlyCurrentDir             = "onlyCurrentDir"
	OptionProbeItem                  = "probeItem"
	OptionDisableEncodeSlash         = "disableEncodeSlash"
	OptionDisableDirObject           = "disableDirObject"
	OptionRedundancyType             = "redundancyType"
	OptionDisableAllSymlink          = "disableAllSymlink"
	OptionDisableIgnoreError         = "disableIgnoreError"
	OptionTagging                    = "tagging"
	OptionStartTime                  = "startTime"
	OptionEndTime                    = "endTime"
	OptionBackupDir                  = "backupDir"
	OptionPassword                   = "password"
	OptionBlockSize                  = "blockSize"
	OptionMode                       = "mode"
	OptionECSRoleName                = "ecsRoleName"
	OptionTokenTimeout               = "tokenTimeout"
	OptionRamRoleArn                 = "ramRoleArn"
	OptionRoleSessionName            = "roleSessionName"
	OptionReadTimeout                = "readTimeOut"
	OptionConnectTimeout             = "connectTimeOut"
	OptionSTSRegion                  = "stsRegion"
	OptionSkipVerifyCert             = "skipVerifyCert"
	OptionItem                       = "item"
	OptionUserAgent                  = "userAgent"
	OptionObjectFile                 = "objectFile"
	OptionSignVersion                = "signVersion"
	OptionRegion                     = "region"
	OptionCloudBoxID                 = "cloudBoxID"
	OptionQueryParam                 = "queryParam"
	OptionForcePathStyle             = "forcePathStyle"
	OptionRuntime                    = "runtime"
)

all supported options of ossutil

View Source
const (
	StatName                   string = "Name"
	StatLocation                      = "Location"
	StatCreationDate                  = "CreationDate"
	StatExtranetEndpoint              = "ExtranetEndpoint"
	StatIntranetEndpoint              = "IntranetEndpoint"
	StatACL                           = "ACL"
	StatOwner                         = "Owner"
	StatLastModified                  = "Last-Modified"
	StatContentMD5                    = "Content-Md5"
	StatCRC64                         = "X-Oss-Hash-Crc64ecma"
	StatStorageClass                  = "StorageClass"
	StatSSEAlgorithm                  = "SSEAlgorithm"
	StatKMSMasterKeyID                = "KMSMasterKeyID"
	StatRedundancyType                = "RedundancyType"
	StatKMSDataEncryption             = "KMSDataEncryption"
	StatTransferAcceleration          = "TransferAcceleration"
	StatCrossRegionReplication        = "CrossRegionReplication"
	StatAccessMonitor                 = "AccessMonitor"
)

the elements show in stat object

View Source
const (
	HashCRC64      = "CRC64-ECMA"
	HashMD5        = "MD5"
	HashContentMD5 = "Content-MD5"
)

the elements show in hash file

View Source
const (
	Package                 string = "ossutil"
	ChannelBuf              int    = 1000
	Version                 string = "v1.7.18"
	DefaultEndpoint         string = "oss.aliyuncs.com"
	ChineseLanguage                = "CH"
	EnglishLanguage                = "EN"
	Scheme                  string = "oss"
	DefaultConfigFile              = "~" + string(os.PathSeparator) + ".ossutilconfig"
	MaxUint                 uint   = ^uint(0)
	MaxInt                  int    = int(MaxUint >> 1)
	MaxUint64               uint64 = ^uint64(0)
	MaxInt64                int64  = int64(MaxUint64 >> 1)
	ReportPrefix                   = "ossutil_report_"
	ReportSuffix                   = ".report"
	DefaultOutputDir               = "ossutil_output"
	CheckpointDir                  = ".ossutil_checkpoint"
	CheckpointSep                  = "---"
	SnapshotConnector              = "==>"
	SnapshotSep                    = "#"
	MaxPartNum                     = 10000
	MaxIdealPartNum                = MaxPartNum / 10
	MinIdealPartNum                = MaxPartNum / 500
	MaxIdealPartSize               = 524288000
	MinIdealPartSize               = 1048576
	DefaultBigFileThreshold int64  = 104857600
	MaxBigFileThreshold     int64  = MaxInt64
	MinBigFileThreshold     int64  = 0
	DefaultPartSize         int64  = -1
	MaxPartSize             int64  = MaxInt64
	MinPartSize             int64  = 1
	DefaultLimitedNum              = -1
	MinLimitedNum                  = 0
	RetryTimes              int    = 10
	MaxRetryTimes           int64  = 500
	MinRetryTimes           int64  = 1
	Routines                int    = 3
	MaxRoutines             int64  = 10000
	MinRoutines             int64  = 1
	MaxParallel             int64  = 10000
	MinParallel             int64  = 1
	DefaultHashType         string = "crc64"
	MD5HashType             string = "md5"
	LogFilePrefix                  = "ossutil_log_"
	URLEncodingType                = "url"
	StorageStandard                = string(oss.StorageStandard)
	StorageIA                      = string(oss.StorageIA)
	StorageArchive                 = string(oss.StorageArchive)
	StorageColdArchive             = string(oss.StorageColdArchive)
	DefaultStorageClass            = StorageStandard
	DefaultMethod                  = string(oss.HTTPGet)
	DefaultTimeout                 = 60
	MinTimeout                     = 0
	MaxTimeout                     = MaxInt64
	DefaultNonePattern             = ""
	IncludePrompt                  = "--include"
	ExcludePrompt                  = "--exclude"
	MaxAppendObjectSize     int64  = 5368709120
	MaxBatchCount           int    = 100
)

global public variable

View Source
const (
	FormatTAB         = "    "
	MaxCommandNameLen = 18
	UsageTextChinese  = "用法: ossutil [command] [args...] [options...]\n请使用ossutil help command来显示command命令的帮助"
	UsageTextEnglish  = "Usage: ossutil [command] [args...] [options...]\nPlease use 'ossutil help command' to show help of command"
)

global public variable for formating help text

View Source
const (
	OptionTypeString optionType = iota
	OptionTypeInt64
	OptionTypeFlagTrue
	OptionTypeAlternative
	OptionTypeStrings
)

option types, only support three kinds now

View Source
const (
	// StsSignVersion sts sign version
	StsSignVersion = "1.0"
	// StsAPIVersion sts api version
	StsAPIVersion = "2015-04-01"

	// TimeFormat time fomrat
	TimeFormat = "2006-01-02T15:04:05Z"
	// RespBodyFormat  respone body format
	RespBodyFormat = "JSON"
	// PercentEncode '/'
	PercentEncode = "%2F"
	// HTTPGet http get method
	HTTPGet = "GET"
)
View Source
const (
	AdvanceSeconds int64 = 60
)
View Source
const (
	ItemEcsAk string = "ecsAk"
)

config items in section AKSerivce

View Source
const (
	ItemRamRoleArn string = "ramRoleArn"
)

config items in section Credentials

View Source
const SchemePrefix string = "oss://"

SchemePrefix is the prefix of oss url

Variables

CommandGroups is the array of all group types

CredOptionList is all options in Credentials section

View Source
var CredOptionMap = map[string]configOption{
	OptionLanguage:        configOption{[]string{"language", "Language"}, false, true, "", ""},
	OptionEndpoint:        configOption{[]string{"endpoint", "host"}, true, true, "", ""},
	OptionAccessKeyID:     configOption{[]string{"accessKeyID", "accessKeyId", "AccessKeyID", "AccessKeyId", "access_key_id", "access_id", "accessid", "access-key-id", "access-id"}, true, false, "", ""},
	OptionAccessKeySecret: configOption{[]string{"accessKeySecret", "AccessKeySecret", "access_key_secret", "access_key", "accesskey", "access-key-secret", "access-key"}, true, false, "", ""},
	OptionSTSToken:        configOption{[]string{"stsToken", "ststoken", "STSToken", "sts_token", "sts-token"}, true, false, "", ""},
	OptionOutputDir:       configOption{[]string{"outputDir", "output-dir", "output_dir", "output_directory"}, false, true, "ossutil生成的文件的输出目录, ", "the directory to store files generated by ossutil, "},
	OptionMode:            configOption{[]string{"mode", "Mode"}, false, false, "", ""},
	OptionRamRoleArn:      configOption{[]string{"ramRoleArn", "RamRoleArn", "ramrolearn", "ram_role_arn", "ram-role-arn"}, false, false, "", ""},
	OptionRoleSessionName: configOption{[]string{"roleSessionName", "RoleSessionName", "rolesessionname", "role-session-name", "role_session_name"}, false, false, "", ""},
	OptionTokenTimeout:    configOption{[]string{"tokenTimeOut", "tokenTimeout", "tokentimeout", "token_timeout", "token-timeout"}, false, false, "", ""},
	OptionSTSRegion:       configOption{[]string{"stsRegion", "stsregion", "sts-region", "sts_region"}, false, false, "", ""},
	OptionECSRoleName:     configOption{[]string{"ecsRoleName", "EcsRoleName", "ecsrolename", "ecs-role-name", "ecs_role_name"}, false, false, "", ""},
}

CredOptionMap allows alias name for options in Credentials section name, allow to show in screen

View Source
var DefaultLanguage = getOsLang()
View Source
var DefaultOptionMap = map[string]configOption{
	OptionUserAgent:      configOption{[]string{"userAgent", "useragent", "user-agent", "user_agent"}, false, false, "", ""},
	OptionLogLevel:       configOption{[]string{"loglevel", "log-level", "log_level"}, false, false, "", ""},
	OptionProxyHost:      configOption{[]string{"proxyHost", "proxyhost", "proxy-host", "proxy_host"}, false, false, "", ""},
	OptionProxyUser:      configOption{[]string{"proxyUser", "proxyuser", "proxy-user", "proxy_user"}, false, false, "", ""},
	OptionProxyPwd:       configOption{[]string{"proxyPwd", "proxypwd", "proxy-pwd", "proxy_pwd"}, false, false, "", ""},
	OptionReadTimeout:    configOption{[]string{"readTimeOut", "readtimeout", "read-timeout", "read_timeout"}, false, false, "", ""},
	OptionConnectTimeout: configOption{[]string{"connectTimeOut", "connectTimeout", "connecttimeout", "connect-timeout", "connect_timeout"}, false, false, "", ""},
	OptionRetryTimes:     configOption{[]string{"retryTimes", "retrytimes", "retry-times", "retry_times"}, false, false, "", ""},
}

DefaultOptionMap allows alias name for options in default section name, allow to show in screen

View Source
var LEnglishLanguage = strings.ToLower(EnglishLanguage)

LEnglishLanguage is the lower case of EnglishLanguage

View Source
var MaxSyncNumbers int = 1000000
View Source
var OptionMap = map[string]Option{
	OptionConfigFile: Option{"-c", "--config-file", "", OptionTypeString, "", "",
		"ossutil工具的配置文件路径,ossutil启动时从配置文件读取配置,在config命令中,ossutil将配置写入该文件。",
		"Path of ossutil configuration file, where to dump config in config command, or to load config in other commands that need credentials."},
	OptionEndpoint: Option{"-e", "--endpoint", "", OptionTypeString, "", "",
		fmt.Sprintf("ossutil工具的基本endpoint配置(该选项值会覆盖配置文件中的相应设置),注意其必须为一个二级域名。"),
		fmt.Sprintf("Base endpoint for oss endpoint(Notice that the value of the option will cover the value in config file). Take notice that it should be second-level domain(SLD).")},
	OptionAccessKeyID:     Option{"-i", "--access-key-id", "", OptionTypeString, "", "", "访问oss使用的AccessKeyID(该选项值会覆盖配置文件中的相应设置)。", "AccessKeyID while access oss(Notice that the value of the option will cover the value in config file)."},
	OptionAccessKeySecret: Option{"-k", "--access-key-secret", "", OptionTypeString, "", "", "访问oss使用的AccessKeySecret(该选项值会覆盖配置文件中的相应设置)。", "AccessKeySecret while access oss(Notice that the value of the option will cover the value in config file)."},
	OptionSTSToken:        Option{"-t", "--sts-token", "", OptionTypeString, "", "", "访问oss使用的STSToken(该选项值会覆盖配置文件中的相应设置),非必须设置项。", "STSToken while access oss(Notice that the value of the option will cover the value in config file), not necessary."},
	OptionLimitedNum:      Option{"", "--limited-num", strconv.Itoa(DefaultLimitedNum), OptionTypeInt64, strconv.FormatInt(MinLimitedNum, 10), "", "返回结果的最大个数。", "the limited number of return results."},
	OptionMarker:          Option{"", "--marker", "", OptionTypeString, "", "", "列举Buckets时的marker,或列举objects或Multipart Uploads时的key marker, 或者其他有需要marker的地方。", "the marker of bucket when list buckets, or the marker of key when list object or Multipart Uploads, Or other places where a marker is needed"},
	OptionUploadIDMarker:  Option{"", "--upload-id-marker", "", OptionTypeString, "", "", "列举Multipart Uploads时的uploadID marker。", "the marker of object when list object or Multipart Uploads."},
	OptionACL:             Option{"", "--acl", "", OptionTypeString, "", "", "acl信息的配置。", "acl information."},
	OptionShortFormat:     Option{"-s", "--short-format", "", OptionTypeFlagTrue, "", "", "显示精简格式,如果未指定该选项,默认显示长格式。", "Show by short format, if the option is not specified, show long format by default."},
	OptionDirectory:       Option{"-d", "--directory", "", OptionTypeFlagTrue, "", "", "返回当前目录下的文件和子目录,而非递归显示所有子目录下的所有object。", "Return matching subdirectory names instead of contents of the subdirectory."},
	OptionMultipart:       Option{"-m", "--multipart", "", OptionTypeFlagTrue, "", "", "指定操作的对象为bucket中未完成的Multipart事件,而非默认情况下的object。", "Indicate that the subject of the command are uncompleted Multipart Uploads, instead of objects(which is the subject in default situation."},
	OptionAllType:         Option{"-a", "--all-type", "", OptionTypeFlagTrue, "", "", "指定操作的对象为bucket中的object和未完成的Multipart事件。", "Indicate that the subject of the command contains both objects and uncompleted Multipart Uploads."},
	OptionRecursion:       Option{"-r", "--recursive", "", OptionTypeFlagTrue, "", "", "递归进行操作。对于支持该选项的命令,当指定该选项时,命令会对bucket下所有符合条件的objects进行操作,否则只对url中指定的单个object进行操作。", "operate recursively, for those commands which support the option, when use them, if the option is specified, the command will operate on all match objects under the bucket, else we will search the specified object and operate on the single object."},
	OptionBucket:          Option{"-b", "--bucket", "", OptionTypeFlagTrue, "", "", "对bucket进行操作,该选项用于确认操作作用于bucket", "the option used to make sure the operation will operate on bucket"},
	OptionStorageClass: Option{"", "--storage-class", DefaultStorageClass, OptionTypeAlternative, fmt.Sprintf("%s/%s/%s/%s", StorageStandard, StorageIA, StorageArchive, StorageColdArchive), "",
		fmt.Sprintf("设置对象的存储方式,默认值:%s,取值范围:%s/%s/%s/%s。", DefaultStorageClass, StorageStandard, StorageIA, StorageArchive, StorageColdArchive),
		fmt.Sprintf("set the storage class of bucket(default: %s), value range is: %s/%s/%s/%s.", DefaultStorageClass, StorageStandard, StorageIA, StorageArchive, StorageColdArchive)},
	OptionForce:  Option{"-f", "--force", "", OptionTypeFlagTrue, "", "", "强制操作,不进行询问提示。", "operate silently without asking user to confirm the operation."},
	OptionUpdate: Option{"-u", "--update", "", OptionTypeFlagTrue, "", "", "更新操作", "update"},
	OptionDelete: Option{"", "--delete", "", OptionTypeFlagTrue, "", "", "删除操作", "delete"},
	OptionOutputDir: Option{"", "--output-dir", DefaultOutputDir, OptionTypeString, "", "",
		fmt.Sprintf("指定输出文件所在的目录,输出文件目前包含:cp命令批量拷贝文件出错时所产生的report文件(关于report文件更多信息,请参考cp命令帮助)。默认值为:当前目录下的%s目录。", DefaultOutputDir),
		fmt.Sprintf("The option specify the directory to place output file in, output file contains: report file generated by cp command when error happens of batch copy operation(for more information about report file, see help of cp command). The default value of the option is: %s directory in current directory.", DefaultOutputDir)},
	OptionBigFileThreshold: Option{"", "--bigfile-threshold", strconv.FormatInt(DefaultBigFileThreshold, 10), OptionTypeInt64, strconv.FormatInt(MinBigFileThreshold, 10), strconv.FormatInt(MaxBigFileThreshold, 10),
		fmt.Sprintf("开启大文件断点续传的文件大小阈值,默认值:%dM,取值范围:%dB-%dB", DefaultBigFileThreshold/1048576, MinBigFileThreshold, MaxBigFileThreshold),
		fmt.Sprintf("the threshold of file size, the file size larger than the threshold will use resume upload or download(default: %d), value range is: %d-%d", DefaultBigFileThreshold, MinBigFileThreshold, MaxBigFileThreshold)},
	OptionPartSize: Option{"", "--part-size", strconv.FormatInt(DefaultPartSize, 10), OptionTypeInt64, strconv.FormatInt(MinPartSize, 10), strconv.FormatInt(MaxPartSize, 10),
		fmt.Sprintf("分片大小,单位为Byte,默认情况下ossutil根据文件大小自行计算合适的分片大小值。如果有特殊需求或者需要性能调优,可以设置该值,取值范围:%d-%d(Byte)", MinPartSize, MaxPartSize),
		fmt.Sprintf("Part size, the unit is: Byte, in default situation, ossutil will calculate the suitable part size according to file size. The option is useful when user has special needs or user need to performance tuning, the value range is: %d-%d(Byte)", MinPartSize, MaxPartSize)},
	OptionDisableCRC64: Option{"", "--disable-crc64", "", OptionTypeFlagTrue, "", "", "该选项关闭crc64,默认情况下,ossutil进行数据传输都打开crc64校验。", "Disable crc64, in default situation, ossutil open crc64 check when transmit data."},
	OptionCheckpointDir: Option{"", "--checkpoint-dir", CheckpointDir, OptionTypeString, "", "",
		fmt.Sprintf("checkpoint目录的路径(默认值为:%s),断点续传时,操作失败ossutil会自动创建该目录,并在该目录下记录checkpoint信息,操作成功会删除该目录。如果指定了该选项,请确保所指定的目录可以被删除。", CheckpointDir),
		fmt.Sprintf("Path of checkpoint directory(default:%s), the directory is used in resume upload or download, when operate failed, ossutil will create the directory automatically, and record the checkpoint information in the directory, when the operation is succeed, the directory will be removed, so when specify the option, please make sure the directory can be removed.", CheckpointDir)},
	OptionSnapshotPath: Option{"", "--snapshot-path", "", OptionTypeString, "", "",
		"该选项用于在某些场景下加速增量上传批量文件或者增量下载批量object。在cp上传文件或者下载object时使用该选项,ossutil在指定的目录下生成快照文件,记录文件上传或者object下载的快照信息,在下一次指定该选项上传或下载时,ossutil会读取指定目录下的快照信息进行增量上传或者下载。用户指定的snapshot目录必须为本地文件系统上的可写目录,若该目录不存在,ossutil会创建该文件用于记录快照信息,如果该目录已存在,ossutil会读取里面的快照信息,根据快照信息进行增量上传(只上传上次未成功上传的文件和本地进行过修改的文件)或者增量下载(只下载上次未成功下载的object和修改过的object),并更新快照信息。注意:该选项在本地记录了成功上传的文件的本地lastModifiedTime或者记录了下载object的lastModifiedTime,从而在下次上传或者下载时通过比较lastModifiedTime来决定是否跳过相同文件的上传或者跳过相同的object下载。当使用该选项上传时,请确保两次上传期间没有其他用户更改了oss上的对应object。当不满足该场景时,如果想要增量上传批量文件,请使用--update选项。ossutil不会主动删除snapshot-path下的快照信息,当用户确定快照信息无用时,请用户及时自行删除snapshot-path。",
		"This option is used to accelerate the incremental upload of batch files or download objects in certain scenarios. If you use the option when upload files or download objects, ossutil will generate files to record the snapshot information in the specified directory. When the next time you upload files or download objects with the option, ossutil will read the snapshot information under the specified directory for incremental upload or incremental download. The snapshot-path you specified must be a local file system directory can be written in, if the directory does not exist, ossutil creates the files for recording snapshot information, else ossutil will read snapshot information from the path for incremental upload(ossutil will only upload the files which haven't not been successfully uploaded to oss or been locally modified) or incremental download(ossutil will only download the objects which have not been successfully downloaded or have been modified), and update the snapshot information to the directory. Note: The option record the lastModifiedTime of local files which have been successfully uploaded in local file system or lastModifiedTime of objects which have been successfully downloaded, and compare the lastModifiedTime of local files or objects in the next cp to decided whether to skip the file or object. If you use the option to achieve incremental upload, please make sure no other user modified the corresponding object in oss during the two uploads. If you can not guarantee the scenarios, please use --update option to achieve incremental upload. In addition, ossutil does not automatically delete snapshot-path snapshot information, in order to avoid too much snapshot information, when the snapshot information is useless, please clean up your own snapshot-path on your own immediately."},
	OptionRetryTimes: Option{"", "--retry-times", strconv.Itoa(RetryTimes), OptionTypeInt64, strconv.FormatInt(MinRetryTimes, 10), strconv.FormatInt(MaxRetryTimes, 10),
		fmt.Sprintf("当错误发生时的重试次数,默认值:%d,取值范围:%d-%d", RetryTimes, MinRetryTimes, MaxRetryTimes),
		fmt.Sprintf("retry times when fail(default: %d), value range is: %d-%d", RetryTimes, MinRetryTimes, MaxRetryTimes)},
	OptionRoutines: Option{"-j", "--jobs", strconv.Itoa(Routines), OptionTypeInt64, strconv.FormatInt(MinRoutines, 10), strconv.FormatInt(MaxRoutines, 10),
		fmt.Sprintf("多文件操作时的并发任务数,默认值:%d,取值范围:%d-%d", Routines, MinRoutines, MaxRoutines),
		fmt.Sprintf("amount of concurrency tasks between multi-files(default: %d), value range is: %d-%d", Routines, MinRoutines, MaxRoutines)},
	OptionParallel: Option{"", "--parallel", "", OptionTypeInt64, strconv.FormatInt(MinParallel, 10), strconv.FormatInt(MaxParallel, 10),
		fmt.Sprintf("单文件内部操作的并发任务数,取值范围:%d-%d, 默认将由ossutil根据操作类型和文件大小自行决定。", MinRoutines, MaxRoutines),
		fmt.Sprintf("amount of concurrency tasks when work with a file, value range is: %d-%d, by default the value will be decided by ossutil intelligently.", MinRoutines, MaxRoutines)},
	OptionRange: Option{"", "--range", "", OptionTypeString, "", "", "下载文件时,指定文件下载的范围,格式为:3-9或3-或-9", "the range when download objects, the form is like: 3-9 or 3- or -9"},
	OptionEncodingType: Option{"", "--encoding-type", "", OptionTypeAlternative, URLEncodingType, "",
		fmt.Sprintf("输入或者输出的object名或文件名的编码方式,目前只支持url encode,即指定该选项时,取值范围为:%s,如果不指定该选项,则表示object名或文件名未经过编码。bucket名不支持url encode。注意,如果指定了该选项,则形如oss://bucket/object的cloud_url,输入形式为:oss://bucket/url_encode(object),其中oss://bucket/字符串不需要编码。", URLEncodingType),
		fmt.Sprintf("the encoding type of object name or file name that user inputs or outputs, currently ossutil only supports url encode, which means the value range of the option is: %s, if you do not specify the option, it means the object name or file name that user inputed or outputed was not encoded. bucket name does not support url encode. Note, if the option is specified, the cloud_url like: oss://bucket/object should be inputted as: oss://bucket/url_encode(object), the string: oss://bucket/ should not be url encoded.", URLEncodingType)},
	OptionInclude: Option{"", "--include", DefaultNonePattern, OptionTypeString, "", "",
		fmt.Sprintf("包含对象匹配模式,如:*.jpg"),
		fmt.Sprintf("Include Pattern of key, e.g., *.jpg")},
	OptionExclude: Option{"", "--exclude", DefaultNonePattern, OptionTypeString, "", "",
		fmt.Sprintf("不包含对象匹配模式,如:*.txt"),
		fmt.Sprintf("Exclude Pattern of key, e.g., *.txt")},
	OptionMeta: Option{"", "--meta", "", OptionTypeString, "", "",
		fmt.Sprintf("设置object的meta为[header:value#header:value...],如:Cache-Control:no-cache#Content-Encoding:gzip"),
		fmt.Sprintf("Set object meta as [header:value#header:value...], e.g., Cache-Control:no-cache#Content-Encoding:gzip")},
	OptionTimeout: Option{"", "--timeout", strconv.FormatInt(DefaultTimeout, 10), OptionTypeInt64, strconv.FormatInt(MinTimeout, 10), strconv.FormatInt(MaxTimeout, 10),
		fmt.Sprintf("签名url的超时时间,单位为秒,默认值为:%d,取值范围:%d-%d", DefaultTimeout, MinTimeout, MaxTimeout),
		fmt.Sprintf("time out of signurl, the unit is: s, default value is %d, the value range is: %d-%d", DefaultTimeout, MinTimeout, MaxTimeout)},
	OptionLanguage: Option{"-L", "--language", DefaultLanguage, OptionTypeAlternative, fmt.Sprintf("%s/%s", ChineseLanguage, EnglishLanguage), "",
		fmt.Sprintf("设置ossutil工具的语言,默认值:%s,取值范围:%s/%s,若设置成\"%s\",请确保您的系统编码为UTF-8。", DefaultLanguage, ChineseLanguage, EnglishLanguage, ChineseLanguage),
		fmt.Sprintf("set the language of ossutil(default: %s), value range is: %s/%s, if you set it to \"%s\", please make sure your system language is UTF-8.", DefaultLanguage, ChineseLanguage, EnglishLanguage, ChineseLanguage)},
	OptionHashType: Option{"", "--type", DefaultHashType, OptionTypeAlternative, fmt.Sprintf("%s/%s", DefaultHashType, MD5HashType), "", fmt.Sprintf("计算的类型, 默认值:%s, 取值范围: %s/%s", DefaultHashType, DefaultHashType, MD5HashType),
		fmt.Sprintf("hash type, Default: %s, value range is: %s/%s", DefaultHashType, DefaultHashType, MD5HashType)},
	OptionVersion:      Option{"-v", "--version", "", OptionTypeFlagTrue, "", "", fmt.Sprintf("显示ossutil的版本(%s)并退出。", Version), fmt.Sprintf("Show ossutil version (%s) and exit.", Version)},
	OptionRequestPayer: Option{"", "--payer", "", OptionTypeString, "", "", "请求的支付方式,如果为请求者付费模式,可以将该值设置成\"requester\"", "The payer of the request. You can set this value to \"requester\" if you want pay for requester"},
	OptionLogLevel: Option{"", "--loglevel", "", OptionTypeString, "", "",
		"日志级别,默认为空,表示不输出日志文件,可选值为:info|debug,info输出提示信息日志,debug输出详细信息日志(包括http请求和响应信息)",
		"log level,default is empty(no log file output),optional value is:info|debug,info will output information logs,debug will output detail logs(including http request and response logs)"},
	OptionMaxUpSpeed: Option{"", "--maxupspeed", "", OptionTypeInt64, "", "",
		"最大上传速度,单位:KB/s,缺省值为0(不受限制)",
		"max upload speed,the unit is:KB/s,default value is 0(unlimited)"},
	OptionMaxDownSpeed: Option{"", "--maxdownspeed", "", OptionTypeInt64, "", "",
		"最大下载速度,单位:KB/s,缺省值为0(不受限制)",
		"max download speed,the unit is:KB/s,default value is 0(unlimited)"},
	OptionUpload: Option{"", "--upload", "", OptionTypeFlagTrue, "", "",
		"表示上传到oss,主要在命令probe中使用",
		"specifies upload action to oss,primarily used in probe command"},
	OptionDownload: Option{"", "--download", "", OptionTypeFlagTrue, "", "",
		"表示从oss下载,主要在命令probe中使用",
		"specifies download action from oss,primarily used in probe command"},
	OptionUrl: Option{"", "--url", "", OptionTypeString, "", "",
		"表示一个url地址,主要在命令probe中使用",
		"specifies a url address,primarily used in probe command"},
	OptionBucketName: Option{"", "--bucketname", "", OptionTypeString, "", "",
		"表示bucket的名称,主要在命令probe中使用",
		"specifies a name of bucket,primarily used in probe command"},
	OptionObject: Option{"", "--object", "", OptionTypeString, "", "",
		"表示oss中对象的名称,主要在命令probe中使用",
		"specifies a name of object,primarily used in probe command"},
	OptionAddr: Option{"", "--addr", "", OptionTypeString, "", "",
		"表示一个网络地址,通常为域名,主要在命令probe中使用",
		"specifies a network address,usually a domain,primarily used in probe command"},
	OptionUpMode: Option{"", "--upmode", "", OptionTypeString, "", "",
		"表示上传模式,缺省值为normal,取值为:normal|append|multipart,分别表示正常上传、追加上传、分块上传,主要在命令probe中使用",
		"specifies the upload mode,default value is normal,optional value is:normal|append|multipart, which means normal upload、append upload and multipart upload,it is primarily used in probe command."},
	OptionDisableEmptyReferer: Option{"", "--disable-empty-referer", "", OptionTypeFlagTrue, "", "",
		"表示不允许referer字段为空,主要在referer命令中使用",
		"specifies that the referer field is not allowed to be empty,primarily used in referer command"},
	OptionMethod: Option{"", "--method", "", OptionTypeString, "", "",
		"表示命令的操作类型,取值为PUT、GET、DELETE、LIST等",
		"specifies the command's operation type. the values ​​are PUT, GET, DELETE, LIST, etc"},
	OptionOrigin: Option{"", "--origin", "", OptionTypeString, "", "",
		"表示http请求头origin字段的值",
		"specifies the value of origin field in http header"},
	OptionPartitionDownload: Option{"", "--partition-download", "", OptionTypeString, "", "",
		"分区下载使用,一个ossutil命令下载一个分区,其值格式为\"分区编号:总分区数\",比如1:5,表示当前ossutil下载分区1,总共有5个分区;分区号从1开始编号,objects的分区规则由工具内部算法决定;利用该选项,待下载的objects分成多个区,可以由多个ossutil命令一起下载完成,每个ossutil命令下载各自的分区,多个ossutil命令可以并行在不同机器上执行",
		"the option is used in partition download mode, one command to download one partition,the value format is \"partition number:total count of partitions\",such as 1:5, indicating that the command downloads partition 1,total partition count is 5; the partition number is numbered from 1, and the partitioning rules for objects are determined by ossutil; with this option, the objects to be downloaded are divided into multiple partitions, which can be downloaded by multiple ossutil commands,each ossutil command can download its own partition,multiple ossutil commands can be executed on different machines in parallel."},
	OptionSSEAlgorithm: Option{"", "--sse-algorithm", "", OptionTypeString, "", "",
		"表示服务端加密算法,取值为KMS或者AES256",
		"specifies the server side encryption algorithm,value is KMS or AES256."},
	OptionKMSMasterKeyID: Option{"", "--kms-masterkey-id", "", OptionTypeString, "", "",
		"表示kms秘钥托管服务中的主秘钥id",
		"specifies the primary key id in the kms(key management service)"},
	OptionKMSDataEncryption: Option{"", "--kms-data-encryption", "", OptionTypeString, "", "",
		"表示kms秘钥托管服务使用的加密算法,目前取值仅支持为SM4, 或者为空",
		"specifies the kms data service encryption algorithm,Currently only supports the value SM4 or emtpy"},
	OptionAcrHeaders: Option{"", "--acr-headers", "", OptionTypeString, "", "",
		"表示http header Access-Control-Request-Headers的值,主要用于cors-options命令",
		"specifies the value of the http header Access-Control-Request-Headers, primarily used in cors-options command."},
	OptionAcrMethod: Option{"", "--acr-method", "", OptionTypeString, "", "",
		"表示http header Access-Control-Request-Method的值,主要用于cors-options命令",
		"specifies the value of the http header Access-Control-Request-Method,primarily used in cors-options command."},
	OptionVersionId: Option{"", "--version-id", "", OptionTypeString, "", "",
		"表示object的版本id",
		"specifies the object's version id"},
	OptionAllversions: Option{"", "--all-versions", "", OptionTypeFlagTrue, "", "",
		"表示object所有版本",
		"specifies the object's all versions"},
	OptionVersionIdMarker: Option{"", "--version-id-marker", "", OptionTypeString, "", "",
		"表示列举objects所有版本的version id marker",
		"specifies the marker of object version id when list objects's all versions"},
	OptionTrafficLimit: Option{"", "--trafic-limit", "", OptionTypeInt64, "", "",
		"http请求限速,单位:bit/s,缺省值为0(不受限制),用于sign命令",
		"http request speed limit,the unit is:bit/s,default value is 0(unlimited),primarily used in sign command"},
	OptionProxyHost: Option{"", "--proxy-host", "", OptionTypeString, "", "",
		"网络代理服务器的url地址,支持http/https/socks5,比如 https://120.79.128.211:3128, socks5://120.79.128.211:1080",
		"url of network proxy server, which supports http/https/socks5, such as https://120.79.128.211:3128, socks5://120.79.128.211:1080"},
	OptionProxyUser: Option{"", "--proxy-user", "", OptionTypeString, "", "",
		"网络代理服务器的用户名,默认为空",
		"username of network proxy, default is empty"},
	OptionProxyPwd: Option{"", "--proxy-pwd", "", OptionTypeString, "", "",
		"网络代理服务器的密码,默认为空",
		"password of network proxy, default is empty"},
	OptionLocalHost: Option{"", "--local-host", "", OptionTypeString, "", "",
		"工具的ip地址,比如 127.0.0.1",
		"ossutil's ip ,such as 127.0.0.1"},
	OptionEnableSymlinkDir: Option{"", "--enable-symlink-dir", "", OptionTypeFlagTrue, "", "",
		"表示允许上传链接子目录下的文件,默认不上传; probe命令可以探测是否存在死循环链接文件或者目录",
		"specifies uploading link subdirectories,default are not uploaded; The probe command can detect whether there is a dead cycle symlink file or directory."},
	OptionOnlyCurrentDir: Option{"", "--only-current-dir", "", OptionTypeFlagTrue, "", "",
		"表示仅操作当前目录下的文件或者object, 忽略子目录",
		"specifies that only files or objects in the current directory are manipulated, and subdirectories are ignored."},
	OptionProbeItem: Option{"", "--probe-item", "", OptionTypeString, "", "",
		"表示probe命令的探测项目, 取值可为upload-speed, download-speed, cycle-symlink",
		"specifies probe command's probe item, the value can be upload-speed, download-speed, cycle-symlink"},
	OptionDisableEncodeSlash: Option{"", "--disable-encode-slash", "", OptionTypeFlagTrue, "", "",
		"表示不对url path中的'/'进行编码, 主要用于sign命令",
		"specifies no encoding of '/' in url path section, primarily used in sign command"},
	OptionDisableDirObject: Option{"", "--disable-dir-object", "", OptionTypeFlagTrue, "", "",
		"表示上传文件时不为目录生成oss对象,主要用于cp命令",
		"specifies that oss object is not generated for directory itself when uploading, primarily used in cp command"},
	OptionRedundancyType: Option{"", "--redundancy-type", "", OptionTypeString, "", "",
		"表示bucket的数据容灾类型, 取值可为LRS, ZRS. LRS为默认值,表示本地容灾, ZRS表示更高可用的同城多可用区容灾(3AZ)",
		"specifies bucket data redundancy type, the value can be LRS, ZRS. LRS is default value, specifies locally redundant storage; ZRS specifies higher availability of redundant storage"},
	OptionDisableAllSymlink: Option{"", "--disable-all-symlink", "", OptionTypeFlagTrue, "", "",
		"表示不允许上传目录下的链接文件以及链接目录, 缺省值为false",
		"specifies that uploading of symlink files and symlink directories under the directory is not allowed, the default value is false."},
	OptionDisableIgnoreError: Option{"", "--disable-ignore-error", "", OptionTypeFlagTrue, "", "",
		"批量操作时候不忽略错误, 缺省值为false",
		"specifies that do not ignore errors during batch cp, default value is false"},
	OptionTagging: Option{"", "--tagging", "", OptionTypeString, "", "",
		"设置object的tagging,取值格式如[\"TagA=A&TagB=B...\"]",
		"Set object tagging, value format is [\"TagA=A&TagB=B...]\""},
	OptionStartTime: Option{"", "--start-time", "", OptionTypeInt64, "", "",
		"起始时间,为linux/Unix系统里面的时间戳,既从1970年1月1日(UTC/GMT的午夜)开始所经过的秒数",
		"The start time is the timestamp in the Linux/Unix system, that is, the number of seconds that have passed since January 1, 1970 (midnight UTC/GMT)"},
	OptionEndTime: Option{"", "--end-time", "", OptionTypeInt64, "", "",
		"结束时间,为linux/Unix系统里面的时间戳,既从1970年1月1日(UTC/GMT的午夜)开始所经过的秒数",
		"The end time is the timestamp in the Linux/Unix system, that is, the number of seconds that have passed since January 1, 1970 (midnight UTC/GMT)"},
	OptionBackupDir: Option{"", "--backup-dir", "", OptionTypeString, "", "",
		"sync命令使用的备份文件的目录",
		"The directory of the backup file used by the sync command"},
	OptionPassword: Option{"-p", "--password", "", OptionTypeFlagTrue, "", "",
		"表示从键盘输入accessKeySecret参数",
		"specifies that the accessKeySecret is inputted from the keyboard"},
	OptionBlockSize: Option{"-B", "--block-size", "", OptionTypeString, "", "",
		"表示du命令字节显示的单位,取值可以为KB, MB, GB, TB",
		"specifies the unit of byte display for du command, the value can be KB, MB, GB, TB"},
	OptionMode: Option{"", "--mode", "", OptionTypeString, "", "",
		"表示鉴权模式,取值可以为AK,StsToken,RamRoleArn,EcsRamRole,缺省值为空",
		"specifies the authentication mode, the value can be AK,StsToken,RamRoleArn,EcsRamRole, default value is empty."},
	OptionECSRoleName: Option{"", "--ecs-role-name", "", OptionTypeString, "", "",
		"表示角色名,主要用于EcsRamRole模式",
		"specifies the authentication mode, primarily used in EcsRamRole mode."},
	OptionTokenTimeout: Option{"", "--token-timeout", "", OptionTypeInt64, "", "",
		"表示token的有效时间,单位为秒, 缺省值为3600,主要用于RamRoleArn模式下的AssumeRole参数",
		"specifies the valid time of a token, the unit is: s, default value is 3600, primarily used for AssumeRole parameters in RamRoleArn mode"},
	OptionRamRoleArn: Option{"", "--ram-role-arn", "", OptionTypeString, "", "",
		"表示RAM角色的ARN,主要用于RamRoleArn模式",
		"specifies the ARN of ram role, primarily used in RamRoleArn mode."},
	OptionRoleSessionName: Option{"", "--role-session-name", "", OptionTypeString, "", "",
		"表示会话名字,主要用于RamRoleArn模式",
		"specifies the session name, primarily used in RamRoleArn mode."},
	OptionReadTimeout: Option{"", "--read-timeout", "", OptionTypeInt64, "", "",
		"表示客户端读超时的时间,单位为秒, 缺省值为1200",
		"specifies the time that the client read timed out, the unit is: s, default value is 1200."},
	OptionConnectTimeout: Option{"", "--connect-timeout", "", OptionTypeInt64, "", "",
		"表示客户端连接超时的时间,单位为秒, 缺省值为120",
		"specifies the time that the client connection timed out, the unit is: s, default value is 120."},
	OptionSTSRegion: Option{"", "--sts-region", "", OptionTypeString, "", "",
		"指定sts endpoint的地区,比如cn-shenzhen,其中,cn指代的是国家,shenzhen指代的是地区,用于构造sts endpoint,该选项缺省时,sts endpoint为sts.aliyuncs.com,主要用于RamRoleArn模式",
		"specifies the region of sts endpoint, such as cn-shenzhen, in this case, cn refers to the country and shenzhen refers to the region, to construct sts endpoint, when this option defaults, the sts endpoint is sts.aliyuncs.com, primarily used in RamRoleArn mode."},
	OptionSkipVerifyCert: Option{"", "--skip-verify-cert", "", OptionTypeFlagTrue, "", "",
		"表示不校验服务端的数字证书",
		"specifies that the oss server's digital certificate file will not be verified"},
	OptionItem: Option{"", "--item", "", OptionTypeString, "", "",
		"表示命令的功能类型,取值为LOCATION、PROGRESS等",
		"specifies the command's function type. the values are LOCATION, PROGRESS, etc"},
	OptionUserAgent: Option{"", "--ua", "", OptionTypeString, "", "",
		"指定http请求中的user agent, 会在缺省值后面加上指定值",
		"Specify the user agent in the http request, and the specified value will be added after the default value"},
	OptionObjectFile: Option{"", "--object-file", "", OptionTypeString, "", "",
		"表示所有待处理的objects,取值为一个存在的文件路径",
		"Specify all the objects that need to be operated, and the specified value should be a exists file path"},
	OptionSignVersion: Option{"", "--sign-version", "", OptionTypeString, "", "",
		"http请求使用的签名算法版本, 缺省为空, 表示v1版本",
		"The version of the signature algorithm used in the HTTP request. It is empty by default, indicating the V1 version"},
	OptionRegion: Option{"", "--region", "", OptionTypeString, "", "",
		"bucket所在的地区, 比如cn-hangzhou, 缺省值为空, 如果使用v4签名则必须传入",
		"The region where the bucket is located, such as cn-hangzhou. The default value is empty. If V4 signature is used, it must be inputted"},
	OptionCloudBoxID: Option{"", "--cloudbox-id", "", OptionTypeString, "", "",
		"云盒的id,缺省值为空,适用于云盒场景",
		"The ID of the cloud box. The default value is empty. It is applicable to cloud box scenarios"},
	OptionQueryParam: Option{"", "--query-param", "", OptionTypeStrings, "", "",
		"设置请求的query参数",
		"Set the query parameters for the request"},
	OptionForcePathStyle: Option{"", "--force-path-style", "", OptionTypeFlagTrue, "", "",
		"使用 path style 访问方式",
		"Use path-style access "},
	OptionRuntime: Option{"", "--runtime", "", OptionTypeInt64, "", "",
		"设置命令的持续的运行时间",
		"specifies the max running time of the command."},
}

OptionMap is a collection of ossutil supported options

View Source
var StsHost = "https://sts.aliyuncs.com/"

StsHost sts host

Functions

func AddStringsToOption added in v1.7.15

func AddStringsToOption(params []string, options []oss.Option) ([]oss.Option, error)

AddStringsToOption add strings option to oss option

func CloudURLToString

func CloudURLToString(bucket string, object string) string

CloudURLToString format url string from input

func DecideConfigFile

func DecideConfigFile(configFile string) string

DecideConfigFile return the config file, if user not specified, return default one

func FindPos

func FindPos(elem string, elemArray []string) int

FindPos find the elem position in a string array

func FindPosCaseInsen

func FindPosCaseInsen(elem string, elemArray []string) int

FindPosCaseInsen find the elem position in a string array, ignore case

func GetAllCommands

func GetAllCommands() []interface{}

GetAllCommands returns all commands list

func GetBool

func GetBool(name string, options OptionMapType) (bool, error)

GetBool is used to get bool option from option map parsed by ParseArgOptions

func GetInt

func GetInt(name string, options OptionMapType) (int64, error)

GetInt is used to get int option from option map parsed by ParseArgOptions

func GetPassword added in v1.7.7

func GetPassword(prompt string) ([]byte, error)

func GetString

func GetString(name string, options OptionMapType) (string, error)

GetString is used to get string option from option map parsed by ParseArgOptions

func GetStrings added in v1.7.15

func GetStrings(name string, options OptionMapType) ([]string, error)

GetStrings is used to get slice option from option map parsed by ParseArgOptions

func InitLogger

func InitLogger(level int, name string)

func LogDebug

func LogDebug(format string, a ...interface{})

func LogEnd

func LogEnd(startT time.Time)

func LogError

func LogError(format string, a ...interface{})

func LogInfo

func LogInfo(format string, a ...interface{})

func LogWarn

func LogWarn(format string, a ...interface{})

func Output

func Output(str string)

Output print input string to stdout and add '\n'

func ParseAndRunCommand

func ParseAndRunCommand() error

ParseAndRunCommand parse command line user input, get command and options, then run command

func RunCommand

func RunCommand(args []string, options OptionMapType) (bool, error)

func UnInitLogger

func UnInitLogger()

Types

type AllPartSizeCommand added in v1.6.0

type AllPartSizeCommand struct {
	// contains filtered or unexported fields
}

func (*AllPartSizeCommand) GetAllStatInfo added in v1.6.0

func (apc *AllPartSizeCommand) GetAllStatInfo() error

func (*AllPartSizeCommand) GetObjectPartsSize added in v1.6.0

func (apc *AllPartSizeCommand) GetObjectPartsSize(bucket *oss.Bucket, statInfo StatPartInfo) (int64, int64, error)

func (*AllPartSizeCommand) Init added in v1.6.0

func (apc *AllPartSizeCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*AllPartSizeCommand) RunCommand added in v1.6.0

func (apc *AllPartSizeCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type AppendFileCommand added in v1.6.0

type AppendFileCommand struct {
	// contains filtered or unexported fields
}

func (*AppendFileCommand) AppendFromFile added in v1.6.0

func (afc *AppendFileCommand) AppendFromFile(bucket *oss.Bucket, position int64) error

func (*AppendFileCommand) Init added in v1.6.0

func (afc *AppendFileCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*AppendFileCommand) RunCommand added in v1.6.0

func (afc *AppendFileCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type AppendProgressListener added in v1.6.0

type AppendProgressListener struct {
	// contains filtered or unexported fields
}

func (*AppendProgressListener) ProgressChanged added in v1.6.0

func (l *AppendProgressListener) ProgressChanged(event *oss.ProgressEvent)

ProgressChanged handle progress event

type AssumedRoleUser added in v1.7.7

type AssumedRoleUser struct {
	Arn           string
	AssumedRoleId string
}

AssumedRoleUser the user to AssumedRole

type AverageInfo added in v1.6.9

type AverageInfo struct {
	Parallel int
	AveSpeed float64
}

type BucketAccessMonitorCommand added in v1.7.15

type BucketAccessMonitorCommand struct {
	// contains filtered or unexported fields
}

func (*BucketAccessMonitorCommand) GetBucketAccessMonitor added in v1.7.15

func (blc *BucketAccessMonitorCommand) GetBucketAccessMonitor() error

func (*BucketAccessMonitorCommand) Init added in v1.7.15

func (blc *BucketAccessMonitorCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*BucketAccessMonitorCommand) PutBucketAccessMonitor added in v1.7.15

func (blc *BucketAccessMonitorCommand) PutBucketAccessMonitor() error

func (*BucketAccessMonitorCommand) RunCommand added in v1.7.15

func (blc *BucketAccessMonitorCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type BucketCnameCommand added in v1.7.7

type BucketCnameCommand struct {
	// contains filtered or unexported fields
}

func (*BucketCnameCommand) DeleteBucketCname added in v1.7.13

func (bwc *BucketCnameCommand) DeleteBucketCname() error

func (*BucketCnameCommand) GetBucketCname added in v1.7.7

func (bwc *BucketCnameCommand) GetBucketCname() error

func (*BucketCnameCommand) GetBucketCnameToken added in v1.7.13

func (bwc *BucketCnameCommand) GetBucketCnameToken() error

func (*BucketCnameCommand) Init added in v1.7.7

func (bwc *BucketCnameCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*BucketCnameCommand) PutBucketCname added in v1.7.13

func (bwc *BucketCnameCommand) PutBucketCname() error

func (*BucketCnameCommand) PutBucketCnameToken added in v1.7.13

func (bwc *BucketCnameCommand) PutBucketCnameToken() error

func (*BucketCnameCommand) PutBucketCnameWithCertificate added in v1.7.16

func (bwc *BucketCnameCommand) PutBucketCnameWithCertificate() error

func (*BucketCnameCommand) RunCommand added in v1.7.7

func (bwc *BucketCnameCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type BucketEncryptionCommand added in v1.6.1

type BucketEncryptionCommand struct {
	// contains filtered or unexported fields
}

func (*BucketEncryptionCommand) DeleteBucketEncryption added in v1.6.1

func (bec *BucketEncryptionCommand) DeleteBucketEncryption() error

func (*BucketEncryptionCommand) GetBucketEncryption added in v1.6.1

func (bec *BucketEncryptionCommand) GetBucketEncryption() error

func (*BucketEncryptionCommand) Init added in v1.6.1

func (bec *BucketEncryptionCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*BucketEncryptionCommand) PutBucketEncryption added in v1.6.1

func (bec *BucketEncryptionCommand) PutBucketEncryption() error

func (*BucketEncryptionCommand) RunCommand added in v1.6.1

func (bec *BucketEncryptionCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type BucketError

type BucketError struct {
	// contains filtered or unexported fields
}

BucketError happens when access bucket error

func (BucketError) Error

func (e BucketError) Error() string

type BucketInventoryCommand added in v1.7.1

type BucketInventoryCommand struct {
	// contains filtered or unexported fields
}

func (*BucketInventoryCommand) DeleteBucketInventory added in v1.7.1

func (bic *BucketInventoryCommand) DeleteBucketInventory() error

func (*BucketInventoryCommand) GetBucketInventory added in v1.7.1

func (bic *BucketInventoryCommand) GetBucketInventory() error

func (*BucketInventoryCommand) Init added in v1.7.1

func (bic *BucketInventoryCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*BucketInventoryCommand) ListBucketInventory added in v1.7.1

func (bic *BucketInventoryCommand) ListBucketInventory() error

func (*BucketInventoryCommand) PutBucketInventory added in v1.7.1

func (bic *BucketInventoryCommand) PutBucketInventory() error

func (*BucketInventoryCommand) RunCommand added in v1.7.1

func (bic *BucketInventoryCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type BucketInventoryOptionType added in v1.7.1

type BucketInventoryOptionType struct {
	// contains filtered or unexported fields
}

type BucketLifeCycleCommand added in v1.6.3

type BucketLifeCycleCommand struct {
	// contains filtered or unexported fields
}

func (*BucketLifeCycleCommand) DeleteBucketLifecycle added in v1.6.3

func (blc *BucketLifeCycleCommand) DeleteBucketLifecycle() error

func (*BucketLifeCycleCommand) GetBucketLifecycle added in v1.6.3

func (blc *BucketLifeCycleCommand) GetBucketLifecycle() error

func (*BucketLifeCycleCommand) Init added in v1.6.3

func (blc *BucketLifeCycleCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*BucketLifeCycleCommand) PutBucketLifecycle added in v1.6.3

func (blc *BucketLifeCycleCommand) PutBucketLifecycle() error

func (*BucketLifeCycleCommand) RunCommand added in v1.6.3

func (blc *BucketLifeCycleCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type BucketLogCommand added in v1.6.0

type BucketLogCommand struct {
	// contains filtered or unexported fields
}

func (*BucketLogCommand) DeleteBucketLog added in v1.6.0

func (blc *BucketLogCommand) DeleteBucketLog() error

func (*BucketLogCommand) GetBucketLog added in v1.6.0

func (blc *BucketLogCommand) GetBucketLog() error

func (*BucketLogCommand) Init added in v1.6.0

func (blc *BucketLogCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*BucketLogCommand) PutBucketLog added in v1.6.0

func (blc *BucketLogCommand) PutBucketLog() error

func (*BucketLogCommand) RunCommand added in v1.6.0

func (blc *BucketLogCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type BucketPolicyCommand added in v1.6.6

type BucketPolicyCommand struct {
	// contains filtered or unexported fields
}

func (*BucketPolicyCommand) DeleteBucketPolicy added in v1.6.6

func (bpc *BucketPolicyCommand) DeleteBucketPolicy() error

func (*BucketPolicyCommand) GetBucketPolicy added in v1.6.6

func (bpc *BucketPolicyCommand) GetBucketPolicy() error

func (*BucketPolicyCommand) Init added in v1.6.6

func (bpc *BucketPolicyCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*BucketPolicyCommand) PutBucketPolicy added in v1.6.6

func (bpc *BucketPolicyCommand) PutBucketPolicy() error

func (*BucketPolicyCommand) RunCommand added in v1.6.6

func (bpc *BucketPolicyCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type BucketQosCommand added in v1.6.4

type BucketQosCommand struct {
	// contains filtered or unexported fields
}

func (*BucketQosCommand) DeleteBucketQos added in v1.6.4

func (bqc *BucketQosCommand) DeleteBucketQos() error

func (*BucketQosCommand) GetBucketQos added in v1.6.4

func (bqc *BucketQosCommand) GetBucketQos() error

func (*BucketQosCommand) Init added in v1.6.4

func (bqc *BucketQosCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*BucketQosCommand) PutBucketQos added in v1.6.4

func (bqc *BucketQosCommand) PutBucketQos() error

func (*BucketQosCommand) RunCommand added in v1.6.4

func (bqc *BucketQosCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type BucketRefererCommand added in v1.6.0

type BucketRefererCommand struct {
	// contains filtered or unexported fields
}

func (*BucketRefererCommand) DeleteBucketRefer added in v1.6.0

func (brc *BucketRefererCommand) DeleteBucketRefer() error

func (*BucketRefererCommand) GetBucketRefer added in v1.6.0

func (brc *BucketRefererCommand) GetBucketRefer() error

func (*BucketRefererCommand) Init added in v1.6.0

func (brc *BucketRefererCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*BucketRefererCommand) PutBucketRefer added in v1.6.0

func (brc *BucketRefererCommand) PutBucketRefer() error

func (*BucketRefererCommand) RunCommand added in v1.6.0

func (brc *BucketRefererCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type BucketResourceGroupCommand added in v1.7.16

type BucketResourceGroupCommand struct {
	// contains filtered or unexported fields
}

func (*BucketResourceGroupCommand) GetBucketResourceGroup added in v1.7.16

func (brgc *BucketResourceGroupCommand) GetBucketResourceGroup() error

func (*BucketResourceGroupCommand) Init added in v1.7.16

func (brgc *BucketResourceGroupCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*BucketResourceGroupCommand) PutBucketResourceGroup added in v1.7.16

func (brgc *BucketResourceGroupCommand) PutBucketResourceGroup() error

func (*BucketResourceGroupCommand) RunCommand added in v1.7.16

func (brgc *BucketResourceGroupCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type BucketStyleCommand added in v1.7.16

type BucketStyleCommand struct {
	// contains filtered or unexported fields
}

func (*BucketStyleCommand) DeleteBucketStyle added in v1.7.16

func (bsc *BucketStyleCommand) DeleteBucketStyle() error

func (*BucketStyleCommand) GetBucketStyle added in v1.7.16

func (bsc *BucketStyleCommand) GetBucketStyle() error

func (*BucketStyleCommand) Init added in v1.7.16

func (bsc *BucketStyleCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*BucketStyleCommand) ListBucketStyle added in v1.7.16

func (bsc *BucketStyleCommand) ListBucketStyle() error

func (*BucketStyleCommand) PutBucketStyle added in v1.7.16

func (bsc *BucketStyleCommand) PutBucketStyle() error

func (*BucketStyleCommand) RunCommand added in v1.7.16

func (bsc *BucketStyleCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type BucketStyleOptionType added in v1.7.16

type BucketStyleOptionType struct {
	// contains filtered or unexported fields
}

type BucketTagCommand added in v1.6.1

type BucketTagCommand struct {
	// contains filtered or unexported fields
}

func (*BucketTagCommand) DeleteBucketTag added in v1.6.1

func (btc *BucketTagCommand) DeleteBucketTag() error

func (*BucketTagCommand) GetBucketTag added in v1.6.1

func (btc *BucketTagCommand) GetBucketTag() error

func (*BucketTagCommand) Init added in v1.6.1

func (btc *BucketTagCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*BucketTagCommand) PutBucketTag added in v1.6.1

func (btc *BucketTagCommand) PutBucketTag() error

func (*BucketTagCommand) RunCommand added in v1.6.1

func (btc *BucketTagCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type BucketVersioningCommand added in v1.6.2

type BucketVersioningCommand struct {
	// contains filtered or unexported fields
}

func (*BucketVersioningCommand) GetBucketVersioning added in v1.6.2

func (bvc *BucketVersioningCommand) GetBucketVersioning() error

func (*BucketVersioningCommand) Init added in v1.6.2

func (bvc *BucketVersioningCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*BucketVersioningCommand) PutBucketVersioning added in v1.6.2

func (bvc *BucketVersioningCommand) PutBucketVersioning() error

func (*BucketVersioningCommand) RunCommand added in v1.6.2

func (bvc *BucketVersioningCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type BucketWebSiteCommand added in v1.6.3

type BucketWebSiteCommand struct {
	// contains filtered or unexported fields
}

func (*BucketWebSiteCommand) DeleteBucketWebsite added in v1.6.3

func (bwc *BucketWebSiteCommand) DeleteBucketWebsite() error

func (*BucketWebSiteCommand) GetBucketWebsite added in v1.6.3

func (bwc *BucketWebSiteCommand) GetBucketWebsite() error

func (*BucketWebSiteCommand) Init added in v1.6.3

func (bwc *BucketWebSiteCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*BucketWebSiteCommand) PutBucketWebsite added in v1.6.3

func (bwc *BucketWebSiteCommand) PutBucketWebsite() error

func (*BucketWebSiteCommand) RunCommand added in v1.6.3

func (bwc *BucketWebSiteCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type CPMonitor

type CPMonitor struct {
	// contains filtered or unexported fields
}

* Put same type variables together to make them 64bits alignment to avoid * atomic.AddInt64() panic * Please guarantee the alignment if you add new filed

type CPMonitorSnap

type CPMonitorSnap struct {
	// contains filtered or unexported fields
}

for cp

type CatCommand added in v1.6.0

type CatCommand struct {
	// contains filtered or unexported fields
}

func (*CatCommand) Init added in v1.6.0

func (catc *CatCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*CatCommand) RunCommand added in v1.6.0

func (catc *CatCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type Client added in v1.7.7

type Client struct {
	AccessKeyId     string
	AccessKeySecret string
	RoleArn         string
	SessionName     string
}

Client sts client

func NewClient added in v1.7.7

func NewClient(accessKeyId, accessKeySecret, roleArn, sessionName string) *Client

NewClient New STS Client

func (*Client) AssumeRole added in v1.7.7

func (c *Client) AssumeRole(tokenTimeout uint, stsEndPoint string) (*Response, error)

AssumeRole assume role

type CloudURL

type CloudURL struct {
	// contains filtered or unexported fields
}

CloudURL describes oss url

func CloudURLFromString

func CloudURLFromString(urlStr, encodingType string) (CloudURL, error)

CloudURLFromString get a oss url from url, if url is not a cloud url, return error

func GetCloudUrl added in v1.6.0

func GetCloudUrl(strlUrl, encodingType string) (*CloudURL, error)

func ObjectURLFromString

func ObjectURLFromString(urlStr, encodingType string) (CloudURL, error)

ObjectURLFromString get a oss url from url, if url is not a cloud url, return error

func (*CloudURL) Init

func (cu *CloudURL) Init(urlStr, encodingType string) error

Init is used to create a cloud url from a user input url

func (CloudURL) IsCloudURL

func (cu CloudURL) IsCloudURL() bool

IsCloudURL shows if the url is a cloud url

func (CloudURL) IsFileURL

func (cu CloudURL) IsFileURL() bool

IsFileURL shows if the url is a file url

func (CloudURL) ToString

func (cu CloudURL) ToString() string

ToString reconstruct url

type CloudURLType

type CloudURLType string
const (
	CloudURLNone    CloudURLType = "none"
	CloudURLService CloudURLType = "service"
	CloudURLBucket  CloudURLType = "bucket"
	CloudURLObject  CloudURLType = "object"
)

type Command

type Command struct {
	// contains filtered or unexported fields
}

Command contains all elements of a command, it's the base class of all commands

func (*Command) Init

func (cmd *Command) Init(args []string, options OptionMapType, cmder interface{}) error

Init is the common functions for all commands, they use Init to initialize itself

type CommandError

type CommandError struct {
	// contains filtered or unexported fields
}

CommandError happens when use command in invalid way

func (CommandError) Error

func (e CommandError) Error() string

type CommandManager

type CommandManager struct {
	// contains filtered or unexported fields
}

CommandManager is used to manager commands, such as build command map and run command

func (*CommandManager) Init

func (cm *CommandManager) Init()

Init build command map

func (*CommandManager) RunCommand

func (cm *CommandManager) RunCommand(commandName string, args []string, options OptionMapType) (bool, error)

RunCommand select command from command map, initialize command and run command

type Commander

type Commander interface {
	RunCommand() error
	Init(args []string, options OptionMapType) error
}

Commander is the interface of all commands

type ConfigCommand

type ConfigCommand struct {
	// contains filtered or unexported fields
}

ConfigCommand is the command config user's credentials information

func (*ConfigCommand) Init

func (cc *ConfigCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*ConfigCommand) RunCommand

func (cc *ConfigCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type CopyCommand

type CopyCommand struct {
	// contains filtered or unexported fields
}

CopyCommand is the command upload, download and copy objects

func (*CopyCommand) Init

func (cc *CopyCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*CopyCommand) RunCommand

func (cc *CopyCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type CopyError

type CopyError struct {
	// contains filtered or unexported fields
}

func (CopyError) Error

func (e CopyError) Error() string

type CorsCommand added in v1.6.0

type CorsCommand struct {
	// contains filtered or unexported fields
}

func (*CorsCommand) DeleteBucketCors added in v1.6.0

func (corsc *CorsCommand) DeleteBucketCors() error

func (*CorsCommand) GetBucketCors added in v1.6.0

func (corsc *CorsCommand) GetBucketCors() error

func (*CorsCommand) Init added in v1.6.0

func (corsc *CorsCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*CorsCommand) PutBucketCors added in v1.6.0

func (corsc *CorsCommand) PutBucketCors() error

func (*CorsCommand) RunCommand added in v1.6.0

func (corsc *CorsCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type CreateSymlinkCommand

type CreateSymlinkCommand struct {
	// contains filtered or unexported fields
}

CreateSymlinkCommand is the command list buckets or objects

func (*CreateSymlinkCommand) Init

func (cc *CreateSymlinkCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*CreateSymlinkCommand) RunCommand

func (cc *CreateSymlinkCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type Credentials added in v1.7.7

type Credentials struct {
	AccessKeyId     string
	AccessKeySecret string
	Expiration      time.Time
	SecurityToken   string
}

Credentials the credentials obtained by AssumedRole, used for the peration of Alibaba Cloud service.

type DuCommand added in v1.6.6

type DuCommand struct {
	// contains filtered or unexported fields
}

func (*DuCommand) GetAllPartSize added in v1.6.6

func (duc *DuCommand) GetAllPartSize(bucket *oss.Bucket) error

func (*DuCommand) Init added in v1.6.6

func (duc *DuCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*DuCommand) RunCommand added in v1.6.6

func (duc *DuCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type EcsRoleAK added in v1.6.4

type EcsRoleAK struct {
	AccessKeyId     string
	AccessKeySecret string
	SecurityToken   string
}

func (*EcsRoleAK) GetAccessKeyID added in v1.6.4

func (ecsRole *EcsRoleAK) GetAccessKeyID() string

func (*EcsRoleAK) GetAccessKeySecret added in v1.6.4

func (ecsRole *EcsRoleAK) GetAccessKeySecret() string

func (*EcsRoleAK) GetSecurityToken added in v1.6.4

func (ecsRole *EcsRoleAK) GetSecurityToken() string

type EcsRoleAKBuild added in v1.6.4

type EcsRoleAKBuild struct {
	HasGet bool

	AccessKeyId     string
	AccessKeySecret string
	SecurityToken   string
	Expiration      string
	LastUpDated     string
	// contains filtered or unexported fields
}

for ecs bind ram and get ak by ossutil automaticly

func (*EcsRoleAKBuild) GetCredentials added in v1.6.4

func (roleBuild *EcsRoleAKBuild) GetCredentials() oss.Credentials

func (*EcsRoleAKBuild) HttpReqAk added in v1.6.4

func (roleBuild *EcsRoleAKBuild) HttpReqAk() (STSAkJson, error)

func (*EcsRoleAKBuild) IsTimeOut added in v1.6.4

func (roleBuild *EcsRoleAKBuild) IsTimeOut() bool

type FileError

type FileError struct {
	// contains filtered or unexported fields
}

FileError happens when access file error

func (FileError) Error

func (e FileError) Error() string

type FileURL

type FileURL struct {
	// contains filtered or unexported fields
}

FileURL describes file url

func (*FileURL) Init

func (fu *FileURL) Init(urlStr, encodingType string) error

Init simulate inheritance, and polymorphism

func (FileURL) IsCloudURL

func (fu FileURL) IsCloudURL() bool

IsCloudURL simulate inheritance, and polymorphism

func (FileURL) IsFileURL

func (fu FileURL) IsFileURL() bool

IsFileURL simulate inheritance, and polymorphism

func (FileURL) ToString

func (fu FileURL) ToString() string

ToString simulate inheritance, and polymorphism

type FormatHelper

type FormatHelper interface {
	// contains filtered or unexported methods
}

FormatHelper is the interface for all commands to format spec information

type HashCommand

type HashCommand struct {
	// contains filtered or unexported fields
}

HashCommand is the command to get crc64/md5 of local file

func (*HashCommand) Init

func (hc *HashCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*HashCommand) RunCommand

func (hc *HashCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type HelpCommand

type HelpCommand struct {
	// contains filtered or unexported fields
}

HelpCommand is the command format help text

func (*HelpCommand) Init

func (hc *HelpCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*HelpCommand) RunCommand

func (hc *HelpCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type LcbCommand added in v1.7.12

type LcbCommand struct {
	// contains filtered or unexported fields
}

LcbCommand is the command list region buckets or objects

func (*LcbCommand) Init added in v1.7.12

func (lc *LcbCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*LcbCommand) RunCommand added in v1.7.12

func (lc *LcbCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type ListCommand

type ListCommand struct {
	// contains filtered or unexported fields
}

ListCommand is the command list buckets or objects

func (*ListCommand) Init

func (lc *ListCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*ListCommand) RunCommand

func (lc *ListCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type ListPartCommand added in v1.6.0

type ListPartCommand struct {
	// contains filtered or unexported fields
}

func (*ListPartCommand) Init added in v1.6.0

func (lpc *ListPartCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*ListPartCommand) ListPart added in v1.6.0

func (lpc *ListPartCommand) ListPart() error

func (*ListPartCommand) RunCommand added in v1.6.0

func (lpc *ListPartCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type LrbCommand added in v1.7.7

type LrbCommand struct {
	// contains filtered or unexported fields
}

LrbCommand is the command list region buckets or objects

func (*LrbCommand) Init added in v1.7.7

func (lc *LrbCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*LrbCommand) RunCommand added in v1.7.7

func (lc *LrbCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type MakeBucketCommand

type MakeBucketCommand struct {
	// contains filtered or unexported fields
}

MakeBucketCommand is the command create bucket

func (*MakeBucketCommand) Init

func (mc *MakeBucketCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*MakeBucketCommand) RunCommand

func (mc *MakeBucketCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type MkdirCommand added in v1.6.0

type MkdirCommand struct {
	// contains filtered or unexported fields
}

func (*MkdirCommand) Init added in v1.6.0

func (mkc *MkdirCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*MkdirCommand) MkBucketDir added in v1.6.0

func (mkc *MkdirCommand) MkBucketDir(dirUrl CloudURL) error

func (*MkdirCommand) RunCommand added in v1.6.0

func (mkc *MkdirCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type Monitor

type Monitor struct {
	// contains filtered or unexported fields
}

* Put same type variables together to make them 64bits alignment to avoid * atomic.AddInt64() panic * Please guarantee the alignment if you add new filed

type MonitorSnap

type MonitorSnap struct {
	// contains filtered or unexported fields
}

for normal object operation

type Monitorer

type Monitorer interface {
	// contains filtered or unexported methods
}

type MultiPartObject added in v1.6.6

type MultiPartObject struct {
	// contains filtered or unexported fields
}

type ObjectError

type ObjectError struct {
	// contains filtered or unexported fields
}

ObjectError happens when access object error

func (ObjectError) Error

func (e ObjectError) Error() string

type ObjectTagCommand added in v1.6.6

type ObjectTagCommand struct {
	// contains filtered or unexported fields
}

func (*ObjectTagCommand) BatchObjectTagging added in v1.6.6

func (otc *ObjectTagCommand) BatchObjectTagging(bucket *oss.Bucket, cloudURL CloudURL) error

func (*ObjectTagCommand) Init added in v1.6.6

func (otc *ObjectTagCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*ObjectTagCommand) RunCommand added in v1.6.6

func (otc *ObjectTagCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

func (*ObjectTagCommand) SingleObjectTagging added in v1.6.6

func (otc *ObjectTagCommand) SingleObjectTagging(bucket *oss.Bucket, objectName string) error

type Option

type Option struct {
	// contains filtered or unexported fields
}

Option describe the component of a option

type OptionMapType

type OptionMapType map[string]interface{}

OptionMapType is the type for ossutil got options

func LoadConfig

func LoadConfig(configFile string) (OptionMapType, error)

LoadConfig load the specified config file

func ParseArgOptions

func ParseArgOptions() ([]string, OptionMapType, error)

ParseArgOptions parse command line and returns args and options

type OptionsCommand added in v1.6.3

type OptionsCommand struct {
	// contains filtered or unexported fields
}

func (*OptionsCommand) Init added in v1.6.3

func (opsc *OptionsCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*OptionsCommand) RunCommand added in v1.6.3

func (opsc *OptionsCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type OssProgressListener

type OssProgressListener struct {
	// contains filtered or unexported fields
}

OssProgressListener progress listener

func (*OssProgressListener) ProgressChanged

func (l *OssProgressListener) ProgressChanged(event *oss.ProgressEvent)

ProgressChanged handle progress event

type OssResumeProgressListener added in v1.6.9

type OssResumeProgressListener struct {
	// contains filtered or unexported fields
}

OssProgressListener resume progress listener

func (*OssResumeProgressListener) ProgressChanged added in v1.6.9

func (l *OssResumeProgressListener) ProgressChanged(event *oss.ProgressEvent)

ProgressChanged handle resume progress event

type ProbeCommand

type ProbeCommand struct {
	// contains filtered or unexported fields
}

func (*ProbeCommand) CheckCycleSymlinkWithDeepTravel added in v1.6.9

func (pc *ProbeCommand) CheckCycleSymlinkWithDeepTravel() error

func (*ProbeCommand) DetectBandWidth added in v1.6.9

func (pc *ProbeCommand) DetectBandWidth() error

func (*ProbeCommand) DetectDownloadTime added in v1.7.18

func (pc *ProbeCommand) DetectDownloadTime() error

func (*ProbeCommand) GetObjectWithContext added in v1.7.18

func (pc *ProbeCommand) GetObjectWithContext(bucket *oss.Bucket, objectName string, st *StatBandWidth, ctx context.Context)

func (*ProbeCommand) Init

func (pc *ProbeCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*ProbeCommand) PutObjectWithContext added in v1.7.18

func (pc *ProbeCommand) PutObjectWithContext(bucket *oss.Bucket, st *StatBandWidth, reader io.Reader, ctx context.Context)

func (*ProbeCommand) RunCommand

func (pc *ProbeCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type RMMonitor

type RMMonitor struct {
	// contains filtered or unexported fields
}

* Put same type variables together to make them 64bits alignment to avoid * atomic.AddInt64() panic * Please guarantee the alignment if you add new filed

type RMMonitorSnap

type RMMonitorSnap struct {
	// contains filtered or unexported fields
}

For rm

type ReadSymlinkCommand

type ReadSymlinkCommand struct {
	// contains filtered or unexported fields
}

ReadSymlinkCommand is the command list buckets or objects

func (*ReadSymlinkCommand) Init

func (rc *ReadSymlinkCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*ReadSymlinkCommand) RunCommand

func (rc *ReadSymlinkCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type RemoveCommand

type RemoveCommand struct {
	// contains filtered or unexported fields
}

RemoveCommand is the command remove bucket or objects

func (*RemoveCommand) Init

func (rc *RemoveCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*RemoveCommand) RunCommand

func (rc *RemoveCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type ReplicationCommand added in v1.7.7

type ReplicationCommand struct {
	// contains filtered or unexported fields
}

func (*ReplicationCommand) DeleteBucketReplication added in v1.7.7

func (replicationc *ReplicationCommand) DeleteBucketReplication() error

func (*ReplicationCommand) GetBucketReplication added in v1.7.7

func (replicationc *ReplicationCommand) GetBucketReplication() error

func (*ReplicationCommand) GetBucketReplicationLocation added in v1.7.7

func (replicationc *ReplicationCommand) GetBucketReplicationLocation() error

func (*ReplicationCommand) GetBucketReplicationProgress added in v1.7.7

func (replicationc *ReplicationCommand) GetBucketReplicationProgress() error

func (*ReplicationCommand) Init added in v1.7.7

func (replicationc *ReplicationCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*ReplicationCommand) PutBucketRTC added in v1.7.16

func (replicationc *ReplicationCommand) PutBucketRTC() error

func (*ReplicationCommand) PutBucketReplication added in v1.7.7

func (replicationc *ReplicationCommand) PutBucketReplication() error

func (*ReplicationCommand) RunCommand added in v1.7.7

func (replicationc *ReplicationCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type Reporter

type Reporter struct {
	// contains filtered or unexported fields
}

func GetReporter

func GetReporter(need bool, outputDir, comment string) (*Reporter, error)

func (*Reporter) Clear

func (re *Reporter) Clear()

func (*Reporter) Comment

func (re *Reporter) Comment()

func (*Reporter) HasPrompt

func (re *Reporter) HasPrompt() bool

func (*Reporter) Init

func (re *Reporter) Init(outputDir, comment string) error

func (*Reporter) Prompt

func (re *Reporter) Prompt(err error)

func (*Reporter) ReportError

func (re *Reporter) ReportError(msg string)

type RequestPaymentCommand added in v1.6.6

type RequestPaymentCommand struct {
	// contains filtered or unexported fields
}

func (*RequestPaymentCommand) GetRequestPayment added in v1.6.6

func (reqpc *RequestPaymentCommand) GetRequestPayment() error

func (*RequestPaymentCommand) Init added in v1.6.6

func (reqpc *RequestPaymentCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*RequestPaymentCommand) PutRequestPayment added in v1.6.6

func (reqpc *RequestPaymentCommand) PutRequestPayment() error

func (*RequestPaymentCommand) RunCommand added in v1.6.6

func (reqpc *RequestPaymentCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type Response added in v1.7.7

type Response struct {
	Credentials     Credentials
	AssumedRoleUser AssumedRoleUser
	RequestId       string
}

Response the response of AssumeRole

type RestoreCommand

type RestoreCommand struct {
	// contains filtered or unexported fields
}

RestoreCommand is the command list buckets or objects

func (*RestoreCommand) Init

func (rc *RestoreCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*RestoreCommand) RunCommand

func (rc *RestoreCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type RevertCommand added in v1.7.1

type RevertCommand struct {
	// contains filtered or unexported fields
}

func (*RevertCommand) Init added in v1.7.1

func (revert *RevertCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*RevertCommand) RunCommand added in v1.7.1

func (revert *RevertCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type RewriteAssembleOptioner

type RewriteAssembleOptioner interface {
	// contains filtered or unexported methods
}

RewriteAssembleOptioner is the interface for those commands, which do not need to assemble options

type RewriteLoadConfiger

type RewriteLoadConfiger interface {
	// contains filtered or unexported methods
}

RewriteLoadConfiger is the interface for those commands, which do not need to load config, or have other action

type STSAkJson added in v1.6.4

type STSAkJson struct {
	AccessKeyId     string `json:"AccessKeyId,omitempty"`
	AccessKeySecret string `json:"AccessKeySecret,omitempty"`
	SecurityToken   string `json:"SecurityToken,omitempty"`
	Expiration      string `json:"Expiration,omitempty"`
	LastUpDated     string `json:"LastUpDated,omitempty"`
	Code            string `json:"Code,omitempty"`
}

func (*STSAkJson) String added in v1.6.4

func (stsJson *STSAkJson) String() string

type ServiceError added in v1.7.7

type ServiceError struct {
	Code       string
	Message    string
	RequestId  string
	HostId     string
	RawMessage string
	StatusCode int
}

ServiceError sts service error

func (*ServiceError) Error added in v1.7.7

func (e *ServiceError) Error() string

Error implement interface error

type SetACLCommand

type SetACLCommand struct {
	// contains filtered or unexported fields
}

SetACLCommand is the command set acl

func (*SetACLCommand) Init

func (sc *SetACLCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*SetACLCommand) RunCommand

func (sc *SetACLCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type SetMetaCommand

type SetMetaCommand struct {
	// contains filtered or unexported fields
}

SetMetaCommand is the command set meta for object

func (*SetMetaCommand) Init

func (sc *SetMetaCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*SetMetaCommand) RunCommand

func (sc *SetMetaCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type SignurlCommand

type SignurlCommand struct {
	// contains filtered or unexported fields
}

SignurlCommand definition

func (*SignurlCommand) Init

func (sc *SignurlCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*SignurlCommand) RunCommand

func (sc *SignurlCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type SpecText

type SpecText struct {
	// contains filtered or unexported fields
}

SpecText is the spec text of a command

type StatBandWidth added in v1.6.9

type StatBandWidth struct {
	Mu         sync.Mutex
	Parallel   int
	StartTick  int64
	TotalBytes int64
	MaxSpeed   float64
}

func (*StatBandWidth) AddBytes added in v1.6.9

func (s *StatBandWidth) AddBytes(bc int64)

func (*StatBandWidth) GetStat added in v1.6.9

func (s *StatBandWidth) GetStat() *StatBandWidth

func (*StatBandWidth) ProgressChanged added in v1.6.9

func (s *StatBandWidth) ProgressChanged(event *oss.ProgressEvent)

func (*StatBandWidth) Reset added in v1.6.9

func (s *StatBandWidth) Reset(pc int)

func (*StatBandWidth) SetMaxSpeed added in v1.6.9

func (s *StatBandWidth) SetMaxSpeed(ms float64)

type StatCommand

type StatCommand struct {
	// contains filtered or unexported fields
}

StatCommand is the command get bucket's or objects' meta information

func (*StatCommand) Init

func (sc *StatCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*StatCommand) RunCommand

func (sc *StatCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type StatPartInfo added in v1.6.0

type StatPartInfo struct {
	// contains filtered or unexported fields
}

type StorageURLer

type StorageURLer interface {
	IsCloudURL() bool
	IsFileURL() bool
	ToString() string
}

StorageURLer is the interface for all url

func StorageURLFromString

func StorageURLFromString(urlStr, encodingType string) (StorageURLer, error)

StorageURLFromString analysis input url type and build a storage url from the url

type SyncCommand added in v1.7.1

type SyncCommand struct {
	// contains filtered or unexported fields
}

SyncCommand is the command upload, download and copy objects

func (*SyncCommand) BatchRmObjects added in v1.7.1

func (sc *SyncCommand) BatchRmObjects(bucket *oss.Bucket, objects []string, options []oss.Option) error

func (*SyncCommand) CheckDestBackupDir added in v1.7.1

func (sc *SyncCommand) CheckDestBackupDir(sUrl StorageURLer) error

func (*SyncCommand) DeleteExtraObjects added in v1.7.1

func (sc *SyncCommand) DeleteExtraObjects(keys map[string]string, sUrl StorageURLer) error

func (*SyncCommand) GetAbsPath added in v1.7.1

func (sc *SyncCommand) GetAbsPath(strPath string) (string, error)

func (*SyncCommand) GetFileList added in v1.7.1

func (sc *SyncCommand) GetFileList(strPath string, chFiles chan<- fileInfoType, chFinish chan<- error)

func (*SyncCommand) GetLocalFileKeys added in v1.7.1

func (sc *SyncCommand) GetLocalFileKeys(sUrl StorageURLer, keys map[string]string) error

func (*SyncCommand) GetOssKeyList added in v1.7.1

func (sc *SyncCommand) GetOssKeyList(bucket *oss.Bucket, sURL StorageURLer, chObjects chan<- objectInfoType, chFinish chan<- error)

func (*SyncCommand) GetOssKeys added in v1.7.1

func (sc *SyncCommand) GetOssKeys(sUrl StorageURLer, keys map[string]string) error

func (*SyncCommand) Init added in v1.7.1

func (sc *SyncCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*SyncCommand) ReadLocalFileKeys added in v1.7.1

func (sc *SyncCommand) ReadLocalFileKeys(chFiles <-chan fileInfoType, chFinish chan<- error, keys map[string]string)

func (*SyncCommand) ReadOssKeys added in v1.7.1

func (sc *SyncCommand) ReadOssKeys(keys map[string]string, sURL StorageURLer, chObjects <-chan objectInfoType, chFinish chan<- error)

func (*SyncCommand) RemoveExtraFiles added in v1.7.1

func (sc *SyncCommand) RemoveExtraFiles(keys map[string]string, sUrl StorageURLer) error

func (*SyncCommand) RunCommand added in v1.7.1

func (sc *SyncCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type TestAppendReader added in v1.6.9

type TestAppendReader struct {
	RandText []byte
	// contains filtered or unexported fields
}

func (*TestAppendReader) Close added in v1.6.9

func (r *TestAppendReader) Close()

Read

func (*TestAppendReader) Read added in v1.6.9

func (r *TestAppendReader) Read(p []byte) (n int, err error)

Read

type UpdateCommand

type UpdateCommand struct {
	// contains filtered or unexported fields
}

UpdateCommand is the command update ossutil

func (*UpdateCommand) Init

func (uc *UpdateCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*UpdateCommand) RunCommand

func (uc *UpdateCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type UserQosCommand added in v1.6.4

type UserQosCommand struct {
	// contains filtered or unexported fields
}

func (*UserQosCommand) GetUserQos added in v1.6.4

func (uqc *UserQosCommand) GetUserQos() error

func (*UserQosCommand) Init added in v1.6.4

func (uqc *UserQosCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*UserQosCommand) RunCommand added in v1.6.4

func (uqc *UserQosCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

type WormCommand added in v1.7.1

type WormCommand struct {
	// contains filtered or unexported fields
}

func (*WormCommand) AbortBucketWorm added in v1.7.1

func (wormc *WormCommand) AbortBucketWorm() error

func (*WormCommand) CompleteBucketWorm added in v1.7.1

func (wormc *WormCommand) CompleteBucketWorm() error

func (*WormCommand) ExtendBucketWorm added in v1.7.1

func (wormc *WormCommand) ExtendBucketWorm() error

func (*WormCommand) GetBucketWorm added in v1.7.1

func (wormc *WormCommand) GetBucketWorm() error

func (*WormCommand) Init added in v1.7.1

func (wormc *WormCommand) Init(args []string, options OptionMapType) error

Init simulate inheritance, and polymorphism

func (*WormCommand) InitiateBucketWorm added in v1.7.1

func (wormc *WormCommand) InitiateBucketWorm() error

func (*WormCommand) RunCommand added in v1.7.1

func (wormc *WormCommand) RunCommand() error

RunCommand simulate inheritance, and polymorphism

Jump to

Keyboard shortcuts

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