{"base_path":"/","components":null,"consumes":"","definitions":{"CreatePunishmentRuleRequestBody":{"properties":{"block_time":{"description":"**参数解释:**\n拦截时间\n**约束限制:**\n取值范围取决于惩罚类别和时间单位\n**取值范围:**\n- short_xxx\n - SECOND [1, 300]\n- long_xxx\n - SECOND [301, 7776000]\n - MINUTE [6, 129600]\n - HOUR [1, 2160]\n - DAY [1, 90]\n - MONTH [1, 3]\n**默认取值:**\n不涉及","format":"int32","type":"integer"},"category":{"description":"**参数解释:**\n攻击惩罚类别\n**约束限制:**\n创建后不可修改,单个类别只能存在一个规则\n**取值范围:**\n - long_ip_block\n - long_cookie_block\n - long_params_block\n - long_header_block\n - short_ip_block\n - short_cookie_block\n - short_params_block\n - short_header_block\n**默认取值:**\n不涉及","enum":["long_ip_block","long_cookie_block","long_params_block","long_header_block","short_ip_block","short_cookie_block","short_params_block","short_header_block"],"type":"string"},"description":{"description":"规则描述","type":"string"},"time_unit":{"default":"SECOND","description":"**参数解释:**\n时间单位,会影响“拦截时间”参数的取值范围\n**约束限制:**\n不涉及\n**取值范围:**\n - SECOND\n - MINUTE\n - HOUR\n - DAY\n - MONTH\n**默认取值:**\nSECOND","enum":["SECOND","MINUTE","HOUR","DAY","MONTH"],"type":"string"}},"required":["category","block_time"],"type":"object"},"CreatePunishmentRuleResponseBody":{"properties":{"block_time":{"description":"拦截时间","format":"int32","type":"integer"},"category":{"description":"攻击惩罚类别","type":"string"},"description":{"description":"规则描述","type":"string"},"id":{"description":"规则id","type":"string"},"policyid":{"description":"所属策略id","type":"string"},"time_unit":{"description":"时间单位","type":"string"},"timestamp":{"description":"创建规则时间戳","format":"int64","type":"integer"}},"type":"object"},"IAM5ErrorDetails":{"description":"调用下游服务的报错信息集合,IAM5鉴权错误时才会返回此信息0。","properties":{"error_code":{"description":"下游服务错误码","type":"string"},"error_msg":{"description":"下游服务报错信息","type":"string"}}},"RestErrorResponse":{"properties":{"details":{"description":"调用下游服务的报错信息集合,IAM5鉴权错误时才会返回此字段。","items":{"$ref":"#/definitions/IAM5ErrorDetails"},"type":"array"},"encoded_authorization_message":{"description":"编码 (加密) 后的详细拒绝原因,用户可以自行调用 STS 服务的decode-authorization-message接口进行解码,可参考STS5联调自验证。IAM5鉴权错误时才会返回此字段。","type":"string"},"error_code":{"description":"错误码","type":"string"},"error_msg":{"description":"错误信息","type":"string"}},"title":"RestErrorResponse","type":"object"}},"description":null,"group_id":"29975c0bd7ce463ca70ad5c074e3974b","host":"waf.cn-north-4.myhuaweicloud.com","id":"a54e54708b7347ca9cc0070f2e3a50d9","info_version":"v1","method":"post","name":"CreatePunishmentRule","parameters":{},"paths":{"/v1/{project_id}/waf/policy/{policy_id}/punishment":{"post":{"description":"创建攻击惩罚规则","operationId":"CreatePunishmentRule","parameters":[{"description":"**参数解释:**\n用户Token,通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。\n**约束限制:**\n不涉及\n**取值范围:**\n不涉及\n**默认取值:**\n不涉及","in":"header","maxLength":4096,"minLength":32,"name":"X-Auth-Token","required":true,"type":"string"},{"default":"application/json;charset=utf8","description":"**参数解释:**\n内容类型\n**约束限制:**\n不涉及\n**取值范围:**\n不涉及\n**默认取值:**\napplication/json;charset=utf8","in":"header","name":"Content-Type","required":true,"type":"string"},{"default":"","description":"**参数解释:**\n项目ID,对应华为云控制台用户名->我的凭证->项目列表->项目ID\n**约束限制:**\n不涉及\n**取值范围:**\n不涉及\n**默认取值:**\n不涉及","in":"path","name":"project_id","required":true,"type":"string"},{"description":"**参数解释:**\n您可以通过调用企业项目管理服务(EPS)的查询企业项目列表接口(ListEnterpriseProject)查询企业项目ID。若需要查询当前用户所有企业项目绑定的资源信息,请传参all_granted_eps。\n**约束限制:**\n不涉及\n**取值范围:**\n - 0:代表default企业项目\n - all_granted_eps:代表所有企业项目\n - 其它企业项目ID:长度为36个字符\n**默认取值:**\n0","in":"query","name":"enterprise_project_id","required":false,"type":"string"},{"description":"**参数解释:**\n防护策略id,您可以通过调用查询防护策略列表(ListPolicy)获取策略id\n**约束限制:**\n不涉及\n**取值范围:**\n不涉及\n**默认取值:**\n不涉及","in":"path","name":"policy_id","required":true,"type":"string"},{"description":"创建攻击惩罚规则请求参数","in":"body","name":"CreatePunishmentRuleRequestBody","required":true,"schema":{"$ref":"#/definitions/CreatePunishmentRuleRequestBody"}}],"produces":["application/json"],"responses":{"200":{"description":"请求成功","examples":{"application/json":{"block_time":1233,"category":"long_ip_block","description":"demo","id":"2c3afdcc982b429da4f72ee483aece3e","policyid":"2fcbcb23ef0d48d99d24d7dcff00307d","time_unit":"SECOND","timestamp":1668148186106}},"schema":{"$ref":"#/definitions/CreatePunishmentRuleResponseBody"}},"400":{"description":"请求失败","schema":{"$ref":"#/definitions/RestErrorResponse"}},"401":{"description":"token权限不足","schema":{"$ref":"#/definitions/RestErrorResponse"}},"500":{"description":"服务器内部错误","schema":{"$ref":"#/definitions/RestErrorResponse"}}},"summary":"创建攻击惩罚规则","tags":["策略规则管理"],"x-constraint":"中东-阿布扎比暂不支持该功能。","x-is-registered":"Y","x-request-examples-1":{"block_time":"1233","category":"long_ip_block","description":"demo","time_unit":"SECOND"},"x-request-examples-description-1":"在项目id为project_id,防护策略id为policy_id的防护策略下创建攻击惩罚规则,攻击惩罚规则的攻击惩罚规则为“long_ip_block”,拦截时间为1233秒,规则描述为“demo\"。","x-request-examples-text-1":{"block_time":"1233","category":"long_ip_block","description":"demo","time_unit":"SECOND"},"x-request-examples-url-1":"POST https://{Endpoint}/v1/{project_id}/waf/policy/{policy_id}/punishment?","x-support-international":true,"x-support-sdk":"Y"}}},"product_short":"WAF","region_id":"cn-north-4","schemes":["HTTPS"],"security_definitions":null,"summary":"创建攻击惩罚规则","tags":"策略规则管理","uri":null,"version":"2.0"}