예제 #1
0
 public CfnWebACLAssociation CreateWebAclAssociation(string id, CfnWebACL webAcl, string resourceArn)
 {
     return(new CfnWebACLAssociation(Scope, id, new CfnWebACLAssociationProps
     {
         WebAclArn = webAcl.AttrArn,
         ResourceArn = resourceArn
     }));
 }
        internal CdlWafv2CsharpStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
        {
            // The CDK includes built-in constructs for most resource types, such as Queues and Topics.
            var _ = new CfnWebACL(this, "WebAcl", new CfnWebACLProps
            {
                /*
                 * DefaultAction = new CfnWebACL.DefaultActionProperty
                 * {
                 *  Allow = {}
                 * },
                 */

                DefaultAction = new CfnWebACL.DefaultActionProperty
                {
                    Allow = new Dictionary <string, object>()
                },

                VisibilityConfig = new CfnWebACL.VisibilityConfigProperty
                {
                    CloudWatchMetricsEnabled = true,
                    SampledRequestsEnabled   = true,
                    MetricName = "test-waf-metric",
                },
                Scope = "REGIONAL",
                Rules = new object[]
                {
                    new CfnWebACL.RuleProperty
                    {
                        Name      = "AWS-AWSManagedRulesCommonRuleSet",
                        Priority  = 0,
                        Statement = new CfnWebACL.StatementOneProperty
                        {
                            ManagedRuleGroupStatement = new CfnWebACL.ManagedRuleGroupStatementProperty
                            {
                                VendorName = "AWS",
                                Name       = "AWSManagedRulesCommonRuleSet",
                            },
                        },
                        VisibilityConfig = new CfnWebACL.VisibilityConfigProperty
                        {
                            CloudWatchMetricsEnabled = true,
                            SampledRequestsEnabled   = true,
                            MetricName = "AWS-AWSManagedRulesCommonRuleSet",
                        },
                        OverrideAction = new CfnWebACL.OverrideActionProperty
                        {
                            Count = new Dictionary <string, object>()
                        },
                    },
                }
            });
        }
예제 #3
0
 internal WafDemoCsStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
 {
     var webAcl = new CfnWebACL(this, "WebAcl", new CfnWebACLProps
     {
         DefaultAction = new CfnWebACL.DefaultActionProperty
         {
             Allow = new Dictionary <string, object>()
         },
         VisibilityConfig = new CfnWebACL.VisibilityConfigProperty
         {
             CloudWatchMetricsEnabled = true,
             SampledRequestsEnabled   = true,
             MetricName = "cs-waf-metric",
         },
         Scope = "REGIONAL",
         Name  = "csharp-webAcl",
         Rules = new object[]
         {
             new CfnWebACL.RuleProperty
             {
                 Name      = "AWS-AWSManagedRulesCommonRuleSet",
                 Priority  = 0,
                 Statement = new CfnWebACL.StatementOneProperty
                 {
                     ManagedRuleGroupStatement = new CfnWebACL.ManagedRuleGroupStatementProperty
                     {
                         VendorName = "AWS",
                         Name       = "AWSManagedRulesCommonRuleSet",
                     },
                 },
                 VisibilityConfig = new CfnWebACL.VisibilityConfigProperty
                 {
                     CloudWatchMetricsEnabled = true,
                     SampledRequestsEnabled   = true,
                     MetricName = "AWS-CS-AWSManagedRulesCommonRuleSet",
                 },
                 OverrideAction = new CfnWebACL.OverrideActionProperty
                 {
                     Count = new Dictionary <string, object>()
                 },
             },
             new CfnWebACL.RuleProperty
             {
                 Name      = "AWSManagedRulesAnonymousIpList",
                 Priority  = 1,
                 Statement = new CfnWebACL.StatementOneProperty
                 {
                     ManagedRuleGroupStatement = new CfnWebACL.ManagedRuleGroupStatementProperty
                     {
                         VendorName = "AWS",
                         Name       = "AWSManagedRulesAnonymousIpList",
                     },
                 },
                 VisibilityConfig = new CfnWebACL.VisibilityConfigProperty
                 {
                     CloudWatchMetricsEnabled = true,
                     SampledRequestsEnabled   = true,
                     MetricName = "AWS-CS-AWSManagedRulesAnonymousIpList",
                 },
                 OverrideAction = new CfnWebACL.OverrideActionProperty
                 {
                     None = new CfnWebACL.RuleActionProperty {
                         Count = false
                     },
                 },
             },
         }
     });
 }
예제 #4
0
 public CfnWebACLAssociation CreateWebAclAssociation(string id, CfnWebACL webAcl, string resourceArn)
 {
     return(HandlerResources.AwsCdkWafHandler.CreateWebAclAssociation(id, webAcl, resourceArn));
 }