This topic describes how to use the OSS SDK for Go V2 to enable access tracking for a bucket.
Usage notes
The sample code in this topic uses the region ID
cn-hangzhoufor the China (Hangzhou) region. By default, public endpoints are used to access resources in a bucket. However, to access resources from other Alibaba Cloud services in the same region as the bucket, you must use an internal endpoint. For more information about the regions and endpoints supported by OSS, see OSS regions and endpoints.The sample code in this topic reads access credentials from environment variables. For more information about how to configure access credentials, see Configure access credentials.
Sample code
References
For more information about the API operation to enable access tracking, see PutBucketAccessMonitor.
For more information about the API operation to query the access tracking status, see GetBucketAccessMonitor.