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.

35 lines
890 B

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