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

com.pulumi.azure.lb.kotlin.OutboundRuleArgs.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.15.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.lb.kotlin

import com.pulumi.azure.lb.OutboundRuleArgs.builder
import com.pulumi.azure.lb.kotlin.inputs.OutboundRuleFrontendIpConfigurationArgs
import com.pulumi.azure.lb.kotlin.inputs.OutboundRuleFrontendIpConfigurationArgsBuilder
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.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * Manages a Load Balancer Outbound Rule.
 * > **NOTE** When using this resource, the Load Balancer needs to have a FrontEnd IP Configuration and a Backend Address Pool Attached.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "LoadBalancerRG",
 *     location: "West Europe",
 * });
 * const examplePublicIp = new azure.network.PublicIp("example", {
 *     name: "PublicIPForLB",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     allocationMethod: "Static",
 * });
 * const exampleLoadBalancer = new azure.lb.LoadBalancer("example", {
 *     name: "TestLoadBalancer",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     frontendIpConfigurations: [{
 *         name: "PublicIPAddress",
 *         publicIpAddressId: examplePublicIp.id,
 *     }],
 * });
 * const exampleBackendAddressPool = new azure.lb.BackendAddressPool("example", {
 *     name: "example",
 *     loadbalancerId: exampleLoadBalancer.id,
 * });
 * const exampleOutboundRule = new azure.lb.OutboundRule("example", {
 *     name: "OutboundRule",
 *     loadbalancerId: exampleLoadBalancer.id,
 *     protocol: "Tcp",
 *     backendAddressPoolId: exampleBackendAddressPool.id,
 *     frontendIpConfigurations: [{
 *         name: "PublicIPAddress",
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="LoadBalancerRG",
 *     location="West Europe")
 * example_public_ip = azure.network.PublicIp("example",
 *     name="PublicIPForLB",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     allocation_method="Static")
 * example_load_balancer = azure.lb.LoadBalancer("example",
 *     name="TestLoadBalancer",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     frontend_ip_configurations=[azure.lb.LoadBalancerFrontendIpConfigurationArgs(
 *         name="PublicIPAddress",
 *         public_ip_address_id=example_public_ip.id,
 *     )])
 * example_backend_address_pool = azure.lb.BackendAddressPool("example",
 *     name="example",
 *     loadbalancer_id=example_load_balancer.id)
 * example_outbound_rule = azure.lb.OutboundRule("example",
 *     name="OutboundRule",
 *     loadbalancer_id=example_load_balancer.id,
 *     protocol="Tcp",
 *     backend_address_pool_id=example_backend_address_pool.id,
 *     frontend_ip_configurations=[azure.lb.OutboundRuleFrontendIpConfigurationArgs(
 *         name="PublicIPAddress",
 *     )])
 * ```
 * ```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 = "LoadBalancerRG",
 *         Location = "West Europe",
 *     });
 *     var examplePublicIp = new Azure.Network.PublicIp("example", new()
 *     {
 *         Name = "PublicIPForLB",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         AllocationMethod = "Static",
 *     });
 *     var exampleLoadBalancer = new Azure.Lb.LoadBalancer("example", new()
 *     {
 *         Name = "TestLoadBalancer",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         FrontendIpConfigurations = new[]
 *         {
 *             new Azure.Lb.Inputs.LoadBalancerFrontendIpConfigurationArgs
 *             {
 *                 Name = "PublicIPAddress",
 *                 PublicIpAddressId = examplePublicIp.Id,
 *             },
 *         },
 *     });
 *     var exampleBackendAddressPool = new Azure.Lb.BackendAddressPool("example", new()
 *     {
 *         Name = "example",
 *         LoadbalancerId = exampleLoadBalancer.Id,
 *     });
 *     var exampleOutboundRule = new Azure.Lb.OutboundRule("example", new()
 *     {
 *         Name = "OutboundRule",
 *         LoadbalancerId = exampleLoadBalancer.Id,
 *         Protocol = "Tcp",
 *         BackendAddressPoolId = exampleBackendAddressPool.Id,
 *         FrontendIpConfigurations = new[]
 *         {
 *             new Azure.Lb.Inputs.OutboundRuleFrontendIpConfigurationArgs
 *             {
 *                 Name = "PublicIPAddress",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/lb"
 * 	"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("LoadBalancerRG"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		examplePublicIp, err := network.NewPublicIp(ctx, "example", &network.PublicIpArgs{
 * 			Name:              pulumi.String("PublicIPForLB"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			AllocationMethod:  pulumi.String("Static"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleLoadBalancer, err := lb.NewLoadBalancer(ctx, "example", &lb.LoadBalancerArgs{
 * 			Name:              pulumi.String("TestLoadBalancer"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			FrontendIpConfigurations: lb.LoadBalancerFrontendIpConfigurationArray{
 * 				&lb.LoadBalancerFrontendIpConfigurationArgs{
 * 					Name:              pulumi.String("PublicIPAddress"),
 * 					PublicIpAddressId: examplePublicIp.ID(),
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleBackendAddressPool, err := lb.NewBackendAddressPool(ctx, "example", &lb.BackendAddressPoolArgs{
 * 			Name:           pulumi.String("example"),
 * 			LoadbalancerId: exampleLoadBalancer.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = lb.NewOutboundRule(ctx, "example", &lb.OutboundRuleArgs{
 * 			Name:                 pulumi.String("OutboundRule"),
 * 			LoadbalancerId:       exampleLoadBalancer.ID(),
 * 			Protocol:             pulumi.String("Tcp"),
 * 			BackendAddressPoolId: exampleBackendAddressPool.ID(),
 * 			FrontendIpConfigurations: lb.OutboundRuleFrontendIpConfigurationArray{
 * 				&lb.OutboundRuleFrontendIpConfigurationArgs{
 * 					Name: pulumi.String("PublicIPAddress"),
 * 				},
 * 			},
 * 		})
 * 		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.PublicIp;
 * import com.pulumi.azure.network.PublicIpArgs;
 * import com.pulumi.azure.lb.LoadBalancer;
 * import com.pulumi.azure.lb.LoadBalancerArgs;
 * import com.pulumi.azure.lb.inputs.LoadBalancerFrontendIpConfigurationArgs;
 * import com.pulumi.azure.lb.BackendAddressPool;
 * import com.pulumi.azure.lb.BackendAddressPoolArgs;
 * import com.pulumi.azure.lb.OutboundRule;
 * import com.pulumi.azure.lb.OutboundRuleArgs;
 * import com.pulumi.azure.lb.inputs.OutboundRuleFrontendIpConfigurationArgs;
 * 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("LoadBalancerRG")
 *             .location("West Europe")
 *             .build());
 *         var examplePublicIp = new PublicIp("examplePublicIp", PublicIpArgs.builder()
 *             .name("PublicIPForLB")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .allocationMethod("Static")
 *             .build());
 *         var exampleLoadBalancer = new LoadBalancer("exampleLoadBalancer", LoadBalancerArgs.builder()
 *             .name("TestLoadBalancer")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .frontendIpConfigurations(LoadBalancerFrontendIpConfigurationArgs.builder()
 *                 .name("PublicIPAddress")
 *                 .publicIpAddressId(examplePublicIp.id())
 *                 .build())
 *             .build());
 *         var exampleBackendAddressPool = new BackendAddressPool("exampleBackendAddressPool", BackendAddressPoolArgs.builder()
 *             .name("example")
 *             .loadbalancerId(exampleLoadBalancer.id())
 *             .build());
 *         var exampleOutboundRule = new OutboundRule("exampleOutboundRule", OutboundRuleArgs.builder()
 *             .name("OutboundRule")
 *             .loadbalancerId(exampleLoadBalancer.id())
 *             .protocol("Tcp")
 *             .backendAddressPoolId(exampleBackendAddressPool.id())
 *             .frontendIpConfigurations(OutboundRuleFrontendIpConfigurationArgs.builder()
 *                 .name("PublicIPAddress")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: LoadBalancerRG
 *       location: West Europe
 *   examplePublicIp:
 *     type: azure:network:PublicIp
 *     name: example
 *     properties:
 *       name: PublicIPForLB
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       allocationMethod: Static
 *   exampleLoadBalancer:
 *     type: azure:lb:LoadBalancer
 *     name: example
 *     properties:
 *       name: TestLoadBalancer
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       frontendIpConfigurations:
 *         - name: PublicIPAddress
 *           publicIpAddressId: ${examplePublicIp.id}
 *   exampleBackendAddressPool:
 *     type: azure:lb:BackendAddressPool
 *     name: example
 *     properties:
 *       name: example
 *       loadbalancerId: ${exampleLoadBalancer.id}
 *   exampleOutboundRule:
 *     type: azure:lb:OutboundRule
 *     name: example
 *     properties:
 *       name: OutboundRule
 *       loadbalancerId: ${exampleLoadBalancer.id}
 *       protocol: Tcp
 *       backendAddressPoolId: ${exampleBackendAddressPool.id}
 *       frontendIpConfigurations:
 *         - name: PublicIPAddress
 * ```
 * 
 * ## Import
 * Load Balancer Outbound Rules can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:lb/outboundRule:OutboundRule example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/loadBalancers/lb1/outboundRules/rule1
 * ```
 * @property allocatedOutboundPorts The number of outbound ports to be used for NAT. Defaults to `1024`.
 * @property backendAddressPoolId The ID of the Backend Address Pool. Outbound traffic is randomly load balanced across IPs in the backend IPs.
 * @property enableTcpReset Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This element is only used when the protocol is set to TCP.
 * @property frontendIpConfigurations One or more `frontend_ip_configuration` blocks as defined below.
 * @property idleTimeoutInMinutes The timeout for the TCP idle connection Defaults to `4`.
 * @property loadbalancerId The ID of the Load Balancer in which to create the Outbound Rule. Changing this forces a new resource to be created.
 * @property name Specifies the name of the Outbound Rule. Changing this forces a new resource to be created.
 * @property protocol The transport protocol for the external endpoint. Possible values are `Udp`, `Tcp` or `All`.
 */
public data class OutboundRuleArgs(
    public val allocatedOutboundPorts: Output? = null,
    public val backendAddressPoolId: Output? = null,
    public val enableTcpReset: Output? = null,
    public val frontendIpConfigurations: Output>? =
        null,
    public val idleTimeoutInMinutes: Output? = null,
    public val loadbalancerId: Output? = null,
    public val name: Output? = null,
    public val protocol: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.lb.OutboundRuleArgs =
        com.pulumi.azure.lb.OutboundRuleArgs.builder()
            .allocatedOutboundPorts(allocatedOutboundPorts?.applyValue({ args0 -> args0 }))
            .backendAddressPoolId(backendAddressPoolId?.applyValue({ args0 -> args0 }))
            .enableTcpReset(enableTcpReset?.applyValue({ args0 -> args0 }))
            .frontendIpConfigurations(
                frontendIpConfigurations?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 -> args0.toJava() })
                    })
                }),
            )
            .idleTimeoutInMinutes(idleTimeoutInMinutes?.applyValue({ args0 -> args0 }))
            .loadbalancerId(loadbalancerId?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .protocol(protocol?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [OutboundRuleArgs].
 */
@PulumiTagMarker
public class OutboundRuleArgsBuilder internal constructor() {
    private var allocatedOutboundPorts: Output? = null

    private var backendAddressPoolId: Output? = null

    private var enableTcpReset: Output? = null

    private var frontendIpConfigurations: Output>? =
        null

    private var idleTimeoutInMinutes: Output? = null

    private var loadbalancerId: Output? = null

    private var name: Output? = null

    private var protocol: Output? = null

    /**
     * @param value The number of outbound ports to be used for NAT. Defaults to `1024`.
     */
    @JvmName("bprvrvxnlqadptno")
    public suspend fun allocatedOutboundPorts(`value`: Output) {
        this.allocatedOutboundPorts = value
    }

    /**
     * @param value The ID of the Backend Address Pool. Outbound traffic is randomly load balanced across IPs in the backend IPs.
     */
    @JvmName("pbhrlxqsbnxliwxo")
    public suspend fun backendAddressPoolId(`value`: Output) {
        this.backendAddressPoolId = value
    }

    /**
     * @param value Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This element is only used when the protocol is set to TCP.
     */
    @JvmName("edutlbdnjppnaurk")
    public suspend fun enableTcpReset(`value`: Output) {
        this.enableTcpReset = value
    }

    /**
     * @param value One or more `frontend_ip_configuration` blocks as defined below.
     */
    @JvmName("wmwdcmlrldaxesqn")
    public suspend
    fun frontendIpConfigurations(`value`: Output>) {
        this.frontendIpConfigurations = value
    }

    @JvmName("nuvrxqeludlbcyhn")
    public suspend fun frontendIpConfigurations(
        vararg
        values: Output,
    ) {
        this.frontendIpConfigurations = Output.all(values.asList())
    }

    /**
     * @param values One or more `frontend_ip_configuration` blocks as defined below.
     */
    @JvmName("owphcirphttlagfe")
    public suspend
    fun frontendIpConfigurations(values: List>) {
        this.frontendIpConfigurations = Output.all(values)
    }

    /**
     * @param value The timeout for the TCP idle connection Defaults to `4`.
     */
    @JvmName("aufuoilsiwpmxxwd")
    public suspend fun idleTimeoutInMinutes(`value`: Output) {
        this.idleTimeoutInMinutes = value
    }

    /**
     * @param value The ID of the Load Balancer in which to create the Outbound Rule. Changing this forces a new resource to be created.
     */
    @JvmName("tkdqojeswmkypqpt")
    public suspend fun loadbalancerId(`value`: Output) {
        this.loadbalancerId = value
    }

    /**
     * @param value Specifies the name of the Outbound Rule. Changing this forces a new resource to be created.
     */
    @JvmName("mbxyssobrubcutgh")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value The transport protocol for the external endpoint. Possible values are `Udp`, `Tcp` or `All`.
     */
    @JvmName("kqyppqfxtglantsp")
    public suspend fun protocol(`value`: Output) {
        this.protocol = value
    }

    /**
     * @param value The number of outbound ports to be used for NAT. Defaults to `1024`.
     */
    @JvmName("ashhjytgindkcpdh")
    public suspend fun allocatedOutboundPorts(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.allocatedOutboundPorts = mapped
    }

    /**
     * @param value The ID of the Backend Address Pool. Outbound traffic is randomly load balanced across IPs in the backend IPs.
     */
    @JvmName("kilfscckhgaxbevl")
    public suspend fun backendAddressPoolId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.backendAddressPoolId = mapped
    }

    /**
     * @param value Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This element is only used when the protocol is set to TCP.
     */
    @JvmName("cnxkvqnpwdgxglko")
    public suspend fun enableTcpReset(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.enableTcpReset = mapped
    }

    /**
     * @param value One or more `frontend_ip_configuration` blocks as defined below.
     */
    @JvmName("fsjsfjxyesgchthd")
    public suspend
    fun frontendIpConfigurations(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.frontendIpConfigurations = mapped
    }

    /**
     * @param argument One or more `frontend_ip_configuration` blocks as defined below.
     */
    @JvmName("ocunayjgxhibegif")
    public suspend
    fun frontendIpConfigurations(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            OutboundRuleFrontendIpConfigurationArgsBuilder().applySuspend { it() }.build()
        }
        val mapped = of(toBeMapped)
        this.frontendIpConfigurations = mapped
    }

    /**
     * @param argument One or more `frontend_ip_configuration` blocks as defined below.
     */
    @JvmName("yofmpsoayjnfifwe")
    public suspend fun frontendIpConfigurations(
        vararg
        argument: suspend OutboundRuleFrontendIpConfigurationArgsBuilder.() -> Unit,
    ) {
        val toBeMapped = argument.toList().map {
            OutboundRuleFrontendIpConfigurationArgsBuilder().applySuspend { it() }.build()
        }
        val mapped = of(toBeMapped)
        this.frontendIpConfigurations = mapped
    }

    /**
     * @param argument One or more `frontend_ip_configuration` blocks as defined below.
     */
    @JvmName("cywwduxpjcavrhit")
    public suspend
    fun frontendIpConfigurations(argument: suspend OutboundRuleFrontendIpConfigurationArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(
            OutboundRuleFrontendIpConfigurationArgsBuilder().applySuspend {
                argument()
            }.build(),
        )
        val mapped = of(toBeMapped)
        this.frontendIpConfigurations = mapped
    }

    /**
     * @param values One or more `frontend_ip_configuration` blocks as defined below.
     */
    @JvmName("ywpmwulpwdqpvwts")
    public suspend fun frontendIpConfigurations(
        vararg
        values: OutboundRuleFrontendIpConfigurationArgs,
    ) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.frontendIpConfigurations = mapped
    }

    /**
     * @param value The timeout for the TCP idle connection Defaults to `4`.
     */
    @JvmName("vbeogisfcjxynvgf")
    public suspend fun idleTimeoutInMinutes(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.idleTimeoutInMinutes = mapped
    }

    /**
     * @param value The ID of the Load Balancer in which to create the Outbound Rule. Changing this forces a new resource to be created.
     */
    @JvmName("uvnuxwyqfytetluq")
    public suspend fun loadbalancerId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.loadbalancerId = mapped
    }

    /**
     * @param value Specifies the name of the Outbound Rule. Changing this forces a new resource to be created.
     */
    @JvmName("raxgxjkfepkmmkbd")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value The transport protocol for the external endpoint. Possible values are `Udp`, `Tcp` or `All`.
     */
    @JvmName("qyjalchyuijxdpmj")
    public suspend fun protocol(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.protocol = mapped
    }

    internal fun build(): OutboundRuleArgs = OutboundRuleArgs(
        allocatedOutboundPorts = allocatedOutboundPorts,
        backendAddressPoolId = backendAddressPoolId,
        enableTcpReset = enableTcpReset,
        frontendIpConfigurations = frontendIpConfigurations,
        idleTimeoutInMinutes = idleTimeoutInMinutes,
        loadbalancerId = loadbalancerId,
        name = name,
        protocol = protocol,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy