@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
379 lines • 13 kB
JavaScript
"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.Tag = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* > **Warning:** `gcp.datacatalog.Tag` is deprecated and will be removed in a future major release. For steps to transition your Data Catalog users, workloads, and content to Dataplex Catalog, see https://cloud.google.com/dataplex/docs/transition-to-dataplex-catalog.
*
* Tags are used to attach custom metadata to Data Catalog resources. Tags conform to the specifications within their tag template.
*
* See [Data Catalog IAM](https://cloud.google.com/data-catalog/docs/concepts/iam) for information on the permissions needed to create or view tags.
*
* To get more information about Tag, see:
*
* * [API documentation](https://cloud.google.com/data-catalog/docs/reference/rest/v1/projects.locations.entryGroups.tags)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/data-catalog/docs)
*
* ## Example Usage
*
* ### Data Catalog Entry Tag Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const entryGroup = new gcp.datacatalog.EntryGroup("entry_group", {entryGroupId: "my_entry_group"});
* const entry = new gcp.datacatalog.Entry("entry", {
* entryGroup: entryGroup.id,
* entryId: "my_entry",
* userSpecifiedType: "my_custom_type",
* userSpecifiedSystem: "SomethingExternal",
* });
* const tagTemplate = new gcp.datacatalog.TagTemplate("tag_template", {
* tagTemplateId: "my_template",
* region: "us-central1",
* displayName: "Demo Tag Template",
* fields: [
* {
* fieldId: "source",
* displayName: "Source of data asset",
* type: {
* primitiveType: "STRING",
* },
* isRequired: true,
* },
* {
* fieldId: "num_rows",
* displayName: "Number of rows in the data asset",
* type: {
* primitiveType: "DOUBLE",
* },
* },
* {
* fieldId: "pii_type",
* displayName: "PII type",
* type: {
* enumType: {
* allowedValues: [
* {
* displayName: "EMAIL",
* },
* {
* displayName: "SOCIAL SECURITY NUMBER",
* },
* {
* displayName: "NONE",
* },
* ],
* },
* },
* },
* ],
* forceDelete: false,
* });
* const basicTag = new gcp.datacatalog.Tag("basic_tag", {
* parent: entry.id,
* template: tagTemplate.id,
* fields: [{
* fieldName: "source",
* stringValue: "my-string",
* }],
* });
* ```
* ### Data Catalog Entry Group Tag
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const entryGroup = new gcp.datacatalog.EntryGroup("entry_group", {entryGroupId: "my_entry_group"});
* const firstEntry = new gcp.datacatalog.Entry("first_entry", {
* entryGroup: entryGroup.id,
* entryId: "first_entry",
* userSpecifiedType: "my_custom_type",
* userSpecifiedSystem: "SomethingExternal",
* });
* const secondEntry = new gcp.datacatalog.Entry("second_entry", {
* entryGroup: entryGroup.id,
* entryId: "second_entry",
* userSpecifiedType: "another_custom_type",
* userSpecifiedSystem: "SomethingElseExternal",
* });
* const tagTemplate = new gcp.datacatalog.TagTemplate("tag_template", {
* tagTemplateId: "my_template",
* region: "us-central1",
* displayName: "Demo Tag Template",
* fields: [
* {
* fieldId: "source",
* displayName: "Source of data asset",
* type: {
* primitiveType: "STRING",
* },
* isRequired: true,
* },
* {
* fieldId: "num_rows",
* displayName: "Number of rows in the data asset",
* type: {
* primitiveType: "DOUBLE",
* },
* },
* {
* fieldId: "pii_type",
* displayName: "PII type",
* type: {
* enumType: {
* allowedValues: [
* {
* displayName: "EMAIL",
* },
* {
* displayName: "SOCIAL SECURITY NUMBER",
* },
* {
* displayName: "NONE",
* },
* ],
* },
* },
* },
* ],
* forceDelete: false,
* });
* const entryGroupTag = new gcp.datacatalog.Tag("entry_group_tag", {
* parent: entryGroup.id,
* template: tagTemplate.id,
* fields: [{
* fieldName: "source",
* stringValue: "my-string",
* }],
* });
* ```
* ### Data Catalog Entry Tag Full
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const entryGroup = new gcp.datacatalog.EntryGroup("entry_group", {entryGroupId: "my_entry_group"});
* const entry = new gcp.datacatalog.Entry("entry", {
* entryGroup: entryGroup.id,
* entryId: "my_entry",
* userSpecifiedType: "my_custom_type",
* userSpecifiedSystem: "SomethingExternal",
* schema: `{
* \\"columns\\": [
* {
* \\"column\\": \\"first_name\\",
* \\"description\\": \\"First name\\",
* \\"mode\\": \\"REQUIRED\\",
* \\"type\\": \\"STRING\\"
* },
* {
* \\"column\\": \\"last_name\\",
* \\"description\\": \\"Last name\\",
* \\"mode\\": \\"REQUIRED\\",
* \\"type\\": \\"STRING\\"
* },
* {
* \\"column\\": \\"address\\",
* \\"description\\": \\"Address\\",
* \\"mode\\": \\"REPEATED\\",
* \\"subcolumns\\": [
* {
* \\"column\\": \\"city\\",
* \\"description\\": \\"City\\",
* \\"mode\\": \\"NULLABLE\\",
* \\"type\\": \\"STRING\\"
* },
* {
* \\"column\\": \\"state\\",
* \\"description\\": \\"State\\",
* \\"mode\\": \\"NULLABLE\\",
* \\"type\\": \\"STRING\\"
* }
* ],
* \\"type\\": \\"RECORD\\"
* }
* ]
* }
* `,
* });
* const tagTemplate = new gcp.datacatalog.TagTemplate("tag_template", {
* tagTemplateId: "my_template",
* region: "us-central1",
* displayName: "Demo Tag Template",
* fields: [
* {
* fieldId: "source",
* displayName: "Source of data asset",
* type: {
* primitiveType: "STRING",
* },
* isRequired: true,
* },
* {
* fieldId: "num_rows",
* displayName: "Number of rows in the data asset",
* type: {
* primitiveType: "DOUBLE",
* },
* },
* {
* fieldId: "pii_type",
* displayName: "PII type",
* type: {
* enumType: {
* allowedValues: [
* {
* displayName: "EMAIL",
* },
* {
* displayName: "SOCIAL SECURITY NUMBER",
* },
* {
* displayName: "NONE",
* },
* ],
* },
* },
* },
* ],
* forceDelete: false,
* });
* const basicTag = new gcp.datacatalog.Tag("basic_tag", {
* parent: entry.id,
* template: tagTemplate.id,
* fields: [
* {
* fieldName: "source",
* stringValue: "my-string",
* },
* {
* fieldName: "num_rows",
* doubleValue: 5,
* },
* {
* fieldName: "pii_type",
* enumValue: "EMAIL",
* },
* ],
* column: "address",
* });
* const second_tag = new gcp.datacatalog.Tag("second-tag", {
* parent: entry.id,
* template: tagTemplate.id,
* fields: [
* {
* fieldName: "source",
* stringValue: "my-string",
* },
* {
* fieldName: "pii_type",
* enumValue: "NONE",
* },
* ],
* column: "first_name",
* });
* ```
*
* ## Import
*
* Tag can be imported using any of these accepted formats:
*
* * `{{name}}`
*
* When using the `pulumi import` command, Tag can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:datacatalog/tag:Tag default {{name}}
* ```
*/
class Tag extends pulumi.CustomResource {
/**
* Get an existing Tag 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 Tag(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'gcp:datacatalog/tag:Tag';
/**
* Returns true if the given object is an instance of Tag. 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'] === Tag.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["column"] = state?.column;
resourceInputs["deletionPolicy"] = state?.deletionPolicy;
resourceInputs["fields"] = state?.fields;
resourceInputs["name"] = state?.name;
resourceInputs["parent"] = state?.parent;
resourceInputs["template"] = state?.template;
resourceInputs["templateDisplayname"] = state?.templateDisplayname;
}
else {
const args = argsOrState;
if (args?.fields === undefined && !opts.urn) {
throw new Error("Missing required property 'fields'");
}
if (args?.template === undefined && !opts.urn) {
throw new Error("Missing required property 'template'");
}
resourceInputs["column"] = args?.column;
resourceInputs["deletionPolicy"] = args?.deletionPolicy;
resourceInputs["fields"] = args?.fields;
resourceInputs["parent"] = args?.parent;
resourceInputs["template"] = args?.template;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["templateDisplayname"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Tag.__pulumiType, name, resourceInputs, opts);
}
}
exports.Tag = Tag;
//# sourceMappingURL=tag.js.map