Block public access to OSS resources at the access point level using OSS SDK for Go 2.0
This topic describes how to manage public access blocking configurations at the access point level by using OSS SDK for Go V2.
Notes
-
The sample code in this topic uses the region ID
cn-hangzhouof 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 (Go SDK V1).
Sample code
References
-
For the complete sample code used to manage public access blocking configurations for access points, see Github example.
-
For more information about the API operation that you can call to enable block public access for an access point, see PutAccessPointPublicAccessBlock.
-
For more information about the API operation that you can call to query public access blocking configurations for an access point, see GetAccessPointPublicAccessBlock.
-
For more information about the API operation that you can call to delete public access blocking configurations for an access point, see DeleteAccessPointPublicAccessBlock.