Skip to content

Commit

Permalink
feat!: convert dataproc to typescript (#310)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
2 people authored and NimJay committed Nov 19, 2022
1 parent 2bbdd53 commit 42573f4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
4 changes: 3 additions & 1 deletion dataproc/createCluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
4 changes: 2 additions & 2 deletions dataproc/quickstart.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
});

Expand Down
9 changes: 6 additions & 3 deletions dataproc/system-test/createCluster.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
7 changes: 5 additions & 2 deletions dataproc/system-test/quickstart.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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 () => {
Expand Down

0 comments on commit 42573f4

Please sign in to comment.