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

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

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

package com.pulumi.azure.network.kotlin

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

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

    public var args: VirtualHubConnectionArgs = VirtualHubConnectionArgs()

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

/**
 * Manages a Connection for a Virtual Hub.
 * ## 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-network",
 *     addressSpaces: ["172.16.0.0/12"],
 *     location: example.location,
 *     resourceGroupName: example.name,
 * });
 * const exampleVirtualWan = new azure.network.VirtualWan("example", {
 *     name: "example-vwan",
 *     resourceGroupName: example.name,
 *     location: example.location,
 * });
 * const exampleVirtualHub = new azure.network.VirtualHub("example", {
 *     name: "example-hub",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     virtualWanId: exampleVirtualWan.id,
 *     addressPrefix: "10.0.1.0/24",
 * });
 * const exampleVirtualHubConnection = new azure.network.VirtualHubConnection("example", {
 *     name: "example-vhub",
 *     virtualHubId: exampleVirtualHub.id,
 *     remoteVirtualNetworkId: exampleVirtualNetwork.id,
 * });
 * ```
 * ```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-network",
 *     address_spaces=["172.16.0.0/12"],
 *     location=example.location,
 *     resource_group_name=example.name)
 * example_virtual_wan = azure.network.VirtualWan("example",
 *     name="example-vwan",
 *     resource_group_name=example.name,
 *     location=example.location)
 * example_virtual_hub = azure.network.VirtualHub("example",
 *     name="example-hub",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     virtual_wan_id=example_virtual_wan.id,
 *     address_prefix="10.0.1.0/24")
 * example_virtual_hub_connection = azure.network.VirtualHubConnection("example",
 *     name="example-vhub",
 *     virtual_hub_id=example_virtual_hub.id,
 *     remote_virtual_network_id=example_virtual_network.id)
 * ```
 * ```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-network",
 *         AddressSpaces = new[]
 *         {
 *             "172.16.0.0/12",
 *         },
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *     });
 *     var exampleVirtualWan = new Azure.Network.VirtualWan("example", new()
 *     {
 *         Name = "example-vwan",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *     });
 *     var exampleVirtualHub = new Azure.Network.VirtualHub("example", new()
 *     {
 *         Name = "example-hub",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         VirtualWanId = exampleVirtualWan.Id,
 *         AddressPrefix = "10.0.1.0/24",
 *     });
 *     var exampleVirtualHubConnection = new Azure.Network.VirtualHubConnection("example", new()
 *     {
 *         Name = "example-vhub",
 *         VirtualHubId = exampleVirtualHub.Id,
 *         RemoteVirtualNetworkId = exampleVirtualNetwork.Id,
 *     });
 * });
 * ```
 * ```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-network"),
 * 			AddressSpaces: pulumi.StringArray{
 * 				pulumi.String("172.16.0.0/12"),
 * 			},
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleVirtualWan, err := network.NewVirtualWan(ctx, "example", &network.VirtualWanArgs{
 * 			Name:              pulumi.String("example-vwan"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleVirtualHub, err := network.NewVirtualHub(ctx, "example", &network.VirtualHubArgs{
 * 			Name:              pulumi.String("example-hub"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 			VirtualWanId:      exampleVirtualWan.ID(),
 * 			AddressPrefix:     pulumi.String("10.0.1.0/24"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = network.NewVirtualHubConnection(ctx, "example", &network.VirtualHubConnectionArgs{
 * 			Name:                   pulumi.String("example-vhub"),
 * 			VirtualHubId:           exampleVirtualHub.ID(),
 * 			RemoteVirtualNetworkId: exampleVirtualNetwork.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.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.VirtualWan;
 * import com.pulumi.azure.network.VirtualWanArgs;
 * import com.pulumi.azure.network.VirtualHub;
 * import com.pulumi.azure.network.VirtualHubArgs;
 * import com.pulumi.azure.network.VirtualHubConnection;
 * import com.pulumi.azure.network.VirtualHubConnectionArgs;
 * 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-network")
 *             .addressSpaces("172.16.0.0/12")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .build());
 *         var exampleVirtualWan = new VirtualWan("exampleVirtualWan", VirtualWanArgs.builder()
 *             .name("example-vwan")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .build());
 *         var exampleVirtualHub = new VirtualHub("exampleVirtualHub", VirtualHubArgs.builder()
 *             .name("example-hub")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .virtualWanId(exampleVirtualWan.id())
 *             .addressPrefix("10.0.1.0/24")
 *             .build());
 *         var exampleVirtualHubConnection = new VirtualHubConnection("exampleVirtualHubConnection", VirtualHubConnectionArgs.builder()
 *             .name("example-vhub")
 *             .virtualHubId(exampleVirtualHub.id())
 *             .remoteVirtualNetworkId(exampleVirtualNetwork.id())
 *             .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-network
 *       addressSpaces:
 *         - 172.16.0.0/12
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *   exampleVirtualWan:
 *     type: azure:network:VirtualWan
 *     name: example
 *     properties:
 *       name: example-vwan
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *   exampleVirtualHub:
 *     type: azure:network:VirtualHub
 *     name: example
 *     properties:
 *       name: example-hub
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       virtualWanId: ${exampleVirtualWan.id}
 *       addressPrefix: 10.0.1.0/24
 *   exampleVirtualHubConnection:
 *     type: azure:network:VirtualHubConnection
 *     name: example
 *     properties:
 *       name: example-vhub
 *       virtualHubId: ${exampleVirtualHub.id}
 *       remoteVirtualNetworkId: ${exampleVirtualNetwork.id}
 * ```
 * 
 * ## Import
 * Virtual Hub Connection's can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:network/virtualHubConnection:VirtualHubConnection example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/virtualHubs/hub1/hubVirtualNetworkConnections/connection1
 * ```
 */
public class VirtualHubConnection internal constructor(
    override val javaResource: com.pulumi.azure.network.VirtualHubConnection,
) : KotlinCustomResource(javaResource, VirtualHubConnectionMapper) {
    /**
     * Should Internet Security be enabled to secure internet traffic? Defaults to `false`.
     */
    public val internetSecurityEnabled: Output?
        get() = javaResource.internetSecurityEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The Name which should be used for this Connection, which must be unique within the Virtual Hub. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The ID of the Virtual Network which the Virtual Hub should be connected to. Changing this forces a new resource to be created.
     */
    public val remoteVirtualNetworkId: Output
        get() = javaResource.remoteVirtualNetworkId().applyValue({ args0 -> args0 })

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

    /**
     * The ID of the Virtual Hub within which this connection should be created. Changing this forces a new resource to be created.
     */
    public val virtualHubId: Output
        get() = javaResource.virtualHubId().applyValue({ args0 -> args0 })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy