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

com.pulumi.azure.network.kotlin.LocalNetworkGateway.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.14.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.network.kotlin

import com.pulumi.azure.network.kotlin.outputs.LocalNetworkGatewayBgpSettings
import com.pulumi.azure.network.kotlin.outputs.LocalNetworkGatewayBgpSettings.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
import kotlin.collections.Map

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

    public var args: LocalNetworkGatewayArgs = LocalNetworkGatewayArgs()

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

/**
 * Manages a local network gateway connection over which specific connections can be configured.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "localNetworkGWTest",
 *     location: "West Europe",
 * });
 * const home = new azure.network.LocalNetworkGateway("home", {
 *     name: "backHome",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     gatewayAddress: "12.13.14.15",
 *     addressSpaces: ["10.0.0.0/16"],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="localNetworkGWTest",
 *     location="West Europe")
 * home = azure.network.LocalNetworkGateway("home",
 *     name="backHome",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     gateway_address="12.13.14.15",
 *     address_spaces=["10.0.0.0/16"])
 * ```
 * ```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 = "localNetworkGWTest",
 *         Location = "West Europe",
 *     });
 *     var home = new Azure.Network.LocalNetworkGateway("home", new()
 *     {
 *         Name = "backHome",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         GatewayAddress = "12.13.14.15",
 *         AddressSpaces = new[]
 *         {
 *             "10.0.0.0/16",
 *         },
 *     });
 * });
 * ```
 * ```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("localNetworkGWTest"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = network.NewLocalNetworkGateway(ctx, "home", &network.LocalNetworkGatewayArgs{
 * 			Name:              pulumi.String("backHome"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 			GatewayAddress:    pulumi.String("12.13.14.15"),
 * 			AddressSpaces: pulumi.StringArray{
 * 				pulumi.String("10.0.0.0/16"),
 * 			},
 * 		})
 * 		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.LocalNetworkGateway;
 * import com.pulumi.azure.network.LocalNetworkGatewayArgs;
 * 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("localNetworkGWTest")
 *             .location("West Europe")
 *             .build());
 *         var home = new LocalNetworkGateway("home", LocalNetworkGatewayArgs.builder()
 *             .name("backHome")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .gatewayAddress("12.13.14.15")
 *             .addressSpaces("10.0.0.0/16")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: localNetworkGWTest
 *       location: West Europe
 *   home:
 *     type: azure:network:LocalNetworkGateway
 *     properties:
 *       name: backHome
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       gatewayAddress: 12.13.14.15
 *       addressSpaces:
 *         - 10.0.0.0/16
 * ```
 * 
 * ## Import
 * Local Network Gateways can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:network/localNetworkGateway:LocalNetworkGateway lng1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/localNetworkGateways/lng1
 * ```
 */
public class LocalNetworkGateway internal constructor(
    override val javaResource: com.pulumi.azure.network.LocalNetworkGateway,
) : KotlinCustomResource(javaResource, LocalNetworkGatewayMapper) {
    /**
     * The list of string CIDRs representing the address spaces the gateway exposes.
     */
    public val addressSpaces: Output>?
        get() = javaResource.addressSpaces().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * A `bgp_settings` block as defined below containing the Local Network Gateway's BGP speaker settings.
     */
    public val bgpSettings: Output?
        get() = javaResource.bgpSettings().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    toKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The gateway IP address to connect with.
     */
    public val gatewayAddress: Output?
        get() = javaResource.gatewayAddress().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The gateway FQDN to connect with.
     * > **NOTE:** Either `gateway_address` or `gateway_fqdn` should be specified.
     */
    public val gatewayFqdn: Output?
        get() = javaResource.gatewayFqdn().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The location/region where the local network gateway is created. Changing this forces a new resource to be created.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * The name of the local network gateway. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The name of the resource group in which to create the local network gateway. Changing this forces a new resource to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * A mapping of tags to assign to the resource.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })
}

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

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy