本文为您提供列出并读取一个存储空间中资源的参考示例。
- 以下策略表示:您可以通过OSS SDK或OSS命令行工具列出并读取一个存储空间
myphotos
中的资源。{ "Version": "1", "Statement": [ { "Effect": "Allow", "Action": "oss:ListObjects", "Resource": "acs:oss:*:*:myphotos" }, { "Effect": "Allow", "Action": "oss:GetObject", "Resource": "acs:oss:*:*:myphotos/*" } ] }
- 以下策略表示:您可以通过OSS控制台列出并读取一个存储空间
myphotos
中的资源。说明 为了操作体验的优化,用户登录OSS控制台时,OSS控制台会额外调用ListBuckets
、GetBucketAcl
和GetObjectAcl
,以确定存储空间属性是公开还是私有。{ "Version": "1", "Statement": [ { "Effect": "Allow", "Action": [ "oss:ListBuckets", "oss:GetBucketStat", "oss:GetBucketInfo", "oss:GetBucketTagging", "oss:GetBucketAcl" ], "Resource": "acs:oss:*:*:*" }, { "Effect": "Allow", "Action": [ "oss:ListObjects", "oss:GetBucketAcl" ], "Resource": "acs:oss:*:*:myphotos" }, { "Effect": "Allow", "Action": [ "oss:GetObject", "oss:GetObjectAcl" ], "Resource": "acs:oss:*:*:myphotos/*" } ] }