"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.DataPolicy = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * A BigQuery Data Policy
 *
 * To get more information about DataPolicy, see:
 *
 * * [API documentation](https://cloud.google.com/bigquery/docs/reference/bigquerydatapolicy/rest/v1beta1/projects.locations.dataPolicies/create)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/bigquery/docs/column-data-masking-intro)
 *
 * ## Example Usage
 *
 * ### Bigquery Datapolicy Data Policy Basic
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const taxonomy = new gcp.datacatalog.Taxonomy("taxonomy", {
 *     region: "us-central1",
 *     displayName: "taxonomy",
 *     description: "A collection of policy tags",
 *     activatedPolicyTypes: ["FINE_GRAINED_ACCESS_CONTROL"],
 * });
 * const policyTag = new gcp.datacatalog.PolicyTag("policy_tag", {
 *     taxonomy: taxonomy.id,
 *     displayName: "Low security",
 *     description: "A policy tag normally associated with low security items",
 * });
 * const dataPolicy = new gcp.bigquerydatapolicy.DataPolicy("data_policy", {
 *     location: "us-central1",
 *     dataPolicyId: "data_policy",
 *     policyTag: policyTag.name,
 *     dataPolicyType: "COLUMN_LEVEL_SECURITY_POLICY",
 * });
 * ```
 * ### Bigquery Datapolicy Data Policy Routine
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const taxonomy = new gcp.datacatalog.Taxonomy("taxonomy", {
 *     region: "us-central1",
 *     displayName: "taxonomy",
 *     description: "A collection of policy tags",
 *     activatedPolicyTypes: ["FINE_GRAINED_ACCESS_CONTROL"],
 * });
 * const policyTag = new gcp.datacatalog.PolicyTag("policy_tag", {
 *     taxonomy: taxonomy.id,
 *     displayName: "Low security",
 *     description: "A policy tag normally associated with low security items",
 * });
 * const test = new gcp.bigquery.Dataset("test", {
 *     datasetId: "dataset_id",
 *     location: "us-central1",
 * });
 * const customMaskingRoutine = new gcp.bigquery.Routine("custom_masking_routine", {
 *     datasetId: test.datasetId,
 *     routineId: "custom_masking_routine",
 *     routineType: "SCALAR_FUNCTION",
 *     language: "SQL",
 *     dataGovernanceType: "DATA_MASKING",
 *     definitionBody: "SAFE.REGEXP_REPLACE(ssn, '[0-9]', 'X')",
 *     returnType: "{\"typeKind\" :  \"STRING\"}",
 *     arguments: [{
 *         name: "ssn",
 *         dataType: "{\"typeKind\" :  \"STRING\"}",
 *     }],
 * });
 * const dataPolicy = new gcp.bigquerydatapolicy.DataPolicy("data_policy", {
 *     location: "us-central1",
 *     dataPolicyId: "data_policy",
 *     policyTag: policyTag.name,
 *     dataPolicyType: "DATA_MASKING_POLICY",
 *     dataMaskingPolicy: {
 *         routine: customMaskingRoutine.id,
 *     },
 * });
 * ```
 *
 * ## Import
 *
 * DataPolicy can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/locations/{{location}}/dataPolicies/{{data_policy_id}}`
 *
 * * `{{project}}/{{location}}/{{data_policy_id}}`
 *
 * * `{{location}}/{{data_policy_id}}`
 *
 * When using the `pulumi import` command, DataPolicy can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:bigquerydatapolicy/dataPolicy:DataPolicy default projects/{{project}}/locations/{{location}}/dataPolicies/{{data_policy_id}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:bigquerydatapolicy/dataPolicy:DataPolicy default {{project}}/{{location}}/{{data_policy_id}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:bigquerydatapolicy/dataPolicy:DataPolicy default {{location}}/{{data_policy_id}}
 * ```
 */
class DataPolicy extends pulumi.CustomResource {
    /**
     * Get an existing DataPolicy 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 DataPolicy(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of DataPolicy.  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'] === DataPolicy.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["dataMaskingPolicy"] = state?.dataMaskingPolicy;
            resourceInputs["dataPolicyId"] = state?.dataPolicyId;
            resourceInputs["dataPolicyType"] = state?.dataPolicyType;
            resourceInputs["location"] = state?.location;
            resourceInputs["name"] = state?.name;
            resourceInputs["policyTag"] = state?.policyTag;
            resourceInputs["project"] = state?.project;
        }
        else {
            const args = argsOrState;
            if (args?.dataPolicyId === undefined && !opts.urn) {
                throw new Error("Missing required property 'dataPolicyId'");
            }
            if (args?.dataPolicyType === undefined && !opts.urn) {
                throw new Error("Missing required property 'dataPolicyType'");
            }
            if (args?.location === undefined && !opts.urn) {
                throw new Error("Missing required property 'location'");
            }
            if (args?.policyTag === undefined && !opts.urn) {
                throw new Error("Missing required property 'policyTag'");
            }
            resourceInputs["dataMaskingPolicy"] = args?.dataMaskingPolicy;
            resourceInputs["dataPolicyId"] = args?.dataPolicyId;
            resourceInputs["dataPolicyType"] = args?.dataPolicyType;
            resourceInputs["location"] = args?.location;
            resourceInputs["policyTag"] = args?.policyTag;
            resourceInputs["project"] = args?.project;
            resourceInputs["name"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(DataPolicy.__pulumiType, name, resourceInputs, opts);
    }
}
exports.DataPolicy = DataPolicy;
/** @internal */
DataPolicy.__pulumiType = 'gcp:bigquerydatapolicy/dataPolicy:DataPolicy';
//# sourceMappingURL=dataPolicy.js.map