UNPKG

@pulumi/gcp

Version:

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

419 lines (418 loc) • 15.1 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * > **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}} * ``` */ export declare 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: string, id: pulumi.Input<pulumi.ID>, state?: TagState, opts?: pulumi.CustomResourceOptions): 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: any): obj is Tag; /** * Resources like Entry can have schemas associated with them. This scope allows users to attach tags to an individual * column based on that schema. For attaching a tag to a nested column, use '.' to separate the column names. Example: * 'outer_column.inner_column' */ readonly column: pulumi.Output<string | undefined>; /** * This maps the ID of a tag field to the value of and additional information about that field. * Valid field IDs are defined by the tag's template. A tag must have at least 1 field and at most 500 fields. * Structure is documented below. */ readonly fields: pulumi.Output<outputs.datacatalog.TagField[]>; /** * The resource name of the tag in URL format. Example: * projects/{project_id}/locations/{location}/entrygroups/{entryGroupId}/entries/{entryId}/tags/{tag_id} or * projects/{project_id}/locations/{location}/entrygroups/{entryGroupId}/tags/{tag_id} * where tagId is a system-generated identifier. Note that this Tag may not actually be stored in the location in this name. */ readonly name: pulumi.Output<string>; /** * The name of the parent this tag is attached to. This can be the name of an entry or an entry group. If an entry group, * the tag will be attached to all entries in that group. */ readonly parent: pulumi.Output<string | undefined>; /** * The resource name of the tag template that this tag uses. Example: * projects/{project_id}/locations/{location}/tagTemplates/{tagTemplateId} * This field cannot be modified after creation. */ readonly template: pulumi.Output<string>; /** * The display name of the tag template. */ readonly templateDisplayname: pulumi.Output<string>; /** * Create a Tag resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: TagArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Tag resources. */ export interface TagState { /** * Resources like Entry can have schemas associated with them. This scope allows users to attach tags to an individual * column based on that schema. For attaching a tag to a nested column, use '.' to separate the column names. Example: * 'outer_column.inner_column' */ column?: pulumi.Input<string>; /** * This maps the ID of a tag field to the value of and additional information about that field. * Valid field IDs are defined by the tag's template. A tag must have at least 1 field and at most 500 fields. * Structure is documented below. */ fields?: pulumi.Input<pulumi.Input<inputs.datacatalog.TagField>[]>; /** * The resource name of the tag in URL format. Example: * projects/{project_id}/locations/{location}/entrygroups/{entryGroupId}/entries/{entryId}/tags/{tag_id} or * projects/{project_id}/locations/{location}/entrygroups/{entryGroupId}/tags/{tag_id} * where tagId is a system-generated identifier. Note that this Tag may not actually be stored in the location in this name. */ name?: pulumi.Input<string>; /** * The name of the parent this tag is attached to. This can be the name of an entry or an entry group. If an entry group, * the tag will be attached to all entries in that group. */ parent?: pulumi.Input<string>; /** * The resource name of the tag template that this tag uses. Example: * projects/{project_id}/locations/{location}/tagTemplates/{tagTemplateId} * This field cannot be modified after creation. */ template?: pulumi.Input<string>; /** * The display name of the tag template. */ templateDisplayname?: pulumi.Input<string>; } /** * The set of arguments for constructing a Tag resource. */ export interface TagArgs { /** * Resources like Entry can have schemas associated with them. This scope allows users to attach tags to an individual * column based on that schema. For attaching a tag to a nested column, use '.' to separate the column names. Example: * 'outer_column.inner_column' */ column?: pulumi.Input<string>; /** * This maps the ID of a tag field to the value of and additional information about that field. * Valid field IDs are defined by the tag's template. A tag must have at least 1 field and at most 500 fields. * Structure is documented below. */ fields: pulumi.Input<pulumi.Input<inputs.datacatalog.TagField>[]>; /** * The name of the parent this tag is attached to. This can be the name of an entry or an entry group. If an entry group, * the tag will be attached to all entries in that group. */ parent?: pulumi.Input<string>; /** * The resource name of the tag template that this tag uses. Example: * projects/{project_id}/locations/{location}/tagTemplates/{tagTemplateId} * This field cannot be modified after creation. */ template: pulumi.Input<string>; }