1 Star 0 Fork 0

Alibaba Cloud/aliyun-oss-go-sdk

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
bucket_info.go 1.75 KB
一键复制 编辑 原始数据 按行查看 历史
walker 提交于 2022-10-25 11:49 +08:00 . add bucket access monitor api
package sample
import (
"fmt"
"github.com/aliyun/aliyun-oss-go-sdk/oss"
)
// BucketInfoSample shows how to get the bucket info.
func BucketInfoSample() {
// New client
client, err := oss.New(endpoint, accessID, accessKey)
if err != nil {
HandleError(err)
}
// Get bucket info
res, err := client.GetBucketInfo(bucketName)
if err != nil {
HandleError(err)
}
fmt.Println("Bucket Info Name: ", res.BucketInfo.Name)
fmt.Println("Bucket Info AccessMonitor: ", res.BucketInfo.AccessMonitor)
fmt.Println("Bucket Info Location: ", res.BucketInfo.Location)
fmt.Println("Bucket Info CreationDate: ", res.BucketInfo.CreationDate)
fmt.Println("Bucket Info ACL: ", res.BucketInfo.ACL)
fmt.Println("Bucket Info Owner Id: ", res.BucketInfo.Owner.ID)
fmt.Println("Bucket Info Owner DisplayName: ", res.BucketInfo.Owner.DisplayName)
fmt.Println("Bucket Info StorageClass: ", res.BucketInfo.StorageClass)
fmt.Println("Bucket Info RedundancyType: ", res.BucketInfo.RedundancyType)
fmt.Println("Bucket Info ExtranetEndpoint: ", res.BucketInfo.ExtranetEndpoint)
fmt.Println("Bucket Info IntranetEndpoint: ", res.BucketInfo.IntranetEndpoint)
fmt.Println("Bucket Info CrossRegionReplication: ", res.BucketInfo.CrossRegionReplication)
if res.BucketInfo.Versioning != "" {
fmt.Println("Bucket Info Versioning: ", res.BucketInfo.Versioning)
}
if res.BucketInfo.SseRule.KMSDataEncryption != "" {
fmt.Println("Bucket Info SseRule KMSDataEncryption: ", res.BucketInfo.SseRule.KMSDataEncryption)
}
if res.BucketInfo.SseRule.KMSMasterKeyID != "" {
fmt.Println("Bucket Info SseRule KMSMasterKeyID: ", res.BucketInfo.SseRule.KMSMasterKeyID)
}
if res.BucketInfo.SseRule.SSEAlgorithm != "" {
fmt.Println("Bucket Info SseRule SSEAlgorithm: ", res.BucketInfo.SseRule.SSEAlgorithm)
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/aliyun/aliyun-oss-go-sdk.git
git@gitee.com:aliyun/aliyun-oss-go-sdk.git
aliyun
aliyun-oss-go-sdk
aliyun-oss-go-sdk
v3.0.2

搜索帮助