UNPKG

@pulumi/gcp

Version:

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

232 lines • 9.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.DatasetAccess = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * Gives dataset access for a single entity. This resource is intended to be used in cases where * it is not possible to compile a full list of access blocks to include in a * `gcp.bigquery.Dataset` resource, to enable them to be added separately. * * > **Note:** If this resource is used alongside a `gcp.bigquery.Dataset` resource, the * dataset resource must either have no defined `access` blocks or a `lifecycle` block with * `ignoreChanges = [access]` so they don't fight over which accesses should be on the dataset. * Additionally, both resource cannot be modified in the same apply. * * To get more information about DatasetAccess, see: * * * [API documentation](https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets) * * How-to Guides * * [Controlling access to datasets](https://cloud.google.com/bigquery/docs/dataset-access-controls) * * > **Warning:** You must specify the role field using the legacy format `OWNER` instead of `roles/bigquery.dataOwner`. * The API does accept both formats but it will always return the legacy format which results in Terraform * showing permanent diff on each plan and apply operation. * * ## Example Usage * * ### Bigquery Dataset Access Basic User * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const dataset = new gcp.bigquery.Dataset("dataset", {datasetId: "example_dataset"}); * const bqowner = new gcp.serviceaccount.Account("bqowner", {accountId: "bqowner"}); * const access = new gcp.bigquery.DatasetAccess("access", { * datasetId: dataset.datasetId, * role: "OWNER", * userByEmail: bqowner.email, * }); * ``` * ### Bigquery Dataset Access View * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const _private = new gcp.bigquery.Dataset("private", {datasetId: "example_dataset"}); * const _public = new gcp.bigquery.Dataset("public", {datasetId: "example_dataset2"}); * const publicTable = new gcp.bigquery.Table("public", { * deletionProtection: false, * datasetId: _public.datasetId, * tableId: "example_table", * view: { * query: "SELECT state FROM [lookerdata:cdc.project_tycho_reports]", * useLegacySql: false, * }, * }); * const access = new gcp.bigquery.DatasetAccess("access", { * datasetId: _private.datasetId, * view: { * projectId: publicTable.project, * datasetId: _public.datasetId, * tableId: publicTable.tableId, * }, * }); * ``` * ### Bigquery Dataset Access Authorized Dataset * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const _private = new gcp.bigquery.Dataset("private", {datasetId: "private"}); * const _public = new gcp.bigquery.Dataset("public", {datasetId: "public"}); * const access = new gcp.bigquery.DatasetAccess("access", { * datasetId: _private.datasetId, * authorizedDataset: { * dataset: { * projectId: _public.project, * datasetId: _public.datasetId, * }, * targetTypes: ["VIEWS"], * }, * }); * ``` * ### Bigquery Dataset Access 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", * }); * const authorizedRoutine = new gcp.bigquery.DatasetAccess("authorized_routine", { * datasetId: _private.datasetId, * routine: { * projectId: publicRoutine.project, * datasetId: publicRoutine.datasetId, * routineId: publicRoutine.routineId, * }, * }); * ``` * * ## Import * * This resource does not support import. */ class DatasetAccess extends pulumi.CustomResource { /** * Get an existing DatasetAccess 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 DatasetAccess(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:bigquery/datasetAccess:DatasetAccess'; /** * Returns true if the given object is an instance of DatasetAccess. 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'] === DatasetAccess.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["apiUpdatedMember"] = state?.apiUpdatedMember; resourceInputs["authorizedDataset"] = state?.authorizedDataset; resourceInputs["condition"] = state?.condition; resourceInputs["datasetId"] = state?.datasetId; resourceInputs["deletionPolicy"] = state?.deletionPolicy; resourceInputs["domain"] = state?.domain; resourceInputs["groupByEmail"] = state?.groupByEmail; resourceInputs["iamMember"] = state?.iamMember; resourceInputs["project"] = state?.project; resourceInputs["role"] = state?.role; resourceInputs["routine"] = state?.routine; resourceInputs["specialGroup"] = state?.specialGroup; resourceInputs["userByEmail"] = state?.userByEmail; resourceInputs["view"] = state?.view; } else { const args = argsOrState; if (args?.datasetId === undefined && !opts.urn) { throw new Error("Missing required property 'datasetId'"); } resourceInputs["authorizedDataset"] = args?.authorizedDataset; resourceInputs["condition"] = args?.condition; resourceInputs["datasetId"] = args?.datasetId; resourceInputs["deletionPolicy"] = args?.deletionPolicy; resourceInputs["domain"] = args?.domain; resourceInputs["groupByEmail"] = args?.groupByEmail; resourceInputs["iamMember"] = args?.iamMember; resourceInputs["project"] = args?.project; resourceInputs["role"] = args?.role; resourceInputs["routine"] = args?.routine; resourceInputs["specialGroup"] = args?.specialGroup; resourceInputs["userByEmail"] = args?.userByEmail; resourceInputs["view"] = args?.view; resourceInputs["apiUpdatedMember"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(DatasetAccess.__pulumiType, name, resourceInputs, opts); } } exports.DatasetAccess = DatasetAccess; //# sourceMappingURL=datasetAccess.js.map