Class v1alpha.BatchServiceClient (1.11.0)

Google Batch Service. The service manages user submitted batch jobs and allocates Google Compute Engine VM instances to run the jobs. v1alpha

Package

@google-cloud/batch

Constructors

(constructor)(opts, gaxInstance)

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

Construct an instance of BatchServiceClient.

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 BatchServiceClient({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;

batchServiceStub

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

descriptors

descriptors: Descriptors;

innerApiCalls

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

locationsClient

locationsClient: LocationsClient;

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

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: ''});

checkDeleteJobProgress(name)

checkDeleteJobProgress(name: string): Promise<LROperation<protos.google.protobuf.Empty, protos.google.cloud.batch.v1alpha.OperationMetadata>>;

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

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.protobuf.Empty, protos.google.cloud.batch.v1alpha.OperationMetadata>>

{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.
   */
  /**
   *  Job name.
   */
  // const name = 'abc123'
  /**
   *  Optional. Reason for this deletion.
   */
  // const reason = 'abc123'
  /**
   *  Optional. An optional request ID to identify requests. Specify a unique
   *  request ID so that if you must retry your request, the server will know to
   *  ignore the request if it has already been completed. The server will
   *  guarantee that for at least 60 minutes after the first request.
   *  For example, consider a situation where you make an initial request and
   *  the request times out. If you make the request again with the same request
   *  ID, the server can check if original operation with the same request ID
   *  was received, and if so, will ignore the second request. This prevents
   *  clients from accidentally creating duplicate commitments.
   *  The request ID must be a valid UUID with the exception that zero UUID is
   *  not supported (00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'

  // Imports the Batch library
  const {BatchServiceClient} = require('@google-cloud/batch').v1alpha;

  // Instantiates a client
  const batchClient = new BatchServiceClient();

  async function callDeleteJob() {
    // Construct request
    const request = {
    };

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

  callDeleteJob();

checkDeleteResourceAllowanceProgress(name)

checkDeleteResourceAllowanceProgress(name: string): Promise<LROperation<protos.google.protobuf.Empty, protos.google.cloud.batch.v1alpha.OperationMetadata>>;

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

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.protobuf.Empty, protos.google.cloud.batch.v1alpha.OperationMetadata>>

{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. ResourceAllowance name.
   */
  // const name = 'abc123'
  /**
   *  Optional. Reason for this deletion.
   */
  // const reason = 'abc123'
  /**
   *  Optional. An optional request ID to identify requests. Specify a unique
   *  request ID so that if you must retry your request, the server will know to
   *  ignore the request if it has already been completed. The server will
   *  guarantee that for at least 60 minutes after the first request.
   *  For example, consider a situation where you make an initial request and
   *  the request times out. If you make the request again with the same request
   *  ID, the server can check if original operation with the same request ID
   *  was received, and if so, will ignore the second request. This prevents
   *  clients from accidentally creating duplicate commitments.
   *  The request ID must be a valid UUID with the exception that zero UUID is
   *  not supported (00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'

  // Imports the Batch library
  const {BatchServiceClient} = require('@google-cloud/batch').v1alpha;

  // Instantiates a client
  const batchClient = new BatchServiceClient();

  async function callDeleteResourceAllowance() {
    // Construct request
    const request = {
      name,
    };

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

  callDeleteResourceAllowance();

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.

createJob(request, options)

createJob(request?: protos.google.cloud.batch.v1alpha.ICreateJobRequest, options?: CallOptions): Promise<[
        protos.google.cloud.batch.v1alpha.IJob,
        protos.google.cloud.batch.v1alpha.ICreateJobRequest | undefined,
        {} | undefined
    ]>;

Create a Job.

Parameters
Name Description
request ICreateJobRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.batch.v1alpha.IJob, protos.google.cloud.batch.v1alpha.ICreateJobRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . 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 parent resource name where the Job will be created.
   *  Pattern: "projects/{project}/locations/{location}"
   */
  // const parent = 'abc123'
  /**
   *  ID used to uniquely identify the Job within its parent scope.
   *  This field should contain at most 63 characters and must start with
   *  lowercase characters.
   *  Only lowercase characters, numbers and '-' are accepted.
   *  The '-' character cannot be the first or the last one.
   *  A system generated ID will be used if the field is not set.
   *  The job.name field in the request will be ignored and the created resource
   *  name of the Job will be "{parent}/jobs/{job_id}".
   */
  // const jobId = 'abc123'
  /**
   *  Required. The Job to create.
   */
  // const job = {}
  /**
   *  Optional. An optional request ID to identify requests. Specify a unique
   *  request ID so that if you must retry your request, the server will know to
   *  ignore the request if it has already been completed. The server will
   *  guarantee that for at least 60 minutes since the first request.
   *  For example, consider a situation where you make an initial request and
   *  the request times out. If you make the request again with the same request
   *  ID, the server can check if original operation with the same request ID
   *  was received, and if so, will ignore the second request. This prevents
   *  clients from accidentally creating duplicate commitments.
   *  The request ID must be a valid UUID with the exception that zero UUID is
   *  not supported (00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'

  // Imports the Batch library
  const {BatchServiceClient} = require('@google-cloud/batch').v1alpha;

  // Instantiates a client
  const batchClient = new BatchServiceClient();

  async function callCreateJob() {
    // Construct request
    const request = {
      parent,
      job,
    };

    // Run request
    const response = await batchClient.createJob(request);
    console.log(response);
  }

  callCreateJob();

createJob(request, options, callback)

createJob(request: protos.google.cloud.batch.v1alpha.ICreateJobRequest, options: CallOptions, callback: Callback<protos.google.cloud.batch.v1alpha.IJob, protos.google.cloud.batch.v1alpha.ICreateJobRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateJobRequest
options CallOptions
callback Callback<protos.google.cloud.batch.v1alpha.IJob, protos.google.cloud.batch.v1alpha.ICreateJobRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

createJob(request, callback)

createJob(request: protos.google.cloud.batch.v1alpha.ICreateJobRequest, callback: Callback<protos.google.cloud.batch.v1alpha.IJob, protos.google.cloud.batch.v1alpha.ICreateJobRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateJobRequest
callback Callback<protos.google.cloud.batch.v1alpha.IJob, protos.google.cloud.batch.v1alpha.ICreateJobRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

createResourceAllowance(request, options)

createResourceAllowance(request?: protos.google.cloud.batch.v1alpha.ICreateResourceAllowanceRequest, options?: CallOptions): Promise<[
        protos.google.cloud.batch.v1alpha.IResourceAllowance,
        (protos.google.cloud.batch.v1alpha.ICreateResourceAllowanceRequest | undefined),
        {} | undefined
    ]>;

Create a Resource Allowance.

Parameters
Name Description
request ICreateResourceAllowanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.batch.v1alpha.IResourceAllowance, (protos.google.cloud.batch.v1alpha.ICreateResourceAllowanceRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing ResourceAllowance. 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 parent resource name where the ResourceAllowance will be
   *  created. Pattern: "projects/{project}/locations/{location}"
   */
  // const parent = 'abc123'
  /**
   *  ID used to uniquely identify the ResourceAllowance within its parent scope.
   *  This field should contain at most 63 characters and must start with
   *  lowercase characters.
   *  Only lowercase characters, numbers and '-' are accepted.
   *  The '-' character cannot be the first or the last one.
   *  A system generated ID will be used if the field is not set.
   *  The resource_allowance.name field in the request will be ignored and the
   *  created resource name of the ResourceAllowance will be
   *  "{parent}/resourceAllowances/{resource_allowance_id}".
   */
  // const resourceAllowanceId = 'abc123'
  /**
   *  Required. The ResourceAllowance to create.
   */
  // const resourceAllowance = {}
  /**
   *  Optional. An optional request ID to identify requests. Specify a unique
   *  request ID so that if you must retry your request, the server will know to
   *  ignore the request if it has already been completed. The server will
   *  guarantee that for at least 60 minutes since the first request.
   *  For example, consider a situation where you make an initial request and
   *  the request times out. If you make the request again with the same request
   *  ID, the server can check if original operation with the same request ID
   *  was received, and if so, will ignore the second request. This prevents
   *  clients from accidentally creating duplicate commitments.
   *  The request ID must be a valid UUID with the exception that zero UUID is
   *  not supported (00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'

  // Imports the Batch library
  const {BatchServiceClient} = require('@google-cloud/batch').v1alpha;

  // Instantiates a client
  const batchClient = new BatchServiceClient();

  async function callCreateResourceAllowance() {
    // Construct request
    const request = {
      parent,
      resourceAllowance,
    };

    // Run request
    const response = await batchClient.createResourceAllowance(request);
    console.log(response);
  }

  callCreateResourceAllowance();

createResourceAllowance(request, options, callback)

createResourceAllowance(request: protos.google.cloud.batch.v1alpha.ICreateResourceAllowanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.batch.v1alpha.IResourceAllowance, protos.google.cloud.batch.v1alpha.ICreateResourceAllowanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateResourceAllowanceRequest
options CallOptions
callback Callback<protos.google.cloud.batch.v1alpha.IResourceAllowance, protos.google.cloud.batch.v1alpha.ICreateResourceAllowanceRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

createResourceAllowance(request, callback)

createResourceAllowance(request: protos.google.cloud.batch.v1alpha.ICreateResourceAllowanceRequest, callback: Callback<protos.google.cloud.batch.v1alpha.IResourceAllowance, protos.google.cloud.batch.v1alpha.ICreateResourceAllowanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateResourceAllowanceRequest
callback Callback<protos.google.cloud.batch.v1alpha.IResourceAllowance, protos.google.cloud.batch.v1alpha.ICreateResourceAllowanceRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteJob(request, options)

deleteJob(request?: protos.google.cloud.batch.v1alpha.IDeleteJobRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.batch.v1alpha.IOperationMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Delete a Job.

Parameters
Name Description
request IDeleteJobRequest

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.batch.v1alpha.IOperationMetadata>, 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.
   */
  /**
   *  Job name.
   */
  // const name = 'abc123'
  /**
   *  Optional. Reason for this deletion.
   */
  // const reason = 'abc123'
  /**
   *  Optional. An optional request ID to identify requests. Specify a unique
   *  request ID so that if you must retry your request, the server will know to
   *  ignore the request if it has already been completed. The server will
   *  guarantee that for at least 60 minutes after the first request.
   *  For example, consider a situation where you make an initial request and
   *  the request times out. If you make the request again with the same request
   *  ID, the server can check if original operation with the same request ID
   *  was received, and if so, will ignore the second request. This prevents
   *  clients from accidentally creating duplicate commitments.
   *  The request ID must be a valid UUID with the exception that zero UUID is
   *  not supported (00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'

  // Imports the Batch library
  const {BatchServiceClient} = require('@google-cloud/batch').v1alpha;

  // Instantiates a client
  const batchClient = new BatchServiceClient();

  async function callDeleteJob() {
    // Construct request
    const request = {
    };

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

  callDeleteJob();

deleteJob(request, options, callback)

deleteJob(request: protos.google.cloud.batch.v1alpha.IDeleteJobRequest, options: CallOptions, callback: Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.batch.v1alpha.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteJobRequest
options CallOptions
callback Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.batch.v1alpha.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteJob(request, callback)

deleteJob(request: protos.google.cloud.batch.v1alpha.IDeleteJobRequest, callback: Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.batch.v1alpha.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteJobRequest
callback Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.batch.v1alpha.IOperationMetadata>, 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: ''});

deleteResourceAllowance(request, options)

deleteResourceAllowance(request?: protos.google.cloud.batch.v1alpha.IDeleteResourceAllowanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.batch.v1alpha.IOperationMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Delete a ResourceAllowance.

Parameters
Name Description
request IDeleteResourceAllowanceRequest

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.batch.v1alpha.IOperationMetadata>, 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. ResourceAllowance name.
   */
  // const name = 'abc123'
  /**
   *  Optional. Reason for this deletion.
   */
  // const reason = 'abc123'
  /**
   *  Optional. An optional request ID to identify requests. Specify a unique
   *  request ID so that if you must retry your request, the server will know to
   *  ignore the request if it has already been completed. The server will
   *  guarantee that for at least 60 minutes after the first request.
   *  For example, consider a situation where you make an initial request and
   *  the request times out. If you make the request again with the same request
   *  ID, the server can check if original operation with the same request ID
   *  was received, and if so, will ignore the second request. This prevents
   *  clients from accidentally creating duplicate commitments.
   *  The request ID must be a valid UUID with the exception that zero UUID is
   *  not supported (00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'

  // Imports the Batch library
  const {BatchServiceClient} = require('@google-cloud/batch').v1alpha;

  // Instantiates a client
  const batchClient = new BatchServiceClient();

  async function callDeleteResourceAllowance() {
    // Construct request
    const request = {
      name,
    };

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

  callDeleteResourceAllowance();

deleteResourceAllowance(request, options, callback)

deleteResourceAllowance(request: protos.google.cloud.batch.v1alpha.IDeleteResourceAllowanceRequest, options: CallOptions, callback: Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.batch.v1alpha.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteResourceAllowanceRequest
options CallOptions
callback Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.batch.v1alpha.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteResourceAllowance(request, callback)

deleteResourceAllowance(request: protos.google.cloud.batch.v1alpha.IDeleteResourceAllowanceRequest, callback: Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.batch.v1alpha.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteResourceAllowanceRequest
callback Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.batch.v1alpha.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

getJob(request, options)

getJob(request?: protos.google.cloud.batch.v1alpha.IGetJobRequest, options?: CallOptions): Promise<[
        protos.google.cloud.batch.v1alpha.IJob,
        protos.google.cloud.batch.v1alpha.IGetJobRequest | undefined,
        {} | undefined
    ]>;

Get a Job specified by its resource name.

Parameters
Name Description
request IGetJobRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.batch.v1alpha.IJob, protos.google.cloud.batch.v1alpha.IGetJobRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . 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. Job name.
   */
  // const name = 'abc123'

  // Imports the Batch library
  const {BatchServiceClient} = require('@google-cloud/batch').v1alpha;

  // Instantiates a client
  const batchClient = new BatchServiceClient();

  async function callGetJob() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await batchClient.getJob(request);
    console.log(response);
  }

  callGetJob();

getJob(request, options, callback)

getJob(request: protos.google.cloud.batch.v1alpha.IGetJobRequest, options: CallOptions, callback: Callback<protos.google.cloud.batch.v1alpha.IJob, protos.google.cloud.batch.v1alpha.IGetJobRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetJobRequest
options CallOptions
callback Callback<protos.google.cloud.batch.v1alpha.IJob, protos.google.cloud.batch.v1alpha.IGetJobRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getJob(request, callback)

getJob(request: protos.google.cloud.batch.v1alpha.IGetJobRequest, callback: Callback<protos.google.cloud.batch.v1alpha.IJob, protos.google.cloud.batch.v1alpha.IGetJobRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetJobRequest
callback Callback<protos.google.cloud.batch.v1alpha.IJob, protos.google.cloud.batch.v1alpha.IGetJobRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getLocation(request, options, callback)

getLocation(request: LocationProtos.google.cloud.location.IGetLocationRequest, options?: gax.CallOptions | Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>, callback?: Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>): Promise<LocationProtos.google.cloud.location.ILocation>;

Gets information about a location.

Parameters
Name Description
request LocationProtos.google.cloud.location.IGetLocationRequest

The request object that will be sent.

options CallOptions | Callback<google.cloud.location.ILocation, google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>

Call options. See CallOptions for more details.

callback Callback<google.cloud.location.ILocation, google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>
Returns
Type Description
Promise<google.cloud.location.ILocation>

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

Example

const [response] = await client.getLocation(request);

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

getResourceAllowance(request, options)

getResourceAllowance(request?: protos.google.cloud.batch.v1alpha.IGetResourceAllowanceRequest, options?: CallOptions): Promise<[
        protos.google.cloud.batch.v1alpha.IResourceAllowance,
        (protos.google.cloud.batch.v1alpha.IGetResourceAllowanceRequest | undefined),
        {} | undefined
    ]>;

Get a ResourceAllowance specified by its resource name.

Parameters
Name Description
request IGetResourceAllowanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.batch.v1alpha.IResourceAllowance, (protos.google.cloud.batch.v1alpha.IGetResourceAllowanceRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing ResourceAllowance. 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. ResourceAllowance name.
   */
  // const name = 'abc123'

  // Imports the Batch library
  const {BatchServiceClient} = require('@google-cloud/batch').v1alpha;

  // Instantiates a client
  const batchClient = new BatchServiceClient();

  async function callGetResourceAllowance() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await batchClient.getResourceAllowance(request);
    console.log(response);
  }

  callGetResourceAllowance();

getResourceAllowance(request, options, callback)

getResourceAllowance(request: protos.google.cloud.batch.v1alpha.IGetResourceAllowanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.batch.v1alpha.IResourceAllowance, protos.google.cloud.batch.v1alpha.IGetResourceAllowanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetResourceAllowanceRequest
options CallOptions
callback Callback<protos.google.cloud.batch.v1alpha.IResourceAllowance, protos.google.cloud.batch.v1alpha.IGetResourceAllowanceRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getResourceAllowance(request, callback)

getResourceAllowance(request: protos.google.cloud.batch.v1alpha.IGetResourceAllowanceRequest, callback: Callback<protos.google.cloud.batch.v1alpha.IResourceAllowance, protos.google.cloud.batch.v1alpha.IGetResourceAllowanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetResourceAllowanceRequest
callback Callback<protos.google.cloud.batch.v1alpha.IResourceAllowance, protos.google.cloud.batch.v1alpha.IGetResourceAllowanceRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getTask(request, options)

getTask(request?: protos.google.cloud.batch.v1alpha.IGetTaskRequest, options?: CallOptions): Promise<[
        protos.google.cloud.batch.v1alpha.ITask,
        protos.google.cloud.batch.v1alpha.IGetTaskRequest | undefined,
        {} | undefined
    ]>;

Return a single Task.

Parameters
Name Description
request IGetTaskRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.batch.v1alpha.ITask, protos.google.cloud.batch.v1alpha.IGetTaskRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Task. 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. Task name.
   */
  // const name = 'abc123'

  // Imports the Batch library
  const {BatchServiceClient} = require('@google-cloud/batch').v1alpha;

  // Instantiates a client
  const batchClient = new BatchServiceClient();

  async function callGetTask() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await batchClient.getTask(request);
    console.log(response);
  }

  callGetTask();

getTask(request, options, callback)

getTask(request: protos.google.cloud.batch.v1alpha.IGetTaskRequest, options: CallOptions, callback: Callback<protos.google.cloud.batch.v1alpha.ITask, protos.google.cloud.batch.v1alpha.IGetTaskRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetTaskRequest
options CallOptions
callback Callback<protos.google.cloud.batch.v1alpha.ITask, protos.google.cloud.batch.v1alpha.IGetTaskRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getTask(request, callback)

getTask(request: protos.google.cloud.batch.v1alpha.IGetTaskRequest, callback: Callback<protos.google.cloud.batch.v1alpha.ITask, protos.google.cloud.batch.v1alpha.IGetTaskRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetTaskRequest
callback Callback<protos.google.cloud.batch.v1alpha.ITask, protos.google.cloud.batch.v1alpha.IGetTaskRequest | null | undefined, {} | null | 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.

jobPath(project, location, job)

jobPath(project: string, location: string, job: string): string;

Return a fully-qualified job resource name string.

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

{string} Resource name string.

listJobs(request, options)

listJobs(request?: protos.google.cloud.batch.v1alpha.IListJobsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.batch.v1alpha.IJob[],
        protos.google.cloud.batch.v1alpha.IListJobsRequest | null,
        protos.google.cloud.batch.v1alpha.IListJobsResponse
    ]>;

List all Jobs for a project within a region.

Parameters
Name Description
request IListJobsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.batch.v1alpha.IJob[], protos.google.cloud.batch.v1alpha.IListJobsRequest | null, protos.google.cloud.batch.v1alpha.IListJobsResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of . 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 listJobsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listJobs(request, options, callback)

listJobs(request: protos.google.cloud.batch.v1alpha.IListJobsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.batch.v1alpha.IListJobsRequest, protos.google.cloud.batch.v1alpha.IListJobsResponse | null | undefined, protos.google.cloud.batch.v1alpha.IJob>): void;
Parameters
Name Description
request IListJobsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.batch.v1alpha.IListJobsRequest, protos.google.cloud.batch.v1alpha.IListJobsResponse | null | undefined, protos.google.cloud.batch.v1alpha.IJob>
Returns
Type Description
void

listJobs(request, callback)

listJobs(request: protos.google.cloud.batch.v1alpha.IListJobsRequest, callback: PaginationCallback<protos.google.cloud.batch.v1alpha.IListJobsRequest, protos.google.cloud.batch.v1alpha.IListJobsResponse | null | undefined, protos.google.cloud.batch.v1alpha.IJob>): void;
Parameters
Name Description
request IListJobsRequest
callback PaginationCallback<protos.google.cloud.batch.v1alpha.IListJobsRequest, protos.google.cloud.batch.v1alpha.IListJobsResponse | null | undefined, protos.google.cloud.batch.v1alpha.IJob>
Returns
Type Description
void

listJobsAsync(request, options)

listJobsAsync(request?: protos.google.cloud.batch.v1alpha.IListJobsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.batch.v1alpha.IJob>;

Equivalent to listJobs, but returns an iterable object.

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

Parameters
Name Description
request IListJobsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<protos.google.cloud.batch.v1alpha.IJob>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . 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.
   */
  /**
   *  Parent path.
   */
  // const parent = 'abc123'
  /**
   *  List filter.
   */
  // const filter = 'abc123'
  /**
   *  Optional. Sort results. Supported are "name", "name desc", "create_time",
   *  and "create_time desc".
   */
  // const orderBy = 'abc123'
  /**
   *  Page size.
   */
  // const pageSize = 1234
  /**
   *  Page token.
   */
  // const pageToken = 'abc123'

  // Imports the Batch library
  const {BatchServiceClient} = require('@google-cloud/batch').v1alpha;

  // Instantiates a client
  const batchClient = new BatchServiceClient();

  async function callListJobs() {
    // Construct request
    const request = {
    };

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

  callListJobs();

listJobsStream(request, options)

listJobsStream(request?: protos.google.cloud.batch.v1alpha.IListJobsRequest, options?: CallOptions): Transform;

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

Parameters
Name Description
request IListJobsRequest

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 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 listJobsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listLocationsAsync(request, options)

listLocationsAsync(request: LocationProtos.google.cloud.location.IListLocationsRequest, options?: CallOptions): AsyncIterable<LocationProtos.google.cloud.location.ILocation>;

Lists information about the supported locations for this service. Returns an iterable object.

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

Parameters
Name Description
request LocationProtos.google.cloud.location.IListLocationsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<google.cloud.location.ILocation>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . 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

const iterable = client.listLocationsAsync(request);
for await (const response of iterable) {
  // process response
}

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)

listResourceAllowances(request, options)

listResourceAllowances(request?: protos.google.cloud.batch.v1alpha.IListResourceAllowancesRequest, options?: CallOptions): Promise<[
        protos.google.cloud.batch.v1alpha.IResourceAllowance[],
        protos.google.cloud.batch.v1alpha.IListResourceAllowancesRequest | null,
        protos.google.cloud.batch.v1alpha.IListResourceAllowancesResponse
    ]>;

List all ResourceAllowances for a project within a region.

Parameters
Name Description
request IListResourceAllowancesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.batch.v1alpha.IResourceAllowance[], protos.google.cloud.batch.v1alpha.IListResourceAllowancesRequest | null, protos.google.cloud.batch.v1alpha.IListResourceAllowancesResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of ResourceAllowance. 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 listResourceAllowancesAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listResourceAllowances(request, options, callback)

listResourceAllowances(request: protos.google.cloud.batch.v1alpha.IListResourceAllowancesRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.batch.v1alpha.IListResourceAllowancesRequest, protos.google.cloud.batch.v1alpha.IListResourceAllowancesResponse | null | undefined, protos.google.cloud.batch.v1alpha.IResourceAllowance>): void;
Parameters
Name Description
request IListResourceAllowancesRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.batch.v1alpha.IListResourceAllowancesRequest, protos.google.cloud.batch.v1alpha.IListResourceAllowancesResponse | null | undefined, protos.google.cloud.batch.v1alpha.IResourceAllowance>
Returns
Type Description
void

listResourceAllowances(request, callback)

listResourceAllowances(request: protos.google.cloud.batch.v1alpha.IListResourceAllowancesRequest, callback: PaginationCallback<protos.google.cloud.batch.v1alpha.IListResourceAllowancesRequest, protos.google.cloud.batch.v1alpha.IListResourceAllowancesResponse | null | undefined, protos.google.cloud.batch.v1alpha.IResourceAllowance>): void;
Parameters
Name Description
request IListResourceAllowancesRequest
callback PaginationCallback<protos.google.cloud.batch.v1alpha.IListResourceAllowancesRequest, protos.google.cloud.batch.v1alpha.IListResourceAllowancesResponse | null | undefined, protos.google.cloud.batch.v1alpha.IResourceAllowance>
Returns
Type Description
void

listResourceAllowancesAsync(request, options)

listResourceAllowancesAsync(request?: protos.google.cloud.batch.v1alpha.IListResourceAllowancesRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.batch.v1alpha.IResourceAllowance>;

Equivalent to listResourceAllowances, but returns an iterable object.

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

Parameters
Name Description
request IListResourceAllowancesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<protos.google.cloud.batch.v1alpha.IResourceAllowance>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing ResourceAllowance. 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. Parent path.
   */
  // const parent = 'abc123'
  /**
   *  Optional. Page size.
   */
  // const pageSize = 1234
  /**
   *  Optional. Page token.
   */
  // const pageToken = 'abc123'

  // Imports the Batch library
  const {BatchServiceClient} = require('@google-cloud/batch').v1alpha;

  // Instantiates a client
  const batchClient = new BatchServiceClient();

  async function callListResourceAllowances() {
    // Construct request
    const request = {
      parent,
    };

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

  callListResourceAllowances();

listResourceAllowancesStream(request, options)

listResourceAllowancesStream(request?: protos.google.cloud.batch.v1alpha.IListResourceAllowancesRequest, options?: CallOptions): Transform;

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

Parameters
Name Description
request IListResourceAllowancesRequest

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 ResourceAllowance 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 listResourceAllowancesAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listTasks(request, options)

listTasks(request?: protos.google.cloud.batch.v1alpha.IListTasksRequest, options?: CallOptions): Promise<[
        protos.google.cloud.batch.v1alpha.ITask[],
        protos.google.cloud.batch.v1alpha.IListTasksRequest | null,
        protos.google.cloud.batch.v1alpha.IListTasksResponse
    ]>;

List Tasks associated with a job.

Parameters
Name Description
request IListTasksRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.batch.v1alpha.ITask[], protos.google.cloud.batch.v1alpha.IListTasksRequest | null, protos.google.cloud.batch.v1alpha.IListTasksResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of Task. 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 listTasksAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listTasks(request, options, callback)

listTasks(request: protos.google.cloud.batch.v1alpha.IListTasksRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.batch.v1alpha.IListTasksRequest, protos.google.cloud.batch.v1alpha.IListTasksResponse | null | undefined, protos.google.cloud.batch.v1alpha.ITask>): void;
Parameters
Name Description
request IListTasksRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.batch.v1alpha.IListTasksRequest, protos.google.cloud.batch.v1alpha.IListTasksResponse | null | undefined, protos.google.cloud.batch.v1alpha.ITask>
Returns
Type Description
void

listTasks(request, callback)

listTasks(request: protos.google.cloud.batch.v1alpha.IListTasksRequest, callback: PaginationCallback<protos.google.cloud.batch.v1alpha.IListTasksRequest, protos.google.cloud.batch.v1alpha.IListTasksResponse | null | undefined, protos.google.cloud.batch.v1alpha.ITask>): void;
Parameters
Name Description
request IListTasksRequest
callback PaginationCallback<protos.google.cloud.batch.v1alpha.IListTasksRequest, protos.google.cloud.batch.v1alpha.IListTasksResponse | null | undefined, protos.google.cloud.batch.v1alpha.ITask>
Returns
Type Description
void

listTasksAsync(request, options)

listTasksAsync(request?: protos.google.cloud.batch.v1alpha.IListTasksRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.batch.v1alpha.ITask>;

Equivalent to listTasks, but returns an iterable object.

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

Parameters
Name Description
request IListTasksRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<protos.google.cloud.batch.v1alpha.ITask>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing Task. 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. Name of a TaskGroup from which Tasks are being requested.
   *  Pattern:
   *  "projects/{project}/locations/{location}/jobs/{job}/taskGroups/{task_group}"
   */
  // const parent = 'abc123'
  /**
   *  Task filter, null filter matches all Tasks.
   *  Filter string should be of the format State=TaskStatus.State e.g.
   *  State=RUNNING
   */
  // const filter = 'abc123'
  /**
   *  Not implemented.
   */
  // const orderBy = 'abc123'
  /**
   *  Page size.
   */
  // const pageSize = 1234
  /**
   *  Page token.
   */
  // const pageToken = 'abc123'

  // Imports the Batch library
  const {BatchServiceClient} = require('@google-cloud/batch').v1alpha;

  // Instantiates a client
  const batchClient = new BatchServiceClient();

  async function callListTasks() {
    // Construct request
    const request = {
      parent,
    };

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

  callListTasks();

listTasksStream(request, options)

listTasksStream(request?: protos.google.cloud.batch.v1alpha.IListTasksRequest, options?: CallOptions): Transform;

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

Parameters
Name Description
request IListTasksRequest

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 Task 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 listTasksAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

locationPath(project, location)

locationPath(project: string, location: string): string;

Return a fully-qualified location resource name string.

Parameters
Name Description
project string
location string
Returns
Type Description
string

{string} Resource name string.

matchJobFromJobName(jobName)

matchJobFromJobName(jobName: string): string | number;

Parse the job from Job resource.

Parameter
Name Description
jobName string

A fully-qualified path representing Job resource.

Returns
Type Description
string | number

{string} A string representing the job.

matchJobFromTaskGroupName(taskGroupName)

matchJobFromTaskGroupName(taskGroupName: string): string | number;

Parse the job from TaskGroup resource.

Parameter
Name Description
taskGroupName string

A fully-qualified path representing TaskGroup resource.

Returns
Type Description
string | number

{string} A string representing the job.

matchJobFromTaskName(taskName)

matchJobFromTaskName(taskName: string): string | number;

Parse the job from Task resource.

Parameter
Name Description
taskName string

A fully-qualified path representing Task resource.

Returns
Type Description
string | number

{string} A string representing the job.

matchLocationFromJobName(jobName)

matchLocationFromJobName(jobName: string): string | number;

Parse the location from Job resource.

Parameter
Name Description
jobName string

A fully-qualified path representing Job resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromLocationName(locationName)

matchLocationFromLocationName(locationName: string): string | number;

Parse the location from Location resource.

Parameter
Name Description
locationName string

A fully-qualified path representing Location resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromResourceAllowanceName(resourceAllowanceName)

matchLocationFromResourceAllowanceName(resourceAllowanceName: string): string | number;

Parse the location from ResourceAllowance resource.

Parameter
Name Description
resourceAllowanceName string

A fully-qualified path representing ResourceAllowance resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromTaskGroupName(taskGroupName)

matchLocationFromTaskGroupName(taskGroupName: string): string | number;

Parse the location from TaskGroup resource.

Parameter
Name Description
taskGroupName string

A fully-qualified path representing TaskGroup resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromTaskName(taskName)

matchLocationFromTaskName(taskName: string): string | number;

Parse the location from Task resource.

Parameter
Name Description
taskName string

A fully-qualified path representing Task resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchProjectFromJobName(jobName)

matchProjectFromJobName(jobName: string): string | number;

Parse the project from Job resource.

Parameter
Name Description
jobName string

A fully-qualified path representing Job resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromLocationName(locationName)

matchProjectFromLocationName(locationName: string): string | number;

Parse the project from Location resource.

Parameter
Name Description
locationName string

A fully-qualified path representing Location resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromProjectName(projectName)

matchProjectFromProjectName(projectName: string): string | number;

Parse the project from Project resource.

Parameter
Name Description
projectName string

A fully-qualified path representing Project resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromResourceAllowanceName(resourceAllowanceName)

matchProjectFromResourceAllowanceName(resourceAllowanceName: string): string | number;

Parse the project from ResourceAllowance resource.

Parameter
Name Description
resourceAllowanceName string

A fully-qualified path representing ResourceAllowance resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromTaskGroupName(taskGroupName)

matchProjectFromTaskGroupName(taskGroupName: string): string | number;

Parse the project from TaskGroup resource.

Parameter
Name Description
taskGroupName string

A fully-qualified path representing TaskGroup resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromTaskName(taskName)

matchProjectFromTaskName(taskName: string): string | number;

Parse the project from Task resource.

Parameter
Name Description
taskName string

A fully-qualified path representing Task resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchResourceAllowanceFromResourceAllowanceName(resourceAllowanceName)

matchResourceAllowanceFromResourceAllowanceName(resourceAllowanceName: string): string | number;

Parse the resource_allowance from ResourceAllowance resource.

Parameter
Name Description
resourceAllowanceName string

A fully-qualified path representing ResourceAllowance resource.

Returns
Type Description
string | number

{string} A string representing the resource_allowance.

matchTaskFromTaskName(taskName)

matchTaskFromTaskName(taskName: string): string | number;

Parse the task from Task resource.

Parameter
Name Description
taskName string

A fully-qualified path representing Task resource.

Returns
Type Description
string | number

{string} A string representing the task.

matchTaskGroupFromTaskGroupName(taskGroupName)

matchTaskGroupFromTaskGroupName(taskGroupName: string): string | number;

Parse the task_group from TaskGroup resource.

Parameter
Name Description
taskGroupName string

A fully-qualified path representing TaskGroup resource.

Returns
Type Description
string | number

{string} A string representing the task_group.

matchTaskGroupFromTaskName(taskName)

matchTaskGroupFromTaskName(taskName: string): string | number;

Parse the task_group from Task resource.

Parameter
Name Description
taskName string

A fully-qualified path representing Task resource.

Returns
Type Description
string | number

{string} A string representing the task_group.

projectPath(project)

projectPath(project: string): string;

Return a fully-qualified project resource name string.

Parameter
Name Description
project string
Returns
Type Description
string

{string} Resource name string.

resourceAllowancePath(project, location, resourceAllowance)

resourceAllowancePath(project: string, location: string, resourceAllowance: string): string;

Return a fully-qualified resourceAllowance resource name string.

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

{string} Resource name string.

taskGroupPath(project, location, job, taskGroup)

taskGroupPath(project: string, location: string, job: string, taskGroup: string): string;

Return a fully-qualified taskGroup resource name string.

Parameters
Name Description
project string
location string
job string
taskGroup string
Returns
Type Description
string

{string} Resource name string.

taskPath(project, location, job, taskGroup, task)

taskPath(project: string, location: string, job: string, taskGroup: string, task: string): string;

Return a fully-qualified task resource name string.

Parameters
Name Description
project string
location string
job string
taskGroup string
task string
Returns
Type Description
string

{string} Resource name string.

updateJob(request, options)

updateJob(request?: protos.google.cloud.batch.v1alpha.IUpdateJobRequest, options?: CallOptions): Promise<[
        protos.google.cloud.batch.v1alpha.IJob,
        protos.google.cloud.batch.v1alpha.IUpdateJobRequest | undefined,
        {} | undefined
    ]>;

Update a Job.

Parameters
Name Description
request IUpdateJobRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.batch.v1alpha.IJob, protos.google.cloud.batch.v1alpha.IUpdateJobRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . 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 Job to update.
   *  Only fields specified in `updateMask` are updated.
   */
  // const job = {}
  /**
   *  Required. Mask of fields to update.
   *  The `jobs.patch` method can only be used while a job is in the `QUEUED`,
   *  `SCHEDULED`, or `RUNNING` state and currently only supports increasing the
   *  value of the first `taskCount` field in the job's `taskGroups` field.
   *  Therefore, you must set the value of `updateMask` to `taskGroups`. Any
   *  other job fields in the update request will be ignored.
   *  For example, to update a job's `taskCount` to `2`, set `updateMask` to
   *  `taskGroups` and use the following request body:
   *  

   *  {
   *    "taskGroups":{
   *      "taskCount": 2
   *    } 
   *  }
   *  

/ // const updateMask = {} /*

  • Optional. An optional request ID to identify requests. Specify a unique
  • request ID so that if you must retry your request, the server will know to
  • ignore the request if it has already been completed. The server will
  • guarantee that for at least 60 minutes after the first request.
  • For example, consider a situation where you make an initial request and
  • the request times out. If you make the request again with the same request
  • ID, the server can check if original operation with the same request ID
  • was received, and if so, will ignore the second request. This prevents
  • clients from accidentally creating duplicate commitments.
  • The request ID must be a valid UUID with the exception that zero UUID is
  • not supported (00000000-0000-0000-0000-000000000000). */ // const requestId = 'abc123'

    // Imports the Batch library const {BatchServiceClient} = require('@google-cloud/batch').v1alpha;

    // Instantiates a client const batchClient = new BatchServiceClient();

    async function callUpdateJob() { // Construct request const request = { job, updateMask, };

    // Run request const response = await batchClient.updateJob(request); console.log(response); }

    callUpdateJob();

updateJob(request, options, callback)

updateJob(request: protos.google.cloud.batch.v1alpha.IUpdateJobRequest, options: CallOptions, callback: Callback<protos.google.cloud.batch.v1alpha.IJob, protos.google.cloud.batch.v1alpha.IUpdateJobRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateJobRequest
options CallOptions
callback Callback<protos.google.cloud.batch.v1alpha.IJob, protos.google.cloud.batch.v1alpha.IUpdateJobRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

updateJob(request, callback)

updateJob(request: protos.google.cloud.batch.v1alpha.IUpdateJobRequest, callback: Callback<protos.google.cloud.batch.v1alpha.IJob, protos.google.cloud.batch.v1alpha.IUpdateJobRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateJobRequest
callback Callback<protos.google.cloud.batch.v1alpha.IJob, protos.google.cloud.batch.v1alpha.IUpdateJobRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

updateResourceAllowance(request, options)

updateResourceAllowance(request?: protos.google.cloud.batch.v1alpha.IUpdateResourceAllowanceRequest, options?: CallOptions): Promise<[
        protos.google.cloud.batch.v1alpha.IResourceAllowance,
        (protos.google.cloud.batch.v1alpha.IUpdateResourceAllowanceRequest | undefined),
        {} | undefined
    ]>;

Update a Resource Allowance.

Parameters
Name Description
request IUpdateResourceAllowanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.batch.v1alpha.IResourceAllowance, (protos.google.cloud.batch.v1alpha.IUpdateResourceAllowanceRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing ResourceAllowance. 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 ResourceAllowance to update.
   *  Update description.
   *  Only fields specified in `update_mask` are updated.
   */
  // const resourceAllowance = {}
  /**
   *  Required. Mask of fields to update.
   *  Field mask is used to specify the fields to be overwritten in the
   *  ResourceAllowance resource by the update.
   *  The fields specified in the update_mask are relative to the resource, not
   *  the full request. A field will be overwritten if it is in the mask. If the
   *  user does not provide a mask then all fields will be overwritten.
   *  UpdateResourceAllowance request now only supports update on `limit` field.
   */
  // const updateMask = {}
  /**
   *  Optional. An optional request ID to identify requests. Specify a unique
   *  request ID so that if you must retry your request, the server will know to
   *  ignore the request if it has already been completed. The server will
   *  guarantee that for at least 60 minutes since the first request.
   *  For example, consider a situation where you make an initial request and
   *  the request times out. If you make the request again with the same request
   *  ID, the server can check if original operation with the same request ID
   *  was received, and if so, will ignore the second request. This prevents
   *  clients from accidentally creating duplicate commitments.
   *  The request ID must be a valid UUID with the exception that zero UUID is
   *  not supported (00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'

  // Imports the Batch library
  const {BatchServiceClient} = require('@google-cloud/batch').v1alpha;

  // Instantiates a client
  const batchClient = new BatchServiceClient();

  async function callUpdateResourceAllowance() {
    // Construct request
    const request = {
      resourceAllowance,
      updateMask,
    };

    // Run request
    const response = await batchClient.updateResourceAllowance(request);
    console.log(response);
  }

  callUpdateResourceAllowance();

updateResourceAllowance(request, options, callback)

updateResourceAllowance(request: protos.google.cloud.batch.v1alpha.IUpdateResourceAllowanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.batch.v1alpha.IResourceAllowance, protos.google.cloud.batch.v1alpha.IUpdateResourceAllowanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateResourceAllowanceRequest
options CallOptions
callback Callback<protos.google.cloud.batch.v1alpha.IResourceAllowance, protos.google.cloud.batch.v1alpha.IUpdateResourceAllowanceRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

updateResourceAllowance(request, callback)

updateResourceAllowance(request: protos.google.cloud.batch.v1alpha.IUpdateResourceAllowanceRequest, callback: Callback<protos.google.cloud.batch.v1alpha.IResourceAllowance, protos.google.cloud.batch.v1alpha.IUpdateResourceAllowanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateResourceAllowanceRequest
callback Callback<protos.google.cloud.batch.v1alpha.IResourceAllowance, protos.google.cloud.batch.v1alpha.IUpdateResourceAllowanceRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void