diff --git a/packages/google-cloud-vpc-access/.jsdoc.js b/packages/google-cloud-vpc-access/.jsdoc.js index 3924b8e91f0..ea83faaf6e0 100644 --- a/packages/google-cloud-vpc-access/.jsdoc.js +++ b/packages/google-cloud-vpc-access/.jsdoc.js @@ -43,7 +43,7 @@ module.exports = { copyright: 'Copyright 2021 Google LLC', includeDate: false, sourceFiles: false, - systemName: '@google-cloud/vpcaccess', + systemName: '@google-cloud/vpc-access', theme: 'lumen', default: { outputSourceFiles: false diff --git a/packages/google-cloud-vpc-access/README.md b/packages/google-cloud-vpc-access/README.md index acbbc237aa4..4de15d130ae 100644 --- a/packages/google-cloud-vpc-access/README.md +++ b/packages/google-cloud-vpc-access/README.md @@ -32,8 +32,8 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained]. * [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) @@ -55,6 +55,41 @@ npm install @google-cloud/vpc-access ``` +### Using the client library + +```javascript +// Imports the Google Cloud client library + +// remove this line after package is released +// eslint-disable-next-line node/no-missing-require +const {VpcAccessServiceClient} = require('@google-cloud/vpc-access'); + +// TODO(developer): replace with your prefered project ID. +// const projectId = 'my-project' + +// Creates a client +// eslint-disable-next-line no-unused-vars +const client = new VpcAccessServiceClient(); + +async function listConnectors() { + const connectors = await client.listConnectors({ + parent: `projects/${projectId}/locations/${location}`, + }); + console.info(connectors); +} +listConnectors(); + +``` + + + +## Samples + +Samples are in the [`samples/`](https://github.com/googleapis/nodejs-vpc-access/tree/master/samples) directory. Each sample's `README.md` has instructions for running its sample. + +| Sample | Source Code | Try it | +| --------------------------- | --------------------------------- | ------ | +| Quickstart | [source code](https://github.com/googleapis/nodejs-vpc-access/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-vpc-access&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) | diff --git a/packages/google-cloud-vpc-access/linkinator.config.json b/packages/google-cloud-vpc-access/linkinator.config.json index 0947c2e0e5b..808426131ba 100644 --- a/packages/google-cloud-vpc-access/linkinator.config.json +++ b/packages/google-cloud-vpc-access/linkinator.config.json @@ -1 +1,11 @@ -{"recurse":true,"skip":["https://codecov.io/gh/googleapis/","www.googleapis.com","img.shields.io"],"silent":true,"concurrency":10} \ No newline at end of file +{ + "recurse": true, + "skip": [ + "https://github.com/googleapis/nodejs-vpc-access/blob/master/CHANGELOG.md", + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io" + ], + "silent": true, + "concurrency": 10 +} diff --git a/packages/google-cloud-vpc-access/package.json b/packages/google-cloud-vpc-access/package.json index 0e49e74ac93..3bc3d4297fe 100644 --- a/packages/google-cloud-vpc-access/package.json +++ b/packages/google-cloud-vpc-access/package.json @@ -2,7 +2,7 @@ "name": "@google-cloud/vpc-access", "version": "0.1.0", "description": "vpcaccess client for Node.js", - "repository": "googleapis/googleapis/nodejs-vpc-access", + "repository": "googleapis/nodejs-vpc-access", "license": "Apache-2.0", "author": "Google LLC", "main": "build/src/index.js", diff --git a/packages/google-cloud-vpc-access/samples/README.md b/packages/google-cloud-vpc-access/samples/README.md new file mode 100644 index 00000000000..dcb0a638047 --- /dev/null +++ b/packages/google-cloud-vpc-access/samples/README.md @@ -0,0 +1,50 @@ +[//]: # "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 + +# [Virtual Private Cloud: Node.js Samples](https://github.com/googleapis/nodejs-vpc-access) + +[![Open in Cloud Shell][shell_img]][shell_link] + + + +## Table of Contents + +* [Before you begin](#before-you-begin) +* [Samples](#samples) + * [Quickstart](#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-vpc-access#using-the-client-library). + +`cd samples` + +`npm install` + +`cd ..` + +## Samples + + + +### Quickstart + +View the [source code](https://github.com/googleapis/nodejs-vpc-access/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-vpc-access&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) + +__Usage:__ + + +`node samples/quickstart.js` + + + + + + +[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-vpc-access&page=editor&open_in_editor=samples/README.md +[product-docs]: https://cloud.google.com/vpc/ diff --git a/packages/google-cloud-vpc-access/samples/quickstart.js b/packages/google-cloud-vpc-access/samples/quickstart.js index 73392b2f201..57cd7caa2ba 100644 --- a/packages/google-cloud-vpc-access/samples/quickstart.js +++ b/packages/google-cloud-vpc-access/samples/quickstart.js @@ -13,8 +13,7 @@ 'use strict'; -async function main() { - +async function main(projectId, location) { // [START nodejs_vpc_access_quickstart] // Imports the Google Cloud client library @@ -27,16 +26,15 @@ async function main() { // Creates a client // eslint-disable-next-line no-unused-vars - const client = new {VpcAccessServiceClient}(); + const client = new VpcAccessServiceClient(); - //TODO(library generator): write the actual function you will be testing - async function doSomething() { - console.log('DPE! Change this code so that it shows how to use the library! See comments below on structure.') - // const [thing] = await client.methodName({ - // }); - // console.info(thing); + async function listConnectors() { + const connectors = await client.listConnectors({ + parent: `projects/${projectId}/locations/${location}`, + }); + console.info(connectors); } - doSomething(); + listConnectors(); // [END nodejs_vpc_access_quickstart] } diff --git a/packages/google-cloud-vpc-access/samples/test/quickstart.js b/packages/google-cloud-vpc-access/samples/test/quickstart.js index 3ef70355138..f981be82773 100644 --- a/packages/google-cloud-vpc-access/samples/test/quickstart.js +++ b/packages/google-cloud-vpc-access/samples/test/quickstart.js @@ -29,10 +29,10 @@ const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const cwd = path.join(__dirname, '..'); -const client = new {VpcAccessServiceClient}(); +const client = new VpcAccessServiceClient(); describe('Quickstart', () => { - //TODO: remove this if not using the projectId + //TODO: remove this if not using the projectId // eslint-disable-next-line no-unused-vars let projectId; @@ -42,12 +42,9 @@ describe('Quickstart', () => { }); it('should run quickstart', async () => { - //TODO: remove this line - // eslint-disable-next-line no-unused-vars - const stdout = execSync( - `node ./quickstart.js`, - {cwd} - ); - //assert(stdout, stdout !== null); + const stdout = execSync(`node ./quickstart.js ${projectId} us-central1`, { + cwd, + }); + assert.match(stdout, /\[\]/); }); }); diff --git a/packages/google-cloud-vpc-access/system-test/fixtures/sample/src/index.js b/packages/google-cloud-vpc-access/system-test/fixtures/sample/src/index.js index 03579b8927b..6584a2dd18b 100644 --- a/packages/google-cloud-vpc-access/system-test/fixtures/sample/src/index.js +++ b/packages/google-cloud-vpc-access/system-test/fixtures/sample/src/index.js @@ -17,7 +17,7 @@ // ** All changes to this file may be overwritten. ** /* eslint-disable node/no-missing-require, no-unused-vars */ -const vpcaccess = require('@google-cloud/vpcaccess'); +const vpcaccess = require('@google-cloud/vpc-access'); function main() { const vpcAccessServiceClient = new vpcaccess.VpcAccessServiceClient(); diff --git a/packages/google-cloud-vpc-access/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-vpc-access/system-test/fixtures/sample/src/index.ts index b3db2a315e8..238f17ec956 100644 --- a/packages/google-cloud-vpc-access/system-test/fixtures/sample/src/index.ts +++ b/packages/google-cloud-vpc-access/system-test/fixtures/sample/src/index.ts @@ -16,7 +16,7 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -import {VpcAccessServiceClient} from '@google-cloud/vpcaccess'; +import {VpcAccessServiceClient} from '@google-cloud/vpc-access'; // check that the client class type name can be used function doStuffWithVpcAccessServiceClient(client: VpcAccessServiceClient) {