All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.azure.waf.Policy Maven / Gradle / Ivy

Go to download

A Pulumi package for creating and managing Microsoft Azure cloud resources, based on the Terraform azurerm provider. We recommend using the [Azure Native provider](https://github.com/pulumi/pulumi-azure-native) to provision Azure infrastructure. Azure Native provides complete coverage of Azure resources and same-day access to new resources and resource updates.

There is a newer version: 6.10.0-alpha.1731737215
Show newest version
// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package com.pulumi.azure.waf;

import com.pulumi.azure.Utilities;
import com.pulumi.azure.waf.PolicyArgs;
import com.pulumi.azure.waf.inputs.PolicyState;
import com.pulumi.azure.waf.outputs.PolicyCustomRule;
import com.pulumi.azure.waf.outputs.PolicyManagedRules;
import com.pulumi.azure.waf.outputs.PolicyPolicySettings;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.String;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nullable;

/**
 * Manages a Azure Web Application Firewall Policy instance.
 * 
 * ## Example Usage
 * 
 * <!--Start PulumiCodeChooser -->
 * 
 * {@code
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.waf.Policy;
 * import com.pulumi.azure.waf.PolicyArgs;
 * import com.pulumi.azure.waf.inputs.PolicyCustomRuleArgs;
 * import com.pulumi.azure.waf.inputs.PolicyPolicySettingsArgs;
 * import com.pulumi.azure.waf.inputs.PolicyManagedRulesArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * 
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 * 
 *     public static void stack(Context ctx) {
 *         var example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("example-rg")
 *             .location("West Europe")
 *             .build());
 * 
 *         var examplePolicy = new Policy("examplePolicy", PolicyArgs.builder()
 *             .name("example-wafpolicy")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .customRules(            
 *                 PolicyCustomRuleArgs.builder()
 *                     .name("Rule1")
 *                     .priority(1)
 *                     .ruleType("MatchRule")
 *                     .matchConditions(PolicyCustomRuleMatchConditionArgs.builder()
 *                         .matchVariables(PolicyCustomRuleMatchConditionMatchVariableArgs.builder()
 *                             .variableName("RemoteAddr")
 *                             .build())
 *                         .operator("IPMatch")
 *                         .negationCondition(false)
 *                         .matchValues(                        
 *                             "192.168.1.0/24",
 *                             "10.0.0.0/24")
 *                         .build())
 *                     .action("Block")
 *                     .build(),
 *                 PolicyCustomRuleArgs.builder()
 *                     .name("Rule2")
 *                     .priority(2)
 *                     .ruleType("MatchRule")
 *                     .matchConditions(                    
 *                         PolicyCustomRuleMatchConditionArgs.builder()
 *                             .matchVariables(PolicyCustomRuleMatchConditionMatchVariableArgs.builder()
 *                                 .variableName("RemoteAddr")
 *                                 .build())
 *                             .operator("IPMatch")
 *                             .negationCondition(false)
 *                             .matchValues("192.168.1.0/24")
 *                             .build(),
 *                         PolicyCustomRuleMatchConditionArgs.builder()
 *                             .matchVariables(PolicyCustomRuleMatchConditionMatchVariableArgs.builder()
 *                                 .variableName("RequestHeaders")
 *                                 .selector("UserAgent")
 *                                 .build())
 *                             .operator("Contains")
 *                             .negationCondition(false)
 *                             .matchValues("Windows")
 *                             .build())
 *                     .action("Block")
 *                     .build())
 *             .policySettings(PolicyPolicySettingsArgs.builder()
 *                 .enabled(true)
 *                 .mode("Prevention")
 *                 .requestBodyCheck(true)
 *                 .fileUploadLimitInMb(100)
 *                 .maxRequestBodySizeInKb(128)
 *                 .build())
 *             .managedRules(PolicyManagedRulesArgs.builder()
 *                 .exclusions(                
 *                     PolicyManagedRulesExclusionArgs.builder()
 *                         .matchVariable("RequestHeaderNames")
 *                         .selector("x-company-secret-header")
 *                         .selectorMatchOperator("Equals")
 *                         .build(),
 *                     PolicyManagedRulesExclusionArgs.builder()
 *                         .matchVariable("RequestCookieNames")
 *                         .selector("too-tasty")
 *                         .selectorMatchOperator("EndsWith")
 *                         .build())
 *                 .managedRuleSets(PolicyManagedRulesManagedRuleSetArgs.builder()
 *                     .type("OWASP")
 *                     .version("3.2")
 *                     .ruleGroupOverrides(PolicyManagedRulesManagedRuleSetRuleGroupOverrideArgs.builder()
 *                         .ruleGroupName("REQUEST-920-PROTOCOL-ENFORCEMENT")
 *                         .rules(                        
 *                             PolicyManagedRulesManagedRuleSetRuleGroupOverrideRuleArgs.builder()
 *                                 .id("920300")
 *                                 .enabled(true)
 *                                 .action("Log")
 *                                 .build(),
 *                             PolicyManagedRulesManagedRuleSetRuleGroupOverrideRuleArgs.builder()
 *                                 .id("920440")
 *                                 .enabled(true)
 *                                 .action("Block")
 *                                 .build())
 *                         .build())
 *                     .build())
 *                 .build())
 *             .build());
 * 
 *     }
 * }
 * }
 * 
* <!--End PulumiCodeChooser --> * * ## Import * * Web Application Firewall Policy can be imported using the `resource id`, e.g. * * ```sh * $ pulumi import azure:waf/policy:Policy example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-rg/providers/Microsoft.Network/applicationGatewayWebApplicationFirewallPolicies/example-wafpolicy * ``` * */ @ResourceType(type="azure:waf/policy:Policy") public class Policy extends com.pulumi.resources.CustomResource { /** * One or more `custom_rules` blocks as defined below. * */ @Export(name="customRules", refs={List.class,PolicyCustomRule.class}, tree="[0,1]") private Output> customRules; /** * @return One or more `custom_rules` blocks as defined below. * */ public Output>> customRules() { return Codegen.optional(this.customRules); } /** * A list of HTTP Listener IDs from an `azure.network.ApplicationGateway`. * */ @Export(name="httpListenerIds", refs={List.class,String.class}, tree="[0,1]") private Output> httpListenerIds; /** * @return A list of HTTP Listener IDs from an `azure.network.ApplicationGateway`. * */ public Output> httpListenerIds() { return this.httpListenerIds; } /** * Resource location. Changing this forces a new resource to be created. * */ @Export(name="location", refs={String.class}, tree="[0]") private Output location; /** * @return Resource location. Changing this forces a new resource to be created. * */ public Output location() { return this.location; } /** * A `managed_rules` blocks as defined below. * */ @Export(name="managedRules", refs={PolicyManagedRules.class}, tree="[0]") private Output managedRules; /** * @return A `managed_rules` blocks as defined below. * */ public Output managedRules() { return this.managedRules; } /** * The name of the policy. Changing this forces a new resource to be created. * */ @Export(name="name", refs={String.class}, tree="[0]") private Output name; /** * @return The name of the policy. Changing this forces a new resource to be created. * */ public Output name() { return this.name; } /** * A list of URL Path Map Path Rule IDs from an `azure.network.ApplicationGateway`. * */ @Export(name="pathBasedRuleIds", refs={List.class,String.class}, tree="[0,1]") private Output> pathBasedRuleIds; /** * @return A list of URL Path Map Path Rule IDs from an `azure.network.ApplicationGateway`. * */ public Output> pathBasedRuleIds() { return this.pathBasedRuleIds; } /** * A `policy_settings` block as defined below. * */ @Export(name="policySettings", refs={PolicyPolicySettings.class}, tree="[0]") private Output policySettings; /** * @return A `policy_settings` block as defined below. * */ public Output> policySettings() { return Codegen.optional(this.policySettings); } /** * The name of the resource group. Changing this forces a new resource to be created. * */ @Export(name="resourceGroupName", refs={String.class}, tree="[0]") private Output resourceGroupName; /** * @return The name of the resource group. Changing this forces a new resource to be created. * */ public Output resourceGroupName() { return this.resourceGroupName; } /** * A mapping of tags to assign to the Web Application Firewall Policy. * */ @Export(name="tags", refs={Map.class,String.class}, tree="[0,1,1]") private Output> tags; /** * @return A mapping of tags to assign to the Web Application Firewall Policy. * */ public Output>> tags() { return Codegen.optional(this.tags); } /** * * @param name The _unique_ name of the resulting resource. */ public Policy(java.lang.String name) { this(name, PolicyArgs.Empty); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. */ public Policy(java.lang.String name, PolicyArgs args) { this(name, args, null); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. * @param options A bag of options that control this resource's behavior. */ public Policy(java.lang.String name, PolicyArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("azure:waf/policy:Policy", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false); } private Policy(java.lang.String name, Output id, @Nullable PolicyState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("azure:waf/policy:Policy", name, state, makeResourceOptions(options, id), false); } private static PolicyArgs makeArgs(PolicyArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { if (options != null && options.getUrn().isPresent()) { return null; } return args == null ? PolicyArgs.Empty : args; } private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) { var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder() .version(Utilities.getVersion()) .build(); return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id); } /** * Get an existing Host resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state * @param options Optional settings to control the behavior of the CustomResource. */ public static Policy get(java.lang.String name, Output id, @Nullable PolicyState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { return new Policy(name, id, state, options); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy