From 42573f4bee9f82372f3ac7eca5f5b1228a5311e9 Mon Sep 17 00:00:00 2001 From: Summer Ji Date: Sat, 29 Feb 2020 12:08:41 -0800 Subject: [PATCH] feat!: convert dataproc to typescript (#310) * conversion to typescript * modified synth.py * fix samples test path issue * try to fix google.protobuf.Empty in docs * remove package chai from dependencies, Add source include protos for fixing google.protobuf.Empty * conversion to typescript * modified synth.py * fix samples test path issue * try to fix google.protobuf.Empty in docs * remove package chai from dependencies, Add source include protos for fixing google.protobuf.Empty * update latest published protos, gen docs for protos * lint fix * add protos into source in .jsdoc.js * remove unneeded AUTHOR and COPYING here * update upstream protos to fix [Empty](google.protobuf.Empty) * update package and jsdoc * fix merge Co-authored-by: Alexander Fenster --- dataproc/createCluster.js | 4 +++- dataproc/quickstart.js | 4 ++-- dataproc/system-test/createCluster.test.js | 9 ++++++--- dataproc/system-test/quickstart.test.js | 7 +++++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/dataproc/createCluster.js b/dataproc/createCluster.js index 3dffbee17a..da62e566fd 100644 --- a/dataproc/createCluster.js +++ b/dataproc/createCluster.js @@ -14,9 +14,11 @@ // Code for creating a Cloud Dataproc cluster with the Node.js Client Library +/*eslint no-warning-comments: [0, { "terms": ["todo", "fixme"], "location": "anywhere" }]*/ + function main(projectId, region, clusterName) { // [START dataproc_create_cluster] - const dataproc = require('@google-cloud/dataproc').v1; + const dataproc = require('@google-cloud/dataproc'); // Create a client with the endpoint set to the desired cluster region const client = new dataproc.v1.ClusterControllerClient({ diff --git a/dataproc/quickstart.js b/dataproc/quickstart.js index e8bec76e76..ae0fefe162 100644 --- a/dataproc/quickstart.js +++ b/dataproc/quickstart.js @@ -24,13 +24,13 @@ 'use strict'; function main(projectId, region, clusterName, jobFilePath) { - const dataproc = require('@google-cloud/dataproc').v1; + const dataproc = require('@google-cloud/dataproc'); const {Storage} = require('@google-cloud/storage'); const sleep = require('sleep'); // Create a cluster client with the endpoint set to the desired cluster region - const clusterClient = new dataproc.ClusterControllerClient({ + const clusterClient = new dataproc.v1.ClusterControllerClient({ apiEndpoint: `${region}-dataproc.googleapis.com`, }); diff --git a/dataproc/system-test/createCluster.test.js b/dataproc/system-test/createCluster.test.js index e47bcaeef3..67d3403f79 100644 --- a/dataproc/system-test/createCluster.test.js +++ b/dataproc/system-test/createCluster.test.js @@ -22,14 +22,17 @@ const uuid = require('uuid'); const region = 'us-central1'; const clusterName = `node-cc-test-${uuid()}`; -const dataproc = require('@google-cloud/dataproc').v1; -const clusterClient = new dataproc.ClusterControllerClient({ +const dataproc = require('@google-cloud/dataproc'); +const clusterClient = new dataproc.v1.ClusterControllerClient({ apiEndpoint: `${region}-dataproc.googleapis.com`, }); const projectId = process.env.GCLOUD_PROJECT; -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = cmd => + cp.execSync(cmd, { + encoding: 'utf-8', + }); describe('create a dataproc cluster', () => { it('should create a dataproc cluster', async () => { diff --git a/dataproc/system-test/quickstart.test.js b/dataproc/system-test/quickstart.test.js index 09f6a86d06..d769ce42f3 100644 --- a/dataproc/system-test/quickstart.test.js +++ b/dataproc/system-test/quickstart.test.js @@ -19,7 +19,7 @@ const {describe, it, before, after} = require('mocha'); const cp = require('child_process'); const uuid = require('uuid'); -const dataproc = require('@google-cloud/dataproc').v1; +const dataproc = require('@google-cloud/dataproc'); const {Storage} = require('@google-cloud/storage'); const myUuid = uuid(); @@ -41,7 +41,10 @@ const clusterClient = new dataproc.v1.ClusterControllerClient({ const storage = new Storage(); -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = cmd => + cp.execSync(cmd, { + encoding: 'utf-8', + }); describe('execute the quickstart', () => { before(async () => {