Skip to content

Commit 5389852

Browse files
author
jojoliang
committed
add delete bucket opt
1 parent e19eb11 commit 5389852

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

bucket.go

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,23 @@ func (s *BucketService) Put(ctx context.Context, opt *BucketPutOptions) (*Respon
8484
return resp, err
8585
}
8686

87+
type BucketDeleteOptions struct {
88+
XOptionHeader *http.Header `header:"-,omitempty" url:"-" xml:"-"`
89+
}
90+
8791
// Delete Bucket请求可以在指定账号下删除Bucket,删除之前要求Bucket为空。
8892
//
8993
// https://www.qcloud.com/document/product/436/7732
90-
func (s *BucketService) Delete(ctx context.Context) (*Response, error) {
94+
func (s *BucketService) Delete(ctx context.Context, opt ...*BucketDeleteOptions) (*Response, error) {
95+
var dopt *BucketDeleteOptions
96+
if len(opt) > 0 {
97+
dopt = opt[0]
98+
}
9199
sendOpt := sendOptions{
92-
baseURL: s.client.BaseURL.BucketURL,
93-
uri: "/",
94-
method: http.MethodDelete,
100+
baseURL: s.client.BaseURL.BucketURL,
101+
uri: "/",
102+
method: http.MethodDelete,
103+
optHeader: dopt,
95104
}
96105
resp, err := s.client.send(ctx, &sendOpt)
97106
return resp, err
@@ -103,9 +112,9 @@ type BucketHeadOptions struct {
103112

104113
// Head Bucket请求可以确认是否存在该Bucket,是否有权限访问,Head的权限与Read一致。
105114
//
106-
// 当其存在时,返回 HTTP 状态码200;
107-
// 当无权限时,返回 HTTP 状态码403;
108-
// 当不存在时,返回 HTTP 状态码404。
115+
// 当其存在时,返回 HTTP 状态码200;
116+
// 当无权限时,返回 HTTP 状态码403;
117+
// 当不存在时,返回 HTTP 状态码404。
109118
//
110119
// https://www.qcloud.com/document/product/436/7735
111120
func (s *BucketService) Head(ctx context.Context, opt ...*BucketHeadOptions) (*Response, error) {

0 commit comments

Comments
 (0)