@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
215 lines • 11 kB
JavaScript
;
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.Table = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Creates a table resource in a dataset for Google BigQuery. For more information see
* [the official documentation](https://cloud.google.com/bigquery/docs/) and
* [API](https://cloud.google.com/bigquery/docs/reference/rest/v2/tables).
*
* > **Note**: On newer versions of the provider, you must explicitly set `deletion_protection=false`
* (and run `pulumi update` to write the field to state) in order to destroy an instance.
* It is recommended to not set this field (or set it to true) until you're ready to destroy.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const _default = new gcp.bigquery.Dataset("default", {
* datasetId: "foo",
* friendlyName: "test",
* description: "This is a test description",
* location: "EU",
* defaultTableExpirationMs: 3600000,
* labels: {
* env: "default",
* },
* });
* const defaultTable = new gcp.bigquery.Table("default", {
* datasetId: _default.datasetId,
* tableId: "bar",
* timePartitioning: {
* type: "DAY",
* },
* labels: {
* env: "default",
* },
* schema: `[
* {
* "name": "permalink",
* "type": "STRING",
* "mode": "NULLABLE",
* "description": "The Permalink"
* },
* {
* "name": "state",
* "type": "STRING",
* "mode": "NULLABLE",
* "description": "State where the head office is located"
* }
* ]
* `,
* });
* const sheet = new gcp.bigquery.Table("sheet", {
* datasetId: _default.datasetId,
* tableId: "sheet",
* externalDataConfiguration: {
* autodetect: true,
* sourceFormat: "GOOGLE_SHEETS",
* googleSheetsOptions: {
* skipLeadingRows: 1,
* },
* sourceUris: ["https://docs.google.com/spreadsheets/d/123456789012345"],
* },
* });
* ```
*
* ## Import
*
* BigQuery tables can be imported using any of these accepted formats:
*
* * `projects/{{project}}/datasets/{{dataset_id}}/tables/{{table_id}}`
*
* * `{{project}}/{{dataset_id}}/{{table_id}}`
*
* * `{{dataset_id}}/{{table_id}}`
*
* When using the `pulumi import` command, BigQuery tables can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:bigquery/table:Table default projects/{{project}}/datasets/{{dataset_id}}/tables/{{table_id}}
* ```
*
* ```sh
* $ pulumi import gcp:bigquery/table:Table default {{project}}/{{dataset_id}}/{{table_id}}
* ```
*
* ```sh
* $ pulumi import gcp:bigquery/table:Table default {{dataset_id}}/{{table_id}}
* ```
*/
class Table extends pulumi.CustomResource {
/**
* Get an existing Table 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 Table(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Table. 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'] === Table.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["biglakeConfiguration"] = state ? state.biglakeConfiguration : undefined;
resourceInputs["clusterings"] = state ? state.clusterings : undefined;
resourceInputs["creationTime"] = state ? state.creationTime : undefined;
resourceInputs["datasetId"] = state ? state.datasetId : undefined;
resourceInputs["deletionProtection"] = state ? state.deletionProtection : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined;
resourceInputs["encryptionConfiguration"] = state ? state.encryptionConfiguration : undefined;
resourceInputs["etag"] = state ? state.etag : undefined;
resourceInputs["expirationTime"] = state ? state.expirationTime : undefined;
resourceInputs["externalCatalogTableOptions"] = state ? state.externalCatalogTableOptions : undefined;
resourceInputs["externalDataConfiguration"] = state ? state.externalDataConfiguration : undefined;
resourceInputs["friendlyName"] = state ? state.friendlyName : undefined;
resourceInputs["labels"] = state ? state.labels : undefined;
resourceInputs["lastModifiedTime"] = state ? state.lastModifiedTime : undefined;
resourceInputs["location"] = state ? state.location : undefined;
resourceInputs["materializedView"] = state ? state.materializedView : undefined;
resourceInputs["maxStaleness"] = state ? state.maxStaleness : undefined;
resourceInputs["numBytes"] = state ? state.numBytes : undefined;
resourceInputs["numLongTermBytes"] = state ? state.numLongTermBytes : undefined;
resourceInputs["numRows"] = state ? state.numRows : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : undefined;
resourceInputs["rangePartitioning"] = state ? state.rangePartitioning : undefined;
resourceInputs["requirePartitionFilter"] = state ? state.requirePartitionFilter : undefined;
resourceInputs["resourceTags"] = state ? state.resourceTags : undefined;
resourceInputs["schema"] = state ? state.schema : undefined;
resourceInputs["schemaForeignTypeInfo"] = state ? state.schemaForeignTypeInfo : undefined;
resourceInputs["selfLink"] = state ? state.selfLink : undefined;
resourceInputs["tableConstraints"] = state ? state.tableConstraints : undefined;
resourceInputs["tableId"] = state ? state.tableId : undefined;
resourceInputs["tableMetadataView"] = state ? state.tableMetadataView : undefined;
resourceInputs["tableReplicationInfo"] = state ? state.tableReplicationInfo : undefined;
resourceInputs["timePartitioning"] = state ? state.timePartitioning : undefined;
resourceInputs["type"] = state ? state.type : undefined;
resourceInputs["view"] = state ? state.view : undefined;
}
else {
const args = argsOrState;
if ((!args || args.datasetId === undefined) && !opts.urn) {
throw new Error("Missing required property 'datasetId'");
}
if ((!args || args.tableId === undefined) && !opts.urn) {
throw new Error("Missing required property 'tableId'");
}
resourceInputs["biglakeConfiguration"] = args ? args.biglakeConfiguration : undefined;
resourceInputs["clusterings"] = args ? args.clusterings : undefined;
resourceInputs["datasetId"] = args ? args.datasetId : undefined;
resourceInputs["deletionProtection"] = args ? args.deletionProtection : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["encryptionConfiguration"] = args ? args.encryptionConfiguration : undefined;
resourceInputs["expirationTime"] = args ? args.expirationTime : undefined;
resourceInputs["externalCatalogTableOptions"] = args ? args.externalCatalogTableOptions : undefined;
resourceInputs["externalDataConfiguration"] = args ? args.externalDataConfiguration : undefined;
resourceInputs["friendlyName"] = args ? args.friendlyName : undefined;
resourceInputs["labels"] = args ? args.labels : undefined;
resourceInputs["materializedView"] = args ? args.materializedView : undefined;
resourceInputs["maxStaleness"] = args ? args.maxStaleness : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["rangePartitioning"] = args ? args.rangePartitioning : undefined;
resourceInputs["requirePartitionFilter"] = args ? args.requirePartitionFilter : undefined;
resourceInputs["resourceTags"] = args ? args.resourceTags : undefined;
resourceInputs["schema"] = args ? args.schema : undefined;
resourceInputs["schemaForeignTypeInfo"] = args ? args.schemaForeignTypeInfo : undefined;
resourceInputs["tableConstraints"] = args ? args.tableConstraints : undefined;
resourceInputs["tableId"] = args ? args.tableId : undefined;
resourceInputs["tableMetadataView"] = args ? args.tableMetadataView : undefined;
resourceInputs["tableReplicationInfo"] = args ? args.tableReplicationInfo : undefined;
resourceInputs["timePartitioning"] = args ? args.timePartitioning : undefined;
resourceInputs["view"] = args ? args.view : undefined;
resourceInputs["creationTime"] = undefined /*out*/;
resourceInputs["effectiveLabels"] = undefined /*out*/;
resourceInputs["etag"] = undefined /*out*/;
resourceInputs["lastModifiedTime"] = undefined /*out*/;
resourceInputs["location"] = undefined /*out*/;
resourceInputs["numBytes"] = undefined /*out*/;
resourceInputs["numLongTermBytes"] = undefined /*out*/;
resourceInputs["numRows"] = undefined /*out*/;
resourceInputs["pulumiLabels"] = undefined /*out*/;
resourceInputs["selfLink"] = undefined /*out*/;
resourceInputs["type"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(Table.__pulumiType, name, resourceInputs, opts);
}
}
exports.Table = Table;
/** @internal */
Table.__pulumiType = 'gcp:bigquery/table:Table';
//# sourceMappingURL=table.js.map