Skip to content

Commit c83fc15

Browse files
committed
Upgrade ossutil to v1.7.9
1 parent ae1fe54 commit c83fc15

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+2955
-122
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.16
55
require (
66
github.com/alibabacloud-go/tea v1.1.15
77
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1111
8-
github.com/aliyun/aliyun-oss-go-sdk v2.1.8+incompatible
8+
github.com/aliyun/aliyun-oss-go-sdk v2.2.1+incompatible
99
github.com/aliyun/credentials-go v1.1.2
1010
github.com/alyu/configparser v0.0.0-20191103060215-744e9a66e7bc
1111
github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f // indirect
@@ -22,7 +22,7 @@ require (
2222
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
2323
golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1 // indirect
2424
golang.org/x/sys v0.0.0-20210412220455-f1c623a9e750 // indirect
25-
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba // indirect
25+
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 // indirect
2626
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c
2727
gopkg.in/ini.v1 v1.62.0
2828
)

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ github.com/alibabacloud-go/tea v1.1.15 h1:IaBC1Mm5Ss+l7cWnOXSxCmnWoWrEdeHEtDgQzo
55
github.com/alibabacloud-go/tea v1.1.15/go.mod h1:nXxjm6CIFkBhwW4FQkNrolwbfon8Svy6cujmKFUq98A=
66
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1111 h1:Kxgh3rDNqjYPv82Otmajcv2+VlL3RHJY/7NZpjt/6Gc=
77
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1111/go.mod h1:pUKYbK5JQ+1Dfxk80P0qxGqe5dkxDoabbZS7zOcouyA=
8-
github.com/aliyun/aliyun-oss-go-sdk v2.1.8+incompatible h1:hLUNPbx10wawWW7DeNExvTrlb90db3UnnNTFKHZEFhE=
9-
github.com/aliyun/aliyun-oss-go-sdk v2.1.8+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8=
8+
github.com/aliyun/aliyun-oss-go-sdk v2.2.1+incompatible h1:uuJIwCFhbZy+zdvLy5zrcIToPEQP0s5CFOZ0Zj03O/w=
9+
github.com/aliyun/aliyun-oss-go-sdk v2.2.1+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8=
1010
github.com/aliyun/credentials-go v1.1.2 h1:qU1vwGIBb3UJ8BwunHDRFtAhS6jnQLnde/yk0+Ih2GY=
1111
github.com/aliyun/credentials-go v1.1.2/go.mod h1:ozcZaMR5kLM7pwtCMEpVmQ242suV6qTJya2bDq4X1Tw=
1212
github.com/alyu/configparser v0.0.0-20191103060215-744e9a66e7bc h1:eN2FUvn4J1A31pICABioDYukoh1Tmlei6L3ImZUin/I=
@@ -142,8 +142,8 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
142142
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
143143
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
144144
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
145-
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba h1:O8mE0/t419eoIwhTFpKVkHiTs/Igowgfkj25AcZrtiE=
146-
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
145+
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 h1:M73Iuj3xbbb9Uk1DYhzydthsj6oOd6l9bpuFcNoUvTs=
146+
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
147147
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
148148
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
149149
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=

oss/CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1+
## 版本号:v1.7.9日期:2022-01-21
2+
### 变更内容
3+
- 增加: 取消对于meta格式的限制,只要以x-oss开头即可
4+
5+
## 版本号:v1.7.8日期:2021-12-15
6+
### 变更内容
7+
- 增加: cp下载支持传入meta信息,比如Accept-Encoding
8+
- 修复:set-acl修改bucket权限属性时候,如果bucket不存在行为从“自动创建”改成报错
9+
- 增加: 创建bucket支持传入配置文件,配置文件内容为bucket的创建属性
10+
- 增加: cp命令批量上传文件,如果扫描本地文件出错支持暂时忽略
11+
- 增加: 增加--ua选项,支持用户自定义user agent,会加在工具设置的user agent后面
12+
13+
## 版本号:v1.7.7日期:2021-08-26
14+
### 变更内容
15+
- 增加: 支持cname查询
16+
- 增加:lifecycle配置支持prefix overlap
17+
18+
## 版本号:v1.7.6日期:2021-08-05
19+
### 变更内容
20+
- 增加: 支持限速下载
21+
- 增加:支持同步边管理功能
22+
23+
## 版本号:v1.7.5 日期:2021-07-09
24+
### 变更内容
25+
- 增加: 增加lrb命令
26+
- 增加:支持选择跳过服务端证书校验
27+
28+
## 版本号:v1.7.4 日期:2021-07-30
29+
### 变更内容
30+
- 增加: 支持多种鉴权模式
31+
132
## 版本号:v1.7.3 日期:2021-04-09
233
### 变更内容
334
- 增加: du命令支持不同单位显示大小

oss/README-CN.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
# Aliyun OSSUTIL
22

33
[![GitHub version](https://badge.fury.io/gh/aliyun%2Fossutil.svg)](https://badge.fury.io/gh/aliyun%2Fossutil)
4-
[![Build Status](https://travis-ci.com/aliyun/ossutil.svg?branch=master)](https://travis-ci.com/aliyun/ossutil)
4+
[![Build Status](https://travis-ci.org/aliyun/ossutil.svg?branch=master)](https://travis-ci.org/aliyun/ossutil)
55
[![Coverage Status](https://coveralls.io/repos/github/aliyun/ossutil/badge.svg?branch=master)](https://coveralls.io/github/aliyun/ossutil?branch=master)
66

77
### [README of English](https://github.com/aliyun/ossutil/blob/master/README.md)
88

99
## 关于
10-
- 此工具采用go语言,基于OSS[阿里云对象存储服务](http://www.aliyun.com/product/oss/)官方GO SDK v2.1.8 构建。
10+
- 此工具采用go语言,基于OSS[阿里云对象存储服务](http://www.aliyun.com/product/oss/)官方GO SDK v2.2.0 构建。
1111
- 阿里云对象存储(Object Storage Service,简称OSS),是阿里云对外提供的海量,安全,低成本,高可靠的云存储服务。
1212
- OSS适合存放任意文件类型,适合各种网站、开发企业及开发者使用。
1313
- 该工具旨在为用户提供一个方便的,以命令行方式管理OSS数据的途径。
1414
- 当前版本提供了列举和删除Multipart Uploads功能。
1515
- 当前版本未提供Bucket管理功能功能,相关功能会在后续版本中开发。
1616

1717
## 版本
18-
- 当前版本:v1.7.3
18+
- 当前版本:v1.7.9
1919

2020
## 运行环境
2121
- Linux

oss/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
# Alibaba Cloud OSSUTIL
22

33
[![GitHub Version](https://badge.fury.io/gh/aliyun%2Fossutil.svg)](https://badge.fury.io/gh/aliyun%2Fossutil)
4-
[![Build Status](https://travis-ci.com/aliyun/ossutil.svg?branch=master)](https://travis-ci.com/aliyun/ossutil)
4+
[![Build Status](https://travis-ci.org/aliyun/ossutil.svg?branch=master)](https://travis-ci.org/aliyun/ossutil)
55
[![Coverage Status](https://coveralls.io/repos/github/aliyun/ossutil/badge.svg?branch=master)](https://coveralls.io/github/aliyun/ossutil?branch=master)
66

77
### [README of Chinese](https://github.com/aliyun/ossutil/blob/master/README-CN.md)
88

99
## About
10-
- This tool is developed with Go and built on the official GO SDK v2.1.8 of OSS [Alibaba Cloud Object Storage Service](http://www.aliyun.com/product/oss/).
10+
- This tool is developed with Go and built on the official GO SDK v2.2.0 of OSS [Alibaba Cloud Object Storage Service](http://www.aliyun.com/product/oss/).
1111
- OSS is a cloud storage service provided by Alibaba Cloud, featuring massive capacity, security, low cost, and high reliability.
1212
- OSS can store any type of files. It applies to various websites, development enterprises and developers.
1313
- This tool aims to provide a convenient-to-use command line for users to manage data in OSS.
1414
- The current version provides to list and delete multipart upload tasks.
1515
- The current version does not support bucket management. The feature will be available in future versions.
1616

1717
## Version
18-
- Current version: v1.7.3
18+
- Current version: v1.7.9
1919

2020
## Run environment
2121
- Linux

oss/lib/allpart_size.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ var allPartSizeCommand = AllPartSizeCommand{
103103
OptionReadTimeout,
104104
OptionConnectTimeout,
105105
OptionSTSRegion,
106+
OptionSkipVerfiyCert,
107+
OptionUserAgent,
106108
},
107109
},
108110
}

oss/lib/append_file.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ var appendFileCommand = AppendFileCommand{
158158
OptionReadTimeout,
159159
OptionConnectTimeout,
160160
OptionSTSRegion,
161+
OptionSkipVerfiyCert,
162+
OptionUserAgent,
161163
},
162164
},
163165
}

oss/lib/bucket_cname.go

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
package lib
2+
3+
import (
4+
"fmt"
5+
"os"
6+
"strings"
7+
)
8+
9+
var specChineseBucketCname = SpecText{
10+
synopsisText: "管理bucket cname",
11+
12+
paramText: "bucket_url [local_xml_file] [options]",
13+
14+
syntaxText: `
15+
ossutil bucket-cname --method get oss://bucket [local_xml_file] [options]
16+
`,
17+
detailHelpText: `
18+
cname命令通过设置method选项值为get可以查询bucket的cname配置
19+
20+
用法:
21+
该命令只有一种种用法:
22+
1) ossutil bucket-cname --method get oss://bucket [local_xml_file] [options]
23+
这个命令查询bucket的cname配置
24+
如果输入参数local_xml_file,cname配置将输出到该文件,否则输出到屏幕上
25+
`,
26+
sampleText: `
27+
1) 查询bucket的cname配置,结果输出到标准输出
28+
ossutil bucket-cname --method get oss://bucket
29+
`,
30+
}
31+
32+
var specEnglishBucketCname = SpecText{
33+
synopsisText: "get bucket cname configuration",
34+
35+
paramText: "bucket_url [local_xml_file] [options]",
36+
37+
syntaxText: `
38+
ossutil bucket-cname --method get oss://bucket [local_xml_file] [options]
39+
`,
40+
detailHelpText: `
41+
bucket-cname command can get the cname configuration of the oss bucket by
42+
set method option value to get
43+
44+
Usage:
45+
There are only one usage for this command:
46+
1) ossutil bucket-cname --method get oss://bucket [local_xml_file] [options]
47+
The command gets the cname configuration of bucket
48+
If you input parameter local_xml_file,the configuration will be output to local_xml_file
49+
If you don't input parameter local_xml_file,the configuration will be output to stdout
50+
`,
51+
sampleText: `
52+
1) get cname configuration to stdout
53+
ossutil bucket-cname --method get oss://bucket
54+
`,
55+
}
56+
57+
type bucketCnameOptionType struct {
58+
bucketName string
59+
}
60+
61+
type BucketCnameCommand struct {
62+
command Command
63+
bwOption bucketCnameOptionType
64+
}
65+
66+
var bucketCnameCommand = BucketCnameCommand{
67+
command: Command{
68+
name: "bucket-cname",
69+
nameAlias: []string{"bucket-cname"},
70+
minArgc: 1,
71+
maxArgc: 2,
72+
specChinese: specChineseBucketCname,
73+
specEnglish: specEnglishBucketCname,
74+
group: GroupTypeNormalCommand,
75+
validOptionNames: []string{
76+
OptionConfigFile,
77+
OptionEndpoint,
78+
OptionAccessKeyID,
79+
OptionAccessKeySecret,
80+
OptionSTSToken,
81+
OptionProxyHost,
82+
OptionProxyUser,
83+
OptionProxyPwd,
84+
OptionLogLevel,
85+
OptionMethod,
86+
OptionPassword,
87+
OptionMode,
88+
OptionECSRoleName,
89+
OptionTokenTimeout,
90+
OptionRamRoleArn,
91+
OptionRoleSessionName,
92+
OptionReadTimeout,
93+
OptionConnectTimeout,
94+
OptionSTSRegion,
95+
OptionSkipVerfiyCert,
96+
OptionUserAgent,
97+
},
98+
},
99+
}
100+
101+
// function for FormatHelper interface
102+
func (bwc *BucketCnameCommand) formatHelpForWhole() string {
103+
return bwc.command.formatHelpForWhole()
104+
}
105+
106+
func (bwc *BucketCnameCommand) formatIndependHelp() string {
107+
return bwc.command.formatIndependHelp()
108+
}
109+
110+
// Init simulate inheritance, and polymorphism
111+
func (bwc *BucketCnameCommand) Init(args []string, options OptionMapType) error {
112+
return bwc.command.Init(args, options, bwc)
113+
}
114+
115+
// RunCommand simulate inheritance, and polymorphism
116+
func (bwc *BucketCnameCommand) RunCommand() error {
117+
strMethod, _ := GetString(OptionMethod, bwc.command.options)
118+
if strMethod == "" {
119+
return fmt.Errorf("--method value is empty")
120+
}
121+
122+
strMethod = strings.ToLower(strMethod)
123+
if strMethod != "get" {
124+
return fmt.Errorf("--method only support get")
125+
}
126+
127+
srcBucketUrL, err := GetCloudUrl(bwc.command.args[0], "")
128+
if err != nil {
129+
return err
130+
}
131+
132+
bwc.bwOption.bucketName = srcBucketUrL.bucket
133+
return bwc.GetBucketCname()
134+
}
135+
136+
func (bwc *BucketCnameCommand) GetBucketCname() error {
137+
client, err := bwc.command.ossClient(bwc.bwOption.bucketName)
138+
if err != nil {
139+
return err
140+
}
141+
142+
output, err := client.GetBucketCname(bwc.bwOption.bucketName)
143+
if err != nil {
144+
return err
145+
}
146+
147+
var outFile *os.File
148+
if len(bwc.command.args) >= 2 {
149+
fileName := bwc.command.args[1]
150+
_, err = os.Stat(fileName)
151+
if err == nil {
152+
bConitnue := bwc.confirm(fileName)
153+
if !bConitnue {
154+
return nil
155+
}
156+
}
157+
158+
outFile, err = os.OpenFile(fileName, os.O_CREATE|os.O_TRUNC|os.O_RDWR, 0660)
159+
if err != nil {
160+
return err
161+
}
162+
defer outFile.Close()
163+
} else {
164+
outFile = os.Stdout
165+
}
166+
167+
outFile.Write([]byte(output))
168+
169+
fmt.Printf("\n\n")
170+
171+
return nil
172+
}
173+
174+
func (bwc *BucketCnameCommand) confirm(str string) bool {
175+
var val string
176+
fmt.Printf(getClearStr(fmt.Sprintf("bucket cname: overwrite \"%s\"(y or N)? ", str)))
177+
if _, err := fmt.Scanln(&val); err != nil || (strings.ToLower(val) != "yes" && strings.ToLower(val) != "y") {
178+
return false
179+
}
180+
return true
181+
}

0 commit comments

Comments
 (0)