"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.LbEdgeExtension = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * LbEdgeExtension is a resource that lets the extension service influence the selection of backend services and Cloud CDN cache keys by modifying request headers.
 *
 * To get more information about LbEdgeExtension, see:
 *
 * * [API documentation](https://cloud.google.com/service-extensions/docs/reference/rest/v1beta1/projects.locations.lbEdgeExtensions)
 * * How-to Guides
 *     * [Configure a edge extension](https://cloud.google.com/service-extensions/docs/configure-edge-extensions)
 *
 * ## Example Usage
 *
 * ### Network Services Lb Edge Extension Basic
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const defaultBackendService = new gcp.compute.BackendService("default", {
 *     name: "elb-backend-subnet",
 *     portName: "http",
 *     protocol: "HTTP",
 *     timeoutSec: 10,
 *     loadBalancingScheme: "EXTERNAL_MANAGED",
 * });
 * const defaultURLMap = new gcp.compute.URLMap("default", {
 *     name: "elb-url-map",
 *     description: "a description",
 *     defaultService: defaultBackendService.id,
 *     hostRules: [{
 *         hosts: ["mysite.com"],
 *         pathMatcher: "allpaths",
 *     }],
 *     pathMatchers: [{
 *         name: "allpaths",
 *         defaultService: defaultBackendService.id,
 *         pathRules: [{
 *             paths: ["/*"],
 *             service: defaultBackendService.id,
 *         }],
 *     }],
 * });
 * const defaultTargetHttpProxy = new gcp.compute.TargetHttpProxy("default", {
 *     name: "elb-target-http-proxy",
 *     description: "a description",
 *     urlMap: defaultURLMap.id,
 * });
 * // forwarding rule
 * const _default = new gcp.compute.GlobalForwardingRule("default", {
 *     name: "elb-forwarding-rule",
 *     target: defaultTargetHttpProxy.id,
 *     portRange: "80",
 *     loadBalancingScheme: "EXTERNAL_MANAGED",
 *     networkTier: "PREMIUM",
 * });
 * const wasm_plugin = new gcp.networkservices.WasmPlugin("wasm-plugin", {
 *     name: "elb-wasm-plugin-data",
 *     description: "my wasm plugin",
 *     mainVersionId: "v1",
 *     labels: {
 *         test_label: "test_value",
 *     },
 *     logConfig: {
 *         enable: true,
 *         sampleRate: 1,
 *         minLogLevel: "WARN",
 *     },
 *     versions: [{
 *         versionName: "v1",
 *         description: "v1 version of my wasm plugin",
 *         imageUri: "projects/my-project-name/locations/us-central1/repositories/repository-standard/genericArtifacts/my-wasm-plugin:v1",
 *         labels: {
 *             test_label: "test_value",
 *         },
 *     }],
 * });
 * const defaultLbEdgeExtension = new gcp.networkservices.LbEdgeExtension("default", {
 *     name: "elb-edge-ext",
 *     description: "my edge extension",
 *     location: "global",
 *     loadBalancingScheme: "EXTERNAL_MANAGED",
 *     forwardingRules: [_default.selfLink],
 *     extensionChains: [{
 *         name: "chain1",
 *         matchCondition: {
 *             celExpression: "request.host == 'example.com'",
 *         },
 *         extensions: [{
 *             name: "ext11",
 *             service: wasm_plugin.id,
 *             failOpen: false,
 *             supportedEvents: ["REQUEST_HEADERS"],
 *             forwardHeaders: ["custom-header"],
 *         }],
 *     }],
 *     labels: {
 *         foo: "bar",
 *     },
 * });
 * ```
 *
 * ## Import
 *
 * LbEdgeExtension can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/locations/{{location}}/lbEdgeExtensions/{{name}}`
 *
 * * `{{project}}/{{location}}/{{name}}`
 *
 * * `{{location}}/{{name}}`
 *
 * When using the `pulumi import` command, LbEdgeExtension can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:networkservices/lbEdgeExtension:LbEdgeExtension default projects/{{project}}/locations/{{location}}/lbEdgeExtensions/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:networkservices/lbEdgeExtension:LbEdgeExtension default {{project}}/{{location}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:networkservices/lbEdgeExtension:LbEdgeExtension default {{location}}/{{name}}
 * ```
 */
class LbEdgeExtension extends pulumi.CustomResource {
    /**
     * Get an existing LbEdgeExtension 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 LbEdgeExtension(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of LbEdgeExtension.  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'] === LbEdgeExtension.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["description"] = state?.description;
            resourceInputs["effectiveLabels"] = state?.effectiveLabels;
            resourceInputs["extensionChains"] = state?.extensionChains;
            resourceInputs["forwardingRules"] = state?.forwardingRules;
            resourceInputs["labels"] = state?.labels;
            resourceInputs["loadBalancingScheme"] = state?.loadBalancingScheme;
            resourceInputs["location"] = state?.location;
            resourceInputs["name"] = state?.name;
            resourceInputs["project"] = state?.project;
            resourceInputs["pulumiLabels"] = state?.pulumiLabels;
        }
        else {
            const args = argsOrState;
            if (args?.extensionChains === undefined && !opts.urn) {
                throw new Error("Missing required property 'extensionChains'");
            }
            if (args?.forwardingRules === undefined && !opts.urn) {
                throw new Error("Missing required property 'forwardingRules'");
            }
            if (args?.loadBalancingScheme === undefined && !opts.urn) {
                throw new Error("Missing required property 'loadBalancingScheme'");
            }
            if (args?.location === undefined && !opts.urn) {
                throw new Error("Missing required property 'location'");
            }
            resourceInputs["description"] = args?.description;
            resourceInputs["extensionChains"] = args?.extensionChains;
            resourceInputs["forwardingRules"] = args?.forwardingRules;
            resourceInputs["labels"] = args?.labels;
            resourceInputs["loadBalancingScheme"] = args?.loadBalancingScheme;
            resourceInputs["location"] = args?.location;
            resourceInputs["name"] = args?.name;
            resourceInputs["project"] = args?.project;
            resourceInputs["effectiveLabels"] = undefined /*out*/;
            resourceInputs["pulumiLabels"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
        opts = pulumi.mergeOptions(opts, secretOpts);
        super(LbEdgeExtension.__pulumiType, name, resourceInputs, opts);
    }
}
exports.LbEdgeExtension = LbEdgeExtension;
/** @internal */
LbEdgeExtension.__pulumiType = 'gcp:networkservices/lbEdgeExtension:LbEdgeExtension';
//# sourceMappingURL=lbEdgeExtension.js.map