![JAR search and dependency download from the Maven repository](/logo.png)
com.pulumi.azure.lb.kotlin.RuleArgs.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-azure-kotlin Show documentation
Show all versions of pulumi-azure-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.lb.kotlin
import com.pulumi.azure.lb.RuleArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List
import kotlin.jvm.JvmName
/**
* Manages a Load Balancer Rule.
* > **NOTE** When using this resource, the Load Balancer needs to have a FrontEnd IP Configuration 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: "West US",
* resourceGroupName: example.name,
* allocationMethod: "Static",
* });
* const exampleLoadBalancer = new azure.lb.LoadBalancer("example", {
* name: "TestLoadBalancer",
* location: "West US",
* resourceGroupName: example.name,
* frontendIpConfigurations: [{
* name: "PublicIPAddress",
* publicIpAddressId: examplePublicIp.id,
* }],
* });
* const exampleRule = new azure.lb.Rule("example", {
* loadbalancerId: exampleLoadBalancer.id,
* name: "LBRule",
* protocol: "Tcp",
* frontendPort: 3389,
* backendPort: 3389,
* frontendIpConfigurationName: "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="West US",
* resource_group_name=example.name,
* allocation_method="Static")
* example_load_balancer = azure.lb.LoadBalancer("example",
* name="TestLoadBalancer",
* location="West US",
* resource_group_name=example.name,
* frontend_ip_configurations=[{
* "name": "PublicIPAddress",
* "public_ip_address_id": example_public_ip.id,
* }])
* example_rule = azure.lb.Rule("example",
* loadbalancer_id=example_load_balancer.id,
* name="LBRule",
* protocol="Tcp",
* frontend_port=3389,
* backend_port=3389,
* frontend_ip_configuration_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 = "West US",
* ResourceGroupName = example.Name,
* AllocationMethod = "Static",
* });
* var exampleLoadBalancer = new Azure.Lb.LoadBalancer("example", new()
* {
* Name = "TestLoadBalancer",
* Location = "West US",
* ResourceGroupName = example.Name,
* FrontendIpConfigurations = new[]
* {
* new Azure.Lb.Inputs.LoadBalancerFrontendIpConfigurationArgs
* {
* Name = "PublicIPAddress",
* PublicIpAddressId = examplePublicIp.Id,
* },
* },
* });
* var exampleRule = new Azure.Lb.Rule("example", new()
* {
* LoadbalancerId = exampleLoadBalancer.Id,
* Name = "LBRule",
* Protocol = "Tcp",
* FrontendPort = 3389,
* BackendPort = 3389,
* FrontendIpConfigurationName = "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: pulumi.String("West US"),
* 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: pulumi.String("West US"),
* ResourceGroupName: example.Name,
* FrontendIpConfigurations: lb.LoadBalancerFrontendIpConfigurationArray{
* &lb.LoadBalancerFrontendIpConfigurationArgs{
* Name: pulumi.String("PublicIPAddress"),
* PublicIpAddressId: examplePublicIp.ID(),
* },
* },
* })
* if err != nil {
* return err
* }
* _, err = lb.NewRule(ctx, "example", &lb.RuleArgs{
* LoadbalancerId: exampleLoadBalancer.ID(),
* Name: pulumi.String("LBRule"),
* Protocol: pulumi.String("Tcp"),
* FrontendPort: pulumi.Int(3389),
* BackendPort: pulumi.Int(3389),
* FrontendIpConfigurationName: 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.Rule;
* import com.pulumi.azure.lb.RuleArgs;
* 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("West US")
* .resourceGroupName(example.name())
* .allocationMethod("Static")
* .build());
* var exampleLoadBalancer = new LoadBalancer("exampleLoadBalancer", LoadBalancerArgs.builder()
* .name("TestLoadBalancer")
* .location("West US")
* .resourceGroupName(example.name())
* .frontendIpConfigurations(LoadBalancerFrontendIpConfigurationArgs.builder()
* .name("PublicIPAddress")
* .publicIpAddressId(examplePublicIp.id())
* .build())
* .build());
* var exampleRule = new Rule("exampleRule", RuleArgs.builder()
* .loadbalancerId(exampleLoadBalancer.id())
* .name("LBRule")
* .protocol("Tcp")
* .frontendPort(3389)
* .backendPort(3389)
* .frontendIpConfigurationName("PublicIPAddress")
* .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: West US
* resourceGroupName: ${example.name}
* allocationMethod: Static
* exampleLoadBalancer:
* type: azure:lb:LoadBalancer
* name: example
* properties:
* name: TestLoadBalancer
* location: West US
* resourceGroupName: ${example.name}
* frontendIpConfigurations:
* - name: PublicIPAddress
* publicIpAddressId: ${examplePublicIp.id}
* exampleRule:
* type: azure:lb:Rule
* name: example
* properties:
* loadbalancerId: ${exampleLoadBalancer.id}
* name: LBRule
* protocol: Tcp
* frontendPort: 3389
* backendPort: 3389
* frontendIpConfigurationName: PublicIPAddress
* ```
*
* ## Import
* Load Balancer Rules can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:lb/rule:Rule example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/loadBalancers/lb1/loadBalancingRules/rule1
* ```
* @property backendAddressPoolIds A list of reference to a Backend Address Pool over which this Load Balancing Rule operates.
* > **NOTE:** In most cases users can only set one Backend Address Pool ID in the `backend_address_pool_ids`. Especially, when the sku of the LB is `Gateway`, users can set up to two IDs in the `backend_address_pool_ids`.
* @property backendPort The port used for internal connections on the endpoint. Possible values range between 0 and 65535, inclusive. A port of `0` means "Any Port".
* @property disableOutboundSnat Is snat enabled for this Load Balancer Rule? Default `false`.
* @property enableFloatingIp Are the Floating IPs enabled for this Load Balancer Rule? A "floating” IP is reassigned to a secondary server in case the primary server fails. Required to configure a SQL AlwaysOn Availability Group. Defaults to `false`.
* @property enableTcpReset Is TCP Reset enabled for this Load Balancer Rule?
* @property frontendIpConfigurationName The name of the frontend IP configuration to which the rule is associated.
* @property frontendPort The port for the external endpoint. Port numbers for each Rule must be unique within the Load Balancer. Possible values range between 0 and 65534, inclusive. A port of `0` means "Any Port".
* @property idleTimeoutInMinutes Specifies the idle timeout in minutes for TCP connections. Valid values are between `4` and `100` minutes. Defaults to `4` minutes.
* @property loadDistribution Specifies the load balancing distribution type to be used by the Load Balancer. Possible values are: `Default` – The load balancer is configured to use a 5 tuple hash to map traffic to available servers. `SourceIP` – The load balancer is configured to use a 2 tuple hash to map traffic to available servers. `SourceIPProtocol` – The load balancer is configured to use a 3 tuple hash to map traffic to available servers. Also known as Session Persistence, where in the Azure portal the options are called `None`, `Client IP` and `Client IP and Protocol` respectively. Defaults to `Default`.
* @property loadbalancerId The ID of the Load Balancer in which to create the Rule. Changing this forces a new resource to be created.
* @property name Specifies the name of the LB Rule. Changing this forces a new resource to be created.
* @property probeId A reference to a Probe used by this Load Balancing Rule.
* @property protocol The transport protocol for the external endpoint. Possible values are `Tcp`, `Udp` or `All`.
*/
public data class RuleArgs(
public val backendAddressPoolIds: Output>? = null,
public val backendPort: Output? = null,
public val disableOutboundSnat: Output? = null,
public val enableFloatingIp: Output? = null,
public val enableTcpReset: Output? = null,
public val frontendIpConfigurationName: Output? = null,
public val frontendPort: Output? = null,
public val idleTimeoutInMinutes: Output? = null,
public val loadDistribution: Output? = null,
public val loadbalancerId: Output? = null,
public val name: Output? = null,
public val probeId: Output? = null,
public val protocol: Output? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.azure.lb.RuleArgs = com.pulumi.azure.lb.RuleArgs.builder()
.backendAddressPoolIds(backendAddressPoolIds?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
.backendPort(backendPort?.applyValue({ args0 -> args0 }))
.disableOutboundSnat(disableOutboundSnat?.applyValue({ args0 -> args0 }))
.enableFloatingIp(enableFloatingIp?.applyValue({ args0 -> args0 }))
.enableTcpReset(enableTcpReset?.applyValue({ args0 -> args0 }))
.frontendIpConfigurationName(frontendIpConfigurationName?.applyValue({ args0 -> args0 }))
.frontendPort(frontendPort?.applyValue({ args0 -> args0 }))
.idleTimeoutInMinutes(idleTimeoutInMinutes?.applyValue({ args0 -> args0 }))
.loadDistribution(loadDistribution?.applyValue({ args0 -> args0 }))
.loadbalancerId(loadbalancerId?.applyValue({ args0 -> args0 }))
.name(name?.applyValue({ args0 -> args0 }))
.probeId(probeId?.applyValue({ args0 -> args0 }))
.protocol(protocol?.applyValue({ args0 -> args0 })).build()
}
/**
* Builder for [RuleArgs].
*/
@PulumiTagMarker
public class RuleArgsBuilder internal constructor() {
private var backendAddressPoolIds: Output>? = null
private var backendPort: Output? = null
private var disableOutboundSnat: Output? = null
private var enableFloatingIp: Output? = null
private var enableTcpReset: Output? = null
private var frontendIpConfigurationName: Output? = null
private var frontendPort: Output? = null
private var idleTimeoutInMinutes: Output? = null
private var loadDistribution: Output? = null
private var loadbalancerId: Output? = null
private var name: Output? = null
private var probeId: Output? = null
private var protocol: Output? = null
/**
* @param value A list of reference to a Backend Address Pool over which this Load Balancing Rule operates.
* > **NOTE:** In most cases users can only set one Backend Address Pool ID in the `backend_address_pool_ids`. Especially, when the sku of the LB is `Gateway`, users can set up to two IDs in the `backend_address_pool_ids`.
*/
@JvmName("druahknwqvndtyom")
public suspend fun backendAddressPoolIds(`value`: Output>) {
this.backendAddressPoolIds = value
}
@JvmName("pwpywoqfgmlukhti")
public suspend fun backendAddressPoolIds(vararg values: Output) {
this.backendAddressPoolIds = Output.all(values.asList())
}
/**
* @param values A list of reference to a Backend Address Pool over which this Load Balancing Rule operates.
* > **NOTE:** In most cases users can only set one Backend Address Pool ID in the `backend_address_pool_ids`. Especially, when the sku of the LB is `Gateway`, users can set up to two IDs in the `backend_address_pool_ids`.
*/
@JvmName("hgwhklycryaxranu")
public suspend fun backendAddressPoolIds(values: List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy