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.

30 lines
745 B

  1. package cos
  2. import (
  3. "context"
  4. "encoding/xml"
  5. "net/http"
  6. )
  7. // BucketGetLocationResult ...
  8. type BucketGetLocationResult struct {
  9. XMLName xml.Name `xml:"LocationConstraint"`
  10. Location string `xml:",chardata"`
  11. }
  12. // GetLocation ...
  13. //
  14. // Get Bucket Location接口获取Bucket所在地域信息,只有Bucket所有者有权限读取信息。
  15. //
  16. // https://www.qcloud.com/document/product/436/8275
  17. func (s *BucketService) GetLocation(ctx context.Context) (*BucketGetLocationResult, *Response, error) {
  18. var res BucketGetLocationResult
  19. sendOpt := sendOptions{
  20. baseURL: s.client.BaseURL.BucketURL,
  21. uri: "/?location",
  22. method: http.MethodGet,
  23. result: &res,
  24. }
  25. resp, err := s.client.send(ctx, &sendOpt)
  26. return &res, resp, err
  27. }