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

com.pulumi.azure.network.kotlin.RouteServer.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.network.kotlin

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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map

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

    public var args: RouteServerArgs = RouteServerArgs()

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

/**
 * Manages an Azure Route Server
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleVirtualNetwork = new azure.network.VirtualNetwork("example", {
 *     name: "example-vn",
 *     addressSpaces: ["10.0.0.0/16"],
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     tags: {
 *         environment: "Production",
 *     },
 * });
 * const exampleSubnet = new azure.network.Subnet("example", {
 *     name: "RouteServerSubnet",
 *     virtualNetworkName: exampleVirtualNetwork.name,
 *     resourceGroupName: example.name,
 *     addressPrefixes: ["10.0.1.0/24"],
 * });
 * const examplePublicIp = new azure.network.PublicIp("example", {
 *     name: "example-pip",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     allocationMethod: "Static",
 *     sku: "Standard",
 * });
 * const exampleRouteServer = new azure.network.RouteServer("example", {
 *     name: "example-routerserver",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     sku: "Standard",
 *     publicIpAddressId: examplePublicIp.id,
 *     subnetId: exampleSubnet.id,
 *     branchToBranchTrafficEnabled: true,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_virtual_network = azure.network.VirtualNetwork("example",
 *     name="example-vn",
 *     address_spaces=["10.0.0.0/16"],
 *     resource_group_name=example.name,
 *     location=example.location,
 *     tags={
 *         "environment": "Production",
 *     })
 * example_subnet = azure.network.Subnet("example",
 *     name="RouteServerSubnet",
 *     virtual_network_name=example_virtual_network.name,
 *     resource_group_name=example.name,
 *     address_prefixes=["10.0.1.0/24"])
 * example_public_ip = azure.network.PublicIp("example",
 *     name="example-pip",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     allocation_method="Static",
 *     sku="Standard")
 * example_route_server = azure.network.RouteServer("example",
 *     name="example-routerserver",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     sku="Standard",
 *     public_ip_address_id=example_public_ip.id,
 *     subnet_id=example_subnet.id,
 *     branch_to_branch_traffic_enabled=True)
 * ```
 * ```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 = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var exampleVirtualNetwork = new Azure.Network.VirtualNetwork("example", new()
 *     {
 *         Name = "example-vn",
 *         AddressSpaces = new[]
 *         {
 *             "10.0.0.0/16",
 *         },
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         Tags =
 *         {
 *             { "environment", "Production" },
 *         },
 *     });
 *     var exampleSubnet = new Azure.Network.Subnet("example", new()
 *     {
 *         Name = "RouteServerSubnet",
 *         VirtualNetworkName = exampleVirtualNetwork.Name,
 *         ResourceGroupName = example.Name,
 *         AddressPrefixes = new[]
 *         {
 *             "10.0.1.0/24",
 *         },
 *     });
 *     var examplePublicIp = new Azure.Network.PublicIp("example", new()
 *     {
 *         Name = "example-pip",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         AllocationMethod = "Static",
 *         Sku = "Standard",
 *     });
 *     var exampleRouteServer = new Azure.Network.RouteServer("example", new()
 *     {
 *         Name = "example-routerserver",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         Sku = "Standard",
 *         PublicIpAddressId = examplePublicIp.Id,
 *         SubnetId = exampleSubnet.Id,
 *         BranchToBranchTrafficEnabled = true,
 *     });
 * });
 * ```
 * ```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("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleVirtualNetwork, err := network.NewVirtualNetwork(ctx, "example", &network.VirtualNetworkArgs{
 * 			Name: pulumi.String("example-vn"),
 * 			AddressSpaces: pulumi.StringArray{
 * 				pulumi.String("10.0.0.0/16"),
 * 			},
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 			Tags: pulumi.StringMap{
 * 				"environment": pulumi.String("Production"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleSubnet, err := network.NewSubnet(ctx, "example", &network.SubnetArgs{
 * 			Name:               pulumi.String("RouteServerSubnet"),
 * 			VirtualNetworkName: exampleVirtualNetwork.Name,
 * 			ResourceGroupName:  example.Name,
 * 			AddressPrefixes: pulumi.StringArray{
 * 				pulumi.String("10.0.1.0/24"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		examplePublicIp, err := network.NewPublicIp(ctx, "example", &network.PublicIpArgs{
 * 			Name:              pulumi.String("example-pip"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 			AllocationMethod:  pulumi.String("Static"),
 * 			Sku:               pulumi.String("Standard"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = network.NewRouteServer(ctx, "example", &network.RouteServerArgs{
 * 			Name:                         pulumi.String("example-routerserver"),
 * 			ResourceGroupName:            example.Name,
 * 			Location:                     example.Location,
 * 			Sku:                          pulumi.String("Standard"),
 * 			PublicIpAddressId:            examplePublicIp.ID(),
 * 			SubnetId:                     exampleSubnet.ID(),
 * 			BranchToBranchTrafficEnabled: pulumi.Bool(true),
 * 		})
 * 		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.VirtualNetwork;
 * import com.pulumi.azure.network.VirtualNetworkArgs;
 * import com.pulumi.azure.network.Subnet;
 * import com.pulumi.azure.network.SubnetArgs;
 * import com.pulumi.azure.network.PublicIp;
 * import com.pulumi.azure.network.PublicIpArgs;
 * import com.pulumi.azure.network.RouteServer;
 * import com.pulumi.azure.network.RouteServerArgs;
 * 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("example-resources")
 *             .location("West Europe")
 *             .build());
 *         var exampleVirtualNetwork = new VirtualNetwork("exampleVirtualNetwork", VirtualNetworkArgs.builder()
 *             .name("example-vn")
 *             .addressSpaces("10.0.0.0/16")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .tags(Map.of("environment", "Production"))
 *             .build());
 *         var exampleSubnet = new Subnet("exampleSubnet", SubnetArgs.builder()
 *             .name("RouteServerSubnet")
 *             .virtualNetworkName(exampleVirtualNetwork.name())
 *             .resourceGroupName(example.name())
 *             .addressPrefixes("10.0.1.0/24")
 *             .build());
 *         var examplePublicIp = new PublicIp("examplePublicIp", PublicIpArgs.builder()
 *             .name("example-pip")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .allocationMethod("Static")
 *             .sku("Standard")
 *             .build());
 *         var exampleRouteServer = new RouteServer("exampleRouteServer", RouteServerArgs.builder()
 *             .name("example-routerserver")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .sku("Standard")
 *             .publicIpAddressId(examplePublicIp.id())
 *             .subnetId(exampleSubnet.id())
 *             .branchToBranchTrafficEnabled(true)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleVirtualNetwork:
 *     type: azure:network:VirtualNetwork
 *     name: example
 *     properties:
 *       name: example-vn
 *       addressSpaces:
 *         - 10.0.0.0/16
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       tags:
 *         environment: Production
 *   exampleSubnet:
 *     type: azure:network:Subnet
 *     name: example
 *     properties:
 *       name: RouteServerSubnet
 *       virtualNetworkName: ${exampleVirtualNetwork.name}
 *       resourceGroupName: ${example.name}
 *       addressPrefixes:
 *         - 10.0.1.0/24
 *   examplePublicIp:
 *     type: azure:network:PublicIp
 *     name: example
 *     properties:
 *       name: example-pip
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       allocationMethod: Static
 *       sku: Standard
 *   exampleRouteServer:
 *     type: azure:network:RouteServer
 *     name: example
 *     properties:
 *       name: example-routerserver
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       sku: Standard
 *       publicIpAddressId: ${examplePublicIp.id}
 *       subnetId: ${exampleSubnet.id}
 *       branchToBranchTrafficEnabled: true
 * ```
 * 
 * ## Import
 * Route Server can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:network/routeServer:RouteServer example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/virtualHubs/routeServer1
 * ```
 */
public class RouteServer internal constructor(
    override val javaResource: com.pulumi.azure.network.RouteServer,
) : KotlinCustomResource(javaResource, RouteServerMapper) {
    /**
     * Whether to enable route exchange between Azure Route Server and the gateway(s)
     */
    public val branchToBranchTrafficEnabled: Output?
        get() = javaResource.branchToBranchTrafficEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Specifies the supported Azure location where the Route Server should exist. Changing this forces a new resource to be created.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

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

    /**
     * The ID of the Public IP Address. This option is required since September 1st 2021. Changing this forces a new resource to be created.
     */
    public val publicIpAddressId: Output
        get() = javaResource.publicIpAddressId().applyValue({ args0 -> args0 })

    /**
     * Specifies the name of the Resource Group where the Route Server should exist. Changing this forces a new resource to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    public val routingState: Output
        get() = javaResource.routingState().applyValue({ args0 -> args0 })

    /**
     * The SKU of the Route Server. The only possible value is `Standard`. Changing this forces a new resource to be created.
     */
    public val sku: Output
        get() = javaResource.sku().applyValue({ args0 -> args0 })

    /**
     * The ID of the Subnet that the Route Server will reside. Changing this forces a new resource to be created.
     * > **NOTE:** Azure Route Server requires a dedicated subnet named RouteServerSubnet. The subnet size has to be at least /27 or short prefix (such as /26 or /25) and cannot be attached to any security group, otherwise, you'll receive an error message when deploying the Route Server
     */
    public val subnetId: Output
        get() = javaResource.subnetId().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 val virtualRouterAsn: Output
        get() = javaResource.virtualRouterAsn().applyValue({ args0 -> args0 })

    public val virtualRouterIps: Output>
        get() = javaResource.virtualRouterIps().applyValue({ args0 -> args0.map({ args0 -> args0 }) })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy