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

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

package com.pulumi.azure.network.kotlin

import com.pulumi.azure.network.kotlin.outputs.VpnSiteLink
import com.pulumi.azure.network.kotlin.outputs.VpnSiteO365Policy
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
import com.pulumi.azure.network.kotlin.outputs.VpnSiteLink.Companion.toKotlin as vpnSiteLinkToKotlin
import com.pulumi.azure.network.kotlin.outputs.VpnSiteO365Policy.Companion.toKotlin as vpnSiteO365PolicyToKotlin

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

    public var args: VpnSiteArgs = VpnSiteArgs()

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

/**
 * Manages a VPN Site.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-rg",
 *     location: "West Europe",
 * });
 * const exampleVirtualWan = new azure.network.VirtualWan("example", {
 *     name: "example-vwan",
 *     resourceGroupName: example.name,
 *     location: example.location,
 * });
 * const exampleVpnSite = new azure.network.VpnSite("example", {
 *     name: "site1",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     virtualWanId: exampleVirtualWan.id,
 *     addressCidrs: ["10.0.0.0/24"],
 *     links: [{
 *         name: "link1",
 *         ipAddress: "10.0.0.1",
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-rg",
 *     location="West Europe")
 * example_virtual_wan = azure.network.VirtualWan("example",
 *     name="example-vwan",
 *     resource_group_name=example.name,
 *     location=example.location)
 * example_vpn_site = azure.network.VpnSite("example",
 *     name="site1",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     virtual_wan_id=example_virtual_wan.id,
 *     address_cidrs=["10.0.0.0/24"],
 *     links=[{
 *         "name": "link1",
 *         "ip_address": "10.0.0.1",
 *     }])
 * ```
 * ```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-rg",
 *         Location = "West Europe",
 *     });
 *     var exampleVirtualWan = new Azure.Network.VirtualWan("example", new()
 *     {
 *         Name = "example-vwan",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *     });
 *     var exampleVpnSite = new Azure.Network.VpnSite("example", new()
 *     {
 *         Name = "site1",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         VirtualWanId = exampleVirtualWan.Id,
 *         AddressCidrs = new[]
 *         {
 *             "10.0.0.0/24",
 *         },
 *         Links = new[]
 *         {
 *             new Azure.Network.Inputs.VpnSiteLinkArgs
 *             {
 *                 Name = "link1",
 *                 IpAddress = "10.0.0.1",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```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-rg"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		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
 * 		}
 * 		_, err = network.NewVpnSite(ctx, "example", &network.VpnSiteArgs{
 * 			Name:              pulumi.String("site1"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 			VirtualWanId:      exampleVirtualWan.ID(),
 * 			AddressCidrs: pulumi.StringArray{
 * 				pulumi.String("10.0.0.0/24"),
 * 			},
 * 			Links: network.VpnSiteLinkArray{
 * 				&network.VpnSiteLinkArgs{
 * 					Name:      pulumi.String("link1"),
 * 					IpAddress: pulumi.String("10.0.0.1"),
 * 				},
 * 			},
 * 		})
 * 		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.VirtualWan;
 * import com.pulumi.azure.network.VirtualWanArgs;
 * import com.pulumi.azure.network.VpnSite;
 * import com.pulumi.azure.network.VpnSiteArgs;
 * import com.pulumi.azure.network.inputs.VpnSiteLinkArgs;
 * 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-rg")
 *             .location("West Europe")
 *             .build());
 *         var exampleVirtualWan = new VirtualWan("exampleVirtualWan", VirtualWanArgs.builder()
 *             .name("example-vwan")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .build());
 *         var exampleVpnSite = new VpnSite("exampleVpnSite", VpnSiteArgs.builder()
 *             .name("site1")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .virtualWanId(exampleVirtualWan.id())
 *             .addressCidrs("10.0.0.0/24")
 *             .links(VpnSiteLinkArgs.builder()
 *                 .name("link1")
 *                 .ipAddress("10.0.0.1")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-rg
 *       location: West Europe
 *   exampleVirtualWan:
 *     type: azure:network:VirtualWan
 *     name: example
 *     properties:
 *       name: example-vwan
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *   exampleVpnSite:
 *     type: azure:network:VpnSite
 *     name: example
 *     properties:
 *       name: site1
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       virtualWanId: ${exampleVirtualWan.id}
 *       addressCidrs:
 *         - 10.0.0.0/24
 *       links:
 *         - name: link1
 *           ipAddress: 10.0.0.1
 * ```
 * 
 * ## Import
 * VPN Sites can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:network/vpnSite:VpnSite example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/vpnSites/site1
 * ```
 */
public class VpnSite internal constructor(
    override val javaResource: com.pulumi.azure.network.VpnSite,
) : KotlinCustomResource(javaResource, VpnSiteMapper) {
    /**
     * Specifies a list of IP address CIDRs that are located on your on-premises site. Traffic destined for these address spaces is routed to your local site.
     * > **NOTE:** The `address_cidrs` has to be set when the `link.bgp` isn't specified.
     */
    public val addressCidrs: Output>?
        get() = javaResource.addressCidrs().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

    /**
     * The model of the VPN device.
     */
    public val deviceModel: Output?
        get() = javaResource.deviceModel().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name of the VPN device vendor.
     */
    public val deviceVendor: Output?
        get() = javaResource.deviceVendor().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * One or more `link` blocks as defined below.
     */
    public val links: Output>?
        get() = javaResource.links().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> vpnSiteLinkToKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * The Azure Region where the VPN Site should exist. Changing this forces a new VPN Site to be created.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

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

    /**
     * An `o365_policy` block as defined below.
     */
    public val o365Policy: Output
        get() = javaResource.o365Policy().applyValue({ args0 ->
            args0.let({ args0 ->
                vpnSiteO365PolicyToKotlin(args0)
            })
        })

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

    /**
     * A mapping of tags which should be assigned to the VPN Site.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * The ID of the Virtual Wan where this VPN site resides in. Changing this forces a new VPN Site to be created.
     */
    public val virtualWanId: Output
        get() = javaResource.virtualWanId().applyValue({ args0 -> args0 })
}

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

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy