UNPKG

@pulumi/gcp

Version:

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

183 lines 6.59 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.RouterRoutePolicy = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * A route policy created in a router * * To get more information about RouterRoutePolicy, 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 Route Policy Export * * ```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 subnet = new gcp.compute.Subnetwork("subnet", { * name: "my-subnetwork", * network: net.id, * ipCidrRange: "10.0.0.0/16", * region: "us-central1", * }); * const router = new gcp.compute.Router("router", { * name: "my-router", * region: subnet.region, * network: net.id, * }); * const rp_export = new gcp.compute.RouterRoutePolicy("rp-export", { * router: router.name, * region: router.region, * name: "my-rp1", * type: "ROUTE_POLICY_TYPE_EXPORT", * terms: [{ * priority: 1, * match: { * expression: "destination == '10.0.0.0/12'", * }, * actions: [{ * expression: "accept()", * }], * }], * }); * ``` * ### Router Route Policy Import * * ```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 subnet = new gcp.compute.Subnetwork("subnet", { * name: "my-subnetwork", * network: net.id, * ipCidrRange: "10.0.0.0/16", * region: "us-central1", * }); * const router = new gcp.compute.Router("router", { * name: "my-router", * region: subnet.region, * network: net.id, * }); * const rp_import = new gcp.compute.RouterRoutePolicy("rp-import", { * name: "my-rp2", * router: router.name, * region: router.region, * type: "ROUTE_POLICY_TYPE_IMPORT", * terms: [{ * priority: 2, * match: { * expression: "destination == '10.0.0.0/12'", * }, * actions: [{ * expression: "accept()", * }], * }], * }); * ``` * * ## Import * * RouterRoutePolicy can be imported using any of these accepted formats: * * * `{{project}}/{{region}}/{{router}}/routePolicies/{{name}}` * * * `{{project}}/{{region}}/{{router}}/{{name}}` * * * `{{region}}/{{router}}/{{name}}` * * * `{{router}}/{{name}}` * * When using the `pulumi import` command, RouterRoutePolicy can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:compute/routerRoutePolicy:RouterRoutePolicy default {{project}}/{{region}}/{{router}}/routePolicies/{{name}} * ``` * * ```sh * $ pulumi import gcp:compute/routerRoutePolicy:RouterRoutePolicy default {{project}}/{{region}}/{{router}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:compute/routerRoutePolicy:RouterRoutePolicy default {{region}}/{{router}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:compute/routerRoutePolicy:RouterRoutePolicy default {{router}}/{{name}} * ``` */ class RouterRoutePolicy extends pulumi.CustomResource { /** * Get an existing RouterRoutePolicy 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 RouterRoutePolicy(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of RouterRoutePolicy. 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'] === RouterRoutePolicy.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["fingerprint"] = state ? state.fingerprint : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["project"] = state ? state.project : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["router"] = state ? state.router : undefined; resourceInputs["terms"] = state ? state.terms : undefined; resourceInputs["type"] = state ? state.type : undefined; } else { const args = argsOrState; if ((!args || args.router === undefined) && !opts.urn) { throw new Error("Missing required property 'router'"); } if ((!args || args.terms === undefined) && !opts.urn) { throw new Error("Missing required property 'terms'"); } resourceInputs["name"] = args ? args.name : undefined; resourceInputs["project"] = args ? args.project : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["router"] = args ? args.router : undefined; resourceInputs["terms"] = args ? args.terms : undefined; resourceInputs["type"] = args ? args.type : undefined; resourceInputs["fingerprint"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(RouterRoutePolicy.__pulumiType, name, resourceInputs, opts); } } exports.RouterRoutePolicy = RouterRoutePolicy; /** @internal */ RouterRoutePolicy.__pulumiType = 'gcp:compute/routerRoutePolicy:RouterRoutePolicy'; //# sourceMappingURL=routerRoutePolicy.js.map