访问管理 条件键和条件运算符

在通过 CAM 控制台的 策略生成器创建策略 时,可以以根据需要设置策略生效条件。

相关产品
访问管理 产品页,含版本规格、价格与购买入口。

一、条件键

腾讯云通用条件键命名格式:qcs:<condition-key>,当前只支持4种条件键,条件键的内容及描述如下:

通用条件键 类型 描述
qcs:current_time Date and time Web Server 接收到请求的时间。以 ISO8601 标准表示,并需要使用 UTC 时间。
qcs:ip IP address 发起请求的 IP 地址。要符合 CIDR 规范。
qcs:resource_tag String 基于资源上的标签控制对这些资源的访问。可将策略中指定的标签键/值对与绑定在资源上的键/值对进行比较,仅当匹配时才能访问资源。
qcs:request_tag String 控制可以在请求中传递哪些标签。可将策略中指定的标签键/值对与请求中传递的键/值对进行比较,仅当匹配时才能绑定或解绑标签。

二、运算符

在生效条件(Condition) 中使用条件运算符来将策略中的条件键和条件值与请求上下文中的值进行匹配。

按照类型将条件运算符分为7类:字符串类型(String)、数字类型(Number)、日期类型(Date and time)、布尔类型(Boolean)和 IP 地址类型(IP address)、二进制条件运算符(Binary)、空条件键运算符(Null)。

条件运算符类型 条件运算符 描述
字符串条件运算符 string_equal 字符串等于(区分大小写)
 string_not_equal 字符串不等于(区分大小写)
 string_equal_ignore_case 字符串等于(不区分大小写)
 string_not_equal_ignore_case 字符串不等于(不区分大小写)
数字条件运算符 numeric_equal 数值等于
 numeric_not_equal 数值不等于
 numeric_less_than 数值小于
 numeric_less_than_equal 数值小于等于
 numeric_greater_than 数值大于
 numeric_greater_than_equal 数值大于等于
日期条件运算符 date_equal 日期时间等于
 date_not_equal 日期时间不等于
 date_less_than 日期时间小于
 date_less_than_equal 日期时间小于等于
 date_greater_than 日期时间大于
 date_greater_than_equal 日期时间大于等于
布尔值条件运算符 bool_equal 布尔值匹配
二进制条件运算符 binary_equal 数值等于
IP 地址条件运算符 ip_equal IP 地址等于
 ip_not_equal IP 地址不等于
空条件键运算符 null_equal 条件键为空匹配

三、映射关系

在生效语句中,可以使用的条件(Condition)取决于选择的条件键,条件键与运算符的映射关系如下:

注意:说明:

注意:运算符 string_like 和 string_not_like 对应的条件值只支持大小写字母、数字、-、_,不支持列表类接口。列表类接口可以通过 支持 CAM 的业务接口 查询。

条件键 运算符
qcs:resource_tag/qcs:request_tag string_equal
 string_not_equal
 string_equal_ignore_case
 string_not_equal_ignore_case
 string_like
 string_not_like
qcs:current_time date_equal
 date_not_equal
 date_less_than
 date_less_than_equal
 date_greater_than
 date_greater_than_equal
qcs:ip ip_equal
 ip_not_equal
赞 (0)
上一篇 4天前
下一篇 4天前