Exemplo n.º 1
0
def create_waf_policy(cmd,
                      resource_group_name,
                      policy_name,
                      disabled=False,
                      mode=None,
                      redirect_url=None,
                      custom_block_response_status_code=None,
                      custom_block_response_body=None,
                      tags=None):
    client = cf_waf_policies(cmd.cli_ctx, None)
    from azext_front_door.vendored_sdks.models import (
        WebApplicationFirewallPolicy, ManagedRuleSetList, PolicySettings,
        CustomRuleList)
    policy = WebApplicationFirewallPolicy(
        location='global',
        tags=tags,
        policy_settings=PolicySettings(
            enabled_state='Enabled' if not disabled else 'Disabled',
            mode=mode,
            redirect_url=redirect_url,
            custom_block_response_status_code=custom_block_response_status_code,
            custom_block_response_body=custom_block_response_body),
        custom_rules=CustomRuleList(rules=[]),
        managed_rules=ManagedRuleSetList(rule_sets=[]))
    return client.create_or_update(resource_group_name, policy_name, policy)
Exemplo n.º 2
0
def create_waf_policy(cmd,
                      resource_group_name,
                      policy_name,
                      disabled=False,
                      mode=None,
                      location=None,
                      tags=None):
    client = cf_waf_policies(cmd.cli_ctx, None)
    from azext_front_door.vendored_sdks.models import (
        WebApplicationFirewallPolicy, ManagedRuleSets, PolicySettings,
        CustomRules)
    policy = WebApplicationFirewallPolicy(
        location=location,
        tags=tags,
        policy_settings=PolicySettings(
            enabled_state='Enabled' if not disabled else 'Disabled',
            mode=mode),
        custom_rules=CustomRules(rules=[]),
        managed_rules=ManagedRuleSets(rule_sets=[]))
    return client.create_or_update(resource_group_name, policy_name, policy)