Skip to content

Commit 82f5d8d

Browse files
alexander-fensterNimJay
authored andcommitted
enabling test and CI
1 parent b416d30 commit 82f5d8d

3 files changed

Lines changed: 78 additions & 0 deletions

File tree

‎dataproc/.eslintrc.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
rules:
3+
no-console: off

‎dataproc/quickstart.js‎

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// Copyright 2017, Google LLC All rights reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
'use strict';
16+
17+
if (
18+
!process.env.GCLOUD_PROJECT ||
19+
!process.env.GOOGLE_APPLICATION_CREDENTIALS
20+
) {
21+
throw new Error(
22+
'Usage: GCLOUD_PROJECT=<project_id> GOOGLE_APPLICATION_CREDENTIALS=<path to json key> node #{$0}'
23+
);
24+
}
25+
var projectId = process.env.GCLOUD_PROJECT;
26+
27+
const dataproc = require('../src');
28+
29+
var client = new dataproc.v1.ClusterControllerClient({
30+
// optional auth parameters.
31+
});
32+
33+
// Iterate over all elements.
34+
var projectId2 = projectId;
35+
var region = 'global';
36+
var request = {
37+
projectId: projectId2,
38+
region: region,
39+
};
40+
41+
client.listClusters(request).then(responses => {
42+
var resources = responses[0];
43+
console.log('Total resources:', resources.length);
44+
for (let i = 0; i < resources.length; i += 1) {
45+
console.log(resources[i]);
46+
}
47+
});
48+
49+
// Or obtain the paged response.
50+
var options = {autoPaginate: false};
51+
var callback = responses => {
52+
// The actual resources in a response.
53+
var resources = responses[0];
54+
// The next request if the response shows that there are more responses.
55+
var nextRequest = responses[1];
56+
// The actual response object, if necessary.
57+
// var rawResponse = responses[2];
58+
for (let i = 0; i < resources.length; i += 1) {
59+
console.log(resources[i]);
60+
}
61+
if (nextRequest) {
62+
// Fetch the next page.
63+
return client.listClusters(nextRequest, options).then(callback);
64+
}
65+
};
66+
client.listClusters(request, options).then(callback);
67+
68+
client.listClustersStream(request).on('data', element => {
69+
console.log(element);
70+
});

‎dataproc/system-test/.eslintrc.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
rules:
3+
node/no-unpublished-require: off
4+
node/no-unsupported-features: off
5+
no-empty: off

0 commit comments

Comments
 (0)