@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
324 lines • 12.8 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.Dataset = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* ## Example Usage
*
* ### Bigquery Dataset Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const bqowner = new gcp.serviceaccount.Account("bqowner", {accountId: "bqowner"});
* const dataset = new gcp.bigquery.Dataset("dataset", {
* datasetId: "example_dataset",
* friendlyName: "test",
* description: "This is a test description",
* location: "EU",
* defaultTableExpirationMs: 3600000,
* labels: {
* env: "default",
* },
* accesses: [
* {
* role: "OWNER",
* userByEmail: bqowner.email,
* },
* {
* role: "READER",
* domain: "hashicorp.com",
* },
* ],
* });
* ```
* ### Bigquery Dataset Cmek
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const keyRing = new gcp.kms.KeyRing("key_ring", {
* name: "example-keyring",
* location: "us",
* });
* const cryptoKey = new gcp.kms.CryptoKey("crypto_key", {
* name: "example-key",
* keyRing: keyRing.id,
* });
* const dataset = new gcp.bigquery.Dataset("dataset", {
* datasetId: "example_dataset",
* friendlyName: "test",
* description: "This is a test description",
* location: "US",
* defaultTableExpirationMs: 3600000,
* defaultEncryptionConfiguration: {
* kmsKeyName: cryptoKey.id,
* },
* });
* ```
* ### Bigquery Dataset Authorized Dataset
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const bqowner = new gcp.serviceaccount.Account("bqowner", {accountId: "bqowner"});
* const _public = new gcp.bigquery.Dataset("public", {
* datasetId: "public",
* friendlyName: "test",
* description: "This dataset is public",
* location: "EU",
* defaultTableExpirationMs: 3600000,
* labels: {
* env: "default",
* },
* accesses: [
* {
* role: "OWNER",
* userByEmail: bqowner.email,
* },
* {
* role: "READER",
* domain: "hashicorp.com",
* },
* ],
* });
* const dataset = new gcp.bigquery.Dataset("dataset", {
* datasetId: "private",
* friendlyName: "test",
* description: "This dataset is private",
* location: "EU",
* defaultTableExpirationMs: 3600000,
* labels: {
* env: "default",
* },
* accesses: [
* {
* role: "OWNER",
* userByEmail: bqowner.email,
* },
* {
* role: "READER",
* domain: "hashicorp.com",
* },
* {
* dataset: {
* dataset: {
* projectId: _public.project,
* datasetId: _public.datasetId,
* },
* targetTypes: ["VIEWS"],
* },
* },
* ],
* });
* ```
* ### Bigquery Dataset Authorized Routine
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const _public = new gcp.bigquery.Dataset("public", {
* datasetId: "public_dataset",
* description: "This dataset is public",
* });
* const publicRoutine = new gcp.bigquery.Routine("public", {
* datasetId: _public.datasetId,
* routineId: "public_routine",
* routineType: "TABLE_VALUED_FUNCTION",
* language: "SQL",
* definitionBody: "SELECT 1 + value AS value\n",
* arguments: [{
* name: "value",
* argumentKind: "FIXED_TYPE",
* dataType: JSON.stringify({
* typeKind: "INT64",
* }),
* }],
* returnTableType: JSON.stringify({
* columns: [{
* name: "value",
* type: {
* typeKind: "INT64",
* },
* }],
* }),
* });
* const _private = new gcp.bigquery.Dataset("private", {
* datasetId: "private_dataset",
* description: "This dataset is private",
* accesses: [
* {
* role: "OWNER",
* userByEmail: "my@service-account.com",
* },
* {
* routine: {
* projectId: publicRoutine.project,
* datasetId: publicRoutine.datasetId,
* routineId: publicRoutine.routineId,
* },
* },
* ],
* });
* ```
* ### Bigquery Dataset External Reference Aws
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const dataset = new gcp.bigquery.Dataset("dataset", {
* datasetId: "example_dataset",
* friendlyName: "test",
* description: "This is a test description",
* location: "aws-us-east-1",
* externalDatasetReference: {
* externalSource: "aws-glue://arn:aws:glue:us-east-1:999999999999:database/database",
* connection: "projects/project/locations/aws-us-east-1/connections/connection",
* },
* });
* ```
* ### Bigquery Dataset External Catalog Dataset Options
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const dataset = new gcp.bigquery.Dataset("dataset", {
* datasetId: "example_dataset",
* friendlyName: "test",
* description: "This is a test description",
* location: "US",
* externalCatalogDatasetOptions: {
* parameters: {
* dataset_owner: "test_dataset_owner",
* },
* defaultStorageLocationUri: "gs://test_dataset/tables",
* },
* });
* ```
*
* ## Import
*
* Dataset can be imported using any of these accepted formats:
*
* * `projects/{{project}}/datasets/{{dataset_id}}`
*
* * `{{project}}/{{dataset_id}}`
*
* * `{{dataset_id}}`
*
* When using the `pulumi import` command, Dataset can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:bigquery/dataset:Dataset default projects/{{project}}/datasets/{{dataset_id}}
* ```
*
* ```sh
* $ pulumi import gcp:bigquery/dataset:Dataset default {{project}}/{{dataset_id}}
* ```
*
* ```sh
* $ pulumi import gcp:bigquery/dataset:Dataset default {{dataset_id}}
* ```
*/
class Dataset extends pulumi.CustomResource {
/**
* Get an existing Dataset 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 Dataset(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Dataset. 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'] === Dataset.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["accesses"] = state ? state.accesses : undefined;
resourceInputs["creationTime"] = state ? state.creationTime : undefined;
resourceInputs["datasetId"] = state ? state.datasetId : undefined;
resourceInputs["defaultCollation"] = state ? state.defaultCollation : undefined;
resourceInputs["defaultEncryptionConfiguration"] = state ? state.defaultEncryptionConfiguration : undefined;
resourceInputs["defaultPartitionExpirationMs"] = state ? state.defaultPartitionExpirationMs : undefined;
resourceInputs["defaultTableExpirationMs"] = state ? state.defaultTableExpirationMs : undefined;
resourceInputs["deleteContentsOnDestroy"] = state ? state.deleteContentsOnDestroy : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined;
resourceInputs["etag"] = state ? state.etag : undefined;
resourceInputs["externalCatalogDatasetOptions"] = state ? state.externalCatalogDatasetOptions : undefined;
resourceInputs["externalDatasetReference"] = state ? state.externalDatasetReference : undefined;
resourceInputs["friendlyName"] = state ? state.friendlyName : undefined;
resourceInputs["isCaseInsensitive"] = state ? state.isCaseInsensitive : undefined;
resourceInputs["labels"] = state ? state.labels : undefined;
resourceInputs["lastModifiedTime"] = state ? state.lastModifiedTime : undefined;
resourceInputs["location"] = state ? state.location : undefined;
resourceInputs["maxTimeTravelHours"] = state ? state.maxTimeTravelHours : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : undefined;
resourceInputs["resourceTags"] = state ? state.resourceTags : undefined;
resourceInputs["selfLink"] = state ? state.selfLink : undefined;
resourceInputs["storageBillingModel"] = state ? state.storageBillingModel : undefined;
}
else {
const args = argsOrState;
if ((!args || args.datasetId === undefined) && !opts.urn) {
throw new Error("Missing required property 'datasetId'");
}
resourceInputs["accesses"] = args ? args.accesses : undefined;
resourceInputs["datasetId"] = args ? args.datasetId : undefined;
resourceInputs["defaultCollation"] = args ? args.defaultCollation : undefined;
resourceInputs["defaultEncryptionConfiguration"] = args ? args.defaultEncryptionConfiguration : undefined;
resourceInputs["defaultPartitionExpirationMs"] = args ? args.defaultPartitionExpirationMs : undefined;
resourceInputs["defaultTableExpirationMs"] = args ? args.defaultTableExpirationMs : undefined;
resourceInputs["deleteContentsOnDestroy"] = args ? args.deleteContentsOnDestroy : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["externalCatalogDatasetOptions"] = args ? args.externalCatalogDatasetOptions : undefined;
resourceInputs["externalDatasetReference"] = args ? args.externalDatasetReference : undefined;
resourceInputs["friendlyName"] = args ? args.friendlyName : undefined;
resourceInputs["isCaseInsensitive"] = args ? args.isCaseInsensitive : undefined;
resourceInputs["labels"] = args ? args.labels : undefined;
resourceInputs["location"] = args ? args.location : undefined;
resourceInputs["maxTimeTravelHours"] = args ? args.maxTimeTravelHours : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["resourceTags"] = args ? args.resourceTags : undefined;
resourceInputs["storageBillingModel"] = args ? args.storageBillingModel : undefined;
resourceInputs["creationTime"] = undefined /*out*/;
resourceInputs["effectiveLabels"] = undefined /*out*/;
resourceInputs["etag"] = undefined /*out*/;
resourceInputs["lastModifiedTime"] = undefined /*out*/;
resourceInputs["pulumiLabels"] = undefined /*out*/;
resourceInputs["selfLink"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(Dataset.__pulumiType, name, resourceInputs, opts);
}
}
exports.Dataset = Dataset;
/** @internal */
Dataset.__pulumiType = 'gcp:bigquery/dataset:Dataset';
//# sourceMappingURL=dataset.js.map