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.

28 lines
747 B

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