Skip to content

Releases: tencentyun/coscli

v1.0.8

04 Feb 03:21
b2a8fff

Choose a tag to compare

修改内容:

1. cp 命令

  • 优化分块上传文件传输进度

2. sync 命令

  • 优化分块上传文件传输进度
  • 修复进程日志bug,当--process-log参数设置为false时,不再输出进程日志
  • 修复--snapshot-path 历史未使用此参数上传的文件不生成快照信息bug

3. ls 命令

修改参数:

  • --limit:当设置为-1时,可以拉取所有cos文件,不限制数量

4. signurl 命令

新增参数

  • --simple-output:启用简易输出模式,默认值为 false。当设置为 true 时,仅输出签名 URL,简化返回结果。

v1.0.7

10 Sep 09:47
997a2eb

Choose a tag to compare

一、新增命令

1. object-tagging 命令

功能:管理对象标签
​参数​​:

  • --method
    

    :操作类型(必选)

    • put:设置对象标签
    • add:添加对象标签
    • get:获取对象标签
    • delete:删除对象标签
  • --version-id:操作对象的特定版本

示例

# 设置对象标签
./coscli object-tagging --method put cos://examplebucket/exampleobject tag1#test1 tag2#test2

# 添加对象标签
./coscli object-tagging --method add cos://examplebucket/exampleobject tag3#test3

# 获取对象标签
./coscli object-tagging --method get cos://examplebucket/exampleobject

# 删除所有对象标签
./coscli object-tagging --method delete cos://examplebucket/exampleobject

# 删除指定对象标签
./coscli object-tagging --method delete cos://examplebucket/exampleobject tag1#test1 tag2#test2

2. object-acl 命令

功能:管理对象ACL
​参数​​:

  • --method
    

    :操作类型(必选)

    • put:设置对象ACL
    • get:获取对象ACL
  • --version-id:对象版本号

  • --acl:预设ACL(如 default, private, public-read)

  • --grant-read:赋予读取权限

  • --grant-read-acp:赋予读取ACL权限

  • --grant-write-acp:赋予写入ACL权限

  • --grant-full-control:赋予完全控制权限

示例

# 设置对象ACL
./coscli object-acl --method put cos://examplebucket/exampleobject --grant-read="id=\"100000000013\",id=\"100000000012\""

# 获取对象ACL
./coscli object-acl --method get cos://examplebucket/exampleobject

3. bucket-acl 命令

功能:管理存储桶ACL
​参数​​:

  • --method
    

    :操作类型(必选)

    • put:设置存储桶ACL
    • get:获取存储桶ACL
  • --acl:预设ACL(如 private, public-read)

  • --grant-read:赋予读取权限

  • --grant-write:赋予写入权限

  • --grant-read-acp:赋予读取ACL权限

  • --grant-write-acp:赋予写入ACL权限

  • --grant-full-control:赋予完全控制权限

示例

# 设置存储桶ACL
./coscli bucket-acl --method put cos://examplebucket --grant-read="id=\"100000000013\",id=\"100000000012\""

# 获取存储桶ACL
./coscli bucket-acl --method get cos://examplebucket

4. bucket-policy 命令

功能:管理存储桶策略
​参数​​:

  • --method
    

    :操作类型(必选)

    • put:设置存储桶策略
    • get:获取存储桶策略
    • delete:删除存储桶策略
  • --policy:存储桶策略(JSON格式或直接指定文件路径,如/data/policy.txt 需要指定为file:///data/policy.txt)

示例

# 设置存储桶策略
./coscli bucket-policy --method put cos://examplebucket --policy="{\"Statement\":[...]}"

# 获取存储桶策略
./coscli bucket-policy --method get cos://examplebucket

# 删除存储桶策略
./coscli bucket-policy --method delete cos://examplebucket

5. bucket-encryption 命令

功能:管理存储桶加密策略
​参数​​:

  • --method
    

    :操作类型(必选)

    • put:设置加密策略
    • get:获取加密策略
    • delete:删除加密策略
  • --sse-algorithm:加密算法(AES256, SM4, KMS)

  • --kms-master-key-id:KMS主密钥ID

  • --kms-algorithm:KMS加密算法(AES256, SM4)

示例

# 设置存储桶加密
./coscli bucket-encryption --method put cos://examplebucket --sse-algorithm AES256

# 获取存储桶加密策略
./coscli bucket-encryption --method get cos://examplebucket

# 删除存储桶加密策略
./coscli bucket-encryption --method delete cos://examplebucket

6. inventory 命令

功能:管理存储桶清单
​参数​​:

  • --method
    

    :操作类型(必选)

    • put:设置存储桶清单
    • get:获取存储桶清单
    • delete:删除存储桶清单
    • list:列出所有存储桶清单
    • post:发起一次性清单
  • --task-id:清单任务ID

  • --configuration:清单配置(JSON格式、XML格式或直接指定文件路径,如/data/configuration.txt 需要指定为file:///data/configuration.txt)

示例

# 设置存储桶清单
./coscli inventory --method put cos://test6 --task-id list4 --configuration "<InventoryConfiguration>...</InventoryConfiguration>"

# 获取存储桶清单
./coscli inventory --method get cos://test6 --task-id list4

# 删除存储桶清单
./coscli inventory --method delete cos://test6 --task-id list4

# 列出所有存储桶清单
./coscli inventory --method list cos://test6

# 发起一次性清单
./coscli inventory --method post cos://test6 --task-id list4 --configuration "<InventoryConfiguration>...</InventoryConfiguration>"

二、修改命令

1. 通用参数

新增参数

  • --disable-log:禁用coscli.log日志记录(默认false)
  • --bucket-type:指定桶类型(COS/OFS)

2. cp 命令

新增参数

  • --process-log:记录传输日志(默认true)
  • --process-log-path:指定传输日志路径(默认在执行当前路径下coscli_output下)
  • --skip-dir:跳过文件夹上传(等sdk 修复)
  • --acl:对象ACL属性
  • --grant-read:赋予读取权限
  • --grant-read-acp:赋予读取ACL权限
  • --grant-write-acp:赋予写入ACL权限
  • --grant-full-control:赋予完全控制权限
  • --tags:对象标签集合,最多可设置10个标签(例如,--tags="Key1=Value1&Key2=Value2")
  • --forbid-overwrite:禁止覆盖同名对象
  • --encryption-type:服务端加密方式(SSE-COS/SSE-C)
  • --server-side-encryption:SSE-COS加密算法
  • --sse-customer-algo:SSE-C加密算法
  • --sse-customer-key:用户自定义密钥
  • --sse-customer-key-md5:密钥MD5值
  • --check-point:是否开启断点续传,默认ture,开启断点续传

修改参数

  • --disable-checksum:默认值改为true(只校验分块CRC64)

3. sync 命令

新增参数

  • --process-log:记录传输日志(默认true)
  • --process-log-path:指定传输日志路径
  • --skip-dir:跳过文件夹上传
  • --update:仅更新修改时间较新的文件
  • --ignore-existing:仅上传不存在的文件
  • --acl:对象ACL属性
  • --grant-read:赋予读取权限
  • --grant-read-acp:赋予读取ACL权限
  • --grant-write-acp:赋予写入ACL权限
  • --grant-full-control:赋予完全控制权限
  • --tags:对象标签集合,最多可设置10个标签(例如,--tags="Key1=Value1&Key2=Value2")
  • --forbid-overwrite:禁止覆盖同名对象
  • --encryption-type:服务端加密方式
  • --server-side-encryption:SSE-COS加密算法
  • --sse-customer-algo:SSE-C加密算法
  • --sse-customer-key:用户自定义密钥
  • --sse-customer-key-md5:密钥MD5值
  • --check-point:是否开启断点续传,默认ture,开启断点续传

修改参数

  • --disable-checksum:默认值改为true

  • --delete:优化镜像同步流程


4. config set 命令

新增参数

  • --disable_auto_fetch_bucket_type:禁用自动获取桶类型

    可选值 true | false

​ 若不设置或值为 false,则会自动获取桶类型(需要cos:HeadBucket权限)。

​ 若设置为 true,则不自动获取桶类型,会使用用户配置文件中的桶类型(Bucket.Ofs为true,则桶类型设置为ofs,若为false,则设置为cos)


5. bucket-tagging 命令

新增参数

  • --method add:添加桶标签

示例

# 设置桶标签
./coscli bucket-tagging --method put cos://examplebucket tag1#test1 tag2#test2

# 添加桶标签
./coscli bucket-tagging --method add cos://examplebucket tag3#test3

# 获取桶标签
./coscli bucket-tagging --method get cos://examplebucket

# 删除所有桶标签
./coscli bucket-tagging --method delete cos://examplebucket

# 删除指定桶标签
./coscli bucket-tagging --method delete cos://examplebucket tag1#test1 tag2#test2

6. mb 命令

新增参数

  • --acl:存储桶ACL属性
  • --grant-read:赋予读取权限
  • --grant-write:赋予写入权限
  • --grant-read-acp:赋予读取ACL权限
  • --grant-write-acp:赋予写入ACL权限
  • --grant-full-control:赋予完全控制权限
  • --tags:存储桶标签集合,最多可设置50个标签(例如,--tags="Key1=Value1&Key2=Value2")

v1.0.6

20 Mar 10:28
78f27ce

Choose a tag to compare

修复单文件删除时加-f参数删除不成功问题

v1.0.5

17 Mar 02:29
2d1fb41

Choose a tag to compare

请注意:在 v1.0.4 和 v1.0.5 版本中,使用 --force 参数删除单个文件时操作可能无法成功。建议使用 v1.0.6 或更高版本。
Note: In versions v1.0.4 and v1.0.5, using the --force parameter to delete a single file may not succeed. Please use version v1.0.6 or above.

改动点:
1.支持严格签名模式

Modification point:
1.Support strict signature mode

v1.0.4

25 Feb 11:14
2365dc7

Choose a tag to compare

请注意:在 v1.0.4 和 v1.0.5 版本中,使用 --force 参数删除单个文件时操作可能无法成功。建议使用 v1.0.6 或更高版本。
Note: In versions v1.0.4 and v1.0.5, using the --force parameter to delete a single file may not succeed. Please use version v1.0.6 or above.

修改命令:

  1. ls
  • 新增参数:--all-versions ,列举对象的所有版本,仅当bucket开启版本控制后可用。列出历史版本参数增加显示字段VersionId, IsLatest, Delete Marker
  • 限频重试策略优化,当触发限频时,默认进行重试,retry-num参数不再生效
  1. du
  • 新增参数:--all-versions 统计对象的所有版本数据,仅当bucket开启版本控制后可用。统计信息增加显示DeleteMarker数量
  1. lspart
  • 新增参数:--upload-id
  • 当传入upload-id时,需指定具体文件,仅展示upload-id对应的文件碎片信息
  • 未传入upload-id时,展示指定prefix下正在进行中的分块上传任务
  1. abort
  • 增加参数:--fail-output及--fail-output-path错误日志相关参数,与cp及sync命令的相关参数作用相同,用来记录清理过程中失败的信息
  • 性能优化
  1. rb
  • 增加参数:--fail-output及--fail-output-path错误日志相关参数,与cp及sync命令的相关参数作用相同,用来记录清理过程中失败的信息
  • 输出信息优化
  1. rm
  • 批量删除每批次删除对象数改为1000(之前是100)
  • 输出信息优化
  • 新增参数:--all-versions
  • 仅支持在已开启版本控制的Bucket内使用,且仅在传入--recursive(-r)参数时可用,遍历删除所有版本对象
  • 新增参数:--version-id
  • 仅支持在已开启版本控制的Bucket内使用,且仅在未传入--recursive(-r)参数时可用,删除指定object的指定版本
  1. cp
  • 新增参数:--version-id 下载指定版本的文件,仅支持在已开启版本控制的Bucket内使用
  • 新增参数:--move 仅COS路径间拷贝可用(其他会报错),会在文件成功拷贝到目标路径后,删除源文件
  • 上传筛选本地文件名逻辑修改,改为筛选命令传入的路径+文件名
  • 错误重试策略优化,默认进行5xx错误重试,指定错误重试次数和间隔后,会进行部分4xx重试
  • copy时支持修改文件存储类型
  • 增加传输开始控制台输出及传输结束输出,并记录至coscli.log
  • 使用参数--part-size=0开启自适应分块大小
  1. sync
  • 上传筛选本地文件名逻辑修改,改为筛选命令传入的路径+文件名
  • 错误重试策略优化,默认进行5xx错误重试,指定错误重试次数和间隔后,会进行部分4xx重试
  • 增加传输开始控制台输出及传输结束输出,并记录至coscli.log
  • --part-size=0开启自适应分块大小
  1. restore
  • 增加支持maz归档存储类型取回和深度归档存储取回
  • 输出提示信息优化
  • 错误信息记录优化,调用API失败会记录错误日志到coscli_output
  • 可靠性优化,增加默认限频重试
  • 可用性优化,增加409 StatusCode(已触发回热)直接跳过
  1. mb
  • 新增参数:--maz(-m)默认为false,为true时即为创建多az的存储桶
  1. config set
  • 新增参数:--disable_encryption 默认为false,为true时即为不加密配置文件中的秘钥相关信息
  1. config init
  • 新增交互式配置Input Disable Encryption 仅当传true时,取消加密配置文件中的秘钥相关信息

新增命令:
1.bucket-versioning

  • 使用示例:./coscli bucket-versioning --method [method] cos://<bucket-name> versioning
  • 开启版本控制:./coscli bucket-versioning --method put cos://examplebucket Enabled
  • 暂停版本控制:./coscli bucket-versioning --method put cos://examplebucket Suspended

Command Modifications:

  1. ls
  • Added parameter: --all-versions, lists all versions of an object, available only when bucket versioning is enabled. Added fields for historical versions: VersionId, IsLatest, Delete Marker.
  • Optimized rate limiting retry strategy, default retries when rate limit is triggered, retry-num parameter is no longer in effect.
  1. du
  • Added parameter: --all-versions, calculates data of all object versions, available only when bucket versioning is enabled. Added information to display the count of DeleteMarkers.
  1. lspart
  • Added parameter: --upload-id
  • When upload-id is specified, the specific file must be indicated, and displays the parts information of the file corresponding to the upload-id.
  • When upload-id is not specified, displays ongoing multipart upload tasks under the specified prefix.
  1. abort
  • Added parameters: --fail-output and --fail-output-path for error log, same function as related parameters in cp and sync commands, used to log failed information during cleanup.
  • Performance optimization.
  1. rb
  • Added parameters: --fail-output and --fail-output-path for error log, same function as related parameters in cp and sync commands, used to log failed information during cleanup.
  • Output information optimization.
  1. rm
  • Changed batch delete count to 1000 objects per batch (previously 100).
  • Output information optimization.
  • Added parameter: --all-versions
  • Only works in versioning-enabled buckets and only available when --recursive (-r) parameter is passed, recursively deletes all versions of objects.
  • Added parameter: --version-id
  • Only works in versioning-enabled buckets and only available when --recursive (-r) parameter is not passed, deletes a specified version of the specified object.
  1. cp
  • Added parameter: --version-id, downloads the specified version of the file, only available in versioning-enabled buckets.
  • Added parameter: --move, only available for copying between COS paths (otherwise will report an error), deletes the source file after successfully copying to the target path.
  • Modified local filename filtering logic to filter based on the command-passed path + filename.
  • Optimized error retry strategy, defaults to retrying on 5xx errors, optionally retries some 4xx errors if specified.
  • Supports changing file storage types during copy.
  • Added console output for transfer start and transfer end, and records to coscli.log.
  • Use parameter --part-size=0 to enable adaptive part size.
  1. sync
  • Modified local filename filtering logic to filter based on the command-passed path + filename.
  • Optimized error retry strategy, defaults to retrying on 5xx errors, optionally retries some 4xx errors if specified.
  • Added console output for transfer start and transfer end, and records to coscli.log.
  • Use --part-size=0 to enable adaptive part size.
  1. restore
  • Added support for maz archive storage retrieval and deep archive storage retrieval.
  • Optimized output prompt information.
  • Optimized error log, records error log to coscli_output on API call failure.
  • Reliability optimization, added default rate limit retry.
  • Availability optimization, directly skips 409 StatusCode (already heated).
  1. mb
  • Added parameter: --maz (-m), defaults to false, when true creates multi-az storage bucket.
  1. config set
  • Added parameter: --disable_encryption, defaults to false, when true disables encryption of key-related information in the configuration file.
  1. config init
  • Added interactive configuration Input Disable Encryption, only cancels encryption of key-related information in the configuration file when true is passed.

New Commands:

  1. bucket-versioning
  • Usage example: ./coscli bucket-versioning --method [method] cos://<bucket-name> versioning
  • Enable versioning: ./coscli bucket-versioning --method put cos://examplebucket Enabled
  • Suspend versioning: ./coscli bucket-versioning --method put cos://examplebucket Suspended

v1.0.3

27 Nov 08:26
fa3fdd6

Choose a tag to compare

修改点:
1.优化传输性能
2.修复lsdu列出部分文件异常的问题

Changes:

  1. Optimize transmission performance
  2. Fix the issue where lsdu lists some files abnormally

v1.0.2

21 Oct 03:32
752be27

Choose a tag to compare

更新内容:

  1. cp及sync命令增加--disable-checksum 选项,默认为false,校验整个文件的crc64,为true时仅校验分片crc64
  2. 兼容ofs融合桶api(ls cp sync rm等命令)
  3. 新增创建/获取symlink命令,可针对特定object创建软链,并通过软链快速获取key值
  4. 新增cat命令,可查看object内容,建议1MB以内小文件使用
  5. 新增lsdu命令,可列出当前目录所有文件及文件夹内容,并统计每个文件夹的文件数及总大小
  6. 新增--log-path全局选项,自定义coscli.log文件位置。可指定文件夹或具体文件(文件需以.log结尾)如:/data/ 或 /data/coscli.log
  7. 错误返回优化

Update contents:

  1. Add the --disable-checksum option to the cp and sync commands. By default, it is set to false, which means the entire file's crc64 is verified. If set to true, only the fragment's crc64 is verified.
  2. Compatible with OFS fusion bucket API (commands like ls, cp, sync, rm, etc.).
  3. Add new commands to create/get symlink. You can create a symlink for a specific object and quickly obtain the key value through the symlink.
  4. Add a new cat command to view object content. It is recommended to use it for small files under 1MB.
  5. Add a new lsdu command to list all files and folders in the current directory, and count the number of files and the total size of each folder.
  6. Add a global --log-path option to customize the location of the coscli.log file. You can specify a directory or a specific file (the file must end with .log), e.g., /data/ or /data/coscli.log.
  7. Optimize error returns.

v1.0.1

30 Aug 15:03

Choose a tag to compare

Fix the issue where the 'rm' command's use of include and exclude parameters is ineffective

v0.20.0-beta

15 Mar 06:25
2fe1c46

Choose a tag to compare

Fix the compatibility bug with Chinese characters in the list. Add retry logic for downloads.

v0.19.0-beta

03 Jan 08:07
ed65fa6

Choose a tag to compare

coscli supports domain switching, sync function optimization, and ls bucket supports specifying domain