"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.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, { ...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?.createTime;
            resourceInputs["description"] = state?.description;
            resourceInputs["effectiveLabels"] = state?.effectiveLabels;
            resourceInputs["filter"] = state?.filter;
            resourceInputs["interconnectAttachment"] = state?.interconnectAttachment;
            resourceInputs["kind"] = state?.kind;
            resourceInputs["labels"] = state?.labels;
            resourceInputs["name"] = state?.name;
            resourceInputs["network"] = state?.network;
            resourceInputs["nextHopIlbIp"] = state?.nextHopIlbIp;
            resourceInputs["nextHopOtherRoutes"] = state?.nextHopOtherRoutes;
            resourceInputs["priority"] = state?.priority;
            resourceInputs["project"] = state?.project;
            resourceInputs["pulumiLabels"] = state?.pulumiLabels;
            resourceInputs["updateTime"] = state?.updateTime;
            resourceInputs["virtualMachine"] = state?.virtualMachine;
            resourceInputs["warnings"] = state?.warnings;
        }
        else {
            const args = argsOrState;
            if (args?.filter === undefined && !opts.urn) {
                throw new Error("Missing required property 'filter'");
            }
            if (args?.network === undefined && !opts.urn) {
                throw new Error("Missing required property 'network'");
            }
            resourceInputs["description"] = args?.description;
            resourceInputs["filter"] = args?.filter;
            resourceInputs["interconnectAttachment"] = args?.interconnectAttachment;
            resourceInputs["labels"] = args?.labels;
            resourceInputs["name"] = args?.name;
            resourceInputs["network"] = args?.network;
            resourceInputs["nextHopIlbIp"] = args?.nextHopIlbIp;
            resourceInputs["nextHopOtherRoutes"] = args?.nextHopOtherRoutes;
            resourceInputs["priority"] = args?.priority;
            resourceInputs["project"] = args?.project;
            resourceInputs["virtualMachine"] = args?.virtualMachine;
            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