智慧食堂
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

bucket_get_domain.go 397 B

123456789101112131415161718
  1. package qiniu
  2. import (
  3. "github.com/qiniu/api.v7/v7/auth"
  4. "github.com/qiniu/api.v7/v7/storage"
  5. )
  6. func BucketGetDomain(bucketName string) (string, error) {
  7. mac := auth.New(AK, SK)
  8. cfg := storage.Config{UseHTTPS: false}
  9. bucketManager := storage.NewBucketManager(mac, &cfg)
  10. b, err := bucketManager.ListBucketDomains(bucketName)
  11. if err != nil {
  12. return "", err
  13. }
  14. return b[0].Domain, nil
  15. }