Block public access at the access point level (Java SDK V2)
Manage public access block configurations at the access point level with OSS Java SDK V2.
Prerequisites
OSS Java SDK V2 is installed. If you use Maven, add the
com.aliyun:alibabacloud-oss-v2dependency topom.xml.Access credentials are configured by using environment variables. The sample code in this topic uses
EnvironmentVariableCredentialsProviderto read credentials from theOSS_ACCESS_KEY_IDandOSS_ACCESS_KEY_SECRETenvironment variables.
Permissions
An Alibaba Cloud account has all permissions by default. RAM users and RAM roles under the account have no permissions by default. Grant the required permissions from the Alibaba Cloud account or an account administrator.
API | Action | Description |
PutAccessPointPublicAccessBlock |
| Set, query, or delete the block public access configuration for an access point. |
Sample code
OSS Java SDK V2 does not provide strongly typed interfaces for block public access at the access point level. The following examples use the generic invokeOperation method to call the PutAccessPointPublicAccessBlock, GetAccessPointPublicAccessBlock, and DeleteAccessPointPublicAccessBlock operations. Do not use the bucket-level block public access examples as a substitute for this feature.
References
For API details about enabling block public access for an access point, see PutAccessPointPublicAccessBlock.
For API details about obtaining the block public access configuration of an access point, see GetAccessPointPublicAccessBlock.
For API details about deleting the block public access configuration of an access point, see DeleteAccessPointPublicAccessBlock.
For more information about block public access, see Block public access.