Class v1.ClusterControllerClient (5.12.0)

The ClusterControllerService provides methods to manage clusters of Compute Engine instances. v1

Package

@google-cloud/dataproc

Constructors

(constructor)(opts, gaxInstance)

constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);

Construct an instance of ClusterControllerClient.

Parameters
Name Description
opts ClientOptions
gaxInstance typeof gax | typeof fallback

: loaded instance of google-gax. Useful if you need to avoid loading the default gRPC version and want to use the fallback HTTP implementation. Load only fallback version and pass it to the constructor: ``` const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC const client = new ClusterControllerClient({fallback: true}, gax); ```

Properties

apiEndpoint

get apiEndpoint(): string;

The DNS address for this API service.

apiEndpoint

static get apiEndpoint(): string;

The DNS address for this API service - same as servicePath.

auth

auth: gax.GoogleAuth;

clusterControllerStub

clusterControllerStub?: Promise<{
        [name: string]: Function;
    }>;

descriptors

descriptors: Descriptors;

iamClient

iamClient: IamClient;

innerApiCalls

innerApiCalls: {
        [name: string]: Function;
    };

operationsClient

operationsClient: gax.OperationsClient;

pathTemplates

pathTemplates: {
        [name: string]: gax.PathTemplate;
    };

port

static get port(): number;

The port for this API service.

scopes

static get scopes(): string[];

The scopes needed to make gRPC calls for every method defined in this service.

servicePath

static get servicePath(): string;

The DNS address for this API service.

universeDomain

get universeDomain(): string;

warn

warn: (code: string, message: string, warnType?: string) => void;

Methods

batchPath(project, location, batch)

batchPath(project: string, location: string, batch: string): string;

Return a fully-qualified batch resource name string.

Parameters
Name Description
project string
location string
batch string
Returns
Type Description
string

{string} Resource name string.

cancelOperation(request, options, callback)

cancelOperation(request: protos.google.longrunning.CancelOperationRequest, options?: gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.CancelOperationRequest, {} | undefined | null>, callback?: Callback<protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null>): Promise<protos.google.protobuf.Empty>;

Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED. Clients can use or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an value with a of 1, corresponding to Code.CANCELLED.

Parameters
Name Description
request CancelOperationRequest

The request object that will be sent.

options CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.CancelOperationRequest, {} | undefined | null>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback Callback<protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null>

The function which will be called with the result of the API call. {Promise} - The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call.

Returns
Type Description
Promise<protos.google.protobuf.Empty>
Example

const client = longrunning.operationsClient();
await client.cancelOperation({name: ''});

checkCreateClusterProgress(name)

checkCreateClusterProgress(name: string): Promise<LROperation<protos.google.cloud.dataproc.v1.Cluster, protos.google.cloud.dataproc.v1.ClusterOperationMetadata>>;

Check the status of the long running operation returned by createCluster().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.cloud.dataproc.v1.Cluster, protos.google.cloud.dataproc.v1.ClusterOperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The ID of the Google Cloud Platform project that the cluster
   *  belongs to.
   */
  // const projectId = 'abc123'
  /**
   *  Required. The Dataproc region in which to handle the request.
   */
  // const region = 'us-central1'
  /**
   *  Required. The cluster to create.
   */
  // const cluster = {}
  /**
   *  Optional. A unique ID used to identify the request. If the server receives
   *  two
   *  CreateClusterRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateClusterRequest)s
   *  with the same id, then the second request will be ignored and the
   *  first google.longrunning.Operation google.longrunning.Operation  created
   *  and stored in the backend is returned.
   *  It is recommended to always set this value to a
   *  UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier).
   *  The ID must contain only letters (a-z, A-Z), numbers (0-9),
   *  underscores (_), and hyphens (-). The maximum length is 40 characters.
   */
  // const requestId = 'abc123'
  /**
   *  Optional. Failure action when primary worker creation fails.
   */
  // const actionOnFailedPrimaryWorkers = {}

  // Imports the Dataproc library
  const {ClusterControllerClient} = require('@google-cloud/dataproc').v1;

  // Instantiates a client
  const dataprocClient = new ClusterControllerClient();

  async function callCreateCluster() {
    // Construct request
    const request = {
      projectId,
      region,
      cluster,
    };

    // Run request
    const [operation] = await dataprocClient.createCluster(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callCreateCluster();

checkDeleteClusterProgress(name)

checkDeleteClusterProgress(name: string): Promise<LROperation<protos.google.protobuf.Empty, protos.google.cloud.dataproc.v1.ClusterOperationMetadata>>;

Check the status of the long running operation returned by deleteCluster().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.protobuf.Empty, protos.google.cloud.dataproc.v1.ClusterOperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The ID of the Google Cloud Platform project that the cluster
   *  belongs to.
   */
  // const projectId = 'abc123'
  /**
   *  Required. The Dataproc region in which to handle the request.
   */
  // const region = 'us-central1'
  /**
   *  Required. The cluster name.
   */
  // const clusterName = 'abc123'
  /**
   *  Optional. Specifying the `cluster_uuid` means the RPC should fail
   *  (with error NOT_FOUND) if cluster with specified UUID does not exist.
   */
  // const clusterUuid = 'abc123'
  /**
   *  Optional. A unique ID used to identify the request. If the server
   *  receives two
   *  DeleteClusterRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteClusterRequest)s
   *  with the same id, then the second request will be ignored and the
   *  first google.longrunning.Operation google.longrunning.Operation  created
   *  and stored in the backend is returned.
   *  It is recommended to always set this value to a
   *  UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier).
   *  The ID must contain only letters (a-z, A-Z), numbers (0-9),
   *  underscores (_), and hyphens (-). The maximum length is 40 characters.
   */
  // const requestId = 'abc123'

  // Imports the Dataproc library
  const {ClusterControllerClient} = require('@google-cloud/dataproc').v1;

  // Instantiates a client
  const dataprocClient = new ClusterControllerClient();

  async function callDeleteCluster() {
    // Construct request
    const request = {
      projectId,
      region,
      clusterName,
    };

    // Run request
    const [operation] = await dataprocClient.deleteCluster(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callDeleteCluster();

checkDiagnoseClusterProgress(name)

checkDiagnoseClusterProgress(name: string): Promise<LROperation<protos.google.cloud.dataproc.v1.DiagnoseClusterResults, protos.google.cloud.dataproc.v1.ClusterOperationMetadata>>;

Check the status of the long running operation returned by diagnoseCluster().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.cloud.dataproc.v1.DiagnoseClusterResults, protos.google.cloud.dataproc.v1.ClusterOperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The ID of the Google Cloud Platform project that the cluster
   *  belongs to.
   */
  // const projectId = 'abc123'
  /**
   *  Required. The Dataproc region in which to handle the request.
   */
  // const region = 'us-central1'
  /**
   *  Required. The cluster name.
   */
  // const clusterName = 'abc123'
  /**
   *  Optional. (Optional) The output Cloud Storage directory for the diagnostic
   *  tarball. If not specified, a task-specific directory in the cluster's
   *  staging bucket will be used.
   */
  // const tarballGcsDir = 'abc123'
  /**
   *  Optional. (Optional) The access type to the diagnostic tarball. If not
   *  specified, falls back to default access of the bucket
   */
  // const tarballAccess = {}
  /**
   *  Optional. Time interval in which diagnosis should be carried out on the
   *  cluster.
   */
  // const diagnosisInterval = {}
  /**
   *  Optional. Specifies a list of jobs on which diagnosis is to be performed.
   *  Format: projects/{project}/regions/{region}/jobs/{job}
   */
  // const jobs = ['abc','def']
  /**
   *  Optional. Specifies a list of yarn applications on which diagnosis is to be
   *  performed.
   */
  // const yarnApplicationIds = ['abc','def']

  // Imports the Dataproc library
  const {ClusterControllerClient} = require('@google-cloud/dataproc').v1;

  // Instantiates a client
  const dataprocClient = new ClusterControllerClient();

  async function callDiagnoseCluster() {
    // Construct request
    const request = {
      projectId,
      region,
      clusterName,
    };

    // Run request
    const [operation] = await dataprocClient.diagnoseCluster(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callDiagnoseCluster();

checkStartClusterProgress(name)

checkStartClusterProgress(name: string): Promise<LROperation<protos.google.cloud.dataproc.v1.Cluster, protos.google.cloud.dataproc.v1.ClusterOperationMetadata>>;

Check the status of the long running operation returned by startCluster().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.cloud.dataproc.v1.Cluster, protos.google.cloud.dataproc.v1.ClusterOperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The ID of the Google Cloud Platform project the
   *  cluster belongs to.
   */
  // const projectId = 'abc123'
  /**
   *  Required. The Dataproc region in which to handle the request.
   */
  // const region = 'us-central1'
  /**
   *  Required. The cluster name.
   */
  // const clusterName = 'abc123'
  /**
   *  Optional. Specifying the `cluster_uuid` means the RPC will fail
   *  (with error NOT_FOUND) if a cluster with the specified UUID does not exist.
   */
  // const clusterUuid = 'abc123'
  /**
   *  Optional. A unique ID used to identify the request. If the server
   *  receives two
   *  StartClusterRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StartClusterRequest)s
   *  with the same id, then the second request will be ignored and the
   *  first google.longrunning.Operation google.longrunning.Operation  created
   *  and stored in the backend is returned.
   *  Recommendation: Set this value to a
   *  UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier).
   *  The ID must contain only letters (a-z, A-Z), numbers (0-9),
   *  underscores (_), and hyphens (-). The maximum length is 40 characters.
   */
  // const requestId = 'abc123'

  // Imports the Dataproc library
  const {ClusterControllerClient} = require('@google-cloud/dataproc').v1;

  // Instantiates a client
  const dataprocClient = new ClusterControllerClient();

  async function callStartCluster() {
    // Construct request
    const request = {
      projectId,
      region,
      clusterName,
    };

    // Run request
    const [operation] = await dataprocClient.startCluster(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callStartCluster();

checkStopClusterProgress(name)

checkStopClusterProgress(name: string): Promise<LROperation<protos.google.cloud.dataproc.v1.Cluster, protos.google.cloud.dataproc.v1.ClusterOperationMetadata>>;

Check the status of the long running operation returned by stopCluster().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.cloud.dataproc.v1.Cluster, protos.google.cloud.dataproc.v1.ClusterOperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The ID of the Google Cloud Platform project the
   *  cluster belongs to.
   */
  // const projectId = 'abc123'
  /**
   *  Required. The Dataproc region in which to handle the request.
   */
  // const region = 'us-central1'
  /**
   *  Required. The cluster name.
   */
  // const clusterName = 'abc123'
  /**
   *  Optional. Specifying the `cluster_uuid` means the RPC will fail
   *  (with error NOT_FOUND) if a cluster with the specified UUID does not exist.
   */
  // const clusterUuid = 'abc123'
  /**
   *  Optional. A unique ID used to identify the request. If the server
   *  receives two
   *  StopClusterRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StopClusterRequest)s
   *  with the same id, then the second request will be ignored and the
   *  first google.longrunning.Operation google.longrunning.Operation  created
   *  and stored in the backend is returned.
   *  Recommendation: Set this value to a
   *  UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier).
   *  The ID must contain only letters (a-z, A-Z), numbers (0-9),
   *  underscores (_), and hyphens (-). The maximum length is 40 characters.
   */
  // const requestId = 'abc123'

  // Imports the Dataproc library
  const {ClusterControllerClient} = require('@google-cloud/dataproc').v1;

  // Instantiates a client
  const dataprocClient = new ClusterControllerClient();

  async function callStopCluster() {
    // Construct request
    const request = {
      projectId,
      region,
      clusterName,
    };

    // Run request
    const [operation] = await dataprocClient.stopCluster(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callStopCluster();

checkUpdateClusterProgress(name)

checkUpdateClusterProgress(name: string): Promise<LROperation<protos.google.cloud.dataproc.v1.Cluster, protos.google.cloud.dataproc.v1.ClusterOperationMetadata>>;

Check the status of the long running operation returned by updateCluster().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.cloud.dataproc.v1.Cluster, protos.google.cloud.dataproc.v1.ClusterOperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The ID of the Google Cloud Platform project the
   *  cluster belongs to.
   */
  // const projectId = 'abc123'
  /**
   *  Required. The Dataproc region in which to handle the request.
   */
  // const region = 'us-central1'
  /**
   *  Required. The cluster name.
   */
  // const clusterName = 'abc123'
  /**
   *  Required. The changes to the cluster.
   */
  // const cluster = {}
  /**
   *  Optional. Timeout for graceful YARN decommissioning. Graceful
   *  decommissioning allows removing nodes from the cluster without
   *  interrupting jobs in progress. Timeout specifies how long to wait for jobs
   *  in progress to finish before forcefully removing nodes (and potentially
   *  interrupting jobs). Default timeout is 0 (for forceful decommission), and
   *  the maximum allowed timeout is 1 day. (see JSON representation of
   *  Duration (https://developers.google.com/protocol-buffers/docs/proto3#json)).
   *  Only supported on Dataproc image versions 1.2 and higher.
   */
  // const gracefulDecommissionTimeout = {}
  /**
   *  Required. Specifies the path, relative to `Cluster`, of
   *  the field to update. For example, to change the number of workers
   *  in a cluster to 5, the `update_mask` parameter would be
   *  specified as `config.worker_config.num_instances`,
   *  and the `PATCH` request body would specify the new value, as follows:
   *      {
   *        "config":{
   *          "workerConfig":{
   *            "numInstances":"5"
   *          }
   *        }
   *      }
   *  Similarly, to change the number of preemptible workers in a cluster to 5,
   *  the `update_mask` parameter would be
   *  `config.secondary_worker_config.num_instances`, and the `PATCH` request
   *  body would be set as follows:
   *      {
   *        "config":{
   *          "secondaryWorkerConfig":{
   *            "numInstances":"5"
   *          }
   *        }
   *      }
   *  Note: Currently, only the following fields can be updated:
   *   
   *   
   *   
   *   
   *   
   *   
   *   
   *   
   *   
   *   
   *   
   *   
   *   
   *   
   *   
   *   
   *   
   *   
   *   
   *   
   *   
   *   
   *   
MaskPurpose
labelsUpdate labels
config.worker_config.num_instancesResize primary worker group
config.secondary_worker_config.num_instancesResize secondary worker group
config.autoscaling_config.policy_uriUse, stop using, or * change autoscaling policies
*/ // const updateMask = {} /** * Optional. A unique ID used to identify the request. If the server * receives two * UpdateClusterRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.UpdateClusterRequest)s * with the same id, then the second request will be ignored and the * first google.longrunning.Operation google.longrunning.Operation created * and stored in the backend is returned. * It is recommended to always set this value to a * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier). * The ID must contain only letters (a-z, A-Z), numbers (0-9), * underscores (_), and hyphens (-). The maximum length is 40 characters. */ // const requestId = 'abc123' // Imports the Dataproc library const {ClusterControllerClient} = require('@google-cloud/dataproc').v1; // Instantiates a client const dataprocClient = new ClusterControllerClient(); async function callUpdateCluster() { // Construct request const request = { projectId, region, clusterName, cluster, updateMask, }; // Run request const [operation] = await dataprocClient.updateCluster(request); const [response] = await operation.promise(); console.log(response); } callUpdateCluster();

close()

close(): Promise<void>;

Terminate the gRPC channel and close the client.

The client will no longer be usable and all future behavior is undefined.

Returns
Type Description
Promise<void>

{Promise} A promise that resolves when the client is closed.

createCluster(request, options)

createCluster(request?: protos.google.cloud.dataproc.v1.ICreateClusterRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.dataproc.v1.ICluster, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Creates a cluster in a project. The returned Operation.metadata will be [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).

Parameters
Name Description
request ICreateClusterRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ LROperation<protos.google.cloud.dataproc.v1.ICluster, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The ID of the Google Cloud Platform project that the cluster
   *  belongs to.
   */
  // const projectId = 'abc123'
  /**
   *  Required. The Dataproc region in which to handle the request.
   */
  // const region = 'us-central1'
  /**
   *  Required. The cluster to create.
   */
  // const cluster = {}
  /**
   *  Optional. A unique ID used to identify the request. If the server receives
   *  two
   *  CreateClusterRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateClusterRequest)s
   *  with the same id, then the second request will be ignored and the
   *  first google.longrunning.Operation google.longrunning.Operation  created
   *  and stored in the backend is returned.
   *  It is recommended to always set this value to a
   *  UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier).
   *  The ID must contain only letters (a-z, A-Z), numbers (0-9),
   *  underscores (_), and hyphens (-). The maximum length is 40 characters.
   */
  // const requestId = 'abc123'
  /**
   *  Optional. Failure action when primary worker creation fails.
   */
  // const actionOnFailedPrimaryWorkers = {}

  // Imports the Dataproc library
  const {ClusterControllerClient} = require('@google-cloud/dataproc').v1;

  // Instantiates a client
  const dataprocClient = new ClusterControllerClient();

  async function callCreateCluster() {
    // Construct request
    const request = {
      projectId,
      region,
      cluster,
    };

    // Run request
    const [operation] = await dataprocClient.createCluster(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callCreateCluster();

createCluster(request, options, callback)

createCluster(request: protos.google.cloud.dataproc.v1.ICreateClusterRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.dataproc.v1.ICluster, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateClusterRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.dataproc.v1.ICluster, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

createCluster(request, callback)

createCluster(request: protos.google.cloud.dataproc.v1.ICreateClusterRequest, callback: Callback<LROperation<protos.google.cloud.dataproc.v1.ICluster, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateClusterRequest
callback Callback<LROperation<protos.google.cloud.dataproc.v1.ICluster, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

cryptoKeyPath(project, location, keyRing, cryptoKey)

cryptoKeyPath(project: string, location: string, keyRing: string, cryptoKey: string): string;

Return a fully-qualified cryptoKey resource name string.

Parameters
Name Description
project string
location string
keyRing string
cryptoKey string
Returns
Type Description
string

{string} Resource name string.

deleteCluster(request, options)

deleteCluster(request?: protos.google.cloud.dataproc.v1.IDeleteClusterRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Deletes a cluster in a project. The returned Operation.metadata will be [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).

Parameters
Name Description
request IDeleteClusterRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The ID of the Google Cloud Platform project that the cluster
   *  belongs to.
   */
  // const projectId = 'abc123'
  /**
   *  Required. The Dataproc region in which to handle the request.
   */
  // const region = 'us-central1'
  /**
   *  Required. The cluster name.
   */
  // const clusterName = 'abc123'
  /**
   *  Optional. Specifying the `cluster_uuid` means the RPC should fail
   *  (with error NOT_FOUND) if cluster with specified UUID does not exist.
   */
  // const clusterUuid = 'abc123'
  /**
   *  Optional. A unique ID used to identify the request. If the server
   *  receives two
   *  DeleteClusterRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteClusterRequest)s
   *  with the same id, then the second request will be ignored and the
   *  first google.longrunning.Operation google.longrunning.Operation  created
   *  and stored in the backend is returned.
   *  It is recommended to always set this value to a
   *  UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier).
   *  The ID must contain only letters (a-z, A-Z), numbers (0-9),
   *  underscores (_), and hyphens (-). The maximum length is 40 characters.
   */
  // const requestId = 'abc123'

  // Imports the Dataproc library
  const {ClusterControllerClient} = require('@google-cloud/dataproc').v1;

  // Instantiates a client
  const dataprocClient = new ClusterControllerClient();

  async function callDeleteCluster() {
    // Construct request
    const request = {
      projectId,
      region,
      clusterName,
    };

    // Run request
    const [operation] = await dataprocClient.deleteCluster(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callDeleteCluster();

deleteCluster(request, options, callback)

deleteCluster(request: protos.google.cloud.dataproc.v1.IDeleteClusterRequest, options: CallOptions, callback: Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteClusterRequest
options CallOptions
callback Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteCluster(request, callback)

deleteCluster(request: protos.google.cloud.dataproc.v1.IDeleteClusterRequest, callback: Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteClusterRequest
callback Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteOperation(request, options, callback)

deleteOperation(request: protos.google.longrunning.DeleteOperationRequest, options?: gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>): Promise<protos.google.protobuf.Empty>;

Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED.

Parameters
Name Description
request DeleteOperationRequest

The request object that will be sent.

options CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>

The function which will be called with the result of the API call. {Promise} - The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call.

Returns
Type Description
Promise<protos.google.protobuf.Empty>
Example

const client = longrunning.operationsClient();
await client.deleteOperation({name: ''});

diagnoseCluster(request, options)

diagnoseCluster(request?: protos.google.cloud.dataproc.v1.IDiagnoseClusterRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.dataproc.v1.IDiagnoseClusterResults, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Gets cluster diagnostic information. The returned Operation.metadata will be [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). After the operation completes, Operation.response contains [DiagnoseClusterResults](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#diagnoseclusterresults).

Parameters
Name Description
request IDiagnoseClusterRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ LROperation<protos.google.cloud.dataproc.v1.IDiagnoseClusterResults, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The ID of the Google Cloud Platform project that the cluster
   *  belongs to.
   */
  // const projectId = 'abc123'
  /**
   *  Required. The Dataproc region in which to handle the request.
   */
  // const region = 'us-central1'
  /**
   *  Required. The cluster name.
   */
  // const clusterName = 'abc123'
  /**
   *  Optional. (Optional) The output Cloud Storage directory for the diagnostic
   *  tarball. If not specified, a task-specific directory in the cluster's
   *  staging bucket will be used.
   */
  // const tarballGcsDir = 'abc123'
  /**
   *  Optional. (Optional) The access type to the diagnostic tarball. If not
   *  specified, falls back to default access of the bucket
   */
  // const tarballAccess = {}
  /**
   *  Optional. Time interval in which diagnosis should be carried out on the
   *  cluster.
   */
  // const diagnosisInterval = {}
  /**
   *  Optional. Specifies a list of jobs on which diagnosis is to be performed.
   *  Format: projects/{project}/regions/{region}/jobs/{job}
   */
  // const jobs = ['abc','def']
  /**
   *  Optional. Specifies a list of yarn applications on which diagnosis is to be
   *  performed.
   */
  // const yarnApplicationIds = ['abc','def']

  // Imports the Dataproc library
  const {ClusterControllerClient} = require('@google-cloud/dataproc').v1;

  // Instantiates a client
  const dataprocClient = new ClusterControllerClient();

  async function callDiagnoseCluster() {
    // Construct request
    const request = {
      projectId,
      region,
      clusterName,
    };

    // Run request
    const [operation] = await dataprocClient.diagnoseCluster(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callDiagnoseCluster();

diagnoseCluster(request, options, callback)

diagnoseCluster(request: protos.google.cloud.dataproc.v1.IDiagnoseClusterRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.dataproc.v1.IDiagnoseClusterResults, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDiagnoseClusterRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.dataproc.v1.IDiagnoseClusterResults, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

diagnoseCluster(request, callback)

diagnoseCluster(request: protos.google.cloud.dataproc.v1.IDiagnoseClusterRequest, callback: Callback<LROperation<protos.google.cloud.dataproc.v1.IDiagnoseClusterResults, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDiagnoseClusterRequest
callback Callback<LROperation<protos.google.cloud.dataproc.v1.IDiagnoseClusterResults, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

getCluster(request, options)

getCluster(request?: protos.google.cloud.dataproc.v1.IGetClusterRequest, options?: CallOptions): Promise<[
        protos.google.cloud.dataproc.v1.ICluster,
        protos.google.cloud.dataproc.v1.IGetClusterRequest | undefined,
        {} | undefined
    ]>;

Gets the resource representation for a cluster in a project.

Parameters
Name Description
request IGetClusterRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.dataproc.v1.ICluster, protos.google.cloud.dataproc.v1.IGetClusterRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Cluster. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The ID of the Google Cloud Platform project that the cluster
   *  belongs to.
   */
  // const projectId = 'abc123'
  /**
   *  Required. The Dataproc region in which to handle the request.
   */
  // const region = 'us-central1'
  /**
   *  Required. The cluster name.
   */
  // const clusterName = 'abc123'

  // Imports the Dataproc library
  const {ClusterControllerClient} = require('@google-cloud/dataproc').v1;

  // Instantiates a client
  const dataprocClient = new ClusterControllerClient();

  async function callGetCluster() {
    // Construct request
    const request = {
      projectId,
      region,
      clusterName,
    };

    // Run request
    const response = await dataprocClient.getCluster(request);
    console.log(response);
  }

  callGetCluster();

getCluster(request, options, callback)

getCluster(request: protos.google.cloud.dataproc.v1.IGetClusterRequest, options: CallOptions, callback: Callback<protos.google.cloud.dataproc.v1.ICluster, protos.google.cloud.dataproc.v1.IGetClusterRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetClusterRequest
options CallOptions
callback Callback<protos.google.cloud.dataproc.v1.ICluster, protos.google.cloud.dataproc.v1.IGetClusterRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getCluster(request, callback)

getCluster(request: protos.google.cloud.dataproc.v1.IGetClusterRequest, callback: Callback<protos.google.cloud.dataproc.v1.ICluster, protos.google.cloud.dataproc.v1.IGetClusterRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetClusterRequest
callback Callback<protos.google.cloud.dataproc.v1.ICluster, protos.google.cloud.dataproc.v1.IGetClusterRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getIamPolicy(request, options, callback)

getIamPolicy(request: IamProtos.google.iam.v1.GetIamPolicyRequest, options?: gax.CallOptions | Callback<IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined>, callback?: Callback<IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined>): Promise<[IamProtos.google.iam.v1.Policy]>;

Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.

Parameters
Name Description
request IamProtos.google.iam.v1.GetIamPolicyRequest

The request object that will be sent.

options CallOptions | Callback<google.iam.v1.Policy, google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback Callback<google.iam.v1.Policy, google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined>

The function which will be called with the result of the API call.

The second parameter to the callback is an object representing .

Returns
Type Description
Promise<[google.iam.v1.Policy]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . The promise has a method named "cancel" which cancels the ongoing API call.

getOperation(request, options, callback)

getOperation(request: protos.google.longrunning.GetOperationRequest, options?: gax.CallOptions | Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>): Promise<[protos.google.longrunning.Operation]>;

Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.

Parameters
Name Description
request GetOperationRequest

The request object that will be sent.

options CallOptions | Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>

The function which will be called with the result of the API call.

The second parameter to the callback is an object representing . {Promise} - The promise which resolves to an array. The first element of the array is an object representing . The promise has a method named "cancel" which cancels the ongoing API call.

Returns
Type Description
Promise<[protos.google.longrunning.Operation]>
Example

const client = longrunning.operationsClient();
const name = '';
const [response] = await client.getOperation({name});
// doThingsWith(response)

getProjectId()

getProjectId(): Promise<string>;
Returns
Type Description
Promise<string>

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
Name Description
callback Callback<string, undefined, undefined>
Returns
Type Description
void

initialize()

initialize(): Promise<{
        [name: string]: Function;
    }>;

Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.

You can await on this method if you want to make sure the client is initialized.

Returns
Type Description
Promise<{ [name: string]: Function; }>

{Promise} A promise that resolves to an authenticated service stub.

listClusters(request, options)

listClusters(request?: protos.google.cloud.dataproc.v1.IListClustersRequest, options?: CallOptions): Promise<[
        protos.google.cloud.dataproc.v1.ICluster[],
        protos.google.cloud.dataproc.v1.IListClustersRequest | null,
        protos.google.cloud.dataproc.v1.IListClustersResponse
    ]>;

Lists all regions/{region}/clusters in a project alphabetically.

Parameters
Name Description
request IListClustersRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.dataproc.v1.ICluster[], protos.google.cloud.dataproc.v1.IListClustersRequest | null, protos.google.cloud.dataproc.v1.IListClustersResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of Cluster. The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listClustersAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listClusters(request, options, callback)

listClusters(request: protos.google.cloud.dataproc.v1.IListClustersRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.dataproc.v1.IListClustersRequest, protos.google.cloud.dataproc.v1.IListClustersResponse | null | undefined, protos.google.cloud.dataproc.v1.ICluster>): void;
Parameters
Name Description
request IListClustersRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.dataproc.v1.IListClustersRequest, protos.google.cloud.dataproc.v1.IListClustersResponse | null | undefined, protos.google.cloud.dataproc.v1.ICluster>
Returns
Type Description
void

listClusters(request, callback)

listClusters(request: protos.google.cloud.dataproc.v1.IListClustersRequest, callback: PaginationCallback<protos.google.cloud.dataproc.v1.IListClustersRequest, protos.google.cloud.dataproc.v1.IListClustersResponse | null | undefined, protos.google.cloud.dataproc.v1.ICluster>): void;
Parameters
Name Description
request IListClustersRequest
callback PaginationCallback<protos.google.cloud.dataproc.v1.IListClustersRequest, protos.google.cloud.dataproc.v1.IListClustersResponse | null | undefined, protos.google.cloud.dataproc.v1.ICluster>
Returns
Type Description
void

listClustersAsync(request, options)

listClustersAsync(request?: protos.google.cloud.dataproc.v1.IListClustersRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.dataproc.v1.ICluster>;

Equivalent to listClusters, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
Name Description
request IListClustersRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<protos.google.cloud.dataproc.v1.ICluster>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing Cluster. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The ID of the Google Cloud Platform project that the cluster
   *  belongs to.
   */
  // const projectId = 'abc123'
  /**
   *  Required. The Dataproc region in which to handle the request.
   */
  // const region = 'us-central1'
  /**
   *  Optional. A filter constraining the clusters to list. Filters are
   *  case-sensitive and have the following syntax:
   *  field = value AND field = value   ...
   *  where **field** is one of `status.state`, `clusterName`, or `labels.KEY`,
   *  and `[KEY]` is a label key. **value** can be `*` to match all values.
   *  `status.state` can be one of the following: `ACTIVE`, `INACTIVE`,
   *  `CREATING`, `RUNNING`, `ERROR`, `DELETING`, `UPDATING`, `STOPPING`, or
   *  `STOPPED`. `ACTIVE` contains the `CREATING`, `UPDATING`, and `RUNNING`
   *  states. `INACTIVE` contains the `DELETING`, `ERROR`, `STOPPING`, and
   *  `STOPPED` states. `clusterName` is the name of the cluster provided at
   *  creation time. Only the logical `AND` operator is supported;
   *  space-separated items are treated as having an implicit `AND` operator.
   *  Example filter:
   *  status.state = ACTIVE AND clusterName = mycluster
   *  AND labels.env = staging AND labels.starred = *
   */
  // const filter = 'abc123'
  /**
   *  Optional. The standard List page size.
   */
  // const pageSize = 1234
  /**
   *  Optional. The standard List page token.
   */
  // const pageToken = 'abc123'

  // Imports the Dataproc library
  const {ClusterControllerClient} = require('@google-cloud/dataproc').v1;

  // Instantiates a client
  const dataprocClient = new ClusterControllerClient();

  async function callListClusters() {
    // Construct request
    const request = {
      projectId,
      region,
    };

    // Run request
    const iterable = dataprocClient.listClustersAsync(request);
    for await (const response of iterable) {
        console.log(response);
    }
  }

  callListClusters();

listClustersStream(request, options)

listClustersStream(request?: protos.google.cloud.dataproc.v1.IListClustersRequest, options?: CallOptions): Transform;

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters
Name Description
request IListClustersRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Transform

{Stream} An object stream which emits an object representing Cluster on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listClustersAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listOperationsAsync(request, options)

listOperationsAsync(request: protos.google.longrunning.ListOperationsRequest, options?: gax.CallOptions): AsyncIterable<protos.google.longrunning.ListOperationsResponse>;

Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED. Returns an iterable object.

For-await-of syntax is used with the iterable to recursively get response element on-demand.

Parameters
Name Description
request ListOperationsRequest

The request object that will be sent.

options CallOptions

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

Returns
Type Description
AsyncIterable<protos.google.longrunning.ListOperationsResponse>

{Object} An iterable Object that conforms to iteration protocols.

Example

const client = longrunning.operationsClient();
for await (const response of client.listOperationsAsync(request));
// doThingsWith(response)

matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName)

matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string): string | number;

Parse the autoscaling_policy from ProjectLocationAutoscalingPolicy resource.

Parameter
Name Description
projectLocationAutoscalingPolicyName string

A fully-qualified path representing project_location_autoscaling_policy resource.

Returns
Type Description
string | number

{string} A string representing the autoscaling_policy.

matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName)

matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string): string | number;

Parse the autoscaling_policy from ProjectRegionAutoscalingPolicy resource.

Parameter
Name Description
projectRegionAutoscalingPolicyName string

A fully-qualified path representing project_region_autoscaling_policy resource.

Returns
Type Description
string | number

{string} A string representing the autoscaling_policy.

matchBatchFromBatchName(batchName)

matchBatchFromBatchName(batchName: string): string | number;

Parse the batch from Batch resource.

Parameter
Name Description
batchName string

A fully-qualified path representing Batch resource.

Returns
Type Description
string | number

{string} A string representing the batch.

matchClusterFromNodeGroupName(nodeGroupName)

matchClusterFromNodeGroupName(nodeGroupName: string): string | number;

Parse the cluster from NodeGroup resource.

Parameter
Name Description
nodeGroupName string

A fully-qualified path representing NodeGroup resource.

Returns
Type Description
string | number

{string} A string representing the cluster.

matchCryptoKeyFromCryptoKeyName(cryptoKeyName)

matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string): string | number;

Parse the crypto_key from CryptoKey resource.

Parameter
Name Description
cryptoKeyName string

A fully-qualified path representing CryptoKey resource.

Returns
Type Description
string | number

{string} A string representing the crypto_key.

matchKeyRingFromCryptoKeyName(cryptoKeyName)

matchKeyRingFromCryptoKeyName(cryptoKeyName: string): string | number;

Parse the key_ring from CryptoKey resource.

Parameter
Name Description
cryptoKeyName string

A fully-qualified path representing CryptoKey resource.

Returns
Type Description
string | number

{string} A string representing the key_ring.

matchLocationFromBatchName(batchName)

matchLocationFromBatchName(batchName: string): string | number;

Parse the location from Batch resource.

Parameter
Name Description
batchName string

A fully-qualified path representing Batch resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromCryptoKeyName(cryptoKeyName)

matchLocationFromCryptoKeyName(cryptoKeyName: string): string | number;

Parse the location from CryptoKey resource.

Parameter
Name Description
cryptoKeyName string

A fully-qualified path representing CryptoKey resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName)

matchLocationFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string): string | number;

Parse the location from ProjectLocationAutoscalingPolicy resource.

Parameter
Name Description
projectLocationAutoscalingPolicyName string

A fully-qualified path representing project_location_autoscaling_policy resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName)

matchLocationFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string): string | number;

Parse the location from ProjectLocationWorkflowTemplate resource.

Parameter
Name Description
projectLocationWorkflowTemplateName string

A fully-qualified path representing project_location_workflow_template resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromServiceName(serviceName)

matchLocationFromServiceName(serviceName: string): string | number;

Parse the location from Service resource.

Parameter
Name Description
serviceName string

A fully-qualified path representing Service resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromSessionName(sessionName)

matchLocationFromSessionName(sessionName: string): string | number;

Parse the location from Session resource.

Parameter
Name Description
sessionName string

A fully-qualified path representing Session resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromSessionTemplateName(sessionTemplateName)

matchLocationFromSessionTemplateName(sessionTemplateName: string): string | number;

Parse the location from SessionTemplate resource.

Parameter
Name Description
sessionTemplateName string

A fully-qualified path representing SessionTemplate resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchNodeGroupFromNodeGroupName(nodeGroupName)

matchNodeGroupFromNodeGroupName(nodeGroupName: string): string | number;

Parse the node_group from NodeGroup resource.

Parameter
Name Description
nodeGroupName string

A fully-qualified path representing NodeGroup resource.

Returns
Type Description
string | number

{string} A string representing the node_group.

matchProjectFromBatchName(batchName)

matchProjectFromBatchName(batchName: string): string | number;

Parse the project from Batch resource.

Parameter
Name Description
batchName string

A fully-qualified path representing Batch resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromCryptoKeyName(cryptoKeyName)

matchProjectFromCryptoKeyName(cryptoKeyName: string): string | number;

Parse the project from CryptoKey resource.

Parameter
Name Description
cryptoKeyName string

A fully-qualified path representing CryptoKey resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromNodeGroupName(nodeGroupName)

matchProjectFromNodeGroupName(nodeGroupName: string): string | number;

Parse the project from NodeGroup resource.

Parameter
Name Description
nodeGroupName string

A fully-qualified path representing NodeGroup resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName)

matchProjectFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string): string | number;

Parse the project from ProjectLocationAutoscalingPolicy resource.

Parameter
Name Description
projectLocationAutoscalingPolicyName string

A fully-qualified path representing project_location_autoscaling_policy resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName)

matchProjectFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string): string | number;

Parse the project from ProjectLocationWorkflowTemplate resource.

Parameter
Name Description
projectLocationWorkflowTemplateName string

A fully-qualified path representing project_location_workflow_template resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName)

matchProjectFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string): string | number;

Parse the project from ProjectRegionAutoscalingPolicy resource.

Parameter
Name Description
projectRegionAutoscalingPolicyName string

A fully-qualified path representing project_region_autoscaling_policy resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName)

matchProjectFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string): string | number;

Parse the project from ProjectRegionWorkflowTemplate resource.

Parameter
Name Description
projectRegionWorkflowTemplateName string

A fully-qualified path representing project_region_workflow_template resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromServiceName(serviceName)

matchProjectFromServiceName(serviceName: string): string | number;

Parse the project from Service resource.

Parameter
Name Description
serviceName string

A fully-qualified path representing Service resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromSessionName(sessionName)

matchProjectFromSessionName(sessionName: string): string | number;

Parse the project from Session resource.

Parameter
Name Description
sessionName string

A fully-qualified path representing Session resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromSessionTemplateName(sessionTemplateName)

matchProjectFromSessionTemplateName(sessionTemplateName: string): string | number;

Parse the project from SessionTemplate resource.

Parameter
Name Description
sessionTemplateName string

A fully-qualified path representing SessionTemplate resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchRegionFromNodeGroupName(nodeGroupName)

matchRegionFromNodeGroupName(nodeGroupName: string): string | number;

Parse the region from NodeGroup resource.

Parameter
Name Description
nodeGroupName string

A fully-qualified path representing NodeGroup resource.

Returns
Type Description
string | number

{string} A string representing the region.

matchRegionFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName)

matchRegionFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string): string | number;

Parse the region from ProjectRegionAutoscalingPolicy resource.

Parameter
Name Description
projectRegionAutoscalingPolicyName string

A fully-qualified path representing project_region_autoscaling_policy resource.

Returns
Type Description
string | number

{string} A string representing the region.

matchRegionFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName)

matchRegionFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string): string | number;

Parse the region from ProjectRegionWorkflowTemplate resource.

Parameter
Name Description
projectRegionWorkflowTemplateName string

A fully-qualified path representing project_region_workflow_template resource.

Returns
Type Description
string | number

{string} A string representing the region.

matchServiceFromServiceName(serviceName)

matchServiceFromServiceName(serviceName: string): string | number;

Parse the service from Service resource.

Parameter
Name Description
serviceName string

A fully-qualified path representing Service resource.

Returns
Type Description
string | number

{string} A string representing the service.

matchSessionFromSessionName(sessionName)

matchSessionFromSessionName(sessionName: string): string | number;

Parse the session from Session resource.

Parameter
Name Description
sessionName string

A fully-qualified path representing Session resource.

Returns
Type Description
string | number

{string} A string representing the session.

matchTemplateFromSessionTemplateName(sessionTemplateName)

matchTemplateFromSessionTemplateName(sessionTemplateName: string): string | number;

Parse the template from SessionTemplate resource.

Parameter
Name Description
sessionTemplateName string

A fully-qualified path representing SessionTemplate resource.

Returns
Type Description
string | number

{string} A string representing the template.

matchWorkflowTemplateFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName)

matchWorkflowTemplateFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string): string | number;

Parse the workflow_template from ProjectLocationWorkflowTemplate resource.

Parameter
Name Description
projectLocationWorkflowTemplateName string

A fully-qualified path representing project_location_workflow_template resource.

Returns
Type Description
string | number

{string} A string representing the workflow_template.

matchWorkflowTemplateFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName)

matchWorkflowTemplateFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string): string | number;

Parse the workflow_template from ProjectRegionWorkflowTemplate resource.

Parameter
Name Description
projectRegionWorkflowTemplateName string

A fully-qualified path representing project_region_workflow_template resource.

Returns
Type Description
string | number

{string} A string representing the workflow_template.

nodeGroupPath(project, region, cluster, nodeGroup)

nodeGroupPath(project: string, region: string, cluster: string, nodeGroup: string): string;

Return a fully-qualified nodeGroup resource name string.

Parameters
Name Description
project string
region string
cluster string
nodeGroup string
Returns
Type Description
string

{string} Resource name string.

projectLocationAutoscalingPolicyPath(project, location, autoscalingPolicy)

projectLocationAutoscalingPolicyPath(project: string, location: string, autoscalingPolicy: string): string;

Return a fully-qualified projectLocationAutoscalingPolicy resource name string.

Parameters
Name Description
project string
location string
autoscalingPolicy string
Returns
Type Description
string

{string} Resource name string.

projectLocationWorkflowTemplatePath(project, location, workflowTemplate)

projectLocationWorkflowTemplatePath(project: string, location: string, workflowTemplate: string): string;

Return a fully-qualified projectLocationWorkflowTemplate resource name string.

Parameters
Name Description
project string
location string
workflowTemplate string
Returns
Type Description
string

{string} Resource name string.

projectRegionAutoscalingPolicyPath(project, region, autoscalingPolicy)

projectRegionAutoscalingPolicyPath(project: string, region: string, autoscalingPolicy: string): string;

Return a fully-qualified projectRegionAutoscalingPolicy resource name string.

Parameters
Name Description
project string
region string
autoscalingPolicy string
Returns
Type Description
string

{string} Resource name string.

projectRegionWorkflowTemplatePath(project, region, workflowTemplate)

projectRegionWorkflowTemplatePath(project: string, region: string, workflowTemplate: string): string;

Return a fully-qualified projectRegionWorkflowTemplate resource name string.

Parameters
Name Description
project string
region string
workflowTemplate string
Returns
Type Description
string

{string} Resource name string.

servicePath(project, location, service)

servicePath(project: string, location: string, service: string): string;

Return a fully-qualified service resource name string.

Parameters
Name Description
project string
location string
service string
Returns
Type Description
string

{string} Resource name string.

sessionPath(project, location, session)

sessionPath(project: string, location: string, session: string): string;

Return a fully-qualified session resource name string.

Parameters
Name Description
project string
location string
session string
Returns
Type Description
string

{string} Resource name string.

sessionTemplatePath(project, location, template)

sessionTemplatePath(project: string, location: string, template: string): string;

Return a fully-qualified sessionTemplate resource name string.

Parameters
Name Description
project string
location string
template string
Returns
Type Description
string

{string} Resource name string.

setIamPolicy(request, options, callback)

setIamPolicy(request: IamProtos.google.iam.v1.SetIamPolicyRequest, options?: gax.CallOptions | Callback<IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined>, callback?: Callback<IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined>): Promise<[IamProtos.google.iam.v1.Policy]>;

Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.

Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.

Parameters
Name Description
request IamProtos.google.iam.v1.SetIamPolicyRequest

The request object that will be sent.

options CallOptions | Callback<google.iam.v1.Policy, google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback Callback<google.iam.v1.Policy, google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined>

The function which will be called with the result of the API call.

The second parameter to the callback is an object representing .

Returns
Type Description
Promise<[google.iam.v1.Policy]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . The promise has a method named "cancel" which cancels the ongoing API call.

startCluster(request, options)

startCluster(request?: protos.google.cloud.dataproc.v1.IStartClusterRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.dataproc.v1.ICluster, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Starts a cluster in a project.

Parameters
Name Description
request IStartClusterRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ LROperation<protos.google.cloud.dataproc.v1.ICluster, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The ID of the Google Cloud Platform project the
   *  cluster belongs to.
   */
  // const projectId = 'abc123'
  /**
   *  Required. The Dataproc region in which to handle the request.
   */
  // const region = 'us-central1'
  /**
   *  Required. The cluster name.
   */
  // const clusterName = 'abc123'
  /**
   *  Optional. Specifying the `cluster_uuid` means the RPC will fail
   *  (with error NOT_FOUND) if a cluster with the specified UUID does not exist.
   */
  // const clusterUuid = 'abc123'
  /**
   *  Optional. A unique ID used to identify the request. If the server
   *  receives two
   *  StartClusterRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StartClusterRequest)s
   *  with the same id, then the second request will be ignored and the
   *  first google.longrunning.Operation google.longrunning.Operation  created
   *  and stored in the backend is returned.
   *  Recommendation: Set this value to a
   *  UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier).
   *  The ID must contain only letters (a-z, A-Z), numbers (0-9),
   *  underscores (_), and hyphens (-). The maximum length is 40 characters.
   */
  // const requestId = 'abc123'

  // Imports the Dataproc library
  const {ClusterControllerClient} = require('@google-cloud/dataproc').v1;

  // Instantiates a client
  const dataprocClient = new ClusterControllerClient();

  async function callStartCluster() {
    // Construct request
    const request = {
      projectId,
      region,
      clusterName,
    };

    // Run request
    const [operation] = await dataprocClient.startCluster(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callStartCluster();

startCluster(request, options, callback)

startCluster(request: protos.google.cloud.dataproc.v1.IStartClusterRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.dataproc.v1.ICluster, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IStartClusterRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.dataproc.v1.ICluster, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

startCluster(request, callback)

startCluster(request: protos.google.cloud.dataproc.v1.IStartClusterRequest, callback: Callback<LROperation<protos.google.cloud.dataproc.v1.ICluster, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IStartClusterRequest
callback Callback<LROperation<protos.google.cloud.dataproc.v1.ICluster, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

stopCluster(request, options)

stopCluster(request?: protos.google.cloud.dataproc.v1.IStopClusterRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.dataproc.v1.ICluster, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Stops a cluster in a project.

Parameters
Name Description
request IStopClusterRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ LROperation<protos.google.cloud.dataproc.v1.ICluster, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The ID of the Google Cloud Platform project the
   *  cluster belongs to.
   */
  // const projectId = 'abc123'
  /**
   *  Required. The Dataproc region in which to handle the request.
   */
  // const region = 'us-central1'
  /**
   *  Required. The cluster name.
   */
  // const clusterName = 'abc123'
  /**
   *  Optional. Specifying the `cluster_uuid` means the RPC will fail
   *  (with error NOT_FOUND) if a cluster with the specified UUID does not exist.
   */
  // const clusterUuid = 'abc123'
  /**
   *  Optional. A unique ID used to identify the request. If the server
   *  receives two
   *  StopClusterRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StopClusterRequest)s
   *  with the same id, then the second request will be ignored and the
   *  first google.longrunning.Operation google.longrunning.Operation  created
   *  and stored in the backend is returned.
   *  Recommendation: Set this value to a
   *  UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier).
   *  The ID must contain only letters (a-z, A-Z), numbers (0-9),
   *  underscores (_), and hyphens (-). The maximum length is 40 characters.
   */
  // const requestId = 'abc123'

  // Imports the Dataproc library
  const {ClusterControllerClient} = require('@google-cloud/dataproc').v1;

  // Instantiates a client
  const dataprocClient = new ClusterControllerClient();

  async function callStopCluster() {
    // Construct request
    const request = {
      projectId,
      region,
      clusterName,
    };

    // Run request
    const [operation] = await dataprocClient.stopCluster(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callStopCluster();

stopCluster(request, options, callback)

stopCluster(request: protos.google.cloud.dataproc.v1.IStopClusterRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.dataproc.v1.ICluster, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IStopClusterRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.dataproc.v1.ICluster, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

stopCluster(request, callback)

stopCluster(request: protos.google.cloud.dataproc.v1.IStopClusterRequest, callback: Callback<LROperation<protos.google.cloud.dataproc.v1.ICluster, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IStopClusterRequest
callback Callback<LROperation<protos.google.cloud.dataproc.v1.ICluster, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

testIamPermissions(request, options, callback)

testIamPermissions(request: IamProtos.google.iam.v1.TestIamPermissionsRequest, options?: gax.CallOptions | Callback<IamProtos.google.iam.v1.TestIamPermissionsResponse, IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined>, callback?: Callback<IamProtos.google.iam.v1.TestIamPermissionsResponse, IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined>): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]>;

Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.

Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.

Parameters
Name Description
request IamProtos.google.iam.v1.TestIamPermissionsRequest

The request object that will be sent.

options CallOptions | Callback<google.iam.v1.TestIamPermissionsResponse, google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback Callback<google.iam.v1.TestIamPermissionsResponse, google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined>

The function which will be called with the result of the API call.

The second parameter to the callback is an object representing .

Returns
Type Description
Promise<[google.iam.v1.TestIamPermissionsResponse]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . The promise has a method named "cancel" which cancels the ongoing API call.

updateCluster(request, options)

updateCluster(request?: protos.google.cloud.dataproc.v1.IUpdateClusterRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.dataproc.v1.ICluster, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Updates a cluster in a project. The returned Operation.metadata will be [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). The cluster must be in a state or an error is returned.

Parameters
Name Description
request IUpdateClusterRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ LROperation<protos.google.cloud.dataproc.v1.ICluster, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The ID of the Google Cloud Platform project the
   *  cluster belongs to.
   */
  // const projectId = 'abc123'
  /**
   *  Required. The Dataproc region in which to handle the request.
   */
  // const region = 'us-central1'
  /**
   *  Required. The cluster name.
   */
  // const clusterName = 'abc123'
  /**
   *  Required. The changes to the cluster.
   */
  // const cluster = {}
  /**
   *  Optional. Timeout for graceful YARN decommissioning. Graceful
   *  decommissioning allows removing nodes from the cluster without
   *  interrupting jobs in progress. Timeout specifies how long to wait for jobs
   *  in progress to finish before forcefully removing nodes (and potentially
   *  interrupting jobs). Default timeout is 0 (for forceful decommission), and
   *  the maximum allowed timeout is 1 day. (see JSON representation of
   *  Duration (https://developers.google.com/protocol-buffers/docs/proto3#json)).
   *  Only supported on Dataproc image versions 1.2 and higher.
   */
  // const gracefulDecommissionTimeout = {}
  /**
   *  Required. Specifies the path, relative to `Cluster`, of
   *  the field to update. For example, to change the number of workers
   *  in a cluster to 5, the `update_mask` parameter would be
   *  specified as `config.worker_config.num_instances`,
   *  and the `PATCH` request body would specify the new value, as follows:
   *      {
   *        "config":{
   *          "workerConfig":{
   *            "numInstances":"5"
   *          }
   *        }
   *      }
   *  Similarly, to change the number of preemptible workers in a cluster to 5,
   *  the `update_mask` parameter would be
   *  `config.secondary_worker_config.num_instances`, and the `PATCH` request
   *  body would be set as follows:
   *      {
   *        "config":{
   *          "secondaryWorkerConfig":{
   *            "numInstances":"5"
   *          }
   *        }
   *      }
   *  Note: Currently, only the following fields can be updated:
   *   
   *   
   *   
   *   
   *   
   *   
   *   
   *   
   *   
   *   
   *   
   *   
   *   
   *   
   *   
   *   
   *   
   *   
   *   
   *   
   *   
   *   
   *   
MaskPurpose
labelsUpdate labels
config.worker_config.num_instancesResize primary worker group
config.secondary_worker_config.num_instancesResize secondary worker group
config.autoscaling_config.policy_uriUse, stop using, or * change autoscaling policies
*/ // const updateMask = {} /** * Optional. A unique ID used to identify the request. If the server * receives two * UpdateClusterRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.UpdateClusterRequest)s * with the same id, then the second request will be ignored and the * first google.longrunning.Operation google.longrunning.Operation created * and stored in the backend is returned. * It is recommended to always set this value to a * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier). * The ID must contain only letters (a-z, A-Z), numbers (0-9), * underscores (_), and hyphens (-). The maximum length is 40 characters. */ // const requestId = 'abc123' // Imports the Dataproc library const {ClusterControllerClient} = require('@google-cloud/dataproc').v1; // Instantiates a client const dataprocClient = new ClusterControllerClient(); async function callUpdateCluster() { // Construct request const request = { projectId, region, clusterName, cluster, updateMask, }; // Run request const [operation] = await dataprocClient.updateCluster(request); const [response] = await operation.promise(); console.log(response); } callUpdateCluster();

updateCluster(request, options, callback)

updateCluster(request: protos.google.cloud.dataproc.v1.IUpdateClusterRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.dataproc.v1.ICluster, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateClusterRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.dataproc.v1.ICluster, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

updateCluster(request, callback)

updateCluster(request: protos.google.cloud.dataproc.v1.IUpdateClusterRequest, callback: Callback<LROperation<protos.google.cloud.dataproc.v1.ICluster, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateClusterRequest
callback Callback<LROperation<protos.google.cloud.dataproc.v1.ICluster, protos.google.cloud.dataproc.v1.IClusterOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void