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

Function main

asset/snippets/getSavedQuery.js:21–43  ·  view source on GitHub ↗
(fullQueryName)

Source from the content-addressed store, hash-verified

19// description: Get Saved Query.
20
21async function main(fullQueryName) {
22 // [START asset_quickstart_get_saved_query]
23 const {AssetServiceClient} = require('@google-cloud/asset');
24
25 const client = new AssetServiceClient();
26 async function getSavedQuery() {
27 const request = {
28 name: fullQueryName,
29 };
30
31 // Handle the operation using the promise pattern.
32 const [query] = await client.getSavedQuery(request);
33 // Do things with with the response.
34 console.log('Query name:', query.name);
35 console.log('Query description:', query.description);
36 console.log('Created time:', query.createTime);
37 console.log('Updated time:', query.lastUpdateTime);
38 console.log('Query type:', query.content.queryContent);
39 console.log('Query content:', JSON.stringify(query.content, null, 4));
40 }
41 await getSavedQuery();
42 // [END asset_quickstart_get_saved_query]
43}
44
45exports.getSavedQuery = main;

Callers

nothing calls this directly

Calls 1

getSavedQueryFunction · 0.85

Tested by

no test coverage detected