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.

48 lines
999 B

5 years ago
  1. package main
  2. import (
  3. "context"
  4. "net/http"
  5. "net/url"
  6. "os"
  7. "fmt"
  8. "github.com/tencentyun/cos-go-sdk-v5"
  9. "github.com/tencentyun/cos-go-sdk-v5/debug"
  10. )
  11. func main() {
  12. uin := "100010805041"
  13. appid := 1259654469
  14. jobid := "795ad997-5557-4869-9a19-b66ec087d460"
  15. u, _ := url.Parse("https://" + uin + ".cos-control.ap-chengdu.myqcloud.com")
  16. b := &cos.BaseURL{BatchURL: u}
  17. c := cos.NewClient(b, &http.Client{
  18. Transport: &cos.AuthorizationTransport{
  19. SecretID: os.Getenv("COS_SECRETID"),
  20. SecretKey: os.Getenv("COS_SECRETKEY"),
  21. Transport: &debug.DebugRequestTransport{
  22. RequestHeader: true,
  23. RequestBody: true,
  24. ResponseHeader: true,
  25. ResponseBody: true,
  26. },
  27. },
  28. })
  29. opt := &cos.BatchUpdatePriorityOptions{
  30. JobId: jobid,
  31. Priority: 3,
  32. }
  33. headers := &cos.BatchRequestHeaders{
  34. XCosAppid: appid,
  35. }
  36. res, _, err := c.Batch.UpdateJobPriority(context.Background(), opt, headers)
  37. if err != nil {
  38. panic(err)
  39. }
  40. if res != nil {
  41. fmt.Printf("%+v", res)
  42. }
  43. }