"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.Gateway = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * Gateway represents the configuration for a proxy, typically a load balancer.
 * It captures the ip:port over which the services are exposed by the proxy,
 * along with any policy configurations. Routes have reference to to Gateways
 * to dictate how requests should be routed by this Gateway.
 *
 * To get more information about Gateway, see:
 *
 * * [API documentation](https://cloud.google.com/traffic-director/docs/reference/network-services/rest/v1/projects.locations.gateways)
 *
 * ## Example Usage
 *
 * ### Network Services Gateway Basic
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const _default = new gcp.networkservices.Gateway("default", {
 *     name: "my-gateway",
 *     scope: "default-scope-basic",
 *     type: "OPEN_MESH",
 *     ports: [443],
 * });
 * ```
 * ### Network Services Gateway Advanced
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const _default = new gcp.networkservices.Gateway("default", {
 *     name: "my-gateway",
 *     labels: {
 *         foo: "bar",
 *     },
 *     description: "my description",
 *     type: "OPEN_MESH",
 *     ports: [443],
 *     scope: "default-scope-advance",
 * });
 * ```
 * ### Network Services Gateway Secure Web Proxy
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * import * as std from "@pulumi/std";
 *
 * const _default = new gcp.certificatemanager.Certificate("default", {
 *     name: "my-certificate",
 *     location: "us-central1",
 *     selfManaged: {
 *         pemCertificate: std.file({
 *             input: "test-fixtures/cert.pem",
 *         }).then(invoke => invoke.result),
 *         pemPrivateKey: std.file({
 *             input: "test-fixtures/private-key.pem",
 *         }).then(invoke => invoke.result),
 *     },
 * });
 * const defaultNetwork = new gcp.compute.Network("default", {
 *     name: "my-network",
 *     routingMode: "REGIONAL",
 *     autoCreateSubnetworks: false,
 * });
 * const defaultSubnetwork = new gcp.compute.Subnetwork("default", {
 *     name: "my-subnetwork-name",
 *     purpose: "PRIVATE",
 *     ipCidrRange: "10.128.0.0/20",
 *     region: "us-central1",
 *     network: defaultNetwork.id,
 *     role: "ACTIVE",
 * });
 * const proxyonlysubnet = new gcp.compute.Subnetwork("proxyonlysubnet", {
 *     name: "my-proxy-only-subnetwork",
 *     purpose: "REGIONAL_MANAGED_PROXY",
 *     ipCidrRange: "192.168.0.0/23",
 *     region: "us-central1",
 *     network: defaultNetwork.id,
 *     role: "ACTIVE",
 * });
 * const defaultGatewaySecurityPolicy = new gcp.networksecurity.GatewaySecurityPolicy("default", {
 *     name: "my-policy-name",
 *     location: "us-central1",
 * });
 * const defaultGatewaySecurityPolicyRule = new gcp.networksecurity.GatewaySecurityPolicyRule("default", {
 *     name: "my-policyrule-name",
 *     location: "us-central1",
 *     gatewaySecurityPolicy: defaultGatewaySecurityPolicy.name,
 *     enabled: true,
 *     priority: 1,
 *     sessionMatcher: "host() == 'example.com'",
 *     basicProfile: "ALLOW",
 * });
 * const defaultGateway = new gcp.networkservices.Gateway("default", {
 *     name: "my-gateway1",
 *     location: "us-central1",
 *     addresses: ["10.128.0.99"],
 *     type: "SECURE_WEB_GATEWAY",
 *     ports: [443],
 *     scope: "my-default-scope1",
 *     certificateUrls: [_default.id],
 *     gatewaySecurityPolicy: defaultGatewaySecurityPolicy.id,
 *     network: defaultNetwork.id,
 *     subnetwork: defaultSubnetwork.id,
 *     deleteSwgAutogenRouterOnDestroy: true,
 * }, {
 *     dependsOn: [proxyonlysubnet],
 * });
 * ```
 * ### Network Services Gateway Multiple Swp Same Network
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * import * as std from "@pulumi/std";
 *
 * const _default = new gcp.certificatemanager.Certificate("default", {
 *     name: "my-certificate",
 *     location: "us-south1",
 *     selfManaged: {
 *         pemCertificate: std.file({
 *             input: "test-fixtures/cert.pem",
 *         }).then(invoke => invoke.result),
 *         pemPrivateKey: std.file({
 *             input: "test-fixtures/private-key.pem",
 *         }).then(invoke => invoke.result),
 *     },
 * });
 * const defaultNetwork = new gcp.compute.Network("default", {
 *     name: "my-network",
 *     routingMode: "REGIONAL",
 *     autoCreateSubnetworks: false,
 * });
 * const defaultSubnetwork = new gcp.compute.Subnetwork("default", {
 *     name: "my-subnetwork-name",
 *     purpose: "PRIVATE",
 *     ipCidrRange: "10.128.0.0/20",
 *     region: "us-south1",
 *     network: defaultNetwork.id,
 *     role: "ACTIVE",
 * });
 * const proxyonlysubnet = new gcp.compute.Subnetwork("proxyonlysubnet", {
 *     name: "my-proxy-only-subnetwork",
 *     purpose: "REGIONAL_MANAGED_PROXY",
 *     ipCidrRange: "192.168.0.0/23",
 *     region: "us-south1",
 *     network: defaultNetwork.id,
 *     role: "ACTIVE",
 * });
 * const defaultGatewaySecurityPolicy = new gcp.networksecurity.GatewaySecurityPolicy("default", {
 *     name: "my-policy-name",
 *     location: "us-south1",
 * });
 * const defaultGatewaySecurityPolicyRule = new gcp.networksecurity.GatewaySecurityPolicyRule("default", {
 *     name: "my-policyrule-name",
 *     location: "us-south1",
 *     gatewaySecurityPolicy: defaultGatewaySecurityPolicy.name,
 *     enabled: true,
 *     priority: 1,
 *     sessionMatcher: "host() == 'example.com'",
 *     basicProfile: "ALLOW",
 * });
 * const defaultGateway = new gcp.networkservices.Gateway("default", {
 *     name: "my-gateway1",
 *     location: "us-south1",
 *     addresses: ["10.128.0.99"],
 *     type: "SECURE_WEB_GATEWAY",
 *     ports: [443],
 *     scope: "my-default-scope1",
 *     certificateUrls: [_default.id],
 *     gatewaySecurityPolicy: defaultGatewaySecurityPolicy.id,
 *     network: defaultNetwork.id,
 *     subnetwork: defaultSubnetwork.id,
 *     deleteSwgAutogenRouterOnDestroy: true,
 * }, {
 *     dependsOn: [proxyonlysubnet],
 * });
 * const gateway2 = new gcp.networkservices.Gateway("gateway2", {
 *     name: "my-gateway2",
 *     location: "us-south1",
 *     addresses: ["10.128.0.98"],
 *     type: "SECURE_WEB_GATEWAY",
 *     ports: [443],
 *     scope: "my-default-scope2",
 *     certificateUrls: [_default.id],
 *     gatewaySecurityPolicy: defaultGatewaySecurityPolicy.id,
 *     network: defaultNetwork.id,
 *     subnetwork: defaultSubnetwork.id,
 *     deleteSwgAutogenRouterOnDestroy: true,
 * }, {
 *     dependsOn: [proxyonlysubnet],
 * });
 * ```
 *
 * ## Import
 *
 * Gateway can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/locations/{{location}}/gateways/{{name}}`
 *
 * * `{{project}}/{{location}}/{{name}}`
 *
 * * `{{location}}/{{name}}`
 *
 * When using the `pulumi import` command, Gateway can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:networkservices/gateway:Gateway default projects/{{project}}/locations/{{location}}/gateways/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:networkservices/gateway:Gateway default {{project}}/{{location}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:networkservices/gateway:Gateway default {{location}}/{{name}}
 * ```
 */
class Gateway extends pulumi.CustomResource {
    /**
     * Get an existing Gateway 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 Gateway(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of Gateway.  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'] === Gateway.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["addresses"] = state?.addresses;
            resourceInputs["certificateUrls"] = state?.certificateUrls;
            resourceInputs["createTime"] = state?.createTime;
            resourceInputs["deleteSwgAutogenRouterOnDestroy"] = state?.deleteSwgAutogenRouterOnDestroy;
            resourceInputs["description"] = state?.description;
            resourceInputs["effectiveLabels"] = state?.effectiveLabels;
            resourceInputs["envoyHeaders"] = state?.envoyHeaders;
            resourceInputs["gatewaySecurityPolicy"] = state?.gatewaySecurityPolicy;
            resourceInputs["ipVersion"] = state?.ipVersion;
            resourceInputs["labels"] = state?.labels;
            resourceInputs["location"] = state?.location;
            resourceInputs["name"] = state?.name;
            resourceInputs["network"] = state?.network;
            resourceInputs["ports"] = state?.ports;
            resourceInputs["project"] = state?.project;
            resourceInputs["pulumiLabels"] = state?.pulumiLabels;
            resourceInputs["routingMode"] = state?.routingMode;
            resourceInputs["scope"] = state?.scope;
            resourceInputs["selfLink"] = state?.selfLink;
            resourceInputs["serverTlsPolicy"] = state?.serverTlsPolicy;
            resourceInputs["subnetwork"] = state?.subnetwork;
            resourceInputs["type"] = state?.type;
            resourceInputs["updateTime"] = state?.updateTime;
        }
        else {
            const args = argsOrState;
            if (args?.ports === undefined && !opts.urn) {
                throw new Error("Missing required property 'ports'");
            }
            if (args?.type === undefined && !opts.urn) {
                throw new Error("Missing required property 'type'");
            }
            resourceInputs["addresses"] = args?.addresses;
            resourceInputs["certificateUrls"] = args?.certificateUrls;
            resourceInputs["deleteSwgAutogenRouterOnDestroy"] = args?.deleteSwgAutogenRouterOnDestroy;
            resourceInputs["description"] = args?.description;
            resourceInputs["envoyHeaders"] = args?.envoyHeaders;
            resourceInputs["gatewaySecurityPolicy"] = args?.gatewaySecurityPolicy;
            resourceInputs["ipVersion"] = args?.ipVersion;
            resourceInputs["labels"] = args?.labels;
            resourceInputs["location"] = args?.location;
            resourceInputs["name"] = args?.name;
            resourceInputs["network"] = args?.network;
            resourceInputs["ports"] = args?.ports;
            resourceInputs["project"] = args?.project;
            resourceInputs["routingMode"] = args?.routingMode;
            resourceInputs["scope"] = args?.scope;
            resourceInputs["serverTlsPolicy"] = args?.serverTlsPolicy;
            resourceInputs["subnetwork"] = args?.subnetwork;
            resourceInputs["type"] = args?.type;
            resourceInputs["createTime"] = undefined /*out*/;
            resourceInputs["effectiveLabels"] = undefined /*out*/;
            resourceInputs["pulumiLabels"] = undefined /*out*/;
            resourceInputs["selfLink"] = undefined /*out*/;
            resourceInputs["updateTime"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
        opts = pulumi.mergeOptions(opts, secretOpts);
        super(Gateway.__pulumiType, name, resourceInputs, opts);
    }
}
exports.Gateway = Gateway;
/** @internal */
Gateway.__pulumiType = 'gcp:networkservices/gateway:Gateway';
//# sourceMappingURL=gateway.js.map