com.pulumi.gcp.compute.kotlin.Router.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.compute.kotlin
import com.pulumi.core.Output
import com.pulumi.gcp.compute.kotlin.outputs.RouterBgp
import com.pulumi.gcp.compute.kotlin.outputs.RouterBgp.Companion.toKotlin
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 [Router].
*/
@PulumiTagMarker
public class RouterResourceBuilder internal constructor() {
public var name: String? = null
public var args: RouterArgs = RouterArgs()
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 RouterArgsBuilder.() -> Unit) {
val builder = RouterArgsBuilder()
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(): Router {
val builtJavaResource = com.pulumi.gcp.compute.Router(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Router(builtJavaResource)
}
}
/**
* Represents a Router resource.
* To get more information about Router, see:
* * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/routers)
* * How-to Guides
* * [Google Cloud Router](https://cloud.google.com/router/docs/)
* ## Example Usage
* ### Router Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const foobarNetwork = new gcp.compute.Network("foobar", {
* name: "my-network",
* autoCreateSubnetworks: false,
* });
* const foobar = new gcp.compute.Router("foobar", {
* name: "my-router",
* network: foobarNetwork.name,
* bgp: {
* asn: 64514,
* advertiseMode: "CUSTOM",
* advertisedGroups: ["ALL_SUBNETS"],
* advertisedIpRanges: [
* {
* range: "1.2.3.4",
* },
* {
* range: "6.7.0.0/16",
* },
* ],
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* foobar_network = gcp.compute.Network("foobar",
* name="my-network",
* auto_create_subnetworks=False)
* foobar = gcp.compute.Router("foobar",
* name="my-router",
* network=foobar_network.name,
* bgp=gcp.compute.RouterBgpArgs(
* asn=64514,
* advertise_mode="CUSTOM",
* advertised_groups=["ALL_SUBNETS"],
* advertised_ip_ranges=[
* gcp.compute.RouterBgpAdvertisedIpRangeArgs(
* range="1.2.3.4",
* ),
* gcp.compute.RouterBgpAdvertisedIpRangeArgs(
* range="6.7.0.0/16",
* ),
* ],
* ))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var foobarNetwork = new Gcp.Compute.Network("foobar", new()
* {
* Name = "my-network",
* AutoCreateSubnetworks = false,
* });
* var foobar = new Gcp.Compute.Router("foobar", new()
* {
* Name = "my-router",
* Network = foobarNetwork.Name,
* Bgp = new Gcp.Compute.Inputs.RouterBgpArgs
* {
* Asn = 64514,
* AdvertiseMode = "CUSTOM",
* AdvertisedGroups = new[]
* {
* "ALL_SUBNETS",
* },
* AdvertisedIpRanges = new[]
* {
* new Gcp.Compute.Inputs.RouterBgpAdvertisedIpRangeArgs
* {
* Range = "1.2.3.4",
* },
* new Gcp.Compute.Inputs.RouterBgpAdvertisedIpRangeArgs
* {
* Range = "6.7.0.0/16",
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* foobarNetwork, err := compute.NewNetwork(ctx, "foobar", &compute.NetworkArgs{
* Name: pulumi.String("my-network"),
* AutoCreateSubnetworks: pulumi.Bool(false),
* })
* if err != nil {
* return err
* }
* _, err = compute.NewRouter(ctx, "foobar", &compute.RouterArgs{
* Name: pulumi.String("my-router"),
* Network: foobarNetwork.Name,
* Bgp: &compute.RouterBgpArgs{
* Asn: pulumi.Int(64514),
* AdvertiseMode: pulumi.String("CUSTOM"),
* AdvertisedGroups: pulumi.StringArray{
* pulumi.String("ALL_SUBNETS"),
* },
* AdvertisedIpRanges: compute.RouterBgpAdvertisedIpRangeArray{
* &compute.RouterBgpAdvertisedIpRangeArgs{
* Range: pulumi.String("1.2.3.4"),
* },
* &compute.RouterBgpAdvertisedIpRangeArgs{
* Range: pulumi.String("6.7.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.gcp.compute.Network;
* import com.pulumi.gcp.compute.NetworkArgs;
* import com.pulumi.gcp.compute.Router;
* import com.pulumi.gcp.compute.RouterArgs;
* import com.pulumi.gcp.compute.inputs.RouterBgpArgs;
* 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 foobarNetwork = new Network("foobarNetwork", NetworkArgs.builder()
* .name("my-network")
* .autoCreateSubnetworks(false)
* .build());
* var foobar = new Router("foobar", RouterArgs.builder()
* .name("my-router")
* .network(foobarNetwork.name())
* .bgp(RouterBgpArgs.builder()
* .asn(64514)
* .advertiseMode("CUSTOM")
* .advertisedGroups("ALL_SUBNETS")
* .advertisedIpRanges(
* RouterBgpAdvertisedIpRangeArgs.builder()
* .range("1.2.3.4")
* .build(),
* RouterBgpAdvertisedIpRangeArgs.builder()
* .range("6.7.0.0/16")
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* foobar:
* type: gcp:compute:Router
* properties:
* name: my-router
* network: ${foobarNetwork.name}
* bgp:
* asn: 64514
* advertiseMode: CUSTOM
* advertisedGroups:
* - ALL_SUBNETS
* advertisedIpRanges:
* - range: 1.2.3.4
* - range: 6.7.0.0/16
* foobarNetwork:
* type: gcp:compute:Network
* name: foobar
* properties:
* name: my-network
* autoCreateSubnetworks: false
* ```
*
* ### Compute Router Encrypted Interconnect
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const network = new gcp.compute.Network("network", {
* name: "test-network",
* autoCreateSubnetworks: false,
* });
* const encrypted_interconnect_router = new gcp.compute.Router("encrypted-interconnect-router", {
* name: "test-router",
* network: network.name,
* encryptedInterconnectRouter: true,
* bgp: {
* asn: 64514,
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* network = gcp.compute.Network("network",
* name="test-network",
* auto_create_subnetworks=False)
* encrypted_interconnect_router = gcp.compute.Router("encrypted-interconnect-router",
* name="test-router",
* network=network.name,
* encrypted_interconnect_router=True,
* bgp=gcp.compute.RouterBgpArgs(
* asn=64514,
* ))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var network = new Gcp.Compute.Network("network", new()
* {
* Name = "test-network",
* AutoCreateSubnetworks = false,
* });
* var encrypted_interconnect_router = new Gcp.Compute.Router("encrypted-interconnect-router", new()
* {
* Name = "test-router",
* Network = network.Name,
* EncryptedInterconnectRouter = true,
* Bgp = new Gcp.Compute.Inputs.RouterBgpArgs
* {
* Asn = 64514,
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* network, err := compute.NewNetwork(ctx, "network", &compute.NetworkArgs{
* Name: pulumi.String("test-network"),
* AutoCreateSubnetworks: pulumi.Bool(false),
* })
* if err != nil {
* return err
* }
* _, err = compute.NewRouter(ctx, "encrypted-interconnect-router", &compute.RouterArgs{
* Name: pulumi.String("test-router"),
* Network: network.Name,
* EncryptedInterconnectRouter: pulumi.Bool(true),
* Bgp: &compute.RouterBgpArgs{
* Asn: pulumi.Int(64514),
* },
* })
* 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.gcp.compute.Network;
* import com.pulumi.gcp.compute.NetworkArgs;
* import com.pulumi.gcp.compute.Router;
* import com.pulumi.gcp.compute.RouterArgs;
* import com.pulumi.gcp.compute.inputs.RouterBgpArgs;
* 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 network = new Network("network", NetworkArgs.builder()
* .name("test-network")
* .autoCreateSubnetworks(false)
* .build());
* var encrypted_interconnect_router = new Router("encrypted-interconnect-router", RouterArgs.builder()
* .name("test-router")
* .network(network.name())
* .encryptedInterconnectRouter(true)
* .bgp(RouterBgpArgs.builder()
* .asn(64514)
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* encrypted-interconnect-router:
* type: gcp:compute:Router
* properties:
* name: test-router
* network: ${network.name}
* encryptedInterconnectRouter: true
* bgp:
* asn: 64514
* network:
* type: gcp:compute:Network
* properties:
* name: test-network
* autoCreateSubnetworks: false
* ```
*
* ## Import
* Router can be imported using any of these accepted formats:
* * `projects/{{project}}/regions/{{region}}/routers/{{name}}`
* * `{{project}}/{{region}}/{{name}}`
* * `{{region}}/{{name}}`
* * `{{name}}`
* When using the `pulumi import` command, Router can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:compute/router:Router default projects/{{project}}/regions/{{region}}/routers/{{name}}
* ```
* ```sh
* $ pulumi import gcp:compute/router:Router default {{project}}/{{region}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:compute/router:Router default {{region}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:compute/router:Router default {{name}}
* ```
*/
public class Router internal constructor(
override val javaResource: com.pulumi.gcp.compute.Router,
) : KotlinCustomResource(javaResource, RouterMapper) {
/**
* BGP information specific to this router.
* Structure is documented below.
*/
public val bgp: Output?
get() = javaResource.bgp().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
toKotlin(args0)
})
}).orElse(null)
})
/**
* Creation timestamp in RFC3339 text format.
*/
public val creationTimestamp: Output
get() = javaResource.creationTimestamp().applyValue({ args0 -> args0 })
/**
* An optional description of this resource.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Indicates if a router is dedicated for use with encrypted VLAN
* attachments (interconnectAttachments).
*/
public val encryptedInterconnectRouter: Output?
get() = javaResource.encryptedInterconnectRouter().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Name of the resource. The name must be 1-63 characters long, and
* comply with RFC1035. Specifically, the name must be 1-63 characters
* long and match the regular expression `a-z?`
* which means the first character must be a lowercase letter, and all
* following characters must be a dash, lowercase letter, or digit,
* except the last character, which cannot be a dash.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* A reference to the network to which this router belongs.
* - - -
*/
public val network: Output
get() = javaResource.network().applyValue({ args0 -> args0 })
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
public val project: Output
get() = javaResource.project().applyValue({ args0 -> args0 })
/**
* Region where the router resides.
*/
public val region: Output
get() = javaResource.region().applyValue({ args0 -> args0 })
/**
* The URI of the created resource.
*/
public val selfLink: Output
get() = javaResource.selfLink().applyValue({ args0 -> args0 })
}
public object RouterMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.compute.Router::class == javaResource::class
override fun map(javaResource: Resource): Router = Router(
javaResource as
com.pulumi.gcp.compute.Router,
)
}
/**
* @see [Router].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [Router].
*/
public suspend fun router(name: String, block: suspend RouterResourceBuilder.() -> Unit): Router {
val builder = RouterResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [Router].
* @param name The _unique_ name of the resulting resource.
*/
public fun router(name: String): Router {
val builder = RouterResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy