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

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

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

package com.pulumi.azure.lb.kotlin

import com.pulumi.azure.lb.kotlin.outputs.BackendAddressPoolAddressInboundNatRulePortMapping
import com.pulumi.azure.lb.kotlin.outputs.BackendAddressPoolAddressInboundNatRulePortMapping.Companion.toKotlin
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

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

    public var args: BackendAddressPoolAddressArgs = BackendAddressPoolAddressArgs()

    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 BackendAddressPoolAddressArgsBuilder.() -> Unit) {
        val builder = BackendAddressPoolAddressArgsBuilder()
        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(): BackendAddressPoolAddress {
        val builtJavaResource = com.pulumi.azure.lb.BackendAddressPoolAddress(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return BackendAddressPoolAddress(builtJavaResource)
    }
}

/**
 * Manages a Backend Address within a Backend Address Pool.
 * > **Note:** Backend Addresses can only be added to a `Standard` SKU Load Balancer.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = azure.network.getVirtualNetwork({
 *     name: "example-network",
 *     resourceGroupName: "example-resources",
 * });
 * const exampleGetLB = azure.lb.getLB({
 *     name: "example-lb",
 *     resourceGroupName: "example-resources",
 * });
 * const exampleGetBackendAddressPool = exampleGetLB.then(exampleGetLB => azure.lb.getBackendAddressPool({
 *     name: "first",
 *     loadbalancerId: exampleGetLB.id,
 * }));
 * const exampleBackendAddressPoolAddress = new azure.lb.BackendAddressPoolAddress("example", {
 *     name: "example",
 *     backendAddressPoolId: exampleGetBackendAddressPool.then(exampleGetBackendAddressPool => exampleGetBackendAddressPool.id),
 *     virtualNetworkId: example.then(example => example.id),
 *     ipAddress: "10.0.0.1",
 * });
 * const backend-pool-cr = exampleGetLB.then(exampleGetLB => azure.lb.getBackendAddressPool({
 *     name: "globalLBBackendPool",
 *     loadbalancerId: exampleGetLB.id,
 * }));
 * const example_1 = new azure.lb.BackendAddressPoolAddress("example-1", {
 *     name: "address1",
 *     backendAddressPoolId: backend_pool_cr.then(backend_pool_cr => backend_pool_cr.id),
 *     backendAddressIpConfigurationId: backend_lb_R1.frontendIpConfiguration[0].id,
 * });
 * const example_2 = new azure.lb.BackendAddressPoolAddress("example-2", {
 *     name: "address2",
 *     backendAddressPoolId: backend_pool_cr.then(backend_pool_cr => backend_pool_cr.id),
 *     backendAddressIpConfigurationId: backend_lb_R2.frontendIpConfiguration[0].id,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.network.get_virtual_network(name="example-network",
 *     resource_group_name="example-resources")
 * example_get_lb = azure.lb.get_lb(name="example-lb",
 *     resource_group_name="example-resources")
 * example_get_backend_address_pool = azure.lb.get_backend_address_pool(name="first",
 *     loadbalancer_id=example_get_lb.id)
 * example_backend_address_pool_address = azure.lb.BackendAddressPoolAddress("example",
 *     name="example",
 *     backend_address_pool_id=example_get_backend_address_pool.id,
 *     virtual_network_id=example.id,
 *     ip_address="10.0.0.1")
 * backend_pool_cr = azure.lb.get_backend_address_pool(name="globalLBBackendPool",
 *     loadbalancer_id=example_get_lb.id)
 * example_1 = azure.lb.BackendAddressPoolAddress("example-1",
 *     name="address1",
 *     backend_address_pool_id=backend_pool_cr.id,
 *     backend_address_ip_configuration_id=backend_lb__r1["frontendIpConfiguration"][0]["id"])
 * example_2 = azure.lb.BackendAddressPoolAddress("example-2",
 *     name="address2",
 *     backend_address_pool_id=backend_pool_cr.id,
 *     backend_address_ip_configuration_id=backend_lb__r2["frontendIpConfiguration"][0]["id"])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = Azure.Network.GetVirtualNetwork.Invoke(new()
 *     {
 *         Name = "example-network",
 *         ResourceGroupName = "example-resources",
 *     });
 *     var exampleGetLB = Azure.Lb.GetLB.Invoke(new()
 *     {
 *         Name = "example-lb",
 *         ResourceGroupName = "example-resources",
 *     });
 *     var exampleGetBackendAddressPool = Azure.Lb.GetBackendAddressPool.Invoke(new()
 *     {
 *         Name = "first",
 *         LoadbalancerId = exampleGetLB.Apply(getLBResult => getLBResult.Id),
 *     });
 *     var exampleBackendAddressPoolAddress = new Azure.Lb.BackendAddressPoolAddress("example", new()
 *     {
 *         Name = "example",
 *         BackendAddressPoolId = exampleGetBackendAddressPool.Apply(getBackendAddressPoolResult => getBackendAddressPoolResult.Id),
 *         VirtualNetworkId = example.Apply(getVirtualNetworkResult => getVirtualNetworkResult.Id),
 *         IpAddress = "10.0.0.1",
 *     });
 *     var backend_pool_cr = Azure.Lb.GetBackendAddressPool.Invoke(new()
 *     {
 *         Name = "globalLBBackendPool",
 *         LoadbalancerId = exampleGetLB.Apply(getLBResult => getLBResult.Id),
 *     });
 *     var example_1 = new Azure.Lb.BackendAddressPoolAddress("example-1", new()
 *     {
 *         Name = "address1",
 *         BackendAddressPoolId = backend_pool_cr.Apply(backend_pool_cr => backend_pool_cr.Apply(getBackendAddressPoolResult => getBackendAddressPoolResult.Id)),
 *         BackendAddressIpConfigurationId = backend_lb_R1.FrontendIpConfiguration[0].Id,
 *     });
 *     var example_2 = new Azure.Lb.BackendAddressPoolAddress("example-2", new()
 *     {
 *         Name = "address2",
 *         BackendAddressPoolId = backend_pool_cr.Apply(backend_pool_cr => backend_pool_cr.Apply(getBackendAddressPoolResult => getBackendAddressPoolResult.Id)),
 *         BackendAddressIpConfigurationId = backend_lb_R2.FrontendIpConfiguration[0].Id,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"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 := network.LookupVirtualNetwork(ctx, &network.LookupVirtualNetworkArgs{
 * 			Name:              "example-network",
 * 			ResourceGroupName: "example-resources",
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleGetLB, err := lb.GetLB(ctx, &lb.GetLBArgs{
 * 			Name:              "example-lb",
 * 			ResourceGroupName: "example-resources",
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleGetBackendAddressPool, err := lb.LookupBackendAddressPool(ctx, &lb.LookupBackendAddressPoolArgs{
 * 			Name:           "first",
 * 			LoadbalancerId: exampleGetLB.Id,
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = lb.NewBackendAddressPoolAddress(ctx, "example", &lb.BackendAddressPoolAddressArgs{
 * 			Name:                 pulumi.String("example"),
 * 			BackendAddressPoolId: pulumi.String(exampleGetBackendAddressPool.Id),
 * 			VirtualNetworkId:     pulumi.String(example.Id),
 * 			IpAddress:            pulumi.String("10.0.0.1"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		backend_pool_cr, err := lb.LookupBackendAddressPool(ctx, &lb.LookupBackendAddressPoolArgs{
 * 			Name:           "globalLBBackendPool",
 * 			LoadbalancerId: exampleGetLB.Id,
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = lb.NewBackendAddressPoolAddress(ctx, "example-1", &lb.BackendAddressPoolAddressArgs{
 * 			Name:                            pulumi.String("address1"),
 * 			BackendAddressPoolId:            pulumi.String(backend_pool_cr.Id),
 * 			BackendAddressIpConfigurationId: pulumi.Any(backend_lb_R1.FrontendIpConfiguration[0].Id),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = lb.NewBackendAddressPoolAddress(ctx, "example-2", &lb.BackendAddressPoolAddressArgs{
 * 			Name:                            pulumi.String("address2"),
 * 			BackendAddressPoolId:            pulumi.String(backend_pool_cr.Id),
 * 			BackendAddressIpConfigurationId: pulumi.Any(backend_lb_R2.FrontendIpConfiguration[0].Id),
 * 		})
 * 		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.network.NetworkFunctions;
 * import com.pulumi.azure.network.inputs.GetVirtualNetworkArgs;
 * import com.pulumi.azure.lb.LbFunctions;
 * import com.pulumi.azure.lb.inputs.GetLBArgs;
 * import com.pulumi.azure.lb.inputs.GetBackendAddressPoolArgs;
 * import com.pulumi.azure.lb.BackendAddressPoolAddress;
 * import com.pulumi.azure.lb.BackendAddressPoolAddressArgs;
 * 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) {
 *         final var example = NetworkFunctions.getVirtualNetwork(GetVirtualNetworkArgs.builder()
 *             .name("example-network")
 *             .resourceGroupName("example-resources")
 *             .build());
 *         final var exampleGetLB = LbFunctions.getLB(GetLBArgs.builder()
 *             .name("example-lb")
 *             .resourceGroupName("example-resources")
 *             .build());
 *         final var exampleGetBackendAddressPool = LbFunctions.getBackendAddressPool(GetBackendAddressPoolArgs.builder()
 *             .name("first")
 *             .loadbalancerId(exampleGetLB.applyValue(getLBResult -> getLBResult.id()))
 *             .build());
 *         var exampleBackendAddressPoolAddress = new BackendAddressPoolAddress("exampleBackendAddressPoolAddress", BackendAddressPoolAddressArgs.builder()
 *             .name("example")
 *             .backendAddressPoolId(exampleGetBackendAddressPool.applyValue(getBackendAddressPoolResult -> getBackendAddressPoolResult.id()))
 *             .virtualNetworkId(example.applyValue(getVirtualNetworkResult -> getVirtualNetworkResult.id()))
 *             .ipAddress("10.0.0.1")
 *             .build());
 *         final var backend-pool-cr = LbFunctions.getBackendAddressPool(GetBackendAddressPoolArgs.builder()
 *             .name("globalLBBackendPool")
 *             .loadbalancerId(exampleGetLB.applyValue(getLBResult -> getLBResult.id()))
 *             .build());
 *         var example_1 = new BackendAddressPoolAddress("example-1", BackendAddressPoolAddressArgs.builder()
 *             .name("address1")
 *             .backendAddressPoolId(backend_pool_cr.id())
 *             .backendAddressIpConfigurationId(backend_lb_R1.frontendIpConfiguration()[0].id())
 *             .build());
 *         var example_2 = new BackendAddressPoolAddress("example-2", BackendAddressPoolAddressArgs.builder()
 *             .name("address2")
 *             .backendAddressPoolId(backend_pool_cr.id())
 *             .backendAddressIpConfigurationId(backend_lb_R2.frontendIpConfiguration()[0].id())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   exampleBackendAddressPoolAddress:
 *     type: azure:lb:BackendAddressPoolAddress
 *     name: example
 *     properties:
 *       name: example
 *       backendAddressPoolId: ${exampleGetBackendAddressPool.id}
 *       virtualNetworkId: ${example.id}
 *       ipAddress: 10.0.0.1
 *   example-1:
 *     type: azure:lb:BackendAddressPoolAddress
 *     properties:
 *       name: address1
 *       backendAddressPoolId: ${["backend-pool-cr"].id}
 *       backendAddressIpConfigurationId: ${["backend-lb-R1"].frontendIpConfiguration[0].id}
 *   example-2:
 *     type: azure:lb:BackendAddressPoolAddress
 *     properties:
 *       name: address2
 *       backendAddressPoolId: ${["backend-pool-cr"].id}
 *       backendAddressIpConfigurationId: ${["backend-lb-R2"].frontendIpConfiguration[0].id}
 * variables:
 *   example:
 *     fn::invoke:
 *       Function: azure:network:getVirtualNetwork
 *       Arguments:
 *         name: example-network
 *         resourceGroupName: example-resources
 *   exampleGetLB:
 *     fn::invoke:
 *       Function: azure:lb:getLB
 *       Arguments:
 *         name: example-lb
 *         resourceGroupName: example-resources
 *   exampleGetBackendAddressPool:
 *     fn::invoke:
 *       Function: azure:lb:getBackendAddressPool
 *       Arguments:
 *         name: first
 *         loadbalancerId: ${exampleGetLB.id}
 *   backend-pool-cr:
 *     fn::invoke:
 *       Function: azure:lb:getBackendAddressPool
 *       Arguments:
 *         name: globalLBBackendPool
 *         loadbalancerId: ${exampleGetLB.id}
 * ```
 * 
 * ## Import
 * Backend Address Pool Addresses can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:lb/backendAddressPoolAddress:BackendAddressPoolAddress example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/loadBalancers/loadBalancer1/backendAddressPools/backendAddressPool1/addresses/address1
 * ```
 */
public class BackendAddressPoolAddress internal constructor(
    override val javaResource: com.pulumi.azure.lb.BackendAddressPoolAddress,
) : KotlinCustomResource(javaResource, BackendAddressPoolAddressMapper) {
    /**
     * The ip config ID of the regional load balancer that's added to the global load balancer's backend address pool.
     * > **Note:** For cross-region load balancer, please append the name of the load balancers, virtual machines, and other resources in each region with a -R1 and -R2.
     */
    public val backendAddressIpConfigurationId: Output?
        get() = javaResource.backendAddressIpConfigurationId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The ID of the Backend Address Pool. Changing this forces a new Backend Address Pool Address to be created.
     */
    public val backendAddressPoolId: Output
        get() = javaResource.backendAddressPoolId().applyValue({ args0 -> args0 })

    /**
     * A list of `inbound_nat_rule_port_mapping` block as defined below.
     */
    public val inboundNatRulePortMappings:
        Output>
        get() = javaResource.inboundNatRulePortMappings().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> toKotlin(args0) })
            })
        })

    /**
     * The Static IP Address which should be allocated to this Backend Address Pool.
     */
    public val ipAddress: Output?
        get() = javaResource.ipAddress().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

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

    /**
     * The ID of the Virtual Network within which the Backend Address Pool should exist.
     */
    public val virtualNetworkId: Output?
        get() = javaResource.virtualNetworkId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

public object BackendAddressPoolAddressMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.lb.BackendAddressPoolAddress::class == javaResource::class

    override fun map(javaResource: Resource): BackendAddressPoolAddress =
        BackendAddressPoolAddress(javaResource as com.pulumi.azure.lb.BackendAddressPoolAddress)
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy