UNPKG

@pulumi/gcp

Version:

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

244 lines • 9.12 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! *** var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.RouterNamedSet = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * A Named Set is a collection of IP addresses or ranges (for PREFIX type) or * BGP communities (for COMMUNITY type) that can be used in route policies. * * > **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider. * See Provider Versions for more details on beta resources. * * To get more information about RouterNamedSet, see: * * * [API documentation](https://cloud.google.com/compute/docs/reference/rest/beta/routers) * * How-to Guides * * [Google Cloud Router](https://cloud.google.com/router/docs/) * * ## Example Usage * * ### Router Named Set Route Policy * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const myNetwork = new gcp.compute.Network("my_network", { * name: "my-network", * autoCreateSubnetworks: false, * }); * const myRouter = new gcp.compute.Router("my_router", { * name: "my-router", * network: myNetwork.name, * region: "us-central1", * bgp: { * asn: 64514, * }, * }); * const myPrefixSet = new gcp.compute.RouterNamedSet("my_prefix_set", { * name: "prefix-set-name", * router: myRouter.name, * region: myRouter.region, * description: "My example prefix named set", * type: "NAMED_SET_TYPE_PREFIX", * elements: [ * { * expression: "'10.0.0.0/8'", * title: "private-range", * }, * { * expression: "'172.16.0.0/12'", * }, * { * expression: "prefix('192.168.10.0/24').orLonger()", * title: "or-longer-example", * }, * ], * }); * const myRoutePolicy = new gcp.compute.RouterRoutePolicy("my_route_policy", { * name: "policy-name", * router: myRouter.name, * region: myRouter.region, * type: "ROUTE_POLICY_TYPE_EXPORT", * terms: [{ * priority: 1, * match: { * expression: pulumi.interpolate`destination.inAnyRange(prefixSets('${myPrefixSet.name}'))`, * }, * actions: [{ * expression: "accept()", * }], * }], * }); * ``` * ### Router Named Set Prefix * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const net = new gcp.compute.Network("net", { * name: "my-network", * autoCreateSubnetworks: false, * }); * const router = new gcp.compute.Router("router", { * name: "my-router", * network: net.name, * region: "us-central1", * }); * const prefixSet = new gcp.compute.RouterNamedSet("prefix_set", { * name: "my-prefix-set", * router: router.name, * region: "us-central1", * description: "A sample prefix named set", * type: "NAMED_SET_TYPE_PREFIX", * elements: [ * { * expression: "'10.0.0.0/8'", * title: "ten-slash-eight", * description: "A sample IPv4 prefix", * }, * { * expression: "'172.16.0.0/12'", * title: "seventeen-two-slash-sixteen", * }, * ], * }); * ``` * ### Router Named Set Community * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const net = new gcp.compute.Network("net", { * name: "my-network", * autoCreateSubnetworks: false, * }); * const router = new gcp.compute.Router("router", { * name: "my-router", * network: net.name, * region: "us-central1", * }); * const communitySet = new gcp.compute.RouterNamedSet("community_set", { * name: "my-community-set", * router: router.name, * region: "us-central1", * description: "A sample community named set", * type: "NAMED_SET_TYPE_COMMUNITY", * elements: [{ * expression: "'65512:100'", * title: "community-one", * description: "A sample BGP community", * }], * }); * ``` * * ## Import * * RouterNamedSet can be imported using any of these accepted formats: * * * `{{project}}/{{region}}/{{router}}/namedSets/{{name}}` * * `{{project}}/{{region}}/{{router}}/{{name}}` * * `{{region}}/{{router}}/{{name}}` * * `{{router}}/{{name}}` * * When using the `pulumi import` command, RouterNamedSet can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:compute/routerNamedSet:RouterNamedSet default {{project}}/{{region}}/{{router}}/namedSets/{{name}} * $ pulumi import gcp:compute/routerNamedSet:RouterNamedSet default {{project}}/{{region}}/{{router}}/{{name}} * $ pulumi import gcp:compute/routerNamedSet:RouterNamedSet default {{region}}/{{router}}/{{name}} * $ pulumi import gcp:compute/routerNamedSet:RouterNamedSet default {{router}}/{{name}} * ``` */ class RouterNamedSet extends pulumi.CustomResource { /** * Get an existing RouterNamedSet 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 RouterNamedSet(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:compute/routerNamedSet:RouterNamedSet'; /** * Returns true if the given object is an instance of RouterNamedSet. 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'] === RouterNamedSet.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["deletionPolicy"] = state?.deletionPolicy; resourceInputs["description"] = state?.description; resourceInputs["elements"] = state?.elements; resourceInputs["fingerprint"] = state?.fingerprint; resourceInputs["name"] = state?.name; resourceInputs["project"] = state?.project; resourceInputs["region"] = state?.region; resourceInputs["router"] = state?.router; resourceInputs["type"] = state?.type; } else { const args = argsOrState; if (args?.router === undefined && !opts.urn) { throw new Error("Missing required property 'router'"); } if (args?.type === undefined && !opts.urn) { throw new Error("Missing required property 'type'"); } resourceInputs["deletionPolicy"] = args?.deletionPolicy; resourceInputs["description"] = args?.description; resourceInputs["elements"] = args?.elements; resourceInputs["name"] = args?.name; resourceInputs["project"] = args?.project; resourceInputs["region"] = args?.region; resourceInputs["router"] = args?.router; resourceInputs["type"] = args?.type; resourceInputs["fingerprint"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(RouterNamedSet.__pulumiType, name, resourceInputs, opts); } } exports.RouterNamedSet = RouterNamedSet; //# sourceMappingURL=routerNamedSet.js.map