- Documentation
Torch Object Storage
SDK Reference
C++
Bucket Interface
Manage Bucket Configuration
Managing Bucket Policies (C++ SDK)
Manage Bucket Configuration
Managing Bucket Policies (C++ SDK)
Managing Bucket Policies (C++ SDK)
A bucket (Bucket) in TOS serves as a globally unique namespace, functioning as a data container for storing object (Object) data. In TOS, permission control is implemented through IAM Policy, Bucket Policy, and bucket and object ACLs. Both bucket policies and ACLs are resource-based permission control mechanisms within TOS. Compared to bucket ACLs, bucket policies offer more flexible permission configurations. This article describes how to set, retrieve, and delete a bucket authorization policy (Policy).
Configure Bucket Policy
warning
- To configure a bucket policy, you must have the tos:PutBucketPolicy permission. For detailed instructions, refer to the Permission Configuration Guide.
- Users with this permission can freely modify bucket policies and may use this permission to obtain other permissions. We recommend that you configure this permission with caution.
Sample Code
The following code is used to configure the bucket policy for bucket examplebucket.
Retrieve Bucket Policy
warning
To obtain the bucket policy, you must have the tos:GetBucketPolicy permission. For specific operations, please refer to the Permission Configuration Guide. Sample Code
The following code is used to retrieve the bucket policy for bucket examplebucket.
Bucket Deletion Policy
warning
To delete a policy, you must have the tos:DeleteBucketPolicy permission. For specific instructions, please refer to the Permission Configuration Guide. Sample Code
The following code is used to delete the bucket policy for the bucket examplebucket.
Relevant Documentation
Last updated: 2025.09.25 14:22:45