3 changed files with 98 additions and 0 deletions
			
			
		| @ -0,0 +1,43 @@ | |||
| package main | |||
| 
 | |||
| import ( | |||
| 	"context" | |||
| 	"os" | |||
| 
 | |||
| 	"net/url" | |||
| 
 | |||
| 	"net/http" | |||
| 
 | |||
| 	"github.com/tencentyun/cos-go-sdk-v5" | |||
| 	"github.com/tencentyun/cos-go-sdk-v5/debug" | |||
| ) | |||
| 
 | |||
| func main() { | |||
| 	u, _ := url.Parse("https://test-1253846586.cos.ap-guangzhou.myqcloud.com") | |||
| 	b := &cos.BaseURL{BucketURL: u} | |||
| 	c := cos.NewClient(b, &http.Client{ | |||
| 		Transport: &cos.AuthorizationTransport{ | |||
| 			SecretID:  os.Getenv("COS_SECRETID"), | |||
| 			SecretKey: os.Getenv("COS_SECRETKEY"), | |||
| 			Transport: &debug.DebugRequestTransport{ | |||
| 				RequestHeader:  true, | |||
| 				RequestBody:    true, | |||
| 				ResponseHeader: true, | |||
| 				ResponseBody:   true, | |||
| 			}, | |||
| 		}, | |||
| 	}) | |||
| 
 | |||
| 	opt := &cos.ObjectRestoreOptions{ | |||
| 		Days: 2, | |||
| 		Tier: &cos.CASJobParameters{ | |||
| 			// Standard, Exepdited and Bulk
 | |||
| 			Tier: "Expedited", | |||
| 		}, | |||
| 	} | |||
| 	name := "archivetest" | |||
| 	_, err := c.Object.PutRestore(context.Background(), name, opt) | |||
| 	if err != nil { | |||
| 		panic(err) | |||
| 	} | |||
| } | |||
						Write
						Preview
					
					
					Loading…
					
					Cancel
						Save
					
		Reference in new issue