"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.OrganizationSecurityPolicyAssociation = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * An association for the OrganizationSecurityPolicy.
 *
 * To get more information about OrganizationSecurityPolicyAssociation, see:
 *
 * * [API documentation](https://cloud.google.com/compute/docs/reference/rest/beta/organizationSecurityPolicies/addAssociation)
 * * How-to Guides
 *     * [Associating a policy with the organization or folder](https://cloud.google.com/vpc/docs/using-firewall-policies#associate)
 *
 * ## Example Usage
 *
 * ### Organization Security Policy Association Basic
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const securityPolicyTarget = new gcp.organizations.Folder("security_policy_target", {
 *     displayName: "tf-test-secpol",
 *     parent: "organizations/123456789",
 *     deletionProtection: false,
 * });
 * const policy = new gcp.compute.OrganizationSecurityPolicy("policy", {
 *     displayName: "tf-test",
 *     parent: securityPolicyTarget.name,
 * });
 * const policyOrganizationSecurityPolicyRule = new gcp.compute.OrganizationSecurityPolicyRule("policy", {
 *     policyId: policy.id,
 *     action: "allow",
 *     direction: "INGRESS",
 *     enableLogging: true,
 *     match: {
 *         config: {
 *             srcIpRanges: [
 *                 "192.168.0.0/16",
 *                 "10.0.0.0/8",
 *             ],
 *             layer4Configs: [
 *                 {
 *                     ipProtocol: "tcp",
 *                     ports: ["22"],
 *                 },
 *                 {
 *                     ipProtocol: "icmp",
 *                 },
 *             ],
 *         },
 *     },
 *     priority: 100,
 * });
 * const policyOrganizationSecurityPolicyAssociation = new gcp.compute.OrganizationSecurityPolicyAssociation("policy", {
 *     name: "tf-test",
 *     attachmentId: policy.parent,
 *     policyId: policy.id,
 * });
 * ```
 *
 * ## Import
 *
 * OrganizationSecurityPolicyAssociation can be imported using any of these accepted formats:
 *
 * * `{{policy_id}}/association/{{name}}`
 *
 * When using the `pulumi import` command, OrganizationSecurityPolicyAssociation can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:compute/organizationSecurityPolicyAssociation:OrganizationSecurityPolicyAssociation default {{policy_id}}/association/{{name}}
 * ```
 */
class OrganizationSecurityPolicyAssociation extends pulumi.CustomResource {
    /**
     * Get an existing OrganizationSecurityPolicyAssociation 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 OrganizationSecurityPolicyAssociation(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of OrganizationSecurityPolicyAssociation.  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'] === OrganizationSecurityPolicyAssociation.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["attachmentId"] = state?.attachmentId;
            resourceInputs["displayName"] = state?.displayName;
            resourceInputs["name"] = state?.name;
            resourceInputs["policyId"] = state?.policyId;
        }
        else {
            const args = argsOrState;
            if (args?.attachmentId === undefined && !opts.urn) {
                throw new Error("Missing required property 'attachmentId'");
            }
            if (args?.policyId === undefined && !opts.urn) {
                throw new Error("Missing required property 'policyId'");
            }
            resourceInputs["attachmentId"] = args?.attachmentId;
            resourceInputs["name"] = args?.name;
            resourceInputs["policyId"] = args?.policyId;
            resourceInputs["displayName"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(OrganizationSecurityPolicyAssociation.__pulumiType, name, resourceInputs, opts);
    }
}
exports.OrganizationSecurityPolicyAssociation = OrganizationSecurityPolicyAssociation;
/** @internal */
OrganizationSecurityPolicyAssociation.__pulumiType = 'gcp:compute/organizationSecurityPolicyAssociation:OrganizationSecurityPolicyAssociation';
//# sourceMappingURL=organizationSecurityPolicyAssociation.js.map