UNPKG

@pulumi/gcp

Version:

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

324 lines • 11.9 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! *** 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: "roles/bigquery.dataOwner", * 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, { ...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?.accesses; resourceInputs["creationTime"] = state?.creationTime; resourceInputs["datasetId"] = state?.datasetId; resourceInputs["defaultCollation"] = state?.defaultCollation; resourceInputs["defaultEncryptionConfiguration"] = state?.defaultEncryptionConfiguration; resourceInputs["defaultPartitionExpirationMs"] = state?.defaultPartitionExpirationMs; resourceInputs["defaultTableExpirationMs"] = state?.defaultTableExpirationMs; resourceInputs["deleteContentsOnDestroy"] = state?.deleteContentsOnDestroy; resourceInputs["description"] = state?.description; resourceInputs["effectiveLabels"] = state?.effectiveLabels; resourceInputs["etag"] = state?.etag; resourceInputs["externalCatalogDatasetOptions"] = state?.externalCatalogDatasetOptions; resourceInputs["externalDatasetReference"] = state?.externalDatasetReference; resourceInputs["friendlyName"] = state?.friendlyName; resourceInputs["isCaseInsensitive"] = state?.isCaseInsensitive; resourceInputs["labels"] = state?.labels; resourceInputs["lastModifiedTime"] = state?.lastModifiedTime; resourceInputs["location"] = state?.location; resourceInputs["maxTimeTravelHours"] = state?.maxTimeTravelHours; resourceInputs["project"] = state?.project; resourceInputs["pulumiLabels"] = state?.pulumiLabels; resourceInputs["resourceTags"] = state?.resourceTags; resourceInputs["selfLink"] = state?.selfLink; resourceInputs["storageBillingModel"] = state?.storageBillingModel; } else { const args = argsOrState; if (args?.datasetId === undefined && !opts.urn) { throw new Error("Missing required property 'datasetId'"); } resourceInputs["accesses"] = args?.accesses; resourceInputs["datasetId"] = args?.datasetId; resourceInputs["defaultCollation"] = args?.defaultCollation; resourceInputs["defaultEncryptionConfiguration"] = args?.defaultEncryptionConfiguration; resourceInputs["defaultPartitionExpirationMs"] = args?.defaultPartitionExpirationMs; resourceInputs["defaultTableExpirationMs"] = args?.defaultTableExpirationMs; resourceInputs["deleteContentsOnDestroy"] = args?.deleteContentsOnDestroy; resourceInputs["description"] = args?.description; resourceInputs["externalCatalogDatasetOptions"] = args?.externalCatalogDatasetOptions; resourceInputs["externalDatasetReference"] = args?.externalDatasetReference; resourceInputs["friendlyName"] = args?.friendlyName; resourceInputs["isCaseInsensitive"] = args?.isCaseInsensitive; resourceInputs["labels"] = args?.labels; resourceInputs["location"] = args?.location; resourceInputs["maxTimeTravelHours"] = args?.maxTimeTravelHours; resourceInputs["project"] = args?.project; resourceInputs["resourceTags"] = args?.resourceTags; resourceInputs["storageBillingModel"] = args?.storageBillingModel; 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