cos:GetBucketPolicy.cos:PutBucketPolicy.cos:DeleteBucketPolicy../coscli bucket-policy --method [method] cos://<bucket-name>
Parameter Format | Description | Example |
cos://<bucket-name> | Specify the target bucket. It supports the use of the bucket alias or bucket name in configuration parameters. If you use the bucket name for access, you must carry the endpoint flag. | Access with the bucket alias: cos://example-alias Access with the bucket name: cos://examplebucket-1250000000 |
Flag Abbreviation | Flag Name | Description |
-h | --help | Views the usage of this command. |
None | --method | Specify the operation to perform, including put (set bucket policy), get (query bucket policy), delete (delete bucket policy) |
None | --policy | Bucket policy (JSON format or directly specify the file path, such as /data/policy.txt, which needs to be specified as file:///data/policy.txt) |
./coscli bucket-policy --method put cos://example-alias --policy="{\\"Statement\\":[...]}"
./coscli bucket-policy --method get cos://example-alias
SECTION | KEY | VALUE---------------+-----------+----------------------------------------------------------------Policy | Version | 2.0+--------------+-----------+---------------------------------------------------------------+| |+--------------+-----------+---------------------------------------------------------------+Statement #1 | SID | costs-12331231231123123-80285-3+ +-----------+---------------------------------------------------------------+| Effect | allow+ +-----------+---------------------------------------------------------------+| Principal | qcs:| | - qcs::cam::uin/1000000000:uin/1000000000| | - qcs::cam::uin/1000000000:uin/1000000000| |+ +-----------+---------------------------------------------------------------+| Action | name/cos:GetBucket+ +-----------+---------------------------------------------------------------+| Resource | qcs::cos:ap-nanjing:uid/1240000000:test-1240000000/*+ +-----------+---------------------------------------------------------------+| Condition | ip_equal:| | qcs:ip:| | - 11.9.10.8| |---------------+-----------+----------------------------------------------------------------Bucket Policy Information
./coscli bucket-policy --method delete cos://example-alias
Feedback