This topic describes how to configure the access tracking feature for buckets using Object Storage Service (OSS) SDK for Go V2.
Usage notes
The sample code in this topic uses the region ID
cn-hangzhou
of the China (Hangzhou) region. By default, the public endpoint is used to access resources in a bucket. If you want to access resources in the bucket by using other Alibaba Cloud services in the same region in which the bucket is located, use an internal endpoint. For more information about the regions and endpoints supported by Object Storage Service (OSS), see OSS regions and endpoints.In this topic, access credentials are obtained 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 that you can call to enable access tracking, see PutBucketAccessMonitor.
For more information about the API operation that you can call to query the access tracking status, see GetBucketAccessMonitor.