UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

238 lines • 11.5 kB
"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! *** var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Table = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(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}} * $ pulumi import gcp:bigquery/table:Table default {{project}}/{{dataset_id}}/{{table_id}} * $ 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, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:bigquery/table:Table'; /** * 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?.biglakeConfiguration; resourceInputs["clusterings"] = state?.clusterings; resourceInputs["creationTime"] = state?.creationTime; resourceInputs["datasetId"] = state?.datasetId; resourceInputs["deletionPolicy"] = state?.deletionPolicy; resourceInputs["deletionProtection"] = state?.deletionProtection; resourceInputs["description"] = state?.description; resourceInputs["effectiveLabels"] = state?.effectiveLabels; resourceInputs["encryptionConfiguration"] = state?.encryptionConfiguration; resourceInputs["etag"] = state?.etag; resourceInputs["expirationTime"] = state?.expirationTime; resourceInputs["externalCatalogTableOptions"] = state?.externalCatalogTableOptions; resourceInputs["externalDataConfiguration"] = state?.externalDataConfiguration; resourceInputs["friendlyName"] = state?.friendlyName; resourceInputs["generatedSchemaColumns"] = state?.generatedSchemaColumns; resourceInputs["ignoreAutoGeneratedSchema"] = state?.ignoreAutoGeneratedSchema; resourceInputs["ignoreSchemaChanges"] = state?.ignoreSchemaChanges; resourceInputs["labels"] = state?.labels; resourceInputs["lastModifiedTime"] = state?.lastModifiedTime; resourceInputs["location"] = state?.location; resourceInputs["materializedView"] = state?.materializedView; resourceInputs["maxStaleness"] = state?.maxStaleness; resourceInputs["numBytes"] = state?.numBytes; resourceInputs["numLongTermBytes"] = state?.numLongTermBytes; resourceInputs["numRows"] = state?.numRows; resourceInputs["project"] = state?.project; resourceInputs["pulumiLabels"] = state?.pulumiLabels; resourceInputs["rangePartitioning"] = state?.rangePartitioning; resourceInputs["requirePartitionFilter"] = state?.requirePartitionFilter; resourceInputs["resourceTags"] = state?.resourceTags; resourceInputs["schema"] = state?.schema; resourceInputs["schemaForeignTypeInfo"] = state?.schemaForeignTypeInfo; resourceInputs["selfLink"] = state?.selfLink; resourceInputs["tableConstraints"] = state?.tableConstraints; resourceInputs["tableId"] = state?.tableId; resourceInputs["tableMetadataView"] = state?.tableMetadataView; resourceInputs["tableReplicationInfo"] = state?.tableReplicationInfo; resourceInputs["timePartitioning"] = state?.timePartitioning; resourceInputs["type"] = state?.type; resourceInputs["view"] = state?.view; } else { const args = argsOrState; if (args?.datasetId === undefined && !opts.urn) { throw new Error("Missing required property 'datasetId'"); } if (args?.tableId === undefined && !opts.urn) { throw new Error("Missing required property 'tableId'"); } resourceInputs["biglakeConfiguration"] = args?.biglakeConfiguration; resourceInputs["clusterings"] = args?.clusterings; resourceInputs["datasetId"] = args?.datasetId; resourceInputs["deletionPolicy"] = args?.deletionPolicy; resourceInputs["deletionProtection"] = args?.deletionProtection; resourceInputs["description"] = args?.description; resourceInputs["encryptionConfiguration"] = args?.encryptionConfiguration; resourceInputs["expirationTime"] = args?.expirationTime; resourceInputs["externalCatalogTableOptions"] = args?.externalCatalogTableOptions; resourceInputs["externalDataConfiguration"] = args?.externalDataConfiguration; resourceInputs["friendlyName"] = args?.friendlyName; resourceInputs["ignoreAutoGeneratedSchema"] = args?.ignoreAutoGeneratedSchema; resourceInputs["ignoreSchemaChanges"] = args?.ignoreSchemaChanges; resourceInputs["labels"] = args?.labels; resourceInputs["materializedView"] = args?.materializedView; resourceInputs["maxStaleness"] = args?.maxStaleness; resourceInputs["project"] = args?.project; resourceInputs["rangePartitioning"] = args?.rangePartitioning; resourceInputs["requirePartitionFilter"] = args?.requirePartitionFilter; resourceInputs["resourceTags"] = args?.resourceTags; resourceInputs["schema"] = args?.schema; resourceInputs["schemaForeignTypeInfo"] = args?.schemaForeignTypeInfo; resourceInputs["tableConstraints"] = args?.tableConstraints; resourceInputs["tableId"] = args?.tableId; resourceInputs["tableMetadataView"] = args?.tableMetadataView; resourceInputs["tableReplicationInfo"] = args?.tableReplicationInfo; resourceInputs["timePartitioning"] = args?.timePartitioning; resourceInputs["view"] = args?.view; resourceInputs["creationTime"] = undefined /*out*/; resourceInputs["effectiveLabels"] = undefined /*out*/; resourceInputs["etag"] = undefined /*out*/; resourceInputs["generatedSchemaColumns"] = 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; //# sourceMappingURL=table.js.map