-
-
Notifications
You must be signed in to change notification settings - Fork 26
/
service.go
40 lines (35 loc) · 950 Bytes
/
service.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
38
39
40
package cos
import (
"context"
"encoding/xml"
"net/http"
)
// ServiceService ...
//
// Service 相关 API
type ServiceService service
// ServiceGetResult ...
type ServiceGetResult struct {
XMLName xml.Name `xml:"ListAllMyBucketsResult"`
Owner *Owner `xml:"Owner"`
Buckets []Bucket `xml:"Buckets>Bucket,omitempty"`
}
// MethodServiceGet method name of Service.Get
const MethodServiceGet MethodName = "Service.Get"
// Get Service 接口是用来获取请求者名下的所有存储空间列表(Bucket list)。
//
// https://cloud.tencent.com/document/product/436/8291
func (s *ServiceService) Get(ctx context.Context) (*ServiceGetResult, *Response, error) {
var res ServiceGetResult
sendOpt := sendOptions{
baseURL: s.client.BaseURL.ServiceURL,
uri: "/",
method: http.MethodGet,
result: &res,
caller: Caller{
Method: MethodServiceGet,
},
}
resp, err := s.client.send(ctx, &sendOpt)
return &res, resp, err
}