Class v1.CloudBuildClient

Creates and manages builds on Google Cloud Platform.

The main concept used by this API is a Build, which describes the location of the source to build, how to build the source, and where to store the built artifacts, if any.

A user can list previously-requested builds or get builds by their ID to determine the status of the build. v1

Package

@google-cloud/cloudbuild

Constructors

(constructor)(opts)

constructor(opts?: ClientOptions);

Construct an instance of CloudBuildClient.

Parameter
NameDescription
opts ClientOptions

Properties

apiEndpoint

static get apiEndpoint(): string;

The DNS address for this API service - same as servicePath(), exists for compatibility reasons.

auth

auth: gax.GoogleAuth;

cloudBuildStub

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

descriptors

descriptors: Descriptors;

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.

warn

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

Methods

approveBuild(request, options)

approveBuild(request?: protos.google.devtools.cloudbuild.v1.IApproveBuildRequest, options?: CallOptions): Promise<[LROperation<protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.IBuildOperationMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined]>;

Approves or rejects a pending build.

If approved, the returned LRO will be analogous to the LRO returned from a CreateBuild call.

If rejected, the returned LRO will be immediately done.

Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IApproveBuildRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[LROperation<protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.IBuildOperationMetadata>, 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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Name of the target build.
   *  For example: "projects/{$project_id}/builds/{$build_id}"
   */
  // const name = 'abc123'
  /**
   *  Approval decision and metadata.
   */
  // const approvalResult = {}

  // Imports the Cloudbuild library
  const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1;

  // Instantiates a client
  const cloudbuildClient = new CloudBuildClient();

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

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

  callApproveBuild();

approveBuild(request, options, callback)

approveBuild(request: protos.google.devtools.cloudbuild.v1.IApproveBuildRequest, options: CallOptions, callback: Callback<LROperation<protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.IBuildOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IApproveBuildRequest
options CallOptions
callback Callback<LROperation<protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.IBuildOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

approveBuild(request, callback)

approveBuild(request: protos.google.devtools.cloudbuild.v1.IApproveBuildRequest, callback: Callback<LROperation<protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.IBuildOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IApproveBuildRequest
callback Callback<LROperation<protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.IBuildOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

cancelBuild(request, options)

cancelBuild(request?: protos.google.devtools.cloudbuild.v1.ICancelBuildRequest, options?: CallOptions): Promise<[protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.ICancelBuildRequest | undefined, {} | undefined]>;

Cancels a build in progress.

Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.ICancelBuildRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.ICancelBuildRequest | undefined, {} | undefined]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [Build]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The name of the `Build` to cancel.
   *  Format: `projects/{project}/locations/{location}/builds/{build}`
   */
  // const name = 'abc123'
  /**
   *  Required. ID of the project.
   */
  // const projectId = 'abc123'
  /**
   *  Required. ID of the build.
   */
  // const id = 'abc123'

  // Imports the Cloudbuild library
  const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1;

  // Instantiates a client
  const cloudbuildClient = new CloudBuildClient();

  async function callCancelBuild() {
    // Construct request
    const request = {
      projectId,
      id,
    };

    // Run request
    const response = await cloudbuildClient.cancelBuild(request);
    console.log(response);
  }

  callCancelBuild();

cancelBuild(request, options, callback)

cancelBuild(request: protos.google.devtools.cloudbuild.v1.ICancelBuildRequest, options: CallOptions, callback: Callback<protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.ICancelBuildRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.ICancelBuildRequest
options CallOptions
callback Callback<protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.ICancelBuildRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

cancelBuild(request, callback)

cancelBuild(request: protos.google.devtools.cloudbuild.v1.ICancelBuildRequest, callback: Callback<protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.ICancelBuildRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.ICancelBuildRequest
callback Callback<protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.ICancelBuildRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

checkApproveBuildProgress(name)

checkApproveBuildProgress(name: string): Promise<LROperation<protos.google.devtools.cloudbuild.v1.Build, protos.google.devtools.cloudbuild.v1.BuildOperationMetadata>>;

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

Parameter
NameDescription
name string

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.devtools.cloudbuild.v1.Build, protos.google.devtools.cloudbuild.v1.BuildOperationMetadata>>

{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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Name of the target build.
   *  For example: "projects/{$project_id}/builds/{$build_id}"
   */
  // const name = 'abc123'
  /**
   *  Approval decision and metadata.
   */
  // const approvalResult = {}

  // Imports the Cloudbuild library
  const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1;

  // Instantiates a client
  const cloudbuildClient = new CloudBuildClient();

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

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

  callApproveBuild();

checkCreateBuildProgress(name)

checkCreateBuildProgress(name: string): Promise<LROperation<protos.google.devtools.cloudbuild.v1.Build, protos.google.devtools.cloudbuild.v1.BuildOperationMetadata>>;

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

Parameter
NameDescription
name string

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.devtools.cloudbuild.v1.Build, protos.google.devtools.cloudbuild.v1.BuildOperationMetadata>>

{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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The parent resource where this build will be created.
   *  Format: `projects/{project}/locations/{location}`
   */
  // const parent = 'abc123'
  /**
   *  Required. ID of the project.
   */
  // const projectId = 'abc123'
  /**
   *  Required. Build resource to create.
   */
  // const build = {}

  // Imports the Cloudbuild library
  const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1;

  // Instantiates a client
  const cloudbuildClient = new CloudBuildClient();

  async function callCreateBuild() {
    // Construct request
    const request = {
      projectId,
      build,
    };

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

  callCreateBuild();

checkCreateWorkerPoolProgress(name)

checkCreateWorkerPoolProgress(name: string): Promise<LROperation<protos.google.devtools.cloudbuild.v1.WorkerPool, protos.google.devtools.cloudbuild.v1.CreateWorkerPoolOperationMetadata>>;

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

Parameter
NameDescription
name string

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.devtools.cloudbuild.v1.WorkerPool, protos.google.devtools.cloudbuild.v1.CreateWorkerPoolOperationMetadata>>

{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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The parent resource where this worker pool will be created.
   *  Format: `projects/{project}/locations/{location}`.
   */
  // const parent = 'abc123'
  /**
   *  Required. `WorkerPool` resource to create.
   */
  // const workerPool = {}
  /**
   *  Required. Immutable. The ID to use for the `WorkerPool`, which will become
   *  the final component of the resource name.
   *  This value should be 1-63 characters, and valid characters
   *  are /[a-z][0-9]-/.
   */
  // const workerPoolId = 'abc123'
  /**
   *  If set, validate the request and preview the response, but do not actually
   *  post it.
   */
  // const validateOnly = true

  // Imports the Cloudbuild library
  const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1;

  // Instantiates a client
  const cloudbuildClient = new CloudBuildClient();

  async function callCreateWorkerPool() {
    // Construct request
    const request = {
      parent,
      workerPool,
      workerPoolId,
    };

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

  callCreateWorkerPool();

checkDeleteWorkerPoolProgress(name)

checkDeleteWorkerPoolProgress(name: string): Promise<LROperation<protos.google.protobuf.Empty, protos.google.devtools.cloudbuild.v1.DeleteWorkerPoolOperationMetadata>>;

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

Parameter
NameDescription
name string

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.protobuf.Empty, protos.google.devtools.cloudbuild.v1.DeleteWorkerPoolOperationMetadata>>

{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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the `WorkerPool` to delete.
   *  Format:
   *  `projects/{project}/locations/{workerPool}/workerPools/{workerPool}`.
   */
  // const name = 'abc123'
  /**
   *  Optional. If this is provided, it must match the server's etag on the
   *  workerpool for the request to be processed.
   */
  // const etag = 'abc123'
  /**
   *  If set to true, and the `WorkerPool` is not found, the request will succeed
   *  but no action will be taken on the server.
   */
  // const allowMissing = true
  /**
   *  If set, validate the request and preview the response, but do not actually
   *  post it.
   */
  // const validateOnly = true

  // Imports the Cloudbuild library
  const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1;

  // Instantiates a client
  const cloudbuildClient = new CloudBuildClient();

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

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

  callDeleteWorkerPool();

checkRetryBuildProgress(name)

checkRetryBuildProgress(name: string): Promise<LROperation<protos.google.devtools.cloudbuild.v1.Build, protos.google.devtools.cloudbuild.v1.BuildOperationMetadata>>;

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

Parameter
NameDescription
name string

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.devtools.cloudbuild.v1.Build, protos.google.devtools.cloudbuild.v1.BuildOperationMetadata>>

{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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The name of the `Build` to retry.
   *  Format: `projects/{project}/locations/{location}/builds/{build}`
   */
  // const name = 'abc123'
  /**
   *  Required. ID of the project.
   */
  // const projectId = 'abc123'
  /**
   *  Required. Build ID of the original build.
   */
  // const id = 'abc123'

  // Imports the Cloudbuild library
  const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1;

  // Instantiates a client
  const cloudbuildClient = new CloudBuildClient();

  async function callRetryBuild() {
    // Construct request
    const request = {
      projectId,
      id,
    };

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

  callRetryBuild();

checkRunBuildTriggerProgress(name)

checkRunBuildTriggerProgress(name: string): Promise<LROperation<protos.google.devtools.cloudbuild.v1.Build, protos.google.devtools.cloudbuild.v1.BuildOperationMetadata>>;

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

Parameter
NameDescription
name string

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.devtools.cloudbuild.v1.Build, protos.google.devtools.cloudbuild.v1.BuildOperationMetadata>>

{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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The name of the `Trigger` to run.
   *  Format: `projects/{project}/locations/{location}/triggers/{trigger}`
   */
  // const name = 'abc123'
  /**
   *  Required. ID of the project.
   */
  // const projectId = 'abc123'
  /**
   *  Required. ID of the trigger.
   */
  // const triggerId = 'abc123'
  /**
   *  Source to build against this trigger.
   */
  // const source = {}

  // Imports the Cloudbuild library
  const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1;

  // Instantiates a client
  const cloudbuildClient = new CloudBuildClient();

  async function callRunBuildTrigger() {
    // Construct request
    const request = {
      projectId,
      triggerId,
    };

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

  callRunBuildTrigger();

checkUpdateWorkerPoolProgress(name)

checkUpdateWorkerPoolProgress(name: string): Promise<LROperation<protos.google.devtools.cloudbuild.v1.WorkerPool, protos.google.devtools.cloudbuild.v1.UpdateWorkerPoolOperationMetadata>>;

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

Parameter
NameDescription
name string

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.devtools.cloudbuild.v1.WorkerPool, protos.google.devtools.cloudbuild.v1.UpdateWorkerPoolOperationMetadata>>

{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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The `WorkerPool` to update.
   *  The `name` field is used to identify the `WorkerPool` to update.
   *  Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`.
   */
  // const workerPool = {}
  /**
   *  A mask specifying which fields in `worker_pool` to update.
   */
  // const updateMask = {}
  /**
   *  If set, validate the request and preview the response, but do not actually
   *  post it.
   */
  // const validateOnly = true

  // Imports the Cloudbuild library
  const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1;

  // Instantiates a client
  const cloudbuildClient = new CloudBuildClient();

  async function callUpdateWorkerPool() {
    // Construct request
    const request = {
      workerPool,
    };

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

  callUpdateWorkerPool();

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
TypeDescription
Promise<void>

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

createBuild(request, options)

createBuild(request?: protos.google.devtools.cloudbuild.v1.ICreateBuildRequest, options?: CallOptions): Promise<[LROperation<protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.IBuildOperationMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined]>;

Starts a build with the specified configuration.

This method returns a long-running Operation, which includes the build ID. Pass the build ID to GetBuild to determine the build status (such as SUCCESS or FAILURE).

Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.ICreateBuildRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[LROperation<protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.IBuildOperationMetadata>, 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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The parent resource where this build will be created.
   *  Format: `projects/{project}/locations/{location}`
   */
  // const parent = 'abc123'
  /**
   *  Required. ID of the project.
   */
  // const projectId = 'abc123'
  /**
   *  Required. Build resource to create.
   */
  // const build = {}

  // Imports the Cloudbuild library
  const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1;

  // Instantiates a client
  const cloudbuildClient = new CloudBuildClient();

  async function callCreateBuild() {
    // Construct request
    const request = {
      projectId,
      build,
    };

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

  callCreateBuild();

createBuild(request, options, callback)

createBuild(request: protos.google.devtools.cloudbuild.v1.ICreateBuildRequest, options: CallOptions, callback: Callback<LROperation<protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.IBuildOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.ICreateBuildRequest
options CallOptions
callback Callback<LROperation<protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.IBuildOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

createBuild(request, callback)

createBuild(request: protos.google.devtools.cloudbuild.v1.ICreateBuildRequest, callback: Callback<LROperation<protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.IBuildOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.ICreateBuildRequest
callback Callback<LROperation<protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.IBuildOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

createBuildTrigger(request, options)

createBuildTrigger(request?: protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest, options?: CallOptions): Promise<[protos.google.devtools.cloudbuild.v1.IBuildTrigger, (protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest | undefined), {} | undefined]>;

Creates a new BuildTrigger.

This API is experimental.

Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.devtools.cloudbuild.v1.IBuildTrigger, (protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest | undefined), {} | undefined]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [BuildTrigger]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The parent resource where this trigger will be created.
   *  Format: `projects/{project}/locations/{location}`
   */
  // const parent = 'abc123'
  /**
   *  Required. ID of the project for which to configure automatic builds.
   */
  // const projectId = 'abc123'
  /**
   *  Required. `BuildTrigger` to create.
   */
  // const trigger = {}

  // Imports the Cloudbuild library
  const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1;

  // Instantiates a client
  const cloudbuildClient = new CloudBuildClient();

  async function callCreateBuildTrigger() {
    // Construct request
    const request = {
      projectId,
      trigger,
    };

    // Run request
    const response = await cloudbuildClient.createBuildTrigger(request);
    console.log(response);
  }

  callCreateBuildTrigger();

createBuildTrigger(request, options, callback)

createBuildTrigger(request: protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest, options: CallOptions, callback: Callback<protos.google.devtools.cloudbuild.v1.IBuildTrigger, protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest
options CallOptions
callback Callback<protos.google.devtools.cloudbuild.v1.IBuildTrigger, protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

createBuildTrigger(request, callback)

createBuildTrigger(request: protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest, callback: Callback<protos.google.devtools.cloudbuild.v1.IBuildTrigger, protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest
callback Callback<protos.google.devtools.cloudbuild.v1.IBuildTrigger, protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

createWorkerPool(request, options)

createWorkerPool(request?: protos.google.devtools.cloudbuild.v1.ICreateWorkerPoolRequest, options?: CallOptions): Promise<[LROperation<protos.google.devtools.cloudbuild.v1.IWorkerPool, protos.google.devtools.cloudbuild.v1.ICreateWorkerPoolOperationMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined]>;

Creates a WorkerPool.

Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.ICreateWorkerPoolRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[LROperation<protos.google.devtools.cloudbuild.v1.IWorkerPool, protos.google.devtools.cloudbuild.v1.ICreateWorkerPoolOperationMetadata>, 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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The parent resource where this worker pool will be created.
   *  Format: `projects/{project}/locations/{location}`.
   */
  // const parent = 'abc123'
  /**
   *  Required. `WorkerPool` resource to create.
   */
  // const workerPool = {}
  /**
   *  Required. Immutable. The ID to use for the `WorkerPool`, which will become
   *  the final component of the resource name.
   *  This value should be 1-63 characters, and valid characters
   *  are /[a-z][0-9]-/.
   */
  // const workerPoolId = 'abc123'
  /**
   *  If set, validate the request and preview the response, but do not actually
   *  post it.
   */
  // const validateOnly = true

  // Imports the Cloudbuild library
  const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1;

  // Instantiates a client
  const cloudbuildClient = new CloudBuildClient();

  async function callCreateWorkerPool() {
    // Construct request
    const request = {
      parent,
      workerPool,
      workerPoolId,
    };

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

  callCreateWorkerPool();

createWorkerPool(request, options, callback)

createWorkerPool(request: protos.google.devtools.cloudbuild.v1.ICreateWorkerPoolRequest, options: CallOptions, callback: Callback<LROperation<protos.google.devtools.cloudbuild.v1.IWorkerPool, protos.google.devtools.cloudbuild.v1.ICreateWorkerPoolOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.ICreateWorkerPoolRequest
options CallOptions
callback Callback<LROperation<protos.google.devtools.cloudbuild.v1.IWorkerPool, protos.google.devtools.cloudbuild.v1.ICreateWorkerPoolOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

createWorkerPool(request, callback)

createWorkerPool(request: protos.google.devtools.cloudbuild.v1.ICreateWorkerPoolRequest, callback: Callback<LROperation<protos.google.devtools.cloudbuild.v1.IWorkerPool, protos.google.devtools.cloudbuild.v1.ICreateWorkerPoolOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.ICreateWorkerPoolRequest
callback Callback<LROperation<protos.google.devtools.cloudbuild.v1.IWorkerPool, protos.google.devtools.cloudbuild.v1.ICreateWorkerPoolOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

cryptoKeyPath(project, location, keyring, key)

cryptoKeyPath(project: string, location: string, keyring: string, key: string): string;

Return a fully-qualified cryptoKey resource name string.

Parameters
NameDescription
project string
location string
keyring string
key string
Returns
TypeDescription
string

{string} Resource name string.

deleteBuildTrigger(request, options)

deleteBuildTrigger(request?: protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest, options?: CallOptions): Promise<[protos.google.protobuf.IEmpty, (protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest | undefined), {} | undefined]>;

Deletes a BuildTrigger by its project ID and trigger ID.

This API is experimental.

Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.protobuf.IEmpty, (protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest | undefined), {} | undefined]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [Empty]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The name of the `Trigger` to delete.
   *  Format: `projects/{project}/locations/{location}/triggers/{trigger}`
   */
  // const name = 'abc123'
  /**
   *  Required. ID of the project that owns the trigger.
   */
  // const projectId = 'abc123'
  /**
   *  Required. ID of the `BuildTrigger` to delete.
   */
  // const triggerId = 'abc123'

  // Imports the Cloudbuild library
  const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1;

  // Instantiates a client
  const cloudbuildClient = new CloudBuildClient();

  async function callDeleteBuildTrigger() {
    // Construct request
    const request = {
      projectId,
      triggerId,
    };

    // Run request
    const response = await cloudbuildClient.deleteBuildTrigger(request);
    console.log(response);
  }

  callDeleteBuildTrigger();

deleteBuildTrigger(request, options, callback)

deleteBuildTrigger(request: protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest
options CallOptions
callback Callback<protos.google.protobuf.IEmpty, protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deleteBuildTrigger(request, callback)

deleteBuildTrigger(request: protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest
callback Callback<protos.google.protobuf.IEmpty, protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deleteWorkerPool(request, options)

deleteWorkerPool(request?: protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolRequest, options?: CallOptions): Promise<[LROperation<protos.google.protobuf.IEmpty, protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolOperationMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined]>;

Deletes a WorkerPool.

Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[LROperation<protos.google.protobuf.IEmpty, protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolOperationMetadata>, 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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the `WorkerPool` to delete.
   *  Format:
   *  `projects/{project}/locations/{workerPool}/workerPools/{workerPool}`.
   */
  // const name = 'abc123'
  /**
   *  Optional. If this is provided, it must match the server's etag on the
   *  workerpool for the request to be processed.
   */
  // const etag = 'abc123'
  /**
   *  If set to true, and the `WorkerPool` is not found, the request will succeed
   *  but no action will be taken on the server.
   */
  // const allowMissing = true
  /**
   *  If set, validate the request and preview the response, but do not actually
   *  post it.
   */
  // const validateOnly = true

  // Imports the Cloudbuild library
  const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1;

  // Instantiates a client
  const cloudbuildClient = new CloudBuildClient();

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

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

  callDeleteWorkerPool();

deleteWorkerPool(request, options, callback)

deleteWorkerPool(request: protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolRequest, options: CallOptions, callback: Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolRequest
options CallOptions
callback Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deleteWorkerPool(request, callback)

deleteWorkerPool(request: protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolRequest, callback: Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolRequest
callback Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getBuild(request, options)

getBuild(request?: protos.google.devtools.cloudbuild.v1.IGetBuildRequest, options?: CallOptions): Promise<[protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.IGetBuildRequest | undefined, {} | undefined]>;

Returns information about a previously requested build.

The Build that is returned includes its status (such as SUCCESS, FAILURE, or WORKING), and timing information.

Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IGetBuildRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.IGetBuildRequest | undefined, {} | undefined]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [Build]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The name of the `Build` to retrieve.
   *  Format: `projects/{project}/locations/{location}/builds/{build}`
   */
  // const name = 'abc123'
  /**
   *  Required. ID of the project.
   */
  // const projectId = 'abc123'
  /**
   *  Required. ID of the build.
   */
  // const id = 'abc123'

  // Imports the Cloudbuild library
  const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1;

  // Instantiates a client
  const cloudbuildClient = new CloudBuildClient();

  async function callGetBuild() {
    // Construct request
    const request = {
      projectId,
      id,
    };

    // Run request
    const response = await cloudbuildClient.getBuild(request);
    console.log(response);
  }

  callGetBuild();

getBuild(request, options, callback)

getBuild(request: protos.google.devtools.cloudbuild.v1.IGetBuildRequest, options: CallOptions, callback: Callback<protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.IGetBuildRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IGetBuildRequest
options CallOptions
callback Callback<protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.IGetBuildRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getBuild(request, callback)

getBuild(request: protos.google.devtools.cloudbuild.v1.IGetBuildRequest, callback: Callback<protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.IGetBuildRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IGetBuildRequest
callback Callback<protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.IGetBuildRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getBuildTrigger(request, options)

getBuildTrigger(request?: protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest, options?: CallOptions): Promise<[protos.google.devtools.cloudbuild.v1.IBuildTrigger, protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest | undefined, {} | undefined]>;

Returns information about a BuildTrigger.

This API is experimental.

Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.devtools.cloudbuild.v1.IBuildTrigger, protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest | undefined, {} | undefined]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [BuildTrigger]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The name of the `Trigger` to retrieve.
   *  Format: `projects/{project}/locations/{location}/triggers/{trigger}`
   */
  // const name = 'abc123'
  /**
   *  Required. ID of the project that owns the trigger.
   */
  // const projectId = 'abc123'
  /**
   *  Required. Identifier (`id` or `name`) of the `BuildTrigger` to get.
   */
  // const triggerId = 'abc123'

  // Imports the Cloudbuild library
  const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1;

  // Instantiates a client
  const cloudbuildClient = new CloudBuildClient();

  async function callGetBuildTrigger() {
    // Construct request
    const request = {
      projectId,
      triggerId,
    };

    // Run request
    const response = await cloudbuildClient.getBuildTrigger(request);
    console.log(response);
  }

  callGetBuildTrigger();

getBuildTrigger(request, options, callback)

getBuildTrigger(request: protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest, options: CallOptions, callback: Callback<protos.google.devtools.cloudbuild.v1.IBuildTrigger, protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest
options CallOptions
callback Callback<protos.google.devtools.cloudbuild.v1.IBuildTrigger, protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getBuildTrigger(request, callback)

getBuildTrigger(request: protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest, callback: Callback<protos.google.devtools.cloudbuild.v1.IBuildTrigger, protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest
callback Callback<protos.google.devtools.cloudbuild.v1.IBuildTrigger, protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getProjectId()

getProjectId(): Promise<string>;
Returns
TypeDescription
Promise<string>

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
NameDescription
callback Callback<string, undefined, undefined>
Returns
TypeDescription
void

getWorkerPool(request, options)

getWorkerPool(request?: protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest, options?: CallOptions): Promise<[protos.google.devtools.cloudbuild.v1.IWorkerPool, protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest | undefined, {} | undefined]>;

Returns details of a WorkerPool.

Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.devtools.cloudbuild.v1.IWorkerPool, protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest | undefined, {} | undefined]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [WorkerPool]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the `WorkerPool` to retrieve.
   *  Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`.
   */
  // const name = 'abc123'

  // Imports the Cloudbuild library
  const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1;

  // Instantiates a client
  const cloudbuildClient = new CloudBuildClient();

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

    // Run request
    const response = await cloudbuildClient.getWorkerPool(request);
    console.log(response);
  }

  callGetWorkerPool();

getWorkerPool(request, options, callback)

getWorkerPool(request: protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest, options: CallOptions, callback: Callback<protos.google.devtools.cloudbuild.v1.IWorkerPool, protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest
options CallOptions
callback Callback<protos.google.devtools.cloudbuild.v1.IWorkerPool, protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getWorkerPool(request, callback)

getWorkerPool(request: protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest, callback: Callback<protos.google.devtools.cloudbuild.v1.IWorkerPool, protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest
callback Callback<protos.google.devtools.cloudbuild.v1.IWorkerPool, protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
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
TypeDescription
Promise<{ [name: string]: Function; }>

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

listBuilds(request, options)

listBuilds(request?: protos.google.devtools.cloudbuild.v1.IListBuildsRequest, options?: CallOptions): Promise<[protos.google.devtools.cloudbuild.v1.IBuild[], protos.google.devtools.cloudbuild.v1.IListBuildsRequest | null, protos.google.devtools.cloudbuild.v1.IListBuildsResponse]>;

Lists previously requested builds.

Previously requested builds may still be in-progress, or may have finished successfully or unsuccessfully.

Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IListBuildsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.devtools.cloudbuild.v1.IBuild[], protos.google.devtools.cloudbuild.v1.IListBuildsRequest | null, protos.google.devtools.cloudbuild.v1.IListBuildsResponse]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of [Build]. 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 listBuildsAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

listBuilds(request, options, callback)

listBuilds(request: protos.google.devtools.cloudbuild.v1.IListBuildsRequest, options: CallOptions, callback: PaginationCallback<protos.google.devtools.cloudbuild.v1.IListBuildsRequest, protos.google.devtools.cloudbuild.v1.IListBuildsResponse | null | undefined, protos.google.devtools.cloudbuild.v1.IBuild>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IListBuildsRequest
options CallOptions
callback PaginationCallback<protos.google.devtools.cloudbuild.v1.IListBuildsRequest, protos.google.devtools.cloudbuild.v1.IListBuildsResponse | null | undefined, protos.google.devtools.cloudbuild.v1.IBuild>
Returns
TypeDescription
void

listBuilds(request, callback)

listBuilds(request: protos.google.devtools.cloudbuild.v1.IListBuildsRequest, callback: PaginationCallback<protos.google.devtools.cloudbuild.v1.IListBuildsRequest, protos.google.devtools.cloudbuild.v1.IListBuildsResponse | null | undefined, protos.google.devtools.cloudbuild.v1.IBuild>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IListBuildsRequest
callback PaginationCallback<protos.google.devtools.cloudbuild.v1.IListBuildsRequest, protos.google.devtools.cloudbuild.v1.IListBuildsResponse | null | undefined, protos.google.devtools.cloudbuild.v1.IBuild>
Returns
TypeDescription
void

listBuildsAsync(request, options)

listBuildsAsync(request?: protos.google.devtools.cloudbuild.v1.IListBuildsRequest, options?: CallOptions): AsyncIterable<protos.google.devtools.cloudbuild.v1.IBuild>;

Equivalent to listBuilds, but returns an iterable object.

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

Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IListBuildsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.devtools.cloudbuild.v1.IBuild>

{Object} An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). When you iterate the returned iterable, each element will be an object representing [Build]. 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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The parent of the collection of `Builds`.
   *  Format: `projects/{project}/locations/location`
   */
  // const parent = 'abc123'
  /**
   *  Required. ID of the project.
   */
  // const projectId = 'abc123'
  /**
   *  Number of results to return in the list.
   */
  // const pageSize = 1234
  /**
   *  The page token for the next page of Builds.
   *  If unspecified, the first page of results is returned.
   *  If the token is rejected for any reason, INVALID_ARGUMENT will be thrown.
   *  In this case, the token should be discarded, and pagination should be
   *  restarted from the first page of results.
   *  See https://google.aip.dev/158 for more.
   */
  // const pageToken = 'abc123'
  /**
   *  The raw filter text to constrain the results.
   */
  // const filter = 'abc123'

  // Imports the Cloudbuild library
  const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1;

  // Instantiates a client
  const cloudbuildClient = new CloudBuildClient();

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

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

  callListBuilds();

listBuildsStream(request, options)

listBuildsStream(request?: protos.google.devtools.cloudbuild.v1.IListBuildsRequest, options?: CallOptions): Transform;

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

Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IListBuildsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Transform

{Stream} An object stream which emits an object representing [Build] 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 listBuildsAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

listBuildTriggers(request, options)

listBuildTriggers(request?: protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, options?: CallOptions): Promise<[protos.google.devtools.cloudbuild.v1.IBuildTrigger[], protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest | null, protos.google.devtools.cloudbuild.v1.IListBuildTriggersResponse]>;

Lists existing BuildTriggers.

This API is experimental.

Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.devtools.cloudbuild.v1.IBuildTrigger[], protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest | null, protos.google.devtools.cloudbuild.v1.IListBuildTriggersResponse]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of [BuildTrigger]. 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 listBuildTriggersAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

listBuildTriggers(request, options, callback)

listBuildTriggers(request: protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, options: CallOptions, callback: PaginationCallback<protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, protos.google.devtools.cloudbuild.v1.IListBuildTriggersResponse | null | undefined, protos.google.devtools.cloudbuild.v1.IBuildTrigger>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest
options CallOptions
callback PaginationCallback<protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, protos.google.devtools.cloudbuild.v1.IListBuildTriggersResponse | null | undefined, protos.google.devtools.cloudbuild.v1.IBuildTrigger>
Returns
TypeDescription
void

listBuildTriggers(request, callback)

listBuildTriggers(request: protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, callback: PaginationCallback<protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, protos.google.devtools.cloudbuild.v1.IListBuildTriggersResponse | null | undefined, protos.google.devtools.cloudbuild.v1.IBuildTrigger>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest
callback PaginationCallback<protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, protos.google.devtools.cloudbuild.v1.IListBuildTriggersResponse | null | undefined, protos.google.devtools.cloudbuild.v1.IBuildTrigger>
Returns
TypeDescription
void

listBuildTriggersAsync(request, options)

listBuildTriggersAsync(request?: protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, options?: CallOptions): AsyncIterable<protos.google.devtools.cloudbuild.v1.IBuildTrigger>;

Equivalent to listBuildTriggers, but returns an iterable object.

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

Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.devtools.cloudbuild.v1.IBuildTrigger>

{Object} An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). When you iterate the returned iterable, each element will be an object representing [BuildTrigger]. 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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The parent of the collection of `Triggers`.
   *  Format: `projects/{project}/locations/{location}`
   */
  // const parent = 'abc123'
  /**
   *  Required. ID of the project for which to list BuildTriggers.
   */
  // const projectId = 'abc123'
  /**
   *  Number of results to return in the list.
   */
  // const pageSize = 1234
  /**
   *  Token to provide to skip to a particular spot in the list.
   */
  // const pageToken = 'abc123'

  // Imports the Cloudbuild library
  const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1;

  // Instantiates a client
  const cloudbuildClient = new CloudBuildClient();

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

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

  callListBuildTriggers();

listBuildTriggersStream(request, options)

listBuildTriggersStream(request?: protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, options?: CallOptions): Transform;

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

Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Transform

{Stream} An object stream which emits an object representing [BuildTrigger] 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 listBuildTriggersAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

listWorkerPools(request, options)

listWorkerPools(request?: protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, options?: CallOptions): Promise<[protos.google.devtools.cloudbuild.v1.IWorkerPool[], protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest | null, protos.google.devtools.cloudbuild.v1.IListWorkerPoolsResponse]>;

Lists WorkerPools.

Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.devtools.cloudbuild.v1.IWorkerPool[], protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest | null, protos.google.devtools.cloudbuild.v1.IListWorkerPoolsResponse]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of [WorkerPool]. 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 listWorkerPoolsAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

listWorkerPools(request, options, callback)

listWorkerPools(request: protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, options: CallOptions, callback: PaginationCallback<protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, protos.google.devtools.cloudbuild.v1.IListWorkerPoolsResponse | null | undefined, protos.google.devtools.cloudbuild.v1.IWorkerPool>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest
options CallOptions
callback PaginationCallback<protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, protos.google.devtools.cloudbuild.v1.IListWorkerPoolsResponse | null | undefined, protos.google.devtools.cloudbuild.v1.IWorkerPool>
Returns
TypeDescription
void

listWorkerPools(request, callback)

listWorkerPools(request: protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, callback: PaginationCallback<protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, protos.google.devtools.cloudbuild.v1.IListWorkerPoolsResponse | null | undefined, protos.google.devtools.cloudbuild.v1.IWorkerPool>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest
callback PaginationCallback<protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, protos.google.devtools.cloudbuild.v1.IListWorkerPoolsResponse | null | undefined, protos.google.devtools.cloudbuild.v1.IWorkerPool>
Returns
TypeDescription
void

listWorkerPoolsAsync(request, options)

listWorkerPoolsAsync(request?: protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, options?: CallOptions): AsyncIterable<protos.google.devtools.cloudbuild.v1.IWorkerPool>;

Equivalent to listWorkerPools, but returns an iterable object.

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

Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.devtools.cloudbuild.v1.IWorkerPool>

{Object} An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). When you iterate the returned iterable, each element will be an object representing [WorkerPool]. 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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The parent of the collection of `WorkerPools`.
   *  Format: `projects/{project}/locations/{location}`.
   */
  // const parent = 'abc123'
  /**
   *  The maximum number of `WorkerPool`s to return. The service may return
   *  fewer than this value. If omitted, the server will use a sensible default.
   */
  // const pageSize = 1234
  /**
   *  A page token, received from a previous `ListWorkerPools` call. Provide this
   *  to retrieve the subsequent page.
   */
  // const pageToken = 'abc123'

  // Imports the Cloudbuild library
  const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1;

  // Instantiates a client
  const cloudbuildClient = new CloudBuildClient();

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

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

  callListWorkerPools();

listWorkerPoolsStream(request, options)

listWorkerPoolsStream(request?: protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, options?: CallOptions): Transform;

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

Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Transform

{Stream} An object stream which emits an object representing [WorkerPool] 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 listWorkerPoolsAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

locationPath(project, location)

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

Return a fully-qualified location resource name string.

Parameters
NameDescription
project string
location string
Returns
TypeDescription
string

{string} Resource name string.

matchBuildFromProjectBuildName(projectBuildName)

matchBuildFromProjectBuildName(projectBuildName: string): string | number;

Parse the build from ProjectBuild resource.

Parameter
NameDescription
projectBuildName string

A fully-qualified path representing project_build resource.

Returns
TypeDescription
string | number

{string} A string representing the build.

matchBuildFromProjectLocationBuildName(projectLocationBuildName)

matchBuildFromProjectLocationBuildName(projectLocationBuildName: string): string | number;

Parse the build from ProjectLocationBuild resource.

Parameter
NameDescription
projectLocationBuildName string

A fully-qualified path representing project_location_build resource.

Returns
TypeDescription
string | number

{string} A string representing the build.

matchKeyFromCryptoKeyName(cryptoKeyName)

matchKeyFromCryptoKeyName(cryptoKeyName: string): string | number;

Parse the key from CryptoKey resource.

Parameter
NameDescription
cryptoKeyName string

A fully-qualified path representing CryptoKey resource.

Returns
TypeDescription
string | number

{string} A string representing the key.

matchKeyringFromCryptoKeyName(cryptoKeyName)

matchKeyringFromCryptoKeyName(cryptoKeyName: string): string | number;

Parse the keyring from CryptoKey resource.

Parameter
NameDescription
cryptoKeyName string

A fully-qualified path representing CryptoKey resource.

Returns
TypeDescription
string | number

{string} A string representing the keyring.

matchLocationFromCryptoKeyName(cryptoKeyName)

matchLocationFromCryptoKeyName(cryptoKeyName: string): string | number;

Parse the location from CryptoKey resource.

Parameter
NameDescription
cryptoKeyName string

A fully-qualified path representing CryptoKey resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromLocationName(locationName)

matchLocationFromLocationName(locationName: string): string | number;

Parse the location from Location resource.

Parameter
NameDescription
locationName string

A fully-qualified path representing Location resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromProjectLocationBuildName(projectLocationBuildName)

matchLocationFromProjectLocationBuildName(projectLocationBuildName: string): string | number;

Parse the location from ProjectLocationBuild resource.

Parameter
NameDescription
projectLocationBuildName string

A fully-qualified path representing project_location_build resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromProjectLocationTriggerName(projectLocationTriggerName)

matchLocationFromProjectLocationTriggerName(projectLocationTriggerName: string): string | number;

Parse the location from ProjectLocationTrigger resource.

Parameter
NameDescription
projectLocationTriggerName string

A fully-qualified path representing project_location_trigger resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromWorkerPoolName(workerPoolName)

matchLocationFromWorkerPoolName(workerPoolName: string): string | number;

Parse the location from WorkerPool resource.

Parameter
NameDescription
workerPoolName string

A fully-qualified path representing WorkerPool resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchProjectFromCryptoKeyName(cryptoKeyName)

matchProjectFromCryptoKeyName(cryptoKeyName: string): string | number;

Parse the project from CryptoKey resource.

Parameter
NameDescription
cryptoKeyName string

A fully-qualified path representing CryptoKey resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromLocationName(locationName)

matchProjectFromLocationName(locationName: string): string | number;

Parse the project from Location resource.

Parameter
NameDescription
locationName string

A fully-qualified path representing Location resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromProjectBuildName(projectBuildName)

matchProjectFromProjectBuildName(projectBuildName: string): string | number;

Parse the project from ProjectBuild resource.

Parameter
NameDescription
projectBuildName string

A fully-qualified path representing project_build resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromProjectLocationBuildName(projectLocationBuildName)

matchProjectFromProjectLocationBuildName(projectLocationBuildName: string): string | number;

Parse the project from ProjectLocationBuild resource.

Parameter
NameDescription
projectLocationBuildName string

A fully-qualified path representing project_location_build resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromProjectLocationTriggerName(projectLocationTriggerName)

matchProjectFromProjectLocationTriggerName(projectLocationTriggerName: string): string | number;

Parse the project from ProjectLocationTrigger resource.

Parameter
NameDescription
projectLocationTriggerName string

A fully-qualified path representing project_location_trigger resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromProjectName(projectName)

matchProjectFromProjectName(projectName: string): string | number;

Parse the project from Project resource.

Parameter
NameDescription
projectName string

A fully-qualified path representing Project resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromProjectTriggerName(projectTriggerName)

matchProjectFromProjectTriggerName(projectTriggerName: string): string | number;

Parse the project from ProjectTrigger resource.

Parameter
NameDescription
projectTriggerName string

A fully-qualified path representing project_trigger resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromSecretVersionName(secretVersionName)

matchProjectFromSecretVersionName(secretVersionName: string): string | number;

Parse the project from SecretVersion resource.

Parameter
NameDescription
secretVersionName string

A fully-qualified path representing SecretVersion resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromServiceAccountName(serviceAccountName)

matchProjectFromServiceAccountName(serviceAccountName: string): string | number;

Parse the project from ServiceAccount resource.

Parameter
NameDescription
serviceAccountName string

A fully-qualified path representing ServiceAccount resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromSubscriptionName(subscriptionName)

matchProjectFromSubscriptionName(subscriptionName: string): string | number;

Parse the project from Subscription resource.

Parameter
NameDescription
subscriptionName string

A fully-qualified path representing Subscription resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromTopicName(topicName)

matchProjectFromTopicName(topicName: string): string | number;

Parse the project from Topic resource.

Parameter
NameDescription
topicName string

A fully-qualified path representing Topic resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromWorkerPoolName(workerPoolName)

matchProjectFromWorkerPoolName(workerPoolName: string): string | number;

Parse the project from WorkerPool resource.

Parameter
NameDescription
workerPoolName string

A fully-qualified path representing WorkerPool resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchSecretFromSecretVersionName(secretVersionName)

matchSecretFromSecretVersionName(secretVersionName: string): string | number;

Parse the secret from SecretVersion resource.

Parameter
NameDescription
secretVersionName string

A fully-qualified path representing SecretVersion resource.

Returns
TypeDescription
string | number

{string} A string representing the secret.

matchServiceAccountFromServiceAccountName(serviceAccountName)

matchServiceAccountFromServiceAccountName(serviceAccountName: string): string | number;

Parse the service_account from ServiceAccount resource.

Parameter
NameDescription
serviceAccountName string

A fully-qualified path representing ServiceAccount resource.

Returns
TypeDescription
string | number

{string} A string representing the service_account.

matchSubscriptionFromSubscriptionName(subscriptionName)

matchSubscriptionFromSubscriptionName(subscriptionName: string): string | number;

Parse the subscription from Subscription resource.

Parameter
NameDescription
subscriptionName string

A fully-qualified path representing Subscription resource.

Returns
TypeDescription
string | number

{string} A string representing the subscription.

matchTopicFromTopicName(topicName)

matchTopicFromTopicName(topicName: string): string | number;

Parse the topic from Topic resource.

Parameter
NameDescription
topicName string

A fully-qualified path representing Topic resource.

Returns
TypeDescription
string | number

{string} A string representing the topic.

matchTriggerFromProjectLocationTriggerName(projectLocationTriggerName)

matchTriggerFromProjectLocationTriggerName(projectLocationTriggerName: string): string | number;

Parse the trigger from ProjectLocationTrigger resource.

Parameter
NameDescription
projectLocationTriggerName string

A fully-qualified path representing project_location_trigger resource.

Returns
TypeDescription
string | number

{string} A string representing the trigger.

matchTriggerFromProjectTriggerName(projectTriggerName)

matchTriggerFromProjectTriggerName(projectTriggerName: string): string | number;

Parse the trigger from ProjectTrigger resource.

Parameter
NameDescription
projectTriggerName string

A fully-qualified path representing project_trigger resource.

Returns
TypeDescription
string | number

{string} A string representing the trigger.

matchVersionFromSecretVersionName(secretVersionName)

matchVersionFromSecretVersionName(secretVersionName: string): string | number;

Parse the version from SecretVersion resource.

Parameter
NameDescription
secretVersionName string

A fully-qualified path representing SecretVersion resource.

Returns
TypeDescription
string | number

{string} A string representing the version.

matchWorkerPoolFromWorkerPoolName(workerPoolName)

matchWorkerPoolFromWorkerPoolName(workerPoolName: string): string | number;

Parse the worker_pool from WorkerPool resource.

Parameter
NameDescription
workerPoolName string

A fully-qualified path representing WorkerPool resource.

Returns
TypeDescription
string | number

{string} A string representing the worker_pool.

projectBuildPath(project, build)

projectBuildPath(project: string, build: string): string;

Return a fully-qualified projectBuild resource name string.

Parameters
NameDescription
project string
build string
Returns
TypeDescription
string

{string} Resource name string.

projectLocationBuildPath(project, location, build)

projectLocationBuildPath(project: string, location: string, build: string): string;

Return a fully-qualified projectLocationBuild resource name string.

Parameters
NameDescription
project string
location string
build string
Returns
TypeDescription
string

{string} Resource name string.

projectLocationTriggerPath(project, location, trigger)

projectLocationTriggerPath(project: string, location: string, trigger: string): string;

Return a fully-qualified projectLocationTrigger resource name string.

Parameters
NameDescription
project string
location string
trigger string
Returns
TypeDescription
string

{string} Resource name string.

projectPath(project)

projectPath(project: string): string;

Return a fully-qualified project resource name string.

Parameter
NameDescription
project string
Returns
TypeDescription
string

{string} Resource name string.

projectTriggerPath(project, trigger)

projectTriggerPath(project: string, trigger: string): string;

Return a fully-qualified projectTrigger resource name string.

Parameters
NameDescription
project string
trigger string
Returns
TypeDescription
string

{string} Resource name string.

receiveTriggerWebhook(request, options)

receiveTriggerWebhook(request?: protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest, options?: CallOptions): Promise<[protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse, (protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest | undefined), {} | undefined]>;

ReceiveTriggerWebhook [Experimental] is called when the API receives a webhook request targeted at a specific trigger.

Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse, (protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest | undefined), {} | undefined]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [ReceiveTriggerWebhookResponse]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The name of the `ReceiveTriggerWebhook` to retrieve.
   *  Format: `projects/{project}/locations/{location}/triggers/{trigger}`
   */
  // const name = 'abc123'
  /**
   *  HTTP request body.
   */
  // const body = {}
  /**
   *  Project in which the specified trigger lives
   */
  // const projectId = 'abc123'
  /**
   *  Name of the trigger to run the payload against
   */
  // const trigger = 'abc123'
  /**
   *  Secret token used for authorization if an OAuth token isn't provided.
   */
  // const secret = 'abc123'

  // Imports the Cloudbuild library
  const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1;

  // Instantiates a client
  const cloudbuildClient = new CloudBuildClient();

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

    // Run request
    const response = await cloudbuildClient.receiveTriggerWebhook(request);
    console.log(response);
  }

  callReceiveTriggerWebhook();

receiveTriggerWebhook(request, options, callback)

receiveTriggerWebhook(request: protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest, options: CallOptions, callback: Callback<protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse, protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest
options CallOptions
callback Callback<protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse, protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

receiveTriggerWebhook(request, callback)

receiveTriggerWebhook(request: protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest, callback: Callback<protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse, protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest
callback Callback<protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse, protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

retryBuild(request, options)

retryBuild(request?: protos.google.devtools.cloudbuild.v1.IRetryBuildRequest, options?: CallOptions): Promise<[LROperation<protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.IBuildOperationMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined]>;

Creates a new build based on the specified build.

This method creates a new build using the original build request, which may or may not result in an identical build.

For triggered builds:

* Triggered builds resolve to a precise revision; therefore a retry of a triggered build will result in a build that uses the same revision.

For non-triggered builds that specify RepoSource:

* If the original build built from the tip of a branch, the retried build will build from the tip of that branch, which may not be the same revision as the original build. * If the original build specified a commit sha or revision ID, the retried build will use the identical source.

For builds that specify StorageSource:

* If the original build pulled source from Google Cloud Storage without specifying the generation of the object, the new build will use the current object, which may be different from the original build source. * If the original build pulled source from Cloud Storage and specified the generation of the object, the new build will attempt to use the same object, which may or may not be available depending on the bucket's lifecycle management settings.

Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IRetryBuildRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[LROperation<protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.IBuildOperationMetadata>, 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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The name of the `Build` to retry.
   *  Format: `projects/{project}/locations/{location}/builds/{build}`
   */
  // const name = 'abc123'
  /**
   *  Required. ID of the project.
   */
  // const projectId = 'abc123'
  /**
   *  Required. Build ID of the original build.
   */
  // const id = 'abc123'

  // Imports the Cloudbuild library
  const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1;

  // Instantiates a client
  const cloudbuildClient = new CloudBuildClient();

  async function callRetryBuild() {
    // Construct request
    const request = {
      projectId,
      id,
    };

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

  callRetryBuild();

retryBuild(request, options, callback)

retryBuild(request: protos.google.devtools.cloudbuild.v1.IRetryBuildRequest, options: CallOptions, callback: Callback<LROperation<protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.IBuildOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IRetryBuildRequest
options CallOptions
callback Callback<LROperation<protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.IBuildOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

retryBuild(request, callback)

retryBuild(request: protos.google.devtools.cloudbuild.v1.IRetryBuildRequest, callback: Callback<LROperation<protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.IBuildOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IRetryBuildRequest
callback Callback<LROperation<protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.IBuildOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

runBuildTrigger(request, options)

runBuildTrigger(request?: protos.google.devtools.cloudbuild.v1.IRunBuildTriggerRequest, options?: CallOptions): Promise<[LROperation<protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.IBuildOperationMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined]>;

Runs a BuildTrigger at a particular source revision.

Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IRunBuildTriggerRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[LROperation<protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.IBuildOperationMetadata>, 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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The name of the `Trigger` to run.
   *  Format: `projects/{project}/locations/{location}/triggers/{trigger}`
   */
  // const name = 'abc123'
  /**
   *  Required. ID of the project.
   */
  // const projectId = 'abc123'
  /**
   *  Required. ID of the trigger.
   */
  // const triggerId = 'abc123'
  /**
   *  Source to build against this trigger.
   */
  // const source = {}

  // Imports the Cloudbuild library
  const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1;

  // Instantiates a client
  const cloudbuildClient = new CloudBuildClient();

  async function callRunBuildTrigger() {
    // Construct request
    const request = {
      projectId,
      triggerId,
    };

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

  callRunBuildTrigger();

runBuildTrigger(request, options, callback)

runBuildTrigger(request: protos.google.devtools.cloudbuild.v1.IRunBuildTriggerRequest, options: CallOptions, callback: Callback<LROperation<protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.IBuildOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IRunBuildTriggerRequest
options CallOptions
callback Callback<LROperation<protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.IBuildOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

runBuildTrigger(request, callback)

runBuildTrigger(request: protos.google.devtools.cloudbuild.v1.IRunBuildTriggerRequest, callback: Callback<LROperation<protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.IBuildOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IRunBuildTriggerRequest
callback Callback<LROperation<protos.google.devtools.cloudbuild.v1.IBuild, protos.google.devtools.cloudbuild.v1.IBuildOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

secretVersionPath(project, secret, version)

secretVersionPath(project: string, secret: string, version: string): string;

Return a fully-qualified secretVersion resource name string.

Parameters
NameDescription
project string
secret string
version string
Returns
TypeDescription
string

{string} Resource name string.

serviceAccountPath(project, serviceAccount)

serviceAccountPath(project: string, serviceAccount: string): string;

Return a fully-qualified serviceAccount resource name string.

Parameters
NameDescription
project string
serviceAccount string
Returns
TypeDescription
string

{string} Resource name string.

subscriptionPath(project, subscription)

subscriptionPath(project: string, subscription: string): string;

Return a fully-qualified subscription resource name string.

Parameters
NameDescription
project string
subscription string
Returns
TypeDescription
string

{string} Resource name string.

topicPath(project, topic)

topicPath(project: string, topic: string): string;

Return a fully-qualified topic resource name string.

Parameters
NameDescription
project string
topic string
Returns
TypeDescription
string

{string} Resource name string.

updateBuildTrigger(request, options)

updateBuildTrigger(request?: protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest, options?: CallOptions): Promise<[protos.google.devtools.cloudbuild.v1.IBuildTrigger, (protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest | undefined), {} | undefined]>;

Updates a BuildTrigger by its project ID and trigger ID.

This API is experimental.

Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.devtools.cloudbuild.v1.IBuildTrigger, (protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest | undefined), {} | undefined]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [BuildTrigger]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. ID of the project that owns the trigger.
   */
  // const projectId = 'abc123'
  /**
   *  Required. ID of the `BuildTrigger` to update.
   */
  // const triggerId = 'abc123'
  /**
   *  Required. `BuildTrigger` to update.
   */
  // const trigger = {}

  // Imports the Cloudbuild library
  const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1;

  // Instantiates a client
  const cloudbuildClient = new CloudBuildClient();

  async function callUpdateBuildTrigger() {
    // Construct request
    const request = {
      projectId,
      triggerId,
      trigger,
    };

    // Run request
    const response = await cloudbuildClient.updateBuildTrigger(request);
    console.log(response);
  }

  callUpdateBuildTrigger();

updateBuildTrigger(request, options, callback)

updateBuildTrigger(request: protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest, options: CallOptions, callback: Callback<protos.google.devtools.cloudbuild.v1.IBuildTrigger, protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest
options CallOptions
callback Callback<protos.google.devtools.cloudbuild.v1.IBuildTrigger, protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updateBuildTrigger(request, callback)

updateBuildTrigger(request: protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest, callback: Callback<protos.google.devtools.cloudbuild.v1.IBuildTrigger, protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest
callback Callback<protos.google.devtools.cloudbuild.v1.IBuildTrigger, protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updateWorkerPool(request, options)

updateWorkerPool(request?: protos.google.devtools.cloudbuild.v1.IUpdateWorkerPoolRequest, options?: CallOptions): Promise<[LROperation<protos.google.devtools.cloudbuild.v1.IWorkerPool, protos.google.devtools.cloudbuild.v1.IUpdateWorkerPoolOperationMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined]>;

Updates a WorkerPool.

Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IUpdateWorkerPoolRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[LROperation<protos.google.devtools.cloudbuild.v1.IWorkerPool, protos.google.devtools.cloudbuild.v1.IUpdateWorkerPoolOperationMetadata>, 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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The `WorkerPool` to update.
   *  The `name` field is used to identify the `WorkerPool` to update.
   *  Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`.
   */
  // const workerPool = {}
  /**
   *  A mask specifying which fields in `worker_pool` to update.
   */
  // const updateMask = {}
  /**
   *  If set, validate the request and preview the response, but do not actually
   *  post it.
   */
  // const validateOnly = true

  // Imports the Cloudbuild library
  const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1;

  // Instantiates a client
  const cloudbuildClient = new CloudBuildClient();

  async function callUpdateWorkerPool() {
    // Construct request
    const request = {
      workerPool,
    };

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

  callUpdateWorkerPool();

updateWorkerPool(request, options, callback)

updateWorkerPool(request: protos.google.devtools.cloudbuild.v1.IUpdateWorkerPoolRequest, options: CallOptions, callback: Callback<LROperation<protos.google.devtools.cloudbuild.v1.IWorkerPool, protos.google.devtools.cloudbuild.v1.IUpdateWorkerPoolOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IUpdateWorkerPoolRequest
options CallOptions
callback Callback<LROperation<protos.google.devtools.cloudbuild.v1.IWorkerPool, protos.google.devtools.cloudbuild.v1.IUpdateWorkerPoolOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updateWorkerPool(request, callback)

updateWorkerPool(request: protos.google.devtools.cloudbuild.v1.IUpdateWorkerPoolRequest, callback: Callback<LROperation<protos.google.devtools.cloudbuild.v1.IWorkerPool, protos.google.devtools.cloudbuild.v1.IUpdateWorkerPoolOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.devtools.cloudbuild.v1.IUpdateWorkerPoolRequest
callback Callback<LROperation<protos.google.devtools.cloudbuild.v1.IWorkerPool, protos.google.devtools.cloudbuild.v1.IUpdateWorkerPoolOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

workerPoolPath(project, location, workerPool)

workerPoolPath(project: string, location: string, workerPool: string): string;

Return a fully-qualified workerPool resource name string.

Parameters
NameDescription
project string
location string
workerPool string
Returns
TypeDescription
string

{string} Resource name string.