first to commit project

This commit is contained in:
alantong
2018-12-06 15:24:18 +08:00
commit 6ad265fc0c
78 changed files with 6171 additions and 0 deletions

30
bucket_location.go Normal file
View File

@@ -0,0 +1,30 @@
package cos
import (
"context"
"encoding/xml"
"net/http"
)
// BucketGetLocationResult ...
type BucketGetLocationResult struct {
XMLName xml.Name `xml:"LocationConstraint"`
Location string `xml:",chardata"`
}
// GetLocation ...
//
// Get Bucket Location接口获取Bucket所在地域信息只有Bucket所有者有权限读取信息。
//
// https://www.qcloud.com/document/product/436/8275
func (s *BucketService) GetLocation(ctx context.Context) (*BucketGetLocationResult, *Response, error) {
var res BucketGetLocationResult
sendOpt := sendOptions{
baseURL: s.client.BaseURL.BucketURL,
uri: "/?location",
method: http.MethodGet,
result: &res,
}
resp, err := s.client.send(ctx, &sendOpt)
return &res, resp, err
}