更新时间:2025-09-25 GMT+08:00
分享

校验策略是否有新访问权限

功能介绍

校验策略是否有新访问权限。

URI

POST /v5/policies/check-no-new-access

请求参数

表1 请求Body参数

参数

是否必选

参数类型

描述

existing_policy_document

String

该策略JSON格式策略文档。

new_policy_document

String

该策略JSON格式策略文档。

policy_type

String

要校验的策略类型。

  • identity_policy:身份策略

  • agency_trust_policy:委托信任策略

  • bucket_policy:桶策略

响应参数

状态码:200

表2 响应Body参数

参数

参数类型

描述

message

String

更新后的策略是否允许新访问权限的消息。

check_result

String

检查新访问权限的结果。

  • pass:无新增访问权限

  • fail:有新增访问权限

reasons

Array of CheckNoNewAccessReason objects

新增action的statement描述。

表3 CheckNoNewAccessReason

参数

参数类型

描述

description

String

对访问权限检查结果的推理的描述。

statement_id

String

新增权限statement的sid标识符。

statement_index

Integer

新增权限statement的index,从0开始。

最小值:0

请求示例

校验策略是否有新访问权限。

POST https://{hostname}/v5/policies/check-no-new-access

{
  "existing_policy_document" : "{\\\"Version\\\":\\\"5.0\\\",\\\"Statement\\\":[{\\\"Effect\\\":\\\"Allow\\\",\\\"Action\\\":[\\\"iam:users:createUserV5\\\"]}]}",
  "new_policy_document" : "{\\\"Version\\\":\\\"5.0\\\",\\\"Statement\\\":[{\\\"Effect\\\":\\\"Allow\\\",\\\"Action\\\":[\\\"iam:users:createUserV5\\\",\\\"obs:bucket:createBucket\\\"]}]}",
  "policy_type" : "identity_policy"
}

响应示例

状态码:200

OK

{
  "check_result" : "fail",
  "message" : "The modified permissions grant new access compared to your existing policy.",
  "reasons" : [ {
    "description" : "New access in the statement with sid: {statement_sid}.",
    "statement_index" : 0,
    "statement_id" : "{statement_sid}"
  } ]
}

状态码

状态码

描述

200

OK

错误码

请参见错误码

相关文档