forked from tencentyun/cos-go-sdk-v5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bucket_accelerate.go
37 lines (33 loc) · 970 Bytes
/
bucket_accelerate.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package cos
import (
"context"
"encoding/xml"
"net/http"
)
type BucketPutAccelerateOptions struct {
XMLName xml.Name `xml:"AccelerateConfiguration"`
Status string `xml:"Status,omitempty"`
Type string `xml:"Type,omitempty"`
}
type BucketGetAccelerateResult BucketPutAccelerateOptions
func (s *BucketService) PutAccelerate(ctx context.Context, opt *BucketPutAccelerateOptions) (*Response, error) {
sendOpt := &sendOptions{
baseURL: s.client.BaseURL.BucketURL,
uri: "/?accelerate",
method: http.MethodPut,
body: opt,
}
resp, err := s.client.doRetry(ctx, sendOpt)
return resp, err
}
func (s *BucketService) GetAccelerate(ctx context.Context) (*BucketGetAccelerateResult, *Response, error) {
var res BucketGetAccelerateResult
sendOpt := &sendOptions{
baseURL: s.client.BaseURL.BucketURL,
uri: "/?accelerate",
method: http.MethodGet,
result: &res,
}
resp, err := s.client.doRetry(ctx, sendOpt)
return &res, resp, err
}