|
@@ -1343,6 +1343,66 @@ func (client Client) DeleteBucketInventory(bucketName, strInventoryId string, op
|
|
|
return CheckRespCode(resp.StatusCode, []int{http.StatusNoContent})
|
|
return CheckRespCode(resp.StatusCode, []int{http.StatusNoContent})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// SetBucketAsyncTask API operation for set async fetch task
|
|
|
|
|
+//
|
|
|
|
|
+// bucketName tht bucket name.
|
|
|
|
|
+//
|
|
|
|
|
+// asynConf configruation
|
|
|
|
|
+//
|
|
|
|
|
+// error it's nil if success, otherwise it's an error.
|
|
|
|
|
+func (client Client) SetBucketAsyncTask(bucketName string, asynConf AsyncFetchTaskConfiguration, options ...Option) (AsyncFetchTaskResult, error) {
|
|
|
|
|
+ var out AsyncFetchTaskResult
|
|
|
|
|
+ params := map[string]interface{}{}
|
|
|
|
|
+ params["asyncFetch"] = nil
|
|
|
|
|
+
|
|
|
|
|
+ var bs []byte
|
|
|
|
|
+ bs, err := xml.Marshal(asynConf)
|
|
|
|
|
+
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ return out, err
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ buffer := new(bytes.Buffer)
|
|
|
|
|
+ buffer.Write(bs)
|
|
|
|
|
+
|
|
|
|
|
+ contentType := http.DetectContentType(buffer.Bytes())
|
|
|
|
|
+ headers := make(map[string]string)
|
|
|
|
|
+ headers[HTTPHeaderContentType] = contentType
|
|
|
|
|
+
|
|
|
|
|
+ resp, err := client.do("POST", bucketName, params, headers, buffer, options...)
|
|
|
|
|
+
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ return out, err
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ defer resp.Body.Close()
|
|
|
|
|
+ err = xmlUnmarshal(resp.Body, &out)
|
|
|
|
|
+ return out, err
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// GetBucketAsyncTask API operation for set async fetch task
|
|
|
|
|
+//
|
|
|
|
|
+// bucketName tht bucket name.
|
|
|
|
|
+//
|
|
|
|
|
+// taskid returned by SetBucketAsyncTask
|
|
|
|
|
+//
|
|
|
|
|
+// error it's nil if success, otherwise it's an error.
|
|
|
|
|
+func (client Client) GetBucketAsyncTask(bucketName string, taskID string, options ...Option) (AsynFetchTaskInfo, error) {
|
|
|
|
|
+ var out AsynFetchTaskInfo
|
|
|
|
|
+ params := map[string]interface{}{}
|
|
|
|
|
+ params["asyncFetch"] = nil
|
|
|
|
|
+
|
|
|
|
|
+ headers := make(map[string]string)
|
|
|
|
|
+ headers[HTTPHeaderOssTaskID] = taskID
|
|
|
|
|
+ resp, err := client.do("GET", bucketName, params, headers, nil, options...)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ return out, err
|
|
|
|
|
+ }
|
|
|
|
|
+ defer resp.Body.Close()
|
|
|
|
|
+ err = xmlUnmarshal(resp.Body, &out)
|
|
|
|
|
+ return out, err
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// SecurityToken sets the temporary user's SecurityToken.
|
|
// SecurityToken sets the temporary user's SecurityToken.
|
|
|
//
|
|
//
|
|
|
// token STS token
|
|
// token STS token
|