云服务器内容精选

  • 请求示例 4 拒绝除了某个指定的 域名 和不带referer头域的外链请求以实现防盗链白名单 防盗链白名单:http://console.huaweicloud.com 示例中桶策略字段的详细说明,具体请参考桶策略参数说明。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 PUT /?policy HTTP/1.1 Host: examplebucket.obs.cn-north-4.myhuaweicloud.com Date: WED, 01 Jul 2015 02:34:34 GMT Authorization: OBS H4IPJX0TQTHTHEBQQCEC:jZiAT8Vx4azWEvPRMWi0X5BpJMA= { "Statement": [{ "Effect": "Deny", "Action": [ "GetObject", "GetObjectVersion" ], "Principal": { "ID": ["*"] }, "Resource": ["examplebucket/*"], "Condition": { "StringNotLike": { "Referer": [ "http://console.huaweicloud.com*", "${null}" ] } } }] }
  • 响应示例 4 1 2 3 4 5 6 HTTP/1.1 204 No Content x-obs-request-id: A603000001604A7DFE4A4AF31E301891 x-obs-id-2: BKOvGmTlt6sda5X4G89PuMO4fabObGYmnpRGkaMba1LqPt0fCACEuCMllAObRK1n Date: WED, 01 Jul 2015 02:34:34 GMT Content-Length: 0 Server: OBS
  • 响应示例 1 1 2 3 4 5 6 HTTP/1.1 204 No Content x-obs-request-id: 7B6DFC9BC71DD58B061285551605709 x-obs-id-2: N0I2REZDOUJDNzFERDU4QjA2MTI4NTU1MTYwNTcwOUFBQUFBQUFBYmJiYmJiYmJD Date: WED, 01 Jul 2015 02:32:25 GMT Content-Length: 0 Server: OBS
  • 请求示例 2 向OBS用户授予权限 用户ID为71f3901173514e6988115ea2c26d1999,用户所属租户ID为783fc6652cf246c096ea836694f71855。 如何获取租户ID和用户ID请参考获取账号、 IAM 用户、项目、用户组、区域、委托的名称和ID。示例中桶策略字段的详细说明,具体请参考桶策略参数说明。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 PUT /?policy HTTP/1.1 Host: examplebucket.obs.cn-north-4.myhuaweicloud.com Date: WED, 01 Jul 2015 02:33:28 GMT Authorization: OBS H4IPJX0TQTHTHEBQQCEC:jZiAT8Vx4azWEvPRMWi0X5BpJMA= { "Statement": [ { "Sid": "Stmt1375240018062", "Action": [ "PutBucketLogging" ], "Effect": "Allow", "Resource": "examplebucket", "Principal": { "ID": [ "domain/783fc6652cf246c096ea836694f71855:user/71f3901173514e6988115ea2c26d1999" ] } } ] }
  • 请求示例 3 拒绝除了某个指定OBS用户的其他用户执行所有操作 用户ID为71f3901173514e6988115ea2c26d1999,用户所属租户ID为783fc6652cf246c096ea836694f71855。 如何获取租户ID和用户ID请参考获取账号、IAM用户、项目、用户组、区域、委托的名称和ID。示例中桶策略字段的详细说明,具体请参考桶策略参数说明。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 PUT /?policy HTTP/1.1 Host: examplebucket.obs.cn-north-4.myhuaweicloud.com Date: WED, 01 Jul 2015 02:34:34 GMT Authorization: OBS H4IPJX0TQTHTHEBQQCEC:jZiAT8Vx4azWEvPRMWi0X5BpJMA= { "Statement": [ { "Effect": "Deny", "Action": ["*"], "Resource": [ "examplebucket/*", "examplebucket" ], "NotPrincipal": { "ID": [ "domain/783fc6652cf246c096ea836694f71855:user/71f3901173514e6988115ea2c26d1999", "domain/783fc6652cf246c096ea836694f71855" ] } } ] }
  • 功能介绍 该接口的实现使用policy子资源创建或者修改一个桶的策略。如果桶已经存在一个策略,那么当前请求中的策略将完全覆盖桶中现存的策略。单个桶的桶策略条数(statement)没有限制,但一个桶中所有桶策略的JSON描述总大小不能超过20KB。 要使用该接口,使用者要求必须是桶的所有者,或者是桶所有者的子用户且具有设置桶策略的权限。 使用桶策略进行权限控制请参考《 对象存储服务 权限配置指南》的OBS权限控制概述章节。
  • 响应示例 3 1 2 3 4 5 6 HTTP/1.1 204 No Content x-obs-request-id: A603000001604A7DFE4A4AF31E301891 x-obs-id-2: BKOvGmTlt6sda5X4G89PuMO4fabObGYmnpRGkaMba1LqPt0fCACEuCMllAObRK1n Date: WED, 01 Jul 2015 02:34:34 GMT Content-Length: 0 Server: OBS
  • 响应示例 2 1 2 3 4 5 6 HTTP/1.1 204 No Content x-obs-request-id: 7B6DFC9BC71DD58B061285551605709 x-obs-id-2: N0I2REZDOUJDNzFERDU4QjA2MTI4NTU1MTYwNTcwOUFBQUFBQUFBYmJiYmJiYmJD Date: WED, 01 Jul 2015 02:33:28 GMT Content-Length: 0 Server: OBS
  • 请求示例 1 向OBS租户授予权限 给租户ID为783fc6652cf246c096ea836694f71855的租户授权。 如何获取租户ID请参考获取账号、IAM用户、项目、用户组、区域、委托的名称和ID。示例中桶策略字段的详细说明,具体请参考桶策略参数说明。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 PUT /?policy HTTP/1.1 Host: examplebucket.obs.cn-north-4.myhuaweicloud.com Date: WED, 01 Jul 2015 02:32:25 GMT Authorization: OBS H4IPJX0TQTHTHEBQQCEC:jZiAT8Vx4azWEvPRMWi0X5BpJMA= { "Statement": [ { "Sid": "Stmt1375240018061", "Action": [ "GetBucketLogging" ], "Effect": "Allow", "Resource": "logging.bucket", "Principal": { "ID": [ "domain/783fc6652cf246c096ea836694f71855:user/*" ] } } ] }