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

com.pulumi.azurenative.network.Policy Maven / Gradle / Ivy

There is a newer version: 2.82.0
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.azurenative.network;

import com.pulumi.azurenative.Utilities;
import com.pulumi.azurenative.network.PolicyArgs;
import com.pulumi.azurenative.network.outputs.CustomRuleListResponse;
import com.pulumi.azurenative.network.outputs.FrontDoorPolicySettingsResponse;
import com.pulumi.azurenative.network.outputs.FrontendEndpointLinkResponse;
import com.pulumi.azurenative.network.outputs.ManagedRuleSetListResponse;
import com.pulumi.azurenative.network.outputs.RoutingRuleLinkResponse;
import com.pulumi.azurenative.network.outputs.SecurityPolicyLinkResponse;
import com.pulumi.azurenative.network.outputs.SkuResponse;
import com.pulumi.core.Alias;
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;

/**
 * Defines web application firewall policy.
 * Azure REST API version: 2022-05-01. Prior API version in Azure Native 1.x: 2020-11-01.
 * 
 * Other available API versions: 2021-06-01, 2024-02-01.
 * 
 * ## Example Usage
 * ### Creates specific policy
 * 
 * 
 * {@code
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.azurenative.network.Policy;
 * import com.pulumi.azurenative.network.PolicyArgs;
 * import com.pulumi.azurenative.network.inputs.CustomRuleListArgs;
 * import com.pulumi.azurenative.network.inputs.ManagedRuleSetListArgs;
 * import com.pulumi.azurenative.network.inputs.FrontDoorPolicySettingsArgs;
 * import com.pulumi.azurenative.network.inputs.SkuArgs;
 * 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 policy = new Policy("policy", PolicyArgs.builder()
 *             .customRules(CustomRuleListArgs.builder()
 *                 .rules(                
 *                     CustomRuleArgs.builder()
 *                         .action("Block")
 *                         .matchConditions(FrontDoorMatchConditionArgs.builder()
 *                             .matchValue(                            
 *                                 "192.168.1.0/24",
 *                                 "10.0.0.0/24")
 *                             .matchVariable("RemoteAddr")
 *                             .operator("IPMatch")
 *                             .build())
 *                         .name("Rule1")
 *                         .priority(1)
 *                         .rateLimitThreshold(1000)
 *                         .ruleType("RateLimitRule")
 *                         .build(),
 *                     CustomRuleArgs.builder()
 *                         .action("Block")
 *                         .matchConditions(                        
 *                             FrontDoorMatchConditionArgs.builder()
 *                                 .matchValue("CH")
 *                                 .matchVariable("RemoteAddr")
 *                                 .operator("GeoMatch")
 *                                 .build(),
 *                             FrontDoorMatchConditionArgs.builder()
 *                                 .matchValue("windows")
 *                                 .matchVariable("RequestHeader")
 *                                 .operator("Contains")
 *                                 .selector("UserAgent")
 *                                 .transforms("Lowercase")
 *                                 .build())
 *                         .name("Rule2")
 *                         .priority(2)
 *                         .ruleType("MatchRule")
 *                         .build())
 *                 .build())
 *             .location("WestUs")
 *             .managedRules(ManagedRuleSetListArgs.builder()
 *                 .managedRuleSets(FrontDoorManagedRuleSetArgs.builder()
 *                     .exclusions(ManagedRuleExclusionArgs.builder()
 *                         .matchVariable("RequestHeaderNames")
 *                         .selector("User-Agent")
 *                         .selectorMatchOperator("Equals")
 *                         .build())
 *                     .ruleGroupOverrides(FrontDoorManagedRuleGroupOverrideArgs.builder()
 *                         .exclusions(ManagedRuleExclusionArgs.builder()
 *                             .matchVariable("RequestCookieNames")
 *                             .selector("token")
 *                             .selectorMatchOperator("StartsWith")
 *                             .build())
 *                         .ruleGroupName("SQLI")
 *                         .rules(                        
 *                             FrontDoorManagedRuleOverrideArgs.builder()
 *                                 .action("Redirect")
 *                                 .enabledState("Enabled")
 *                                 .exclusions(ManagedRuleExclusionArgs.builder()
 *                                     .matchVariable("QueryStringArgNames")
 *                                     .selector("query")
 *                                     .selectorMatchOperator("Equals")
 *                                     .build())
 *                                 .ruleId("942100")
 *                                 .build(),
 *                             FrontDoorManagedRuleOverrideArgs.builder()
 *                                 .enabledState("Disabled")
 *                                 .ruleId("942110")
 *                                 .build())
 *                         .build())
 *                     .ruleSetAction("Block")
 *                     .ruleSetType("DefaultRuleSet")
 *                     .ruleSetVersion("1.0")
 *                     .build())
 *                 .build())
 *             .policyName("Policy1")
 *             .policySettings(FrontDoorPolicySettingsArgs.builder()
 *                 .customBlockResponseBody("PGh0bWw+CjxoZWFkZXI+PHRpdGxlPkhlbGxvPC90aXRsZT48L2hlYWRlcj4KPGJvZHk+CkhlbGxvIHdvcmxkCjwvYm9keT4KPC9odG1sPg==")
 *                 .customBlockResponseStatusCode(429)
 *                 .enabledState("Enabled")
 *                 .mode("Prevention")
 *                 .redirectUrl("http://www.bing.com")
 *                 .requestBodyCheck("Disabled")
 *                 .build())
 *             .resourceGroupName("rg1")
 *             .sku(SkuArgs.builder()
 *                 .name("Classic_AzureFrontDoor")
 *                 .build())
 *             .build());
 * 
 *     }
 * }
 * 
 * }
 * 
* * ## Import * * An existing resource can be imported using its type token, name, and identifier, e.g. * * ```sh * $ pulumi import azure-native:network:Policy Policy1 /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/{policyName} * ``` * */ @ResourceType(type="azure-native:network:Policy") public class Policy extends com.pulumi.resources.CustomResource { /** * Describes custom rules inside the policy. * */ @Export(name="customRules", refs={CustomRuleListResponse.class}, tree="[0]") private Output customRules; /** * @return Describes custom rules inside the policy. * */ public Output> customRules() { return Codegen.optional(this.customRules); } /** * Gets a unique read-only string that changes whenever the resource is updated. * */ @Export(name="etag", refs={String.class}, tree="[0]") private Output etag; /** * @return Gets a unique read-only string that changes whenever the resource is updated. * */ public Output> etag() { return Codegen.optional(this.etag); } /** * Describes Frontend Endpoints associated with this Web Application Firewall policy. * */ @Export(name="frontendEndpointLinks", refs={List.class,FrontendEndpointLinkResponse.class}, tree="[0,1]") private Output> frontendEndpointLinks; /** * @return Describes Frontend Endpoints associated with this Web Application Firewall policy. * */ public Output> frontendEndpointLinks() { return this.frontendEndpointLinks; } /** * Resource location. * */ @Export(name="location", refs={String.class}, tree="[0]") private Output location; /** * @return Resource location. * */ public Output> location() { return Codegen.optional(this.location); } /** * Describes managed rules inside the policy. * */ @Export(name="managedRules", refs={ManagedRuleSetListResponse.class}, tree="[0]") private Output managedRules; /** * @return Describes managed rules inside the policy. * */ public Output> managedRules() { return Codegen.optional(this.managedRules); } /** * Resource name. * */ @Export(name="name", refs={String.class}, tree="[0]") private Output name; /** * @return Resource name. * */ public Output name() { return this.name; } /** * Describes settings for the policy. * */ @Export(name="policySettings", refs={FrontDoorPolicySettingsResponse.class}, tree="[0]") private Output policySettings; /** * @return Describes settings for the policy. * */ public Output> policySettings() { return Codegen.optional(this.policySettings); } /** * Provisioning state of the policy. * */ @Export(name="provisioningState", refs={String.class}, tree="[0]") private Output provisioningState; /** * @return Provisioning state of the policy. * */ public Output provisioningState() { return this.provisioningState; } @Export(name="resourceState", refs={String.class}, tree="[0]") private Output resourceState; public Output resourceState() { return this.resourceState; } /** * Describes Routing Rules associated with this Web Application Firewall policy. * */ @Export(name="routingRuleLinks", refs={List.class,RoutingRuleLinkResponse.class}, tree="[0,1]") private Output> routingRuleLinks; /** * @return Describes Routing Rules associated with this Web Application Firewall policy. * */ public Output> routingRuleLinks() { return this.routingRuleLinks; } /** * Describes Security Policy associated with this Web Application Firewall policy. * */ @Export(name="securityPolicyLinks", refs={List.class,SecurityPolicyLinkResponse.class}, tree="[0,1]") private Output> securityPolicyLinks; /** * @return Describes Security Policy associated with this Web Application Firewall policy. * */ public Output> securityPolicyLinks() { return this.securityPolicyLinks; } /** * The pricing tier of web application firewall policy. Defaults to Classic_AzureFrontDoor if not specified. * */ @Export(name="sku", refs={SkuResponse.class}, tree="[0]") private Output sku; /** * @return The pricing tier of web application firewall policy. Defaults to Classic_AzureFrontDoor if not specified. * */ public Output> sku() { return Codegen.optional(this.sku); } /** * Resource tags. * */ @Export(name="tags", refs={Map.class,String.class}, tree="[0,1,1]") private Output> tags; /** * @return Resource tags. * */ public Output>> tags() { return Codegen.optional(this.tags); } /** * Resource type. * */ @Export(name="type", refs={String.class}, tree="[0]") private Output type; /** * @return Resource type. * */ public Output type() { return this.type; } /** * * @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-native:network:Policy", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false); } private Policy(java.lang.String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("azure-native:network:Policy", name, null, 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()) .aliases(List.of( Output.of(Alias.builder().type("azure-native:network/v20190301:Policy").build()), Output.of(Alias.builder().type("azure-native:network/v20191001:Policy").build()), Output.of(Alias.builder().type("azure-native:network/v20200401:Policy").build()), Output.of(Alias.builder().type("azure-native:network/v20201101:Policy").build()), Output.of(Alias.builder().type("azure-native:network/v20210601:Policy").build()), Output.of(Alias.builder().type("azure-native:network/v20220501:Policy").build()), Output.of(Alias.builder().type("azure-native:network/v20240201:Policy").build()) )) .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 options Optional settings to control the behavior of the CustomResource. */ public static Policy get(java.lang.String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) { return new Policy(name, id, options); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy