This topic describes how to use the OSS SDK for Go V2 to enable, query, and delete global Block Public Access configurations for OSS.
Usage notes
The sample code in this topic uses the region ID
cn-hangzhoufor the China (Hangzhou) region. By default, a public endpoint is used to access OSS. If you want to access OSS from other Alibaba Cloud services in the same region, use an internal endpoint. For more information about the regions and endpoints that OSS supports, see OSS regions and endpoints.This topic provides an example of how to read access credentials from environment variables. For more information about how to configure access credentials, see Configure access credentials.
Sample code
References
For the complete sample code that shows how to manage global Block Public Access for OSS, see the Github example.
For more information about the API operation to enable global Block Public Access for OSS, see PutPublicAccessBlock.
For more information about the API operation to query the global Block Public Access configurations for OSS, see GetPublicAccessBlock.
For more information about the API operation to delete the global Block Public Access configurations for OSS, see DeletePublicAccessBlock.