"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.Firewall = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * Each network has its own firewall controlling access to and from the
 * instances.
 *
 * All traffic to instances, even from other instances, is blocked by the
 * firewall unless firewall rules are created to allow it.
 *
 * The default network has automatically created firewall rules that are
 * shown in default firewall rules. No manually created network has
 * automatically created firewall rules except for a default "allow" rule for
 * outgoing traffic and a default "deny" for incoming traffic. For all
 * networks except the default network, you must create any firewall rules
 * you need.
 *
 * To get more information about Firewall, see:
 *
 * * [API documentation](https://cloud.google.com/compute/docs/reference/v1/firewalls)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/vpc/docs/firewalls)
 *
 * ## Example Usage
 *
 * ### Firewall Basic
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const defaultNetwork = new gcp.compute.Network("default", {name: "test-network"});
 * const _default = new gcp.compute.Firewall("default", {
 *     name: "test-firewall",
 *     network: defaultNetwork.name,
 *     allows: [
 *         {
 *             protocol: "icmp",
 *         },
 *         {
 *             protocol: "tcp",
 *             ports: [
 *                 "80",
 *                 "8080",
 *                 "1000-2000",
 *             ],
 *         },
 *     ],
 *     sourceTags: ["web"],
 * });
 * ```
 * ### Firewall With Target Tags
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const rules = new gcp.compute.Firewall("rules", {
 *     project: "my-project-name",
 *     name: "my-firewall-rule",
 *     network: "default",
 *     description: "Creates firewall rule targeting tagged instances",
 *     allows: [{
 *         protocol: "tcp",
 *         ports: [
 *             "80",
 *             "8080",
 *             "1000-2000",
 *         ],
 *     }],
 *     sourceTags: ["foo"],
 *     targetTags: ["web"],
 * });
 * ```
 *
 * ## Import
 *
 * Firewall can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/global/firewalls/{{name}}`
 *
 * * `{{project}}/{{name}}`
 *
 * * `{{name}}`
 *
 * When using the `pulumi import` command, Firewall can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:compute/firewall:Firewall default projects/{{project}}/global/firewalls/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/firewall:Firewall default {{project}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/firewall:Firewall default {{name}}
 * ```
 */
class Firewall extends pulumi.CustomResource {
    /**
     * Get an existing Firewall 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 Firewall(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of Firewall.  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'] === Firewall.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["allows"] = state?.allows;
            resourceInputs["creationTimestamp"] = state?.creationTimestamp;
            resourceInputs["denies"] = state?.denies;
            resourceInputs["description"] = state?.description;
            resourceInputs["destinationRanges"] = state?.destinationRanges;
            resourceInputs["direction"] = state?.direction;
            resourceInputs["disabled"] = state?.disabled;
            resourceInputs["enableLogging"] = state?.enableLogging;
            resourceInputs["logConfig"] = state?.logConfig;
            resourceInputs["name"] = state?.name;
            resourceInputs["network"] = state?.network;
            resourceInputs["params"] = state?.params;
            resourceInputs["priority"] = state?.priority;
            resourceInputs["project"] = state?.project;
            resourceInputs["selfLink"] = state?.selfLink;
            resourceInputs["sourceRanges"] = state?.sourceRanges;
            resourceInputs["sourceServiceAccounts"] = state?.sourceServiceAccounts;
            resourceInputs["sourceTags"] = state?.sourceTags;
            resourceInputs["targetServiceAccounts"] = state?.targetServiceAccounts;
            resourceInputs["targetTags"] = state?.targetTags;
        }
        else {
            const args = argsOrState;
            if (args?.network === undefined && !opts.urn) {
                throw new Error("Missing required property 'network'");
            }
            resourceInputs["allows"] = args?.allows;
            resourceInputs["denies"] = args?.denies;
            resourceInputs["description"] = args?.description;
            resourceInputs["destinationRanges"] = args?.destinationRanges;
            resourceInputs["direction"] = args?.direction;
            resourceInputs["disabled"] = args?.disabled;
            resourceInputs["enableLogging"] = args?.enableLogging;
            resourceInputs["logConfig"] = args?.logConfig;
            resourceInputs["name"] = args?.name;
            resourceInputs["network"] = args?.network;
            resourceInputs["params"] = args?.params;
            resourceInputs["priority"] = args?.priority;
            resourceInputs["project"] = args?.project;
            resourceInputs["sourceRanges"] = args?.sourceRanges;
            resourceInputs["sourceServiceAccounts"] = args?.sourceServiceAccounts;
            resourceInputs["sourceTags"] = args?.sourceTags;
            resourceInputs["targetServiceAccounts"] = args?.targetServiceAccounts;
            resourceInputs["targetTags"] = args?.targetTags;
            resourceInputs["creationTimestamp"] = undefined /*out*/;
            resourceInputs["selfLink"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(Firewall.__pulumiType, name, resourceInputs, opts);
    }
}
exports.Firewall = Firewall;
/** @internal */
Firewall.__pulumiType = 'gcp:compute/firewall:Firewall';
//# sourceMappingURL=firewall.js.map