UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

161 lines 5.66 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.Router = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * 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", * }, * ], * }, * }); * ``` * ### 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, * }, * }); * ``` * * ## 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}} * ``` */ class Router extends pulumi.CustomResource { /** * Get an existing Router resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { return new Router(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of Router. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === Router.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["bgp"] = state?.bgp; resourceInputs["creationTimestamp"] = state?.creationTimestamp; resourceInputs["description"] = state?.description; resourceInputs["encryptedInterconnectRouter"] = state?.encryptedInterconnectRouter; resourceInputs["md5AuthenticationKeys"] = state?.md5AuthenticationKeys; resourceInputs["name"] = state?.name; resourceInputs["network"] = state?.network; resourceInputs["params"] = state?.params; resourceInputs["project"] = state?.project; resourceInputs["region"] = state?.region; resourceInputs["selfLink"] = state?.selfLink; } else { const args = argsOrState; if (args?.network === undefined && !opts.urn) { throw new Error("Missing required property 'network'"); } resourceInputs["bgp"] = args?.bgp; resourceInputs["description"] = args?.description; resourceInputs["encryptedInterconnectRouter"] = args?.encryptedInterconnectRouter; resourceInputs["md5AuthenticationKeys"] = args?.md5AuthenticationKeys; resourceInputs["name"] = args?.name; resourceInputs["network"] = args?.network; resourceInputs["params"] = args?.params; resourceInputs["project"] = args?.project; resourceInputs["region"] = args?.region; resourceInputs["creationTimestamp"] = undefined /*out*/; resourceInputs["selfLink"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Router.__pulumiType, name, resourceInputs, opts); } } exports.Router = Router; /** @internal */ Router.__pulumiType = 'gcp:compute/router:Router'; //# sourceMappingURL=router.js.map