How to use @google-cloud/dataproc - 3 common examples

To help you get started, we’ve selected a few @google-cloud/dataproc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github googleapis / nodejs-dataproc / samples / quickstart.js View on Github external
// 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};
github googleapis / nodejs-dataproc / samples / createCluster.js View on Github external
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,
github googleapis / nodejs-dataproc / samples / createCluster.js View on Github external
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: {

@google-cloud/dataproc

Google Cloud Dataproc API client for Node.js

Apache-2.0
Latest version published 2 months ago

Package Health Score

87 / 100
Full package analysis

Popular @google-cloud/dataproc functions