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.

36 lines
635 B

  1. package main
  2. import (
  3. "context"
  4. "fmt"
  5. "os"
  6. "net/http"
  7. "github.com/tencentyun/cos-go-sdk-v5"
  8. "github.com/tencentyun/cos-go-sdk-v5/debug"
  9. )
  10. func main() {
  11. c := cos.NewClient(nil, &http.Client{
  12. Transport: &cos.AuthorizationTransport{
  13. SecretID: os.Getenv("COS_SECRETID"),
  14. SecretKey: os.Getenv("COS_SECRETKEY"),
  15. Transport: &debug.DebugRequestTransport{
  16. RequestHeader: true,
  17. RequestBody: true,
  18. ResponseHeader: true,
  19. ResponseBody: true,
  20. },
  21. },
  22. })
  23. s, _, err := c.Service.Get(context.Background())
  24. if err != nil {
  25. panic(err)
  26. }
  27. for _, b := range s.Buckets {
  28. fmt.Printf("%#v\n", b)
  29. }
  30. }