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

Function main

automl/get_operation_status.js:17–51  ·  view source on GitHub ↗
(
  projectId = 'YOUR_PROJECT_ID',
  location = 'us-central1',
  operationId = 'YOUR_OPERATION_ID'
)

Source from the content-addressed store, hash-verified

15'use strict';
16
17function main(
18 projectId = 'YOUR_PROJECT_ID',
19 location = 'us-central1',
20 operationId = 'YOUR_OPERATION_ID'
21) {
22 // [START automl_get_operation_status]
23 /**
24 * TODO(developer): Uncomment these variables before running the sample.
25 */
26 // const projectId = 'YOUR_PROJECT_ID';
27 // const location = 'us-central1';
28 // const operationId = 'YOUR_OPERATION_ID';
29
30 // Imports the Google Cloud AutoML library
31 const {AutoMlClient} = require('@google-cloud/automl').v1;
32
33 // Instantiates a client
34 const client = new AutoMlClient();
35
36 async function getOperationStatus() {
37 // Construct request
38 const request = {
39 name: `projects/${projectId}/locations/${location}/operations/${operationId}`,
40 };
41
42 const [response] = await client.operationsClient.getOperation(request);
43
44 console.log(`Name: ${response.name}`);
45 console.log('Operation details:');
46 console.log(`${response}`);
47 }
48
49 getOperationStatus();
50 // [END automl_get_operation_status]
51}
52
53process.on('unhandledRejection', err => {
54 console.error(err.message);

Callers 1

Calls 1

getOperationStatusFunction · 0.70

Tested by

no test coverage detected