@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
134 lines • 5.4 kB
JavaScript
;
// *** 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, Object.assign(Object.assign({}, 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 ? state.deletionProtection : undefined;
resourceInputs["instance"] = state ? state.instance : undefined;
resourceInputs["materializedViewId"] = state ? state.materializedViewId : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["query"] = state ? state.query : undefined;
}
else {
const args = argsOrState;
if ((!args || args.materializedViewId === undefined) && !opts.urn) {
throw new Error("Missing required property 'materializedViewId'");
}
if ((!args || args.query === undefined) && !opts.urn) {
throw new Error("Missing required property 'query'");
}
resourceInputs["deletionProtection"] = args ? args.deletionProtection : undefined;
resourceInputs["instance"] = args ? args.instance : undefined;
resourceInputs["materializedViewId"] = args ? args.materializedViewId : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["query"] = args ? args.query : undefined;
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