Add PostObjectRestore interface

This commit is contained in:
toranger
2019-02-27 19:35:16 +08:00
parent cce3feb20f
commit 01ab468a2d
3 changed files with 98 additions and 0 deletions

View File

@@ -334,6 +334,33 @@ func (s *CosTestSuite) TestPutGetObjectACL() {
assert.Nil(s.T(), err, "DeleteObject Failed")
}
func (s *CosTestSuite) TestPutObjectRestore() {
name := "archivetest"
putOpt := &cos.ObjectPutOptions{
ObjectPutHeaderOptions: &cos.ObjectPutHeaderOptions{
XCosStorageClass: "ARCHIVE",
},
}
f := strings.NewReader("test")
_, err := s.Client.Object.Put(context.Background(), name, f, putOpt)
assert.Nil(s.T(), err, "PutObject Archive faild")
opt := &cos.ObjectRestoreOptions{
Days: 2,
Tier: &cos.CASJobParameters{
// Standard, Exepdited and Bulk
Tier: "Expedited",
},
}
resp, _ := s.Client.Object.PutRestore(context.Background(), name, opt)
retCode := resp.StatusCode
if retCode != 200 && retCode != 202 && retCode != 409 {
right := false
fmt.Println("PutObjectRestore get code is:", retCode)
assert.Equal(s.T(), true, right, "PutObjectRestore Failed")
}
}
func (s *CosTestSuite) TestCopyObject() {
u := "http://gosdkcopytest-" + s.Appid + ".cos.ap-beijing-1.myqcloud.com"
iu, _ := url.Parse(u)