UNPKG

@pulumi/gcp

Version:

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

178 lines • 8.1 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.PolicyBasedRoute = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Policy-based Routes are more powerful routes that route L4 network traffic based on not just destination IP, but also source IP, protocol and more. A Policy-based Route always take precedence when it conflicts with other types of routes. * * To get more information about PolicyBasedRoute, see: * * * [API documentation](https://cloud.google.com/network-connectivity/docs/reference/networkconnectivity/rest/v1/projects.locations.global.policyBasedRoutes) * * How-to Guides * * [Use policy-based routes](https://cloud.google.com/vpc/docs/use-policy-based-routes#api) * * ## Example Usage * * ### Network Connectivity Policy Based Route Basic * * ```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 _default = new gcp.networkconnectivity.PolicyBasedRoute("default", { * name: "my-pbr", * network: myNetwork.id, * filter: { * protocolVersion: "IPV4", * }, * nextHopOtherRoutes: "DEFAULT_ROUTING", * }); * ``` * ### Network Connectivity Policy Based Route Full * * ```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, * }); * // This example substitutes an arbitrary internal IP for an internal network * // load balancer for brevity. Consult https://cloud.google.com/load-balancing/docs/internal * // to set one up. * const ilb = new gcp.compute.GlobalAddress("ilb", {name: "my-ilb"}); * const _default = new gcp.networkconnectivity.PolicyBasedRoute("default", { * name: "my-pbr", * description: "My routing policy", * network: myNetwork.id, * priority: 2302, * filter: { * protocolVersion: "IPV4", * ipProtocol: "UDP", * srcRange: "10.0.0.0/24", * destRange: "0.0.0.0/0", * }, * nextHopIlbIp: ilb.address, * virtualMachine: { * tags: ["restricted"], * }, * labels: { * env: "default", * }, * }); * ``` * * ## Import * * PolicyBasedRoute can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/global/policyBasedRoutes/{{name}}` * * * `{{project}}/{{name}}` * * * `{{name}}` * * When using the `pulumi import` command, PolicyBasedRoute can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:networkconnectivity/policyBasedRoute:PolicyBasedRoute default projects/{{project}}/locations/global/policyBasedRoutes/{{name}} * ``` * * ```sh * $ pulumi import gcp:networkconnectivity/policyBasedRoute:PolicyBasedRoute default {{project}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:networkconnectivity/policyBasedRoute:PolicyBasedRoute default {{name}} * ``` */ class PolicyBasedRoute extends pulumi.CustomResource { /** * Get an existing PolicyBasedRoute 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 PolicyBasedRoute(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of PolicyBasedRoute. 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'] === PolicyBasedRoute.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["createTime"] = state ? state.createTime : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined; resourceInputs["filter"] = state ? state.filter : undefined; resourceInputs["interconnectAttachment"] = state ? state.interconnectAttachment : undefined; resourceInputs["kind"] = state ? state.kind : undefined; resourceInputs["labels"] = state ? state.labels : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["network"] = state ? state.network : undefined; resourceInputs["nextHopIlbIp"] = state ? state.nextHopIlbIp : undefined; resourceInputs["nextHopOtherRoutes"] = state ? state.nextHopOtherRoutes : undefined; resourceInputs["priority"] = state ? state.priority : undefined; resourceInputs["project"] = state ? state.project : undefined; resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : undefined; resourceInputs["updateTime"] = state ? state.updateTime : undefined; resourceInputs["virtualMachine"] = state ? state.virtualMachine : undefined; resourceInputs["warnings"] = state ? state.warnings : undefined; } else { const args = argsOrState; if ((!args || args.filter === undefined) && !opts.urn) { throw new Error("Missing required property 'filter'"); } if ((!args || args.network === undefined) && !opts.urn) { throw new Error("Missing required property 'network'"); } resourceInputs["description"] = args ? args.description : undefined; resourceInputs["filter"] = args ? args.filter : undefined; resourceInputs["interconnectAttachment"] = args ? args.interconnectAttachment : undefined; resourceInputs["labels"] = args ? args.labels : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["network"] = args ? args.network : undefined; resourceInputs["nextHopIlbIp"] = args ? args.nextHopIlbIp : undefined; resourceInputs["nextHopOtherRoutes"] = args ? args.nextHopOtherRoutes : undefined; resourceInputs["priority"] = args ? args.priority : undefined; resourceInputs["project"] = args ? args.project : undefined; resourceInputs["virtualMachine"] = args ? args.virtualMachine : undefined; resourceInputs["createTime"] = undefined /*out*/; resourceInputs["effectiveLabels"] = undefined /*out*/; resourceInputs["kind"] = undefined /*out*/; resourceInputs["pulumiLabels"] = undefined /*out*/; resourceInputs["updateTime"] = undefined /*out*/; resourceInputs["warnings"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(PolicyBasedRoute.__pulumiType, name, resourceInputs, opts); } } exports.PolicyBasedRoute = PolicyBasedRoute; /** @internal */ PolicyBasedRoute.__pulumiType = 'gcp:networkconnectivity/policyBasedRoute:PolicyBasedRoute'; //# sourceMappingURL=policyBasedRoute.js.map