"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.MaterializedView = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * A materialized view object that can be referenced in SQL queries.
 *
 * To get more information about MaterializedView, see:
 *
 * * [API documentation](https://cloud.google.com/bigtable/docs/reference/admin/rest/v2/projects.instances.materializedViews)
 *
 * ## Example Usage
 *
 * ### Bigtable Materialized View
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const instance = new gcp.bigtable.Instance("instance", {
 *     name: "bt-instance",
 *     clusters: [{
 *         clusterId: "cluster-1",
 *         zone: "us-east1-b",
 *         numNodes: 3,
 *         storageType: "HDD",
 *     }],
 *     deletionProtection: true,
 * });
 * const table = new gcp.bigtable.Table("table", {
 *     name: "bt-table",
 *     instanceName: instance.name,
 *     columnFamilies: [{
 *         family: "CF",
 *     }],
 * });
 * const materializedView = new gcp.bigtable.MaterializedView("materialized_view", {
 *     materializedViewId: "bt-materialized-view",
 *     instance: instance.name,
 *     deletionProtection: false,
 *     query: `SELECT _key, COUNT(CF['col1']) as Count
 * FROM \` + "\`bt-table\`" + \`
 * GROUP BY _key
 * `,
 * }, {
 *     dependsOn: [table],
 * });
 * ```
 *
 * ## Import
 *
 * MaterializedView can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/instances/{{instance}}/materializedViews/{{materialized_view_id}}`
 *
 * * `{{project}}/{{instance}}/{{materialized_view_id}}`
 *
 * * `{{instance}}/{{materialized_view_id}}`
 *
 * When using the `pulumi import` command, MaterializedView can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:bigtable/materializedView:MaterializedView default projects/{{project}}/instances/{{instance}}/materializedViews/{{materialized_view_id}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:bigtable/materializedView:MaterializedView default {{project}}/{{instance}}/{{materialized_view_id}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:bigtable/materializedView:MaterializedView default {{instance}}/{{materialized_view_id}}
 * ```
 */
class MaterializedView extends pulumi.CustomResource {
    /**
     * Get an existing MaterializedView 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 MaterializedView(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of MaterializedView.  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'] === MaterializedView.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["deletionProtection"] = state?.deletionProtection;
            resourceInputs["instance"] = state?.instance;
            resourceInputs["materializedViewId"] = state?.materializedViewId;
            resourceInputs["name"] = state?.name;
            resourceInputs["project"] = state?.project;
            resourceInputs["query"] = state?.query;
        }
        else {
            const args = argsOrState;
            if (args?.materializedViewId === undefined && !opts.urn) {
                throw new Error("Missing required property 'materializedViewId'");
            }
            if (args?.query === undefined && !opts.urn) {
                throw new Error("Missing required property 'query'");
            }
            resourceInputs["deletionProtection"] = args?.deletionProtection;
            resourceInputs["instance"] = args?.instance;
            resourceInputs["materializedViewId"] = args?.materializedViewId;
            resourceInputs["project"] = args?.project;
            resourceInputs["query"] = args?.query;
            resourceInputs["name"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(MaterializedView.__pulumiType, name, resourceInputs, opts);
    }
}
exports.MaterializedView = MaterializedView;
/** @internal */
MaterializedView.__pulumiType = 'gcp:bigtable/materializedView:MaterializedView';
//# sourceMappingURL=materializedView.js.map