You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
890 B

  1. package cos
  2. import (
  3. "context"
  4. "encoding/xml"
  5. "net/http"
  6. )
  7. // ServiceService ...
  8. //
  9. // Service 相关 API
  10. type ServiceService service
  11. // ServiceGetResult ...
  12. type ServiceGetResult struct {
  13. XMLName xml.Name `xml:"ListAllMyBucketsResult"`
  14. Owner *Owner `xml:"Owner"`
  15. Buckets []Bucket `xml:"Buckets>Bucket,omitempty"`
  16. }
  17. // Get Service 接口实现获取该用户下所有Bucket列表。
  18. //
  19. // 该API接口需要使用Authorization签名认证,
  20. // 且只能获取签名中AccessID所属账户的Bucket列表。
  21. //
  22. // https://www.qcloud.com/document/product/436/8291
  23. func (s *ServiceService) Get(ctx context.Context) (*ServiceGetResult, *Response, error) {
  24. var res ServiceGetResult
  25. sendOpt := sendOptions{
  26. baseURL: s.client.BaseURL.ServiceURL,
  27. uri: "/",
  28. method: http.MethodGet,
  29. result: &res,
  30. }
  31. resp, err := s.client.send(ctx, &sendOpt)
  32. return &res, resp, err
  33. }