MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / main

Function main

ai-platform/snippets/delete-dataset.js:19–58  ·  view source on GitHub ↗
(datasetId, project, location = 'us-central1')

Source from the content-addressed store, hash-verified

17'use strict';
18
19async function main(datasetId, project, location = 'us-central1') {
20 // [START aiplatform_delete_dataset_sample]
21 /**
22 * TODO(developer): Uncomment these variables before running the sample.\
23 * (Not necessary if passing values as arguments)
24 */
25
26 // const datasetId = 'YOUR_DATASET_ID';
27 // const project = 'YOUR_PROJECT_ID';
28 // const location = 'YOUR_PROJECT_LOCATION';
29
30 // Imports the Google Cloud Dataset Service Client library
31 const {DatasetServiceClient} = require('@google-cloud/aiplatform');
32
33 // Specifies the location of the api endpoint
34 const clientOptions = {
35 apiEndpoint: 'us-central1-aiplatform.googleapis.com',
36 };
37
38 // Instantiates a client
39 const datasetServiceClient = new DatasetServiceClient(clientOptions);
40
41 async function deleteDataset() {
42 // Configure the resource
43 const name = datasetServiceClient.datasetPath(project, location, datasetId);
44 const request = {name};
45
46 // Delete Dataset Request
47 const [response] = await datasetServiceClient.deleteDataset(request);
48 console.log(`Long running operation: ${response.name}`);
49
50 // Wait for operation to complete
51 await response.promise();
52 const result = response.result;
53
54 console.log('Delete dataset response:\n', result);
55 }
56 deleteDataset();
57 // [END aiplatform_delete_dataset_sample]
58}
59
60process.on('unhandledRejection', err => {
61 console.error(err.message);

Callers 1

delete-dataset.jsFile · 0.70

Calls 1

deleteDatasetFunction · 0.70

Tested by

no test coverage detected