AWSWAFCDKPython如何更改规则操作?
创始人
2024-09-27 18:00:19
0

可以使用AWS CDK Python库中的“aws_cdk.aws_wafv2.CfnWebACL”和“aws_cdk.aws_wafv2.CfnRule”的“Properties”属性来更改AWS WAF规则的操作。在这里,我们将假设您已经使用AWS CDK Python构建了需要更改规则操作的WebACL。

以下是代码示例,将规则操作更改为“ALLOW”:

from aws_cdk import (
    aws_wafv2 as waf,
    core
)

# 创建WebACL规则并将其添加到规则组中 
acl_rule = waf.CfnRule(self, "AllowRule",
                      name="AllowRule",
                      priority=1,
                      action=waf.CfnRule.ActionProperty(allow={}),
                      statement=waf.CfnRule.StatementProperty(
                         managed_rule_group_statement=None,
                         rule_group_reference_statement=None,
                         byte_match_statement=None,
                         sqli_match_statement=None,
                         xss_match_statement=None,
                         geo_match_statement=None,
                         ip_set_reference_statement=None,
                         regex_pattern_set_reference_statement=None,
                         rate_based_statement=None,
                         and_statement=None,
                         or_statement=None,
                         not_statement=None
                        )
                     )
                     
# 更改规则操作为"ALLOW"
acl_rule.action = waf.CfnRule.ActionProperty(allow={})

# 更新WebACL规则的属性
acl_rule.node.default_child.cfn_options.update({
  "metadata":{
    "cfn_nag":{
      "rules_to_suppress": [{
        "id": "W70",
        "reason": "This is an allowed rule"
      }]
    }
  }
})

相关内容

热门资讯

今日头条!wepokerplu... 今日头条!wepokerplus外挂(辅助挂)确实有挂(有挂技巧辅助脚本)1、完成辅助器v3.3的残...
记者发布!fishpoker透... 记者发布!fishpoker透视底牌(辅助挂)切实是真的有挂(有挂方法辅助教程)1. 选牌创建新账号...
查到实测!aapoker脚本怎... 查到实测!aapoker脚本怎么用(辅助挂)果然是有挂(揭秘有挂辅助技巧)1. 选牌创建新账号,点击...
传递经验!wepoker轻量版... 传递经验!wepoker轻量版透视系统(辅助挂)其实存在有挂(有挂功能辅助软件)1、下载好正确养号方...
查到实测!红龙poker辅助器... 查到实测!红龙poker辅助器免费观看(辅助挂)都是是有挂(确实有挂辅助攻略)1、下载好脚本下载之后...
重大消息!wepoker怎么设... 重大消息!wepoker怎么设置房间(辅助挂)都是存在有挂(有挂秘笈辅助教程)1、不需要AI权限,帮...
必看攻略!wepoker私人局... 必看攻略!wepoker私人局辅助挂(辅助挂)确实有挂(有挂实锤辅助器)1、公共底牌简单,透视插件操...
大神推荐!wepoker破解游... 大神推荐!wepoker破解游戏盒子(辅助挂)本来真的有挂(有挂方法辅助方法)1、进入到是否有挂之后...
查到实测辅助!wpk透视辅助方... 查到实测辅助!wpk透视辅助方法(辅助挂)一直有挂(有挂分享辅助工具)1、很好的工具软件,可以解锁游...
实测发现!wepoker有什么... 实测发现!wepoker有什么规律(辅助挂)其实真的有挂(了解有挂辅助器)进入游戏-大厅左侧-新手福...