A bucket policy is an authorization policy for Object Storage Service (OSS) buckets. It allows you to grant or restrict fine-grained access to specific OSS resources to principals, such as Alibaba Cloud accounts, Resource Access Management (RAM) users, RAM roles, or anonymous users. For example, you can grant a RAM user from another Alibaba Cloud account read-only permission to your OSS resources.
Usage notes
Setting, getting, and deleting a bucket policy require the oss:PutBucketPolicy, oss:GetBucketPolicy, and oss:DeleteBucketPolicy permissions, respectively. For details, see Grant custom access policies to a RAM user.
Method definitions
Set a bucket policy
put_bucket_policy(request: PutBucketPolicyRequest, **kwargs) → PutBucketPolicyResult
Get a bucket policy
get_bucket_policy(request: GetBucketPolicyRequest, **kwargs) → GetBucketPolicyResult
Delete a bucket policy
delete_bucket_policy(request: DeleteBucketPolicyRequest, **kwargs) → DeleteBucketPolicyResult
|
Parameter |
Type |
Description |
|
request |
PutBucketPolicyRequest |
The request parameters. For more information, see PutBucketPolicyRequest. |
|
GetBucketPolicyRequest |
The request parameters. For more information, see GetBucketPolicyRequest. |
|
|
DeleteBucketPolicyRequest |
The request parameters. For more information, see DeleteBucketPolicyRequest. |
Return values
|
Type |
Description |
|
PutBucketPolicyResult |
The return value. For more information, see PutBucketPolicyResult. |
|
GetBucketPolicyResult |
The return value. For more information, see GetBucketPolicyResult. |
|
DeleteBucketPolicyResult |
The return value. For more information, see DeleteBucketPolicyResult. |
For the complete definition of the put_bucket_policy method, see put_bucket_policy.
For the complete definition of the get_bucket_policy method, see get_bucket_policy.
For the complete definition of the delete_bucket_policy method, see delete_bucket_policy.
Code examples
Related documents
-
For the complete code sample of setting a vector bucket policy, see put_bucket_policy.py.
-
For the complete code sample of getting a vector bucket policy, see get_bucket_policy.py.
-
For the complete code sample of deleting a vector bucket policy, see delete_bucket_policy.py.