| 21 | const datacatalog = new DataCatalogClient(); |
| 22 | |
| 23 | async function quickstart() { |
| 24 | // Common fields. |
| 25 | let request; |
| 26 | let responses; |
| 27 | |
| 28 | /** |
| 29 | * TODO(developer): Uncomment the following lines before running the sample. |
| 30 | */ |
| 31 | // const projectId = 'my_project'; // Google Cloud Platform project |
| 32 | // const datasetId = 'demo_dataset'; |
| 33 | // const tableId = 'trips'; |
| 34 | |
| 35 | // Currently, Data Catalog stores metadata in the |
| 36 | // us-central1 region. |
| 37 | const location = 'us-central1'; |
| 38 | |
| 39 | // Create Fields. |
| 40 | const fieldSource = { |
| 41 | displayName: 'Source of data asset', |
| 42 | type: { |
| 43 | primitiveType: 'STRING', |
| 44 | }, |
| 45 | }; |
| 46 | |
| 47 | const fieldNumRows = { |
| 48 | displayName: 'Number of rows in data asset', |
| 49 | type: { |
| 50 | primitiveType: 'DOUBLE', |
| 51 | }, |
| 52 | }; |
| 53 | |
| 54 | const fieldHasPII = { |
| 55 | displayName: 'Has PII', |
| 56 | type: { |
| 57 | primitiveType: 'BOOL', |
| 58 | }, |
| 59 | }; |
| 60 | |
| 61 | const fieldPIIType = { |
| 62 | displayName: 'PII type', |
| 63 | type: { |
| 64 | enumType: { |
| 65 | allowedValues: [ |
| 66 | { |
| 67 | displayName: 'EMAIL', |
| 68 | }, |
| 69 | { |
| 70 | displayName: 'SOCIAL SECURITY NUMBER', |
| 71 | }, |
| 72 | { |
| 73 | displayName: 'NONE', |
| 74 | }, |
| 75 | ], |
| 76 | }, |
| 77 | }, |
| 78 | }; |
| 79 | |
| 80 | // Create Tag Template. |