UNPKG

@pulumi/gcp

Version:

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

354 lines • 11.9 kB
"use strict"; // *** 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.Tag = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = 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, Object.assign(Object.assign({}, opts), { id: id })); } /** * 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 ? state.column : undefined; resourceInputs["fields"] = state ? state.fields : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["parent"] = state ? state.parent : undefined; resourceInputs["template"] = state ? state.template : undefined; resourceInputs["templateDisplayname"] = state ? state.templateDisplayname : undefined; } else { const args = argsOrState; if ((!args || args.fields === undefined) && !opts.urn) { throw new Error("Missing required property 'fields'"); } if ((!args || args.template === undefined) && !opts.urn) { throw new Error("Missing required property 'template'"); } resourceInputs["column"] = args ? args.column : undefined; resourceInputs["fields"] = args ? args.fields : undefined; resourceInputs["parent"] = args ? args.parent : undefined; resourceInputs["template"] = args ? args.template : undefined; resourceInputs["name"] = undefined /*out*/; resourceInputs["templateDisplayname"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Tag.__pulumiType, name, resourceInputs, opts); } } exports.Tag = Tag; /** @internal */ Tag.__pulumiType = 'gcp:datacatalog/tag:Tag'; //# sourceMappingURL=tag.js.map