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

com.pulumi.azure.network.kotlin.FirewallPolicy.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.network.kotlin

import com.pulumi.azure.network.kotlin.outputs.FirewallPolicyDns
import com.pulumi.azure.network.kotlin.outputs.FirewallPolicyExplicitProxy
import com.pulumi.azure.network.kotlin.outputs.FirewallPolicyIdentity
import com.pulumi.azure.network.kotlin.outputs.FirewallPolicyInsights
import com.pulumi.azure.network.kotlin.outputs.FirewallPolicyIntrusionDetection
import com.pulumi.azure.network.kotlin.outputs.FirewallPolicyThreatIntelligenceAllowlist
import com.pulumi.azure.network.kotlin.outputs.FirewallPolicyTlsCertificate
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.azure.network.kotlin.outputs.FirewallPolicyDns.Companion.toKotlin as firewallPolicyDnsToKotlin
import com.pulumi.azure.network.kotlin.outputs.FirewallPolicyExplicitProxy.Companion.toKotlin as firewallPolicyExplicitProxyToKotlin
import com.pulumi.azure.network.kotlin.outputs.FirewallPolicyIdentity.Companion.toKotlin as firewallPolicyIdentityToKotlin
import com.pulumi.azure.network.kotlin.outputs.FirewallPolicyInsights.Companion.toKotlin as firewallPolicyInsightsToKotlin
import com.pulumi.azure.network.kotlin.outputs.FirewallPolicyIntrusionDetection.Companion.toKotlin as firewallPolicyIntrusionDetectionToKotlin
import com.pulumi.azure.network.kotlin.outputs.FirewallPolicyThreatIntelligenceAllowlist.Companion.toKotlin as firewallPolicyThreatIntelligenceAllowlistToKotlin
import com.pulumi.azure.network.kotlin.outputs.FirewallPolicyTlsCertificate.Companion.toKotlin as firewallPolicyTlsCertificateToKotlin

/**
 * Builder for [FirewallPolicy].
 */
@PulumiTagMarker
public class FirewallPolicyResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: FirewallPolicyArgs = FirewallPolicyArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend FirewallPolicyArgsBuilder.() -> Unit) {
        val builder = FirewallPolicyArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): FirewallPolicy {
        val builtJavaResource = com.pulumi.azure.network.FirewallPolicy(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return FirewallPolicy(builtJavaResource)
    }
}

/**
 * Manages a Firewall Policy.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleFirewallPolicy = new azure.network.FirewallPolicy("example", {
 *     name: "example-policy",
 *     resourceGroupName: example.name,
 *     location: example.location,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_firewall_policy = azure.network.FirewallPolicy("example",
 *     name="example-policy",
 *     resource_group_name=example.name,
 *     location=example.location)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var exampleFirewallPolicy = new Azure.Network.FirewallPolicy("example", new()
 *     {
 *         Name = "example-policy",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/network"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = network.NewFirewallPolicy(ctx, "example", &network.FirewallPolicyArgs{
 * 			Name:              pulumi.String("example-policy"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * 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.network.FirewallPolicy;
 * import com.pulumi.azure.network.FirewallPolicyArgs;
 * 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-resources")
 *             .location("West Europe")
 *             .build());
 *         var exampleFirewallPolicy = new FirewallPolicy("exampleFirewallPolicy", FirewallPolicyArgs.builder()
 *             .name("example-policy")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleFirewallPolicy:
 *     type: azure:network:FirewallPolicy
 *     name: example
 *     properties:
 *       name: example-policy
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 * ```
 * 
 * ## Import
 * Firewall Policies can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:network/firewallPolicy:FirewallPolicy example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/firewallPolicies/policy1
 * ```
 */
public class FirewallPolicy internal constructor(
    override val javaResource: com.pulumi.azure.network.FirewallPolicy,
) : KotlinCustomResource(javaResource, FirewallPolicyMapper) {
    /**
     * Whether enable auto learn private ip range.
     */
    public val autoLearnPrivateRangesEnabled: Output?
        get() = javaResource.autoLearnPrivateRangesEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The ID of the base Firewall Policy.
     */
    public val basePolicyId: Output?
        get() = javaResource.basePolicyId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A list of reference to child Firewall Policies of this Firewall Policy.
     */
    public val childPolicies: Output>
        get() = javaResource.childPolicies().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * A `dns` block as defined below.
     */
    public val dns: Output?
        get() = javaResource.dns().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    firewallPolicyDnsToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * A `explicit_proxy` block as defined below.
     */
    public val explicitProxy: Output?
        get() = javaResource.explicitProxy().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> firewallPolicyExplicitProxyToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * A list of references to Azure Firewalls that this Firewall Policy is associated with.
     */
    public val firewalls: Output>
        get() = javaResource.firewalls().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * An `identity` block as defined below.
     */
    public val identity: Output?
        get() = javaResource.identity().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    firewallPolicyIdentityToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * An `insights` block as defined below.
     */
    public val insights: Output?
        get() = javaResource.insights().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    firewallPolicyInsightsToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * A `intrusion_detection` block as defined below.
     */
    public val intrusionDetection: Output?
        get() = javaResource.intrusionDetection().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> firewallPolicyIntrusionDetectionToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The Azure Region where the Firewall Policy should exist. Changing this forces a new Firewall Policy to be created.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * The name which should be used for this Firewall Policy. Changing this forces a new Firewall Policy to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * A list of private IP ranges to which traffic will not be SNAT.
     */
    public val privateIpRanges: Output>?
        get() = javaResource.privateIpRanges().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * The name of the Resource Group where the Firewall Policy should exist. Changing this forces a new Firewall Policy to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * A list of references to Firewall Policy Rule Collection Groups that belongs to this Firewall Policy.
     */
    public val ruleCollectionGroups: Output>
        get() = javaResource.ruleCollectionGroups().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * The SKU Tier of the Firewall Policy. Possible values are `Standard`, `Premium` and `Basic`. Changing this forces a new Firewall Policy to be created.
     */
    public val sku: Output
        get() = javaResource.sku().applyValue({ args0 -> args0 })

    /**
     * Whether SQL Redirect traffic filtering is allowed. Enabling this flag requires no rule using ports between `11000`-`11999`.
     */
    public val sqlRedirectAllowed: Output?
        get() = javaResource.sqlRedirectAllowed().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A mapping of tags which should be assigned to the Firewall Policy.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * A `threat_intelligence_allowlist` block as defined below.
     */
    public val threatIntelligenceAllowlist: Output?
        get() = javaResource.threatIntelligenceAllowlist().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    firewallPolicyThreatIntelligenceAllowlistToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The operation mode for Threat Intelligence. Possible values are `Alert`, `Deny` and `Off`. Defaults to `Alert`.
     */
    public val threatIntelligenceMode: Output?
        get() = javaResource.threatIntelligenceMode().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A `tls_certificate` block as defined below.
     */
    public val tlsCertificate: Output?
        get() = javaResource.tlsCertificate().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> firewallPolicyTlsCertificateToKotlin(args0) })
            }).orElse(null)
        })
}

public object FirewallPolicyMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.network.FirewallPolicy::class == javaResource::class

    override fun map(javaResource: Resource): FirewallPolicy = FirewallPolicy(
        javaResource as
            com.pulumi.azure.network.FirewallPolicy,
    )
}

/**
 * @see [FirewallPolicy].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [FirewallPolicy].
 */
public suspend fun firewallPolicy(
    name: String,
    block: suspend FirewallPolicyResourceBuilder.() -> Unit,
): FirewallPolicy {
    val builder = FirewallPolicyResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [FirewallPolicy].
 * @param name The _unique_ name of the resulting resource.
 */
public fun firewallPolicy(name: String): FirewallPolicy {
    val builder = FirewallPolicyResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy