"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.Datapolicyv2DataPolicy = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * BigQuery Data Policy
 *
 * To get more information about DataPolicy, see:
 *
 * * [API documentation](https://cloud.google.com/bigquery/docs/reference/bigquerydatapolicy/rest/v2/projects.locations.dataPolicies)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/bigquery/docs/column-data-masking-intro)
 *
 * ## Example Usage
 *
 * ### Bigquery Datapolicyv2 Datapolicy Basic
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const basicDataPolicy = new gcp.bigquery.Datapolicyv2DataPolicy("basic_data_policy", {
 *     location: "us-central1",
 *     dataPolicyType: "RAW_DATA_ACCESS_POLICY",
 *     dataPolicyId: "basic_data_policy",
 * });
 * ```
 * ### Bigquery Datapolicyv2 Datapolicy Predefined Masking
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const predefinedMaskingDataPolicy = new gcp.bigquery.Datapolicyv2DataPolicy("predefined_masking_data_policy", {
 *     location: "us-central1",
 *     dataPolicyType: "DATA_MASKING_POLICY",
 *     dataMaskingPolicy: {
 *         predefinedExpression: "SHA256",
 *     },
 *     dataPolicyId: "predefined_masking_data_policy",
 * });
 * ```
 * ### Bigquery Datapolicyv2 Datapolicy Routine
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * 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 routineDataPolicy = new gcp.bigquery.Datapolicyv2DataPolicy("routine_data_policy", {
 *     location: "us-central1",
 *     dataPolicyId: "routine_data_policy",
 *     dataPolicyType: "DATA_MASKING_POLICY",
 *     dataMaskingPolicy: {
 *         routine: customMaskingRoutine.id,
 *     },
 * });
 * ```
 * ### Bigquery Datapolicyv2 Datapolicy Withgrantees
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const dataPolicyWithGrantees = new gcp.bigquery.Datapolicyv2DataPolicy("data_policy_with_grantees", {
 *     location: "us-central1",
 *     dataPolicyType: "RAW_DATA_ACCESS_POLICY",
 *     grantees: ["principal://goog/subject/jane@example.com"],
 *     dataPolicyId: "data_policy_with_grantees",
 * });
 * ```
 *
 * ## 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:bigquery/datapolicyv2DataPolicy:Datapolicyv2DataPolicy default projects/{{project}}/locations/{{location}}/dataPolicies/{{data_policy_id}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:bigquery/datapolicyv2DataPolicy:Datapolicyv2DataPolicy default {{project}}/{{location}}/{{data_policy_id}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:bigquery/datapolicyv2DataPolicy:Datapolicyv2DataPolicy default {{location}}/{{data_policy_id}}
 * ```
 */
class Datapolicyv2DataPolicy extends pulumi.CustomResource {
    /**
     * Get an existing Datapolicyv2DataPolicy 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 Datapolicyv2DataPolicy(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of Datapolicyv2DataPolicy.  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'] === Datapolicyv2DataPolicy.__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["etag"] = state?.etag;
            resourceInputs["grantees"] = state?.grantees;
            resourceInputs["location"] = state?.location;
            resourceInputs["name"] = state?.name;
            resourceInputs["policyTag"] = state?.policyTag;
            resourceInputs["project"] = state?.project;
            resourceInputs["version"] = state?.version;
        }
        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'");
            }
            resourceInputs["dataMaskingPolicy"] = args?.dataMaskingPolicy;
            resourceInputs["dataPolicyId"] = args?.dataPolicyId;
            resourceInputs["dataPolicyType"] = args?.dataPolicyType;
            resourceInputs["etag"] = args?.etag;
            resourceInputs["grantees"] = args?.grantees;
            resourceInputs["location"] = args?.location;
            resourceInputs["project"] = args?.project;
            resourceInputs["name"] = undefined /*out*/;
            resourceInputs["policyTag"] = undefined /*out*/;
            resourceInputs["version"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(Datapolicyv2DataPolicy.__pulumiType, name, resourceInputs, opts);
    }
}
exports.Datapolicyv2DataPolicy = Datapolicyv2DataPolicy;
/** @internal */
Datapolicyv2DataPolicy.__pulumiType = 'gcp:bigquery/datapolicyv2DataPolicy:Datapolicyv2DataPolicy';
//# sourceMappingURL=datapolicyv2DataPolicy.js.map