@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
451 lines • 16.9 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.Entry = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* An entry represents a data asset for which you capture metadata, such as a BigQuery table.
* The primary constituents of an entry are aspects, which provide thematically coherent information.
* Examples include a table's schema, sensitive data protection profile, data quality information, or a simple tag.
*
* **Important Considerations:**
*
* * There is a limit of 99 aspects per entry.
* * The entry resource has to use project numbers and not project IDs. Therefore, if
* a dependency was already provisioned using project ID, it needs to be referenced explicitly as a resource name
* containing the project number.
*
* To get more information about Entry, see:
*
* * [API documentation](https://cloud.google.com/dataplex/docs/reference/rest/v1/projects.locations.entryGroups.entries)
* * How-to Guides
* * [Manage entries and ingest custom sources](https://cloud.google.com/dataplex/docs/ingest-custom-sources)
*
* ## Example Usage
*
* ### Dataplex Entry Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const entry_group_basic = new gcp.dataplex.EntryGroup("entry-group-basic", {
* entryGroupId: "entry-group-basic",
* project: "1111111111111",
* location: "us-central1",
* });
* const entry_type_basic = new gcp.dataplex.EntryType("entry-type-basic", {
* entryTypeId: "entry-type-basic",
* project: "1111111111111",
* location: "us-central1",
* });
* const testBasic = new gcp.dataplex.Entry("test_basic", {
* entryGroupId: entry_group_basic.entryGroupId,
* project: "1111111111111",
* location: "us-central1",
* entryId: "entry-basic",
* entryType: entry_type_basic.name,
* });
* ```
* ### Dataplex Entry Full
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const aspect_type_full_one = new gcp.dataplex.AspectType("aspect-type-full-one", {
* aspectTypeId: "aspect-type-full-one",
* location: "us-central1",
* project: "1111111111111",
* metadataTemplate: `{
* \\"name\\": \\"tf-test-template\\",
* \\"type\\": \\"record\\",
* \\"recordFields\\": [
* {
* \\"name\\": \\"type\\",
* \\"type\\": \\"enum\\",
* \\"annotations\\": {
* \\"displayName\\": \\"Type\\",
* \\"description\\": \\"Specifies the type of view represented by the entry.\\"
* },
* \\"index\\": 1,
* \\"constraints\\": {
* \\"required\\": true
* },
* \\"enumValues\\": [
* {
* \\"name\\": \\"VIEW\\",
* \\"index\\": 1
* }
* ]
* }
* ]
* }
* `,
* });
* const aspect_type_full_two = new gcp.dataplex.AspectType("aspect-type-full-two", {
* aspectTypeId: "aspect-type-full-two",
* location: "us-central1",
* project: "1111111111111",
* metadataTemplate: `{
* \\"name\\": \\"tf-test-template\\",
* \\"type\\": \\"record\\",
* \\"recordFields\\": [
* {
* \\"name\\": \\"story\\",
* \\"type\\": \\"enum\\",
* \\"annotations\\": {
* \\"displayName\\": \\"Story\\",
* \\"description\\": \\"Specifies the story of an entry.\\"
* },
* \\"index\\": 1,
* \\"constraints\\": {
* \\"required\\": true
* },
* \\"enumValues\\": [
* {
* \\"name\\": \\"SEQUENCE\\",
* \\"index\\": 1
* }
* ]
* }
* ]
* }
* `,
* });
* const entry_group_full = new gcp.dataplex.EntryGroup("entry-group-full", {
* entryGroupId: "entry-group-full",
* project: "1111111111111",
* location: "us-central1",
* });
* const entry_type_full = new gcp.dataplex.EntryType("entry-type-full", {
* entryTypeId: "entry-type-full",
* project: "1111111111111",
* location: "us-central1",
* requiredAspects: [{
* type: aspect_type_full_one.name,
* }],
* });
* const testEntryFull = new gcp.dataplex.Entry("test_entry_full", {
* entryGroupId: entry_group_full.entryGroupId,
* project: "1111111111111",
* location: "us-central1",
* entryId: "entry-full/has/slashes",
* entryType: entry_type_full.name,
* fullyQualifiedName: "bigquery:1111111111111.test-dataset",
* parentEntry: "projects/1111111111111/locations/us-central1/entryGroups/entry-group-full/entries/some-other-entry",
* entrySource: {
* resource: "bigquery:1111111111111.test-dataset",
* system: "System III",
* platform: "BigQuery",
* displayName: "Human readable name",
* description: "Description from source system",
* labels: {
* "some-label": "some-value",
* },
* ancestors: [
* {
* name: "ancestor-one",
* type: "type-one",
* },
* {
* name: "ancestor-two",
* type: "type-two",
* },
* ],
* createTime: "2023-08-03T19:19:00.094Z",
* updateTime: "2023-08-03T20:19:00.094Z",
* },
* aspects: [
* {
* aspectKey: "1111111111111.us-central1.aspect-type-full-one",
* aspect: {
* data: " {\\\"type\\\": \\\"VIEW\\\" }\n",
* },
* },
* {
* aspectKey: "1111111111111.us-central1.aspect-type-full-two",
* aspect: {
* data: " {\\\"story\\\": \\\"SEQUENCE\\\" }\n",
* },
* },
* ],
* }, {
* dependsOn: [
* aspect_type_full_two,
* aspect_type_full_one,
* ],
* });
* ```
* ### Dataplex Entry Bigquery Table
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const aspect_type_full_one = new gcp.dataplex.AspectType("aspect-type-full-one", {
* aspectTypeId: "aspect-type-one",
* location: "us-central1",
* project: "1111111111111",
* metadataTemplate: `{
* \\"name\\": \\"tf-test-template\\",
* \\"type\\": \\"record\\",
* \\"recordFields\\": [
* {
* \\"name\\": \\"type\\",
* \\"type\\": \\"enum\\",
* \\"annotations\\": {
* \\"displayName\\": \\"Type\\",
* \\"description\\": \\"Specifies the type of view represented by the entry.\\"
* },
* \\"index\\": 1,
* \\"constraints\\": {
* \\"required\\": true
* },
* \\"enumValues\\": [
* {
* \\"name\\": \\"VIEW\\",
* \\"index\\": 1
* }
* ]
* }
* ]
* }
* `,
* });
* const aspect_type_full_two = new gcp.dataplex.AspectType("aspect-type-full-two", {
* aspectTypeId: "aspect-type-two",
* location: "us-central1",
* project: "1111111111111",
* metadataTemplate: `{
* \\"name\\": \\"tf-test-template\\",
* \\"type\\": \\"record\\",
* \\"recordFields\\": [
* {
* \\"name\\": \\"story\\",
* \\"type\\": \\"enum\\",
* \\"annotations\\": {
* \\"displayName\\": \\"Story\\",
* \\"description\\": \\"Specifies the story of an entry.\\"
* },
* \\"index\\": 1,
* \\"constraints\\": {
* \\"required\\": true
* },
* \\"enumValues\\": [
* {
* \\"name\\": \\"SEQUENCE\\",
* \\"index\\": 1
* }
* ]
* }
* ]
* }
* `,
* });
* const example_dataset = new gcp.bigquery.Dataset("example-dataset", {
* datasetId: "dataset_basic",
* friendlyName: "Example Dataset",
* location: "us-central1",
* deleteContentsOnDestroy: true,
* });
* const example_table = new gcp.bigquery.Table("example-table", {
* datasetId: example_dataset.datasetId,
* tableId: "table-basic",
* deletionProtection: false,
* schema: JSON.stringify([
* {
* name: "event_time",
* type: "TIMESTAMP",
* mode: "REQUIRED",
* },
* {
* name: "user_id",
* type: "STRING",
* mode: "NULLABLE",
* },
* {
* name: "event_type",
* type: "STRING",
* mode: "NULLABLE",
* },
* ]),
* });
* const tfTestTable = new gcp.dataplex.Entry("tf_test_table", {
* entryGroupId: "@bigquery",
* project: "1111111111111",
* location: "us-central1",
* entryId: pulumi.interpolate`bigquery.googleapis.com/projects/my-project-name/datasets/${example_dataset.datasetId}/tables/${example_table.tableId}`,
* entryType: "projects/655216118709/locations/global/entryTypes/bigquery-table",
* fullyQualifiedName: pulumi.interpolate`bigquery:my-project-name.${example_dataset.datasetId}.${example_table.tableId}`,
* parentEntry: pulumi.interpolate`projects/1111111111111/locations/us-central1/entryGroups/@bigquery/entries/bigquery.googleapis.com/projects/my-project-name/datasets/${example_dataset.datasetId}`,
* aspects: [
* {
* aspectKey: "1111111111111.us-central1.aspect-type-one",
* aspect: {
* data: " {\\\"type\\\": \\\"VIEW\\\" }\n",
* },
* },
* {
* aspectKey: "1111111111111.us-central1.aspect-type-two@Schema.event_type",
* aspect: {
* data: " {\\\"story\\\": \\\"SEQUENCE\\\" }\n",
* },
* },
* ],
* }, {
* dependsOn: [
* aspect_type_full_two,
* aspect_type_full_one,
* ],
* });
* ```
* ### Dataplex Entry Glossary Term
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as time from "@pulumiverse/time";
*
* const example_glossary = new gcp.dataplex.Glossary("example-glossary", {
* glossaryId: "glossary-basic",
* location: "us-central1",
* });
* const example_glossary_term = new gcp.dataplex.GlossaryTerm("example-glossary-term", {
* parent: pulumi.interpolate`projects/my-project-name/locations/us-central1/glossaries/${example_glossary.glossaryId}`,
* glossaryId: example_glossary.glossaryId,
* location: "us-central1",
* termId: "glossary-term",
* });
* // Introduce a 45-second wait after the glossary resource creation
* const wait_for_sync = new time.Sleep("wait-for-sync", {createDuration: "45s"}, {
* dependsOn: [example_glossary_term],
* });
* const tfTestGlossaryTerm = new gcp.dataplex.Entry("tf_test_glossary_term", {
* entryGroupId: "@dataplex",
* project: "1111111111111",
* location: "us-central1",
* entryId: pulumi.all([example_glossary.glossaryId, example_glossary_term.termId]).apply(([glossaryId, termId]) => `projects/1111111111111/locations/us-central1/glossaries/${glossaryId}/terms/${termId}`),
* entryType: "projects/655216118709/locations/global/entryTypes/glossary-term",
* parentEntry: pulumi.interpolate`projects/1111111111111/locations/us-central1/entryGroups/@dataplex/entries/projects/1111111111111/locations/us-central1/glossaries/${example_glossary.glossaryId}`,
* aspects: [{
* aspectKey: "655216118709.global.overview",
* aspect: {
* data: " {\\\"content\\\": \\\"Term Content\\\" }\n",
* },
* }],
* }, {
* dependsOn: [wait_for_sync],
* });
* ```
*
* ## Import
*
* Entry can be imported using any of these accepted formats:
*
* * `projects/{{project}}/locations/{{location}}/entryGroups/{{entry_group_id}}/entries/{{entry_id}}`
* * `{{project}}/{{location}}/{{entry_group_id}}/{{entry_id}}`
* * `{{location}}/{{entry_group_id}}/{{entry_id}}`
*
* When using the `pulumi import` command, Entry can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:dataplex/entry:Entry default projects/{{project}}/locations/{{location}}/entryGroups/{{entry_group_id}}/entries/{{entry_id}}
* $ pulumi import gcp:dataplex/entry:Entry default {{project}}/{{location}}/{{entry_group_id}}/{{entry_id}}
* $ pulumi import gcp:dataplex/entry:Entry default {{location}}/{{entry_group_id}}/{{entry_id}}
* ```
*/
class Entry extends pulumi.CustomResource {
/**
* Get an existing Entry 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 Entry(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'gcp:dataplex/entry:Entry';
/**
* Returns true if the given object is an instance of Entry. 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'] === Entry.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["aspects"] = state?.aspects;
resourceInputs["createTime"] = state?.createTime;
resourceInputs["deletionPolicy"] = state?.deletionPolicy;
resourceInputs["entryGroupId"] = state?.entryGroupId;
resourceInputs["entryId"] = state?.entryId;
resourceInputs["entrySource"] = state?.entrySource;
resourceInputs["entryType"] = state?.entryType;
resourceInputs["fullyQualifiedName"] = state?.fullyQualifiedName;
resourceInputs["location"] = state?.location;
resourceInputs["name"] = state?.name;
resourceInputs["parentEntry"] = state?.parentEntry;
resourceInputs["project"] = state?.project;
resourceInputs["updateTime"] = state?.updateTime;
}
else {
const args = argsOrState;
if (args?.entryType === undefined && !opts.urn) {
throw new Error("Missing required property 'entryType'");
}
resourceInputs["aspects"] = args?.aspects;
resourceInputs["deletionPolicy"] = args?.deletionPolicy;
resourceInputs["entryGroupId"] = args?.entryGroupId;
resourceInputs["entryId"] = args?.entryId;
resourceInputs["entrySource"] = args?.entrySource;
resourceInputs["entryType"] = args?.entryType;
resourceInputs["fullyQualifiedName"] = args?.fullyQualifiedName;
resourceInputs["location"] = args?.location;
resourceInputs["parentEntry"] = args?.parentEntry;
resourceInputs["project"] = args?.project;
resourceInputs["createTime"] = undefined /*out*/;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["updateTime"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Entry.__pulumiType, name, resourceInputs, opts);
}
}
exports.Entry = Entry;
//# sourceMappingURL=entry.js.map