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

Function setEndpoint

automl/beta/setEndpoint.js:17–41  ·  view source on GitHub ↗
(projectId)

Source from the content-addressed store, hash-verified

15'use strict';
16
17async function setEndpoint(projectId) {
18 // [START automl_set_endpoint]
19 const automl = require('@google-cloud/automl').v1beta1;
20
21 // You must first create a dataset, using the `eu` endpoint, before you can
22 // call other operations such as: list, get, import, delete, etc.
23 const clientOptions = {apiEndpoint: 'eu-automl.googleapis.com'};
24
25 // Instantiates a client
26 const client = new automl.AutoMlClient(clientOptions);
27
28 // A resource that represents Google Cloud Platform location.
29 const projectLocation = client.locationPath(projectId, 'eu');
30 // [END automl_set_endpoint]
31
32 // Grabs the list of datasets in a given project location.
33 // Note: create a dataset in `eu` before calling `listDatasets`.
34 const responses = await client.listDatasets({parent: projectLocation});
35
36 // Prints out each dataset.
37 const datasets = responses[0];
38 datasets.forEach(dataset => {
39 console.log(dataset);
40 });
41}
42
43setEndpoint(...process.argv.slice(2)).catch(err => {
44 console.error(err);

Callers 1

setEndpoint.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected