Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// 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';
// [START dataproc_quickstart]
const dataproc = require('@google-cloud/dataproc');
const client = new dataproc.v1.ClusterControllerClient();
async function quickstart() {
const projectId = await client.getProjectId();
const request = {
region: 'global',
projectId,
};
const [resources] = await client.listClusters(request);
console.log('Total resources:', resources.length);
for (const resource of resources) {
console.log(resource);
}
let nextRequest = request;
// Or obtain the paged response.
const options = {autoPaginate: false};
function main(projectId, region, clusterName) {
// [START dataproc_create_cluster]
const dataproc = require('@google-cloud/dataproc').v1;
// Create a client with the endpoint set to the desired cluster region
const client = new dataproc.v1.ClusterControllerClient({
apiEndpoint: `${region}-dataproc.googleapis.com`,
});
async function createCluster() {
// TODO(developer): Uncomment and set the following variables
// projectId = 'YOUR_PROJECT_ID'
// region = 'YOUR_CLUSTER_REGION'
// clusterName = 'YOUR_CLUSTER_NAME'
// Create the cluster config
const request = {
projectId: projectId,
region: region,
function main(projectId, region, clusterName) {
// [START dataproc_create_cluster]
const dataproc = require('@google-cloud/dataproc').v1;
// Create a client with the endpoint set to the desired cluster region
const client = new dataproc.v1.ClusterControllerClient({
apiEndpoint: `${region}-dataproc.googleapis.com`,
});
async function createCluster() {
// TODO(developer): Uncomment and set the following variables
// projectId = 'YOUR_PROJECT_ID'
// region = 'YOUR_CLUSTER_REGION'
// clusterName = 'YOUR_CLUSTER_NAME'
// Create the cluster config
const request = {
projectId: projectId,
region: region,
cluster: {
clusterName: clusterName,
config: {