From 092fa4c2895b6fa5d19cf80b2a1f5a18ec597bde Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Mon, 13 May 2019 17:36:43 +0000 Subject: [PATCH] docs: use repo-meta to generate README (#130) --- .../google-cloud-asset/.cloud-repo-tools.json | 8 -- .../google-cloud-asset/.repo-metadata.json | 13 ++ packages/google-cloud-asset/README.md | 134 +++++++++++------- packages/google-cloud-asset/package.json | 12 +- packages/google-cloud-asset/samples/README.md | 86 +++++++++++ .../samples/exportAssets.js | 60 ++++++++ .../samples/getBatchAssetHistory.js | 59 ++++++++ .../google-cloud-asset/samples/quickstart.js | 129 +++++------------ .../{quickstart.test.js => sample.test.js} | 13 +- packages/google-cloud-asset/synth.metadata | 2 +- 10 files changed, 348 insertions(+), 168 deletions(-) delete mode 100644 packages/google-cloud-asset/.cloud-repo-tools.json create mode 100644 packages/google-cloud-asset/.repo-metadata.json create mode 100644 packages/google-cloud-asset/samples/README.md create mode 100644 packages/google-cloud-asset/samples/exportAssets.js create mode 100644 packages/google-cloud-asset/samples/getBatchAssetHistory.js rename packages/google-cloud-asset/samples/test/{quickstart.test.js => sample.test.js} (79%) diff --git a/packages/google-cloud-asset/.cloud-repo-tools.json b/packages/google-cloud-asset/.cloud-repo-tools.json deleted file mode 100644 index 29239a36b73..00000000000 --- a/packages/google-cloud-asset/.cloud-repo-tools.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "requiresKeyFile": true, - "requiresProjectId": true, - "product": "asset", - "client_reference_url": "https://cloud.google.com/nodejs/docs/reference/asset/latest/", - "release_quality": "alpha", - "samples": [] -} diff --git a/packages/google-cloud-asset/.repo-metadata.json b/packages/google-cloud-asset/.repo-metadata.json new file mode 100644 index 00000000000..2458047ddb4 --- /dev/null +++ b/packages/google-cloud-asset/.repo-metadata.json @@ -0,0 +1,13 @@ +{ + "name": "asset", + "name_pretty": "Cloud Asset Inventory", + "product_documentation": "https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview", + "client_documentation": "https://cloud.google.com/nodejs/docs/reference/asset/latest/", + "issue_tracker": "https://issuetracker.google.com/savedsearches/559757", + "release_level": "alpha", + "language": "nodejs", + "repo": "googleapis/nodejs-asset", + "distribution_name": "@google-cloud/asset", + "api_id": "cloudasset.googleapis.com", + "requires_billing": true +} diff --git a/packages/google-cloud-asset/README.md b/packages/google-cloud-asset/README.md index 8615ff730c9..e1cbf67468d 100644 --- a/packages/google-cloud-asset/README.md +++ b/packages/google-cloud-asset/README.md @@ -1,79 +1,120 @@ [//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "To regenerate it, use `npm run generate-scaffolding`." +[//]: # "To regenerate it, use `python -m synthtool`." Google Cloud Platform logo -# [Google Cloud Asset Inventory: Node.js Client](https://github.com/googleapis/nodejs-asset) +# [Cloud Asset Inventory: Node.js Client](https://github.com/googleapis/nodejs-asset) -[![release level](https://img.shields.io/badge/release%20level-alpha-orange.svg?style=flat)](https://cloud.google.com/terms/launch-stages) +[![release level](https://img.shields.io/badge/release%20level-alpha-orange.svg?style=flat)](https://cloud.google.com/terms/launch-stages) [![npm version](https://img.shields.io/npm/v/@google-cloud/asset.svg)](https://www.npmjs.org/package/@google-cloud/asset) [![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-asset/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-asset) -[Cloud Asset Inventory](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview) is a storage service that keeps a five week history of Google Cloud Platform (GCP) asset metadata. It allows you to export all asset metadata at a certain timestamp or timeframe. -* [Using the client library](#using-the-client-library) + +Cloud Asset API client for Node.js + + +* [Cloud Asset Inventory Node.js Client API Reference][client-docs] +* [Cloud Asset Inventory Documentation][product-docs] +* [github.com/googleapis/nodejs-asset](https://github.com/googleapis/nodejs-asset) + +Read more about the client libraries for Cloud APIs, including the older +Google APIs Client Libraries, in [Client Libraries Explained][explained]. + +[explained]: https://cloud.google.com/apis/docs/client-libraries-explained + +**Table of contents:** + + +* [Quickstart](#quickstart) + * [Before you begin](#before-you-begin) + * [Installing the client library](#installing-the-client-library) + * [Using the client library](#using-the-client-library) +* [Samples](#samples) * [Versioning](#versioning) * [Contributing](#contributing) * [License](#license) -## Using the client library +## Quickstart -1. [Select or create a Cloud Platform project][projects]. +### Before you begin +1. [Select or create a Cloud Platform project][projects]. 1. [Enable billing for your project][billing]. - -1. [Enable the Google Cloud Asset Inventory API][enable_api]. - +1. [Enable the Cloud Asset Inventory API][enable_api]. 1. [Set up authentication with a service account][auth] so you can access the API from your local workstation. -1. Install the client library: +### Installing the client library + +```bash +npm install @google-cloud/asset +``` - npm install --save @google-cloud/asset -1. Try an example: +### Using the client library ```javascript - const asset = require('@google-cloud/asset'); - const client = new asset.v1beta1.AssetServiceClient({ - // optional auth parameters. - }); - - // Your Google Cloud Platform project ID - const projectId = await client.getProjectId(); - const projectResource = client.projectPath(projectId); - - // var dumpFilePath = 'Dump file path, e.g.: gs:///' - const outputConfig = { - gcsDestination: { - uri: dumpFilePath, - }, - }; - const request = { - parent: projectResource, - outputConfig: outputConfig, - }; - - // Handle the operation using the promise pattern. - const [operation] = await client.exportAssets(request); - // Operation#promise starts polling for the completion of the operation. - const [result] = await operation.promise(); - // Do things with with the response. - console.log(result); + const util = require('util'); + const {AssetServiceClient} = require('@google-cloud/asset'); + + const client = new AssetServiceClient(); + + async function quickstart() { + const projectId = await client.getProjectId(); + const projectResource = client.projectPath(projectId); + // TODO(developer): Choose asset names, such as //storage.googleapis.com/[YOUR_BUCKET_NAME]. + // const assetNames = ['ASSET_NAME1', 'ASSET_NAME2', ...]; + + const request = { + parent: projectResource, + assetNames: assetNames, + contentType: 'RESOURCE', + readTimeWindow: { + startTime: { + seconds: Math.floor(new Date().getTime() / 1000), + }, + }, + }; + + // Handle the operation using the promise pattern. + const result = await client.batchGetAssetsHistory(request); + // Do things with with the response. + console.log(util.inspect(result, {depth: null})); + ``` -The [Cloud Asset Node.js Client API Reference][client-docs] documentation + +## Samples + +Samples are in the [`samples/`](https://github.com/googleapis/nodejs-asset/tree/master/samples) directory. The samples' `README.md` +has instructions for running the samples. + +| Sample | Source Code | Try it | +| --------------------------- | --------------------------------- | ------ | +| Export Assets | [source code](https://github.com/googleapis/nodejs-asset/blob/master/samples/exportAssets.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-asset&page=editor&open_in_editor=samples/exportAssets.js,samples/README.md) | +| Get Batch Asset History | [source code](https://github.com/googleapis/nodejs-asset/blob/master/samples/getBatchAssetHistory.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-asset&page=editor&open_in_editor=samples/getBatchAssetHistory.js,samples/README.md) | +| Asset History Quickstart | [source code](https://github.com/googleapis/nodejs-asset/blob/master/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-asset&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) | + + + +The [Cloud Asset Inventory Node.js Client API Reference][client-docs] documentation also contains samples. ## Versioning This library follows [Semantic Versioning](http://semver.org/). + + + This library is considered to be in **alpha**. This means it is still a work-in-progress and under active development. Any release is subject to backwards-incompatible changes at any time. + + More Information: [Google Cloud Platform Launch Stages][launch_stages] [launch_stages]: https://cloud.google.com/terms/launch-stages @@ -88,21 +129,10 @@ Apache Version 2.0 See [LICENSE](https://github.com/googleapis/nodejs-asset/blob/master/LICENSE) -## What's Next - -* [Cloud Asset Documentation][product-docs] -* [Cloud Asset Node.js Client API Reference][client-docs] -* [github.com/googleapis/nodejs-asset](https://github.com/googleapis/nodejs-asset) - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - [client-docs]: https://cloud.google.com/nodejs/docs/reference/asset/latest/ [product-docs]: https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview [shell_img]: https://gstatic.com/cloudssh/images/open-btn.png [projects]: https://console.cloud.google.com/project [billing]: https://support.google.com/cloud/answer/6293499#enable-billing [enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=cloudasset.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/getting-started +[auth]: https://cloud.google.com/docs/authentication/getting-started \ No newline at end of file diff --git a/packages/google-cloud-asset/package.json b/packages/google-cloud-asset/package.json index 186654be15d..90daf696965 100644 --- a/packages/google-cloud-asset/package.json +++ b/packages/google-cloud-asset/package.json @@ -31,14 +31,13 @@ "scripts": { "cover": "nyc --reporter=lcov mocha test/*.js && nyc report", "docs": "jsdoc -c .jsdoc.js", - "generate-scaffolding": "repo-tools generate all && repo-tools generate lib_samples_readme -l samples/ --config ../.cloud-repo-tools.json", "lint": "eslint '**/*.js'", "samples-test": "cd samples/ && npm link ../ && npm test && cd ../", "system-test": "mocha system-test/*.js smoke-test/*.js --timeout 600000", "test-no-cover": "mocha test/*.js", "test": "npm run cover", "fix": "eslint --fix '**/*.js'", - "docs-test": "linkinator docs -r --skip www.googleapis.com", + "docs-test": "linkinator docs -r --skip 'www.googleapis.com|github.com/googleapis/nodejs-asset/blob/master/samples/exportAssets.js|github.com/googleapis/nodejs-asset/blob/master/samples/getBatchAssetHistory.js'", "predocs-test": "npm run docs" }, "dependencies": { @@ -47,19 +46,18 @@ "protobufjs": "^6.8.0" }, "devDependencies": { - "@google-cloud/nodejs-repo-tools": "^3.0.0", "codecov": "^3.0.4", "eslint": "^5.1.0", "eslint-config-prettier": "^4.0.0", "eslint-plugin-node": "^9.0.0", "eslint-plugin-prettier": "^3.0.0", - "jsdoc-baseline": "git+https://github.com/hegemonic/jsdoc-baseline.git", "intelli-espower-loader": "^1.0.1", - "jsdoc": "^3.5.5", + "jsdoc": "^3.6.2", + "jsdoc-baseline": "git+https://github.com/hegemonic/jsdoc-baseline.git", + "linkinator": "^1.1.2", "mocha": "^6.0.0", "nyc": "^14.0.0", "power-assert": "^1.6.0", - "prettier": "^1.13.7", - "linkinator": "^1.1.2" + "prettier": "^1.13.7" } } diff --git a/packages/google-cloud-asset/samples/README.md b/packages/google-cloud-asset/samples/README.md new file mode 100644 index 00000000000..de14938efb3 --- /dev/null +++ b/packages/google-cloud-asset/samples/README.md @@ -0,0 +1,86 @@ +[//]: # "This README.md file is auto-generated, all changes to this file will be lost." +[//]: # "To regenerate it, use `python -m synthtool`." +Google Cloud Platform logo + +# [Cloud Asset Inventory: Node.js Samples](https://github.com/googleapis/nodejs-asset) + +[![Open in Cloud Shell][shell_img]][shell_link] + + + +## Table of Contents + +* [Before you begin](#before-you-begin) +* [Samples](#samples) + * [Export Assets](#export-assets) + * [Get Batch Asset History](#get-batch-asset-history) + * [Asset History Quickstart](#asset-history-quickstart) + +## Before you begin + +Before running the samples, make sure you've followed the steps outlined in +[Using the client library](https://github.com/googleapis/nodejs-asset#using-the-client-library). + +## Samples + + + +### Export Assets + +Export asserts to specified dump file path. + +View the [source code](https://github.com/googleapis/nodejs-asset/blob/master/samples/exportAssets.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-asset&page=editor&open_in_editor=samples/exportAssets.js,samples/README.md) + +__Usage:__ + + +`node exportAssets.js ` + + +----- + + + + +### Get Batch Asset History + +Batch get history of assets. + +View the [source code](https://github.com/googleapis/nodejs-asset/blob/master/samples/getBatchAssetHistory.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-asset&page=editor&open_in_editor=samples/getBatchAssetHistory.js,samples/README.md) + +__Usage:__ + + +`node getBatchAssetHistory "storage.googleapis.com/"` + + +----- + + + + +### Asset History Quickstart + +Batch get history of assets. + +View the [source code](https://github.com/googleapis/nodejs-asset/blob/master/samples/quickstart.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-asset&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) + +__Usage:__ + + +`node getBatchAssetHistory "storage.googleapis.com/"` + + + + + + +[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png +[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-asset&page=editor&open_in_editor=samples/README.md +[product-docs]: https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview \ No newline at end of file diff --git a/packages/google-cloud-asset/samples/exportAssets.js b/packages/google-cloud-asset/samples/exportAssets.js new file mode 100644 index 00000000000..627f1195bcc --- /dev/null +++ b/packages/google-cloud-asset/samples/exportAssets.js @@ -0,0 +1,60 @@ +/** + * Copyright 2018, Google, LLC. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +'use strict'; + +// sample-metadata: +// title: Export Assets +// description: Export asserts to specified dump file path. +// usage: node exportAssets.js + +async function main(dumpFilePath) { + // [START asset_quickstart_export_assets] + const {AssetServiceClient} = require('@google-cloud/asset'); + const client = new AssetServiceClient(); + + async function exportAssets() { + const projectId = await client.getProjectId(); + const projectResource = client.projectPath(projectId); + + // TODO(developer): choose the dump file path + // const dumpFilePath = 'Dump file path, e.g.: gs:///' + + const request = { + parent: projectResource, + outputConfig: { + gcsDestination: { + uri: dumpFilePath, + }, + }, + }; + + // Handle the operation using the promise pattern. + const [operation] = await client.exportAssets(request); + + // Operation#promise starts polling for the completion of the operation. + const [result] = await operation.promise(); + + // Do things with with the response. + console.log(result); + } + exportAssets(); + // [END asset_quickstart_export_assets] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/packages/google-cloud-asset/samples/getBatchAssetHistory.js b/packages/google-cloud-asset/samples/getBatchAssetHistory.js new file mode 100644 index 00000000000..b0716aaad9d --- /dev/null +++ b/packages/google-cloud-asset/samples/getBatchAssetHistory.js @@ -0,0 +1,59 @@ +/** + * Copyright 2018, Google, LLC. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +'use strict'; + +// sample-metadata: +// title: Get Batch Asset History +// description: Batch get history of assets. +// usage: node getBatchAssetHistory "//storage.googleapis.com/" + +async function main(assetNames) { + // [START asset_quickstart_batch_get_assets_history] + const util = require('util'); + const {AssetServiceClient} = require('@google-cloud/asset'); + + const client = new AssetServiceClient(); + + async function batchGetAssetsHistory() { + const projectId = await client.getProjectId(); + const projectResource = client.projectPath(projectId); + // TODO(developer): Choose asset names, such as //storage.googleapis.com/[YOUR_BUCKET_NAME]. + // const assetNames = ['ASSET_NAME1', 'ASSET_NAME2', ...]; + + const request = { + parent: projectResource, + assetNames: assetNames.split(','), + contentType: 'RESOURCE', + readTimeWindow: { + startTime: { + seconds: Math.floor(new Date().getTime() / 1000), + }, + }, + }; + + // Handle the operation using the promise pattern. + const result = await client.batchGetAssetsHistory(request); + // Do things with with the response. + console.log(util.inspect(result, {depth: null})); + // [END asset_quickstart_batch_get_assets_history] + } + batchGetAssetsHistory(); +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/packages/google-cloud-asset/samples/quickstart.js b/packages/google-cloud-asset/samples/quickstart.js index 8bb9c04d439..c13fb2b9912 100644 --- a/packages/google-cloud-asset/samples/quickstart.js +++ b/packages/google-cloud-asset/samples/quickstart.js @@ -15,105 +15,42 @@ 'use strict'; -async function exportAssets(dumpFilePath) { - // [START asset_quickstart_export_assets] - const {AssetServiceClient} = require('@google-cloud/asset'); - const client = new AssetServiceClient({ - // optional auth parameters. - }); - - // Your Google Cloud Platform project ID - const projectId = await client.getProjectId(); - const projectResource = client.projectPath(projectId); - - // var dumpFilePath = 'Dump file path, e.g.: gs:///' - const outputConfig = { - gcsDestination: { - uri: dumpFilePath, - }, - }; - const request = { - parent: projectResource, - outputConfig: outputConfig, - }; - - // Handle the operation using the promise pattern. - const [operation] = await client.exportAssets(request); - // Operation#promise starts polling for the completion of the operation. - const [result] = await operation.promise(); - // Do things with with the response. - console.log(result); - // [END asset_quickstart_export_assets] -} +// sample-metadata: +// title: Asset History Quickstart +// description: Batch get history of assets. +// usage: node getBatchAssetHistory "//storage.googleapis.com/" -async function batchGetAssetsHistory(assetNames) { - // [START asset_quickstart_batch_get_assets_history] +async function main(assetNames) { + // [START asset_quickstart] const util = require('util'); const {AssetServiceClient} = require('@google-cloud/asset'); - const client = new AssetServiceClient({ - // optional auth parameters. - }); - // Your Google Cloud Platform project ID - const projectId = await client.getProjectId(); - const projectResource = client.projectPath(projectId); - // Your asset names, such as //storage.googleapis.com/[YOUR_BUCKET_NAME]. - // var assetNames = ['ASSET_NAME1', 'ASSET_NAME2', ...]; - - const contentType = 'RESOURCE'; - const readTimeWindow = { - startTime: { - seconds: Math.floor(new Date().getTime() / 1000), - }, - }; - - const request = { - parent: projectResource, - assetNames: assetNames, - contentType: contentType, - readTimeWindow: readTimeWindow, - }; - - // Handle the operation using the promise pattern. - const result = await client.batchGetAssetsHistory(request); - // Do things with with the response. - console.log(util.inspect(result, {depth: null})); - // [END asset_quickstart_batch_get_assets_history] + const client = new AssetServiceClient(); + + async function quickstart() { + const projectId = await client.getProjectId(); + const projectResource = client.projectPath(projectId); + // TODO(developer): Choose asset names, such as //storage.googleapis.com/[YOUR_BUCKET_NAME]. + // const assetNames = ['ASSET_NAME1', 'ASSET_NAME2', ...]; + + const request = { + parent: projectResource, + assetNames: assetNames.split(','), + contentType: 'RESOURCE', + readTimeWindow: { + startTime: { + seconds: Math.floor(new Date().getTime() / 1000), + }, + }, + }; + + // Handle the operation using the promise pattern. + const result = await client.batchGetAssetsHistory(request); + // Do things with with the response. + console.log(util.inspect(result, {depth: null})); + // [END asset_quickstart] + } + quickstart(); } -const cli = require('yargs') - .demand(1) - .command( - 'export-assets ', - 'Export asserts to specified dump file path.', - {}, - opts => exportAssets(opts.dumpFilePath) - ) - .command( - 'batch-get-history ', - 'Batch get history of assets.', - {}, - opts => { - const assetNameList = opts.assetNames.split(','); - batchGetAssetsHistory(assetNameList); - } - ) - .example( - 'node $0 export-assets gs://my-bucket/my-assets.txt', - 'Export assets to gs://my-bucket/my-assets.txt.' - ) - .example( - 'node $0 batch-get-history "//storage.googleapis.com/,"', - 'Batch get history of assets //storage.googleapis.com/ etc.' - ) - .wrap(10) - .recommendCommands() - .epilogue( - 'https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview' - ) - .help() - .strict(); - -if (module === require.main) { - cli.parse(process.argv.slice(2)); -} +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-asset/samples/test/quickstart.test.js b/packages/google-cloud-asset/samples/test/sample.test.js similarity index 79% rename from packages/google-cloud-asset/samples/test/quickstart.test.js rename to packages/google-cloud-asset/samples/test/sample.test.js index 688490a1cb5..7253495cbd1 100644 --- a/packages/google-cloud-asset/samples/test/quickstart.test.js +++ b/packages/google-cloud-asset/samples/test/sample.test.js @@ -22,7 +22,6 @@ const {Storage} = require('@google-cloud/storage'); const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); -const cmd = 'node quickstart.js'; const storage = new Storage(); const bucketName = `asset-nodejs-${uuid.v4()}`; const bucket = storage.bucket(bucketName); @@ -38,7 +37,7 @@ describe('quickstart sample tests', () => { it('should export assets to specified path', async () => { const dumpFilePath = `gs://${bucketName}/my-assets.txt`; - execSync(`${cmd} export-assets ${dumpFilePath}`); + execSync(`node exportAssets ${dumpFilePath}`); const file = await bucket.file('my-assets.txt'); const exists = await file.exists(); assert.ok(exists); @@ -47,7 +46,13 @@ describe('quickstart sample tests', () => { it('should get assets history successfully', async () => { const assetName = `//storage.googleapis.com/${bucketName}`; - const stdout = execSync(`${cmd} batch-get-history ${assetName}`); - assert.match(stdout, new RegExp(assetName)); + const stdout = execSync(`node getBatchAssetHistory ${assetName}`); + assert.include(stdout, assetName); + }); + + it('should run the quickstart', async () => { + const assetName = `//storage.googleapis.com/${bucketName}`; + const stdout = execSync(`node quickstart ${assetName}`); + assert.include(stdout, assetName); }); }); diff --git a/packages/google-cloud-asset/synth.metadata b/packages/google-cloud-asset/synth.metadata index 4aa916dc3aa..e43e475c29f 100644 --- a/packages/google-cloud-asset/synth.metadata +++ b/packages/google-cloud-asset/synth.metadata @@ -46,4 +46,4 @@ } } ] -} \ No newline at end of file +}