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

com.pulumi.azurenative.network.kotlin.NatRuleArgs.kt Maven / Gradle / Ivy

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

package com.pulumi.azurenative.network.kotlin

import com.pulumi.azurenative.network.NatRuleArgs.builder
import com.pulumi.azurenative.network.kotlin.enums.VpnNatRuleMode
import com.pulumi.azurenative.network.kotlin.enums.VpnNatRuleType
import com.pulumi.azurenative.network.kotlin.inputs.VpnNatRuleMappingArgs
import com.pulumi.azurenative.network.kotlin.inputs.VpnNatRuleMappingArgsBuilder
import com.pulumi.core.Either
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * VpnGatewayNatRule Resource.
 * Azure REST API version: 2023-02-01. Prior API version in Azure Native 1.x: 2020-11-01.
 * Other available API versions: 2023-04-01, 2023-05-01, 2023-06-01, 2023-09-01, 2023-11-01, 2024-01-01.
 * ## Example Usage
 * ### NatRulePut
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using AzureNative = Pulumi.AzureNative;
 * return await Deployment.RunAsync(() =>
 * {
 *     var natRule = new AzureNative.Network.NatRule("natRule", new()
 *     {
 *         ExternalMappings = new[]
 *         {
 *             new AzureNative.Network.Inputs.VpnNatRuleMappingArgs
 *             {
 *                 AddressSpace = "192.168.21.0/24",
 *             },
 *         },
 *         GatewayName = "gateway1",
 *         InternalMappings = new[]
 *         {
 *             new AzureNative.Network.Inputs.VpnNatRuleMappingArgs
 *             {
 *                 AddressSpace = "10.4.0.0/24",
 *             },
 *         },
 *         IpConfigurationId = "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/cloudnet1-VNG/ipConfigurations/default",
 *         Mode = AzureNative.Network.VpnNatRuleMode.EgressSnat,
 *         NatRuleName = "natRule1",
 *         ResourceGroupName = "rg1",
 *         Type = AzureNative.Network.VpnNatRuleType.Static,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	network "github.com/pulumi/pulumi-azure-native-sdk/network/v2"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := network.NewNatRule(ctx, "natRule", &network.NatRuleArgs{
 * 			ExternalMappings: network.VpnNatRuleMappingArray{
 * 				&network.VpnNatRuleMappingArgs{
 * 					AddressSpace: pulumi.String("192.168.21.0/24"),
 * 				},
 * 			},
 * 			GatewayName: pulumi.String("gateway1"),
 * 			InternalMappings: network.VpnNatRuleMappingArray{
 * 				&network.VpnNatRuleMappingArgs{
 * 					AddressSpace: pulumi.String("10.4.0.0/24"),
 * 				},
 * 			},
 * 			IpConfigurationId: pulumi.String("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/cloudnet1-VNG/ipConfigurations/default"),
 * 			Mode:              pulumi.String(network.VpnNatRuleModeEgressSnat),
 * 			NatRuleName:       pulumi.String("natRule1"),
 * 			ResourceGroupName: pulumi.String("rg1"),
 * 			Type:              pulumi.String(network.VpnNatRuleTypeStatic),
 * 		})
 * 		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.azurenative.network.NatRule;
 * import com.pulumi.azurenative.network.NatRuleArgs;
 * import com.pulumi.azurenative.network.inputs.VpnNatRuleMappingArgs;
 * 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 natRule = new NatRule("natRule", NatRuleArgs.builder()
 *             .externalMappings(VpnNatRuleMappingArgs.builder()
 *                 .addressSpace("192.168.21.0/24")
 *                 .build())
 *             .gatewayName("gateway1")
 *             .internalMappings(VpnNatRuleMappingArgs.builder()
 *                 .addressSpace("10.4.0.0/24")
 *                 .build())
 *             .ipConfigurationId("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/cloudnet1-VNG/ipConfigurations/default")
 *             .mode("EgressSnat")
 *             .natRuleName("natRule1")
 *             .resourceGroupName("rg1")
 *             .type("Static")
 *             .build());
 *     }
 * }
 * ```
 * ## Import
 * An existing resource can be imported using its type token, name, and identifier, e.g.
 * ```sh
 * $ pulumi import azure-native:network:NatRule natRule1 /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/natRules/{natRuleName}
 * ```
 * @property externalMappings The private IP address external mapping for NAT.
 * @property gatewayName The name of the gateway.
 * @property id Resource ID.
 * @property internalMappings The private IP address internal mapping for NAT.
 * @property ipConfigurationId The IP Configuration ID this NAT rule applies to.
 * @property mode The Source NAT direction of a VPN NAT.
 * @property name The name of the resource that is unique within a resource group. This name can be used to access the resource.
 * @property natRuleName The name of the nat rule.
 * @property resourceGroupName The resource group name of the VpnGateway.
 * @property type The type of NAT rule for VPN NAT.
 */
public data class NatRuleArgs(
    public val externalMappings: Output>? = null,
    public val gatewayName: Output? = null,
    public val id: Output? = null,
    public val internalMappings: Output>? = null,
    public val ipConfigurationId: Output? = null,
    public val mode: Output>? = null,
    public val name: Output? = null,
    public val natRuleName: Output? = null,
    public val resourceGroupName: Output? = null,
    public val type: Output>? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azurenative.network.NatRuleArgs =
        com.pulumi.azurenative.network.NatRuleArgs.builder()
            .externalMappings(
                externalMappings?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            )
            .gatewayName(gatewayName?.applyValue({ args0 -> args0 }))
            .id(id?.applyValue({ args0 -> args0 }))
            .internalMappings(
                internalMappings?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            )
            .ipConfigurationId(ipConfigurationId?.applyValue({ args0 -> args0 }))
            .mode(
                mode?.applyValue({ args0 ->
                    args0.transform({ args0 -> args0 }, { args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            )
            .name(name?.applyValue({ args0 -> args0 }))
            .natRuleName(natRuleName?.applyValue({ args0 -> args0 }))
            .resourceGroupName(resourceGroupName?.applyValue({ args0 -> args0 }))
            .type(
                type?.applyValue({ args0 ->
                    args0.transform({ args0 -> args0 }, { args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            ).build()
}

/**
 * Builder for [NatRuleArgs].
 */
@PulumiTagMarker
public class NatRuleArgsBuilder internal constructor() {
    private var externalMappings: Output>? = null

    private var gatewayName: Output? = null

    private var id: Output? = null

    private var internalMappings: Output>? = null

    private var ipConfigurationId: Output? = null

    private var mode: Output>? = null

    private var name: Output? = null

    private var natRuleName: Output? = null

    private var resourceGroupName: Output? = null

    private var type: Output>? = null

    /**
     * @param value The private IP address external mapping for NAT.
     */
    @JvmName("ivfcagxegkasgcjx")
    public suspend fun externalMappings(`value`: Output>) {
        this.externalMappings = value
    }

    @JvmName("ifcksnhfhockkpwd")
    public suspend fun externalMappings(vararg values: Output) {
        this.externalMappings = Output.all(values.asList())
    }

    /**
     * @param values The private IP address external mapping for NAT.
     */
    @JvmName("iouiymkgmnlxjecd")
    public suspend fun externalMappings(values: List>) {
        this.externalMappings = Output.all(values)
    }

    /**
     * @param value The name of the gateway.
     */
    @JvmName("bhtjbtejikvbwmfp")
    public suspend fun gatewayName(`value`: Output) {
        this.gatewayName = value
    }

    /**
     * @param value Resource ID.
     */
    @JvmName("xymyqysokiegugdg")
    public suspend fun id(`value`: Output) {
        this.id = value
    }

    /**
     * @param value The private IP address internal mapping for NAT.
     */
    @JvmName("renoeyhcqrkkiuwb")
    public suspend fun internalMappings(`value`: Output>) {
        this.internalMappings = value
    }

    @JvmName("sedlkftceqactidp")
    public suspend fun internalMappings(vararg values: Output) {
        this.internalMappings = Output.all(values.asList())
    }

    /**
     * @param values The private IP address internal mapping for NAT.
     */
    @JvmName("cqobctmvoygmivij")
    public suspend fun internalMappings(values: List>) {
        this.internalMappings = Output.all(values)
    }

    /**
     * @param value The IP Configuration ID this NAT rule applies to.
     */
    @JvmName("cuyigxuconpokwfn")
    public suspend fun ipConfigurationId(`value`: Output) {
        this.ipConfigurationId = value
    }

    /**
     * @param value The Source NAT direction of a VPN NAT.
     */
    @JvmName("extoopwyfowkhxur")
    public suspend fun mode(`value`: Output>) {
        this.mode = value
    }

    /**
     * @param value The name of the resource that is unique within a resource group. This name can be used to access the resource.
     */
    @JvmName("oqolrxoldufboxqc")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value The name of the nat rule.
     */
    @JvmName("ircgtyflliywuhes")
    public suspend fun natRuleName(`value`: Output) {
        this.natRuleName = value
    }

    /**
     * @param value The resource group name of the VpnGateway.
     */
    @JvmName("fxwuoblsykshlfqu")
    public suspend fun resourceGroupName(`value`: Output) {
        this.resourceGroupName = value
    }

    /**
     * @param value The type of NAT rule for VPN NAT.
     */
    @JvmName("ckqohmfjtglwlnuh")
    public suspend fun type(`value`: Output>) {
        this.type = value
    }

    /**
     * @param value The private IP address external mapping for NAT.
     */
    @JvmName("qdyumtoxpqcclwbg")
    public suspend fun externalMappings(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.externalMappings = mapped
    }

    /**
     * @param argument The private IP address external mapping for NAT.
     */
    @JvmName("tvqfbngggcgibfcg")
    public suspend fun externalMappings(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            VpnNatRuleMappingArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.externalMappings = mapped
    }

    /**
     * @param argument The private IP address external mapping for NAT.
     */
    @JvmName("oytivitokyragjvx")
    public suspend fun externalMappings(vararg argument: suspend VpnNatRuleMappingArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            VpnNatRuleMappingArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.externalMappings = mapped
    }

    /**
     * @param argument The private IP address external mapping for NAT.
     */
    @JvmName("wwwbbwfdetcarydt")
    public suspend fun externalMappings(argument: suspend VpnNatRuleMappingArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(VpnNatRuleMappingArgsBuilder().applySuspend { argument() }.build())
        val mapped = of(toBeMapped)
        this.externalMappings = mapped
    }

    /**
     * @param values The private IP address external mapping for NAT.
     */
    @JvmName("imlkkldlfrgtoyns")
    public suspend fun externalMappings(vararg values: VpnNatRuleMappingArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.externalMappings = mapped
    }

    /**
     * @param value The name of the gateway.
     */
    @JvmName("vyllqajwifomaghg")
    public suspend fun gatewayName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.gatewayName = mapped
    }

    /**
     * @param value Resource ID.
     */
    @JvmName("fuyhxjvmwapebkvb")
    public suspend fun id(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.id = mapped
    }

    /**
     * @param value The private IP address internal mapping for NAT.
     */
    @JvmName("rhsuxwccnnklacis")
    public suspend fun internalMappings(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.internalMappings = mapped
    }

    /**
     * @param argument The private IP address internal mapping for NAT.
     */
    @JvmName("tbspniveeqgpvogb")
    public suspend fun internalMappings(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            VpnNatRuleMappingArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.internalMappings = mapped
    }

    /**
     * @param argument The private IP address internal mapping for NAT.
     */
    @JvmName("prdwvwqlupkwasuo")
    public suspend fun internalMappings(vararg argument: suspend VpnNatRuleMappingArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            VpnNatRuleMappingArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.internalMappings = mapped
    }

    /**
     * @param argument The private IP address internal mapping for NAT.
     */
    @JvmName("nurqhqkjbxcopmkg")
    public suspend fun internalMappings(argument: suspend VpnNatRuleMappingArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(VpnNatRuleMappingArgsBuilder().applySuspend { argument() }.build())
        val mapped = of(toBeMapped)
        this.internalMappings = mapped
    }

    /**
     * @param values The private IP address internal mapping for NAT.
     */
    @JvmName("cmbgeucblivfjoby")
    public suspend fun internalMappings(vararg values: VpnNatRuleMappingArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.internalMappings = mapped
    }

    /**
     * @param value The IP Configuration ID this NAT rule applies to.
     */
    @JvmName("hjktqpmemnmwddgb")
    public suspend fun ipConfigurationId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.ipConfigurationId = mapped
    }

    /**
     * @param value The Source NAT direction of a VPN NAT.
     */
    @JvmName("qprwsncptnuitcvh")
    public suspend fun mode(`value`: Either?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.mode = mapped
    }

    /**
     * @param value The Source NAT direction of a VPN NAT.
     */
    @JvmName("gmxcmrgkduppbkbm")
    public fun mode(`value`: String) {
        val toBeMapped = Either.ofLeft(value)
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.mode = mapped
    }

    /**
     * @param value The Source NAT direction of a VPN NAT.
     */
    @JvmName("cnnlpkuyyyufjmjk")
    public fun mode(`value`: VpnNatRuleMode) {
        val toBeMapped = Either.ofRight(value)
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.mode = mapped
    }

    /**
     * @param value The name of the resource that is unique within a resource group. This name can be used to access the resource.
     */
    @JvmName("nsneemthdyaapbbl")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value The name of the nat rule.
     */
    @JvmName("cssqbqpkhkvnammx")
    public suspend fun natRuleName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.natRuleName = mapped
    }

    /**
     * @param value The resource group name of the VpnGateway.
     */
    @JvmName("cqpanycrnvnjbkpd")
    public suspend fun resourceGroupName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resourceGroupName = mapped
    }

    /**
     * @param value The type of NAT rule for VPN NAT.
     */
    @JvmName("nijuntbagujfcnnd")
    public suspend fun type(`value`: Either?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.type = mapped
    }

    /**
     * @param value The type of NAT rule for VPN NAT.
     */
    @JvmName("oqhritchgckgqqko")
    public fun type(`value`: String) {
        val toBeMapped = Either.ofLeft(value)
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.type = mapped
    }

    /**
     * @param value The type of NAT rule for VPN NAT.
     */
    @JvmName("amrjqmlrqtqoqgfl")
    public fun type(`value`: VpnNatRuleType) {
        val toBeMapped = Either.ofRight(value)
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.type = mapped
    }

    internal fun build(): NatRuleArgs = NatRuleArgs(
        externalMappings = externalMappings,
        gatewayName = gatewayName,
        id = id,
        internalMappings = internalMappings,
        ipConfigurationId = ipConfigurationId,
        mode = mode,
        name = name,
        natRuleName = natRuleName,
        resourceGroupName = resourceGroupName,
        type = type,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy