Class: Google::Cloud::Build::V1::CloudBuild::Client

Inherits:
Object
  • Object
show all
Includes:
Paths
Defined in:
lib/google/cloud/build/v1/cloud_build/client.rb

Overview

Client for the CloudBuild service.

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.

Defined Under Namespace

Classes: Configuration

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Paths

#build_path, #build_trigger_path, #crypto_key_path, #location_path, #network_path, #project_path, #secret_version_path, #service_account_path, #subscription_path, #topic_path, #worker_pool_path

Constructor Details

#initialize {|config| ... } ⇒ Client

Create a new CloudBuild client object.

Examples:


# Create a client using the default configuration
client = ::Google::Cloud::Build::V1::CloudBuild::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::Build::V1::CloudBuild::Client.new do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the CloudBuild client.

Yield Parameters:



169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 169

def initialize
  # These require statements are intentionally placed here to initialize
  # the gRPC module only when it's required.
  # See https://github.com/googleapis/toolkit/issues/446
  require "gapic/grpc"
  require "google/devtools/cloudbuild/v1/cloudbuild_services_pb"

  # Create the configuration object
  @config = Configuration.new Client.configure

  # Yield the configuration if needed
  yield @config if block_given?

  # Create credentials
  credentials = @config.credentials
  # Use self-signed JWT if the endpoint is unchanged from default,
  # but only if the default endpoint does not have a region prefix.
  enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
                           !@config.endpoint.split(".").first.include?("-")
  credentials ||= Credentials.default scope: @config.scope,
                                      enable_self_signed_jwt: enable_self_signed_jwt
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
    credentials = Credentials.new credentials, scope: @config.scope
  end
  @quota_project_id = @config.quota_project
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id

  @operations_client = Operations.new do |config|
    config.credentials = credentials
    config.endpoint = @config.endpoint
  end

  @cloud_build_stub = ::Gapic::ServiceStub.new(
    ::Google::Cloud::Build::V1::CloudBuild::Stub,
    credentials:  credentials,
    endpoint:     @config.endpoint,
    channel_args: @config.channel_args,
    interceptors: @config.interceptors
  )
end

Instance Attribute Details

#operations_client::Google::Cloud::Build::V1::CloudBuild::Operations (readonly)

Get the associated client for long-running operations.



215
216
217
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 215

def operations_client
  @operations_client
end

Class Method Details

.configure {|config| ... } ⇒ Client::Configuration

Configure the CloudBuild Client class.

See Configuration for a description of the configuration fields.

Examples:


# Modify the configuration for all CloudBuild clients
::Google::Cloud::Build::V1::CloudBuild::Client.configure do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 63

def self.configure
  @configure ||= begin
    namespace = ["Google", "Cloud", "Build", "V1"]
    parent_config = while namespace.any?
                      parent_name = namespace.join "::"
                      parent_const = const_get parent_name
                      break parent_const.configure if parent_const.respond_to? :configure
                      namespace.pop
                    end
    default_config = Client::Configuration.new parent_config

    default_config.rpcs.create_build.timeout = 600.0

    default_config.rpcs.get_build.timeout = 600.0
    default_config.rpcs.get_build.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
    }

    default_config.rpcs.list_builds.timeout = 600.0
    default_config.rpcs.list_builds.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
    }

    default_config.rpcs.cancel_build.timeout = 600.0

    default_config.rpcs.retry_build.timeout = 600.0

    default_config.rpcs.create_build_trigger.timeout = 600.0

    default_config.rpcs.get_build_trigger.timeout = 600.0
    default_config.rpcs.get_build_trigger.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
    }

    default_config.rpcs.list_build_triggers.timeout = 600.0
    default_config.rpcs.list_build_triggers.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
    }

    default_config.rpcs.delete_build_trigger.timeout = 600.0
    default_config.rpcs.delete_build_trigger.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
    }

    default_config.rpcs.update_build_trigger.timeout = 600.0

    default_config.rpcs.run_build_trigger.timeout = 600.0

    default_config.rpcs.create_worker_pool.timeout = 600.0

    default_config.rpcs.get_worker_pool.timeout = 600.0
    default_config.rpcs.get_worker_pool.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
    }

    default_config.rpcs.delete_worker_pool.timeout = 600.0

    default_config.rpcs.update_worker_pool.timeout = 600.0

    default_config.rpcs.list_worker_pools.timeout = 600.0
    default_config.rpcs.list_worker_pools.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
    }

    default_config
  end
  yield @configure if block_given?
  @configure
end

Instance Method Details

#approve_build(request, options = nil) ⇒ ::Gapic::Operation #approve_build(name: nil, approval_result: nil) ⇒ ::Gapic::Operation

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.

Overloads:

  • #approve_build(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to approve_build via a request object, either of type ApproveBuildRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Build::V1::ApproveBuildRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #approve_build(name: nil, approval_result: nil) ⇒ ::Gapic::Operation

    Pass arguments to approve_build via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. Name of the target build. For example: "projects/{$project_id}/builds/{$build_id}"

    • approval_result (::Google::Cloud::Build::V1::ApprovalResult, ::Hash) (defaults to: nil)

      Approval decision and metadata.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 675

def approve_build request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::ApproveBuildRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.approve_build..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Build::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.approve_build.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.approve_build.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @cloud_build_stub.call_rpc :approve_build, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#cancel_build(request, options = nil) ⇒ ::Google::Cloud::Build::V1::Build #cancel_build(name: nil, project_id: nil, id: nil) ⇒ ::Google::Cloud::Build::V1::Build

Cancels a build in progress.

Overloads:

  • #cancel_build(request, options = nil) ⇒ ::Google::Cloud::Build::V1::Build

    Pass arguments to cancel_build via a request object, either of type Google::Cloud::Build::V1::CancelBuildRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Build::V1::CancelBuildRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #cancel_build(name: nil, project_id: nil, id: nil) ⇒ ::Google::Cloud::Build::V1::Build

    Pass arguments to cancel_build via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      The name of the Build to cancel. Format: projects/{project}/locations/{location}/builds/{build}

    • project_id (::String) (defaults to: nil)

      Required. ID of the project.

    • id (::String) (defaults to: nil)

      Required. ID of the build.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 497

def cancel_build request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::CancelBuildRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.cancel_build..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Build::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "project_id" => request.project_id,
    "id" => request.id
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.cancel_build.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.cancel_build.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @cloud_build_stub.call_rpc :cancel_build, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#configure {|config| ... } ⇒ Client::Configuration

Configure the CloudBuild Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on configure.

See Configuration for a description of the configuration fields.

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



148
149
150
151
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 148

def configure
  yield @config if block_given?
  @config
end

#create_build(request, options = nil) ⇒ ::Gapic::Operation #create_build(parent: nil, project_id: nil, build: nil) ⇒ ::Gapic::Operation

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).

Overloads:

  • #create_build(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to create_build via a request object, either of type Google::Cloud::Build::V1::CreateBuildRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Build::V1::CreateBuildRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #create_build(parent: nil, project_id: nil, build: nil) ⇒ ::Gapic::Operation

    Pass arguments to create_build via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      The parent resource where this build will be created. Format: projects/{project}/locations/{location}

    • project_id (::String) (defaults to: nil)

      Required. ID of the project.

    • build (::Google::Cloud::Build::V1::Build, ::Hash) (defaults to: nil)

      Required. Build resource to create.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 257

def create_build request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::CreateBuildRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.create_build..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Build::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "project_id" => request.project_id
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.create_build.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_build.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @cloud_build_stub.call_rpc :create_build, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#create_build_trigger(request, options = nil) ⇒ ::Google::Cloud::Build::V1::BuildTrigger #create_build_trigger(parent: nil, project_id: nil, trigger: nil) ⇒ ::Google::Cloud::Build::V1::BuildTrigger

Creates a new BuildTrigger.

This API is experimental.

Overloads:

  • #create_build_trigger(request, options = nil) ⇒ ::Google::Cloud::Build::V1::BuildTrigger

    Pass arguments to create_build_trigger via a request object, either of type Google::Cloud::Build::V1::CreateBuildTriggerRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Build::V1::CreateBuildTriggerRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #create_build_trigger(parent: nil, project_id: nil, trigger: nil) ⇒ ::Google::Cloud::Build::V1::BuildTrigger

    Pass arguments to create_build_trigger via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      The parent resource where this trigger will be created. Format: projects/{project}/locations/{location}

    • project_id (::String) (defaults to: nil)

      Required. ID of the project for which to configure automatic builds.

    • trigger (::Google::Cloud::Build::V1::BuildTrigger, ::Hash) (defaults to: nil)

      Required. BuildTrigger to create.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 751

def create_build_trigger request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::CreateBuildTriggerRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.create_build_trigger..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Build::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "project_id" => request.project_id
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.create_build_trigger.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_build_trigger.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @cloud_build_stub.call_rpc :create_build_trigger, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#create_worker_pool(request, options = nil) ⇒ ::Gapic::Operation #create_worker_pool(parent: nil, worker_pool: nil, worker_pool_id: nil, validate_only: nil) ⇒ ::Gapic::Operation

Creates a WorkerPool.

Overloads:

  • #create_worker_pool(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to create_worker_pool via a request object, either of type Google::Cloud::Build::V1::CreateWorkerPoolRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Build::V1::CreateWorkerPoolRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #create_worker_pool(parent: nil, worker_pool: nil, worker_pool_id: nil, validate_only: nil) ⇒ ::Gapic::Operation

    Pass arguments to create_worker_pool via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The parent resource where this worker pool will be created. Format: projects/{project}/locations/{location}.

    • worker_pool (::Google::Cloud::Build::V1::WorkerPool, ::Hash) (defaults to: nil)

      Required. WorkerPool resource to create.

    • worker_pool_id (::String) (defaults to: nil)

      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]-/.

    • validate_only (::Boolean) (defaults to: nil)

      If set, validate the request and preview the response, but do not actually post it.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 1292

def create_worker_pool request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::CreateWorkerPoolRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.create_worker_pool..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Build::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "parent" => request.parent
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.create_worker_pool.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_worker_pool.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @cloud_build_stub.call_rpc :create_worker_pool, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_build_trigger(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_build_trigger(name: nil, project_id: nil, trigger_id: nil) ⇒ ::Google::Protobuf::Empty

Deletes a BuildTrigger by its project ID and trigger ID.

This API is experimental.

Overloads:

  • #delete_build_trigger(request, options = nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_build_trigger via a request object, either of type DeleteBuildTriggerRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Build::V1::DeleteBuildTriggerRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #delete_build_trigger(name: nil, project_id: nil, trigger_id: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_build_trigger via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      The name of the Trigger to delete. Format: projects/{project}/locations/{location}/triggers/{trigger}

    • project_id (::String) (defaults to: nil)

      Required. ID of the project that owns the trigger.

    • trigger_id (::String) (defaults to: nil)

      Required. ID of the BuildTrigger to delete.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 980

def delete_build_trigger request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::DeleteBuildTriggerRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.delete_build_trigger..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Build::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "project_id" => request.project_id,
    "trigger_id" => request.trigger_id
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.delete_build_trigger.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_build_trigger.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @cloud_build_stub.call_rpc :delete_build_trigger, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_worker_pool(request, options = nil) ⇒ ::Gapic::Operation #delete_worker_pool(name: nil, etag: nil, allow_missing: nil, validate_only: nil) ⇒ ::Gapic::Operation

Deletes a WorkerPool.

Overloads:

  • #delete_worker_pool(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to delete_worker_pool via a request object, either of type DeleteWorkerPoolRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Build::V1::DeleteWorkerPoolRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #delete_worker_pool(name: nil, etag: nil, allow_missing: nil, validate_only: nil) ⇒ ::Gapic::Operation

    Pass arguments to delete_worker_pool via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the WorkerPool to delete. Format: projects/{project}/locations/{workerPool}/workerPools/{workerPool}.

    • etag (::String) (defaults to: nil)

      Optional. If this is provided, it must match the server's etag on the workerpool for the request to be processed.

    • allow_missing (::Boolean) (defaults to: nil)

      If set to true, and the WorkerPool is not found, the request will succeed but no action will be taken on the server.

    • validate_only (::Boolean) (defaults to: nil)

      If set, validate the request and preview the response, but do not actually post it.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 1441

def delete_worker_pool request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::DeleteWorkerPoolRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.delete_worker_pool..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Build::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.delete_worker_pool.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_worker_pool.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @cloud_build_stub.call_rpc :delete_worker_pool, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_build(request, options = nil) ⇒ ::Google::Cloud::Build::V1::Build #get_build(name: nil, project_id: nil, id: nil) ⇒ ::Google::Cloud::Build::V1::Build

Returns information about a previously requested build.

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

Overloads:

  • #get_build(request, options = nil) ⇒ ::Google::Cloud::Build::V1::Build

    Pass arguments to get_build via a request object, either of type GetBuildRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Build::V1::GetBuildRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_build(name: nil, project_id: nil, id: nil) ⇒ ::Google::Cloud::Build::V1::Build

    Pass arguments to get_build via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      The name of the Build to retrieve. Format: projects/{project}/locations/{location}/builds/{build}

    • project_id (::String) (defaults to: nil)

      Required. ID of the project.

    • id (::String) (defaults to: nil)

      Required. ID of the build.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 334

def get_build request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::GetBuildRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_build..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Build::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "project_id" => request.project_id,
    "id" => request.id
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_build.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_build.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @cloud_build_stub.call_rpc :get_build, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_build_trigger(request, options = nil) ⇒ ::Google::Cloud::Build::V1::BuildTrigger #get_build_trigger(name: nil, project_id: nil, trigger_id: nil) ⇒ ::Google::Cloud::Build::V1::BuildTrigger

Returns information about a BuildTrigger.

This API is experimental.

Overloads:

  • #get_build_trigger(request, options = nil) ⇒ ::Google::Cloud::Build::V1::BuildTrigger

    Pass arguments to get_build_trigger via a request object, either of type GetBuildTriggerRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Build::V1::GetBuildTriggerRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_build_trigger(name: nil, project_id: nil, trigger_id: nil) ⇒ ::Google::Cloud::Build::V1::BuildTrigger

    Pass arguments to get_build_trigger via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      The name of the Trigger to retrieve. Format: projects/{project}/locations/{location}/triggers/{trigger}

    • project_id (::String) (defaults to: nil)

      Required. ID of the project that owns the trigger.

    • trigger_id (::String) (defaults to: nil)

      Required. Identifier (id or name) of the BuildTrigger to get.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 826

def get_build_trigger request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::GetBuildTriggerRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_build_trigger..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Build::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "project_id" => request.project_id,
    "trigger_id" => request.trigger_id
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_build_trigger.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_build_trigger.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @cloud_build_stub.call_rpc :get_build_trigger, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_worker_pool(request, options = nil) ⇒ ::Google::Cloud::Build::V1::WorkerPool #get_worker_pool(name: nil) ⇒ ::Google::Cloud::Build::V1::WorkerPool

Returns details of a WorkerPool.

Overloads:

  • #get_worker_pool(request, options = nil) ⇒ ::Google::Cloud::Build::V1::WorkerPool

    Pass arguments to get_worker_pool via a request object, either of type GetWorkerPoolRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Build::V1::GetWorkerPoolRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_worker_pool(name: nil) ⇒ ::Google::Cloud::Build::V1::WorkerPool

    Pass arguments to get_worker_pool via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the WorkerPool to retrieve. Format: projects/{project}/locations/{location}/workerPools/{workerPool}.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 1362

def get_worker_pool request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::GetWorkerPoolRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_worker_pool..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Build::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_worker_pool.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_worker_pool.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @cloud_build_stub.call_rpc :get_worker_pool, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_build_triggers(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Build::V1::BuildTrigger> #list_build_triggers(parent: nil, project_id: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Build::V1::BuildTrigger>

Lists existing BuildTriggers.

This API is experimental.

Overloads:

  • #list_build_triggers(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Build::V1::BuildTrigger>

    Pass arguments to list_build_triggers via a request object, either of type ListBuildTriggersRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Build::V1::ListBuildTriggersRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_build_triggers(parent: nil, project_id: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Build::V1::BuildTrigger>

    Pass arguments to list_build_triggers via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      The parent of the collection of Triggers. Format: projects/{project}/locations/{location}

    • project_id (::String) (defaults to: nil)

      Required. ID of the project for which to list BuildTriggers.

    • page_size (::Integer) (defaults to: nil)

      Number of results to return in the list.

    • page_token (::String) (defaults to: nil)

      Token to provide to skip to a particular spot in the list.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 904

def list_build_triggers request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::ListBuildTriggersRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.list_build_triggers..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Build::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "project_id" => request.project_id
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.list_build_triggers.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_build_triggers.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @cloud_build_stub.call_rpc :list_build_triggers, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @cloud_build_stub, :list_build_triggers, request, response, operation, options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_builds(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Build::V1::Build> #list_builds(parent: nil, project_id: nil, page_size: nil, page_token: nil, filter: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Build::V1::Build>

Lists previously requested builds.

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

Overloads:

  • #list_builds(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Build::V1::Build>

    Pass arguments to list_builds via a request object, either of type ListBuildsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Build::V1::ListBuildsRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_builds(parent: nil, project_id: nil, page_size: nil, page_token: nil, filter: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Build::V1::Build>

    Pass arguments to list_builds via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      The parent of the collection of Builds. Format: projects/{project}/locations/location

    • project_id (::String) (defaults to: nil)

      Required. ID of the project.

    • page_size (::Integer) (defaults to: nil)

      Number of results to return in the list.

    • page_token (::String) (defaults to: nil)

      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.

    • filter (::String) (defaults to: nil)

      The raw filter text to constrain the results.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 423

def list_builds request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::ListBuildsRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.list_builds..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Build::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "project_id" => request.project_id
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.list_builds.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_builds.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @cloud_build_stub.call_rpc :list_builds, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @cloud_build_stub, :list_builds, request, response, operation, options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_worker_pools(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Build::V1::WorkerPool> #list_worker_pools(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Build::V1::WorkerPool>

Lists WorkerPools.

Overloads:

  • #list_worker_pools(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Build::V1::WorkerPool>

    Pass arguments to list_worker_pools via a request object, either of type ListWorkerPoolsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Build::V1::ListWorkerPoolsRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_worker_pools(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Build::V1::WorkerPool>

    Pass arguments to list_worker_pools via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The parent of the collection of WorkerPools. Format: projects/{project}/locations/{location}.

    • page_size (::Integer) (defaults to: nil)

      The maximum number of WorkerPools to return. The service may return fewer than this value. If omitted, the server will use a sensible default.

    • page_token (::String) (defaults to: nil)

      A page token, received from a previous ListWorkerPools call. Provide this to retrieve the subsequent page.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 1594

def list_worker_pools request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::ListWorkerPoolsRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.list_worker_pools..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Build::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "parent" => request.parent
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.list_worker_pools.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_worker_pools.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @cloud_build_stub.call_rpc :list_worker_pools, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @cloud_build_stub, :list_worker_pools, request, response, operation, options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#receive_trigger_webhook(request, options = nil) ⇒ ::Google::Cloud::Build::V1::ReceiveTriggerWebhookResponse #receive_trigger_webhook(name: nil, body: nil, project_id: nil, trigger: nil, secret: nil) ⇒ ::Google::Cloud::Build::V1::ReceiveTriggerWebhookResponse

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

Overloads:

  • #receive_trigger_webhook(request, options = nil) ⇒ ::Google::Cloud::Build::V1::ReceiveTriggerWebhookResponse

    Pass arguments to receive_trigger_webhook via a request object, either of type ReceiveTriggerWebhookRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Build::V1::ReceiveTriggerWebhookRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #receive_trigger_webhook(name: nil, body: nil, project_id: nil, trigger: nil, secret: nil) ⇒ ::Google::Cloud::Build::V1::ReceiveTriggerWebhookResponse

    Pass arguments to receive_trigger_webhook via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      The name of the ReceiveTriggerWebhook to retrieve. Format: projects/{project}/locations/{location}/triggers/{trigger}

    • body (::Google::Api::HttpBody, ::Hash) (defaults to: nil)

      HTTP request body.

    • project_id (::String) (defaults to: nil)

      Project in which the specified trigger lives

    • trigger (::String) (defaults to: nil)

      Name of the trigger to run the payload against

    • secret (::String) (defaults to: nil)

      Secret token used for authorization if an OAuth token isn't provided.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 1211

def receive_trigger_webhook request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::ReceiveTriggerWebhookRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.receive_trigger_webhook..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Build::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "project_id" => request.project_id,
    "trigger" => request.trigger
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.receive_trigger_webhook.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.receive_trigger_webhook.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @cloud_build_stub.call_rpc :receive_trigger_webhook, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#retry_build(request, options = nil) ⇒ ::Gapic::Operation #retry_build(name: nil, project_id: nil, id: nil) ⇒ ::Gapic::Operation

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.

Overloads:

  • #retry_build(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to retry_build via a request object, either of type RetryBuildRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Build::V1::RetryBuildRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #retry_build(name: nil, project_id: nil, id: nil) ⇒ ::Gapic::Operation

    Pass arguments to retry_build via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      The name of the Build to retry. Format: projects/{project}/locations/{location}/builds/{build}

    • project_id (::String) (defaults to: nil)

      Required. ID of the project.

    • id (::String) (defaults to: nil)

      Required. Build ID of the original build.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 597

def retry_build request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::RetryBuildRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.retry_build..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Build::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "project_id" => request.project_id,
    "id" => request.id
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.retry_build.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.retry_build.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @cloud_build_stub.call_rpc :retry_build, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#run_build_trigger(request, options = nil) ⇒ ::Gapic::Operation #run_build_trigger(name: nil, project_id: nil, trigger_id: nil, source: nil) ⇒ ::Gapic::Operation

Runs a BuildTrigger at a particular source revision.

Overloads:

  • #run_build_trigger(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to run_build_trigger via a request object, either of type RunBuildTriggerRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Build::V1::RunBuildTriggerRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #run_build_trigger(name: nil, project_id: nil, trigger_id: nil, source: nil) ⇒ ::Gapic::Operation

    Pass arguments to run_build_trigger via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      The name of the Trigger to run. Format: projects/{project}/locations/{location}/triggers/{trigger}

    • project_id (::String) (defaults to: nil)

      Required. ID of the project.

    • trigger_id (::String) (defaults to: nil)

      Required. ID of the trigger.

    • source (::Google::Cloud::Build::V1::RepoSource, ::Hash) (defaults to: nil)

      Source to build against this trigger.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 1131

def run_build_trigger request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::RunBuildTriggerRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.run_build_trigger..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Build::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "project_id" => request.project_id,
    "trigger_id" => request.trigger_id
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.run_build_trigger.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.run_build_trigger.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @cloud_build_stub.call_rpc :run_build_trigger, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#update_build_trigger(request, options = nil) ⇒ ::Google::Cloud::Build::V1::BuildTrigger #update_build_trigger(project_id: nil, trigger_id: nil, trigger: nil) ⇒ ::Google::Cloud::Build::V1::BuildTrigger

Updates a BuildTrigger by its project ID and trigger ID.

This API is experimental.

Overloads:

  • #update_build_trigger(request, options = nil) ⇒ ::Google::Cloud::Build::V1::BuildTrigger

    Pass arguments to update_build_trigger via a request object, either of type UpdateBuildTriggerRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Build::V1::UpdateBuildTriggerRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #update_build_trigger(project_id: nil, trigger_id: nil, trigger: nil) ⇒ ::Google::Cloud::Build::V1::BuildTrigger

    Pass arguments to update_build_trigger via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • project_id (::String) (defaults to: nil)

      Required. ID of the project that owns the trigger.

    • trigger_id (::String) (defaults to: nil)

      Required. ID of the BuildTrigger to update.

    • trigger (::Google::Cloud::Build::V1::BuildTrigger, ::Hash) (defaults to: nil)

      Required. BuildTrigger to update.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 1055

def update_build_trigger request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::UpdateBuildTriggerRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.update_build_trigger..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Build::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "project_id" => request.project_id,
    "trigger_id" => request.trigger_id
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.update_build_trigger.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_build_trigger.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @cloud_build_stub.call_rpc :update_build_trigger, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#update_worker_pool(request, options = nil) ⇒ ::Gapic::Operation #update_worker_pool(worker_pool: nil, update_mask: nil, validate_only: nil) ⇒ ::Gapic::Operation

Updates a WorkerPool.

Overloads:

  • #update_worker_pool(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to update_worker_pool via a request object, either of type UpdateWorkerPoolRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Build::V1::UpdateWorkerPoolRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #update_worker_pool(worker_pool: nil, update_mask: nil, validate_only: nil) ⇒ ::Gapic::Operation

    Pass arguments to update_worker_pool via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • worker_pool (::Google::Cloud::Build::V1::WorkerPool, ::Hash) (defaults to: nil)

      Required. The WorkerPool to update.

      The name field is used to identify the WorkerPool to update. Format: projects/{project}/locations/{location}/workerPools/{workerPool}.

    • update_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      A mask specifying which fields in worker_pool to update.

    • validate_only (::Boolean) (defaults to: nil)

      If set, validate the request and preview the response, but do not actually post it.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 1518

def update_worker_pool request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::UpdateWorkerPoolRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.update_worker_pool..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Build::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "worker_pool.name" => request.worker_pool.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.update_worker_pool.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_worker_pool.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @cloud_build_stub.call_rpc :update_worker_pool, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end