class Google::Cloud::Build::V1::CloudBuild::Client

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.

Attributes

cloud_build_stub[R]

@private

operations_client[R]

Get the associated client for long-running operations.

@return [::Google::Cloud::Build::V1::CloudBuild::Operations]

Public Class Methods

configure() { |configure| ... } click to toggle source

Configure the CloudBuild Client class.

See {::Google::Cloud::Build::V1::CloudBuild::Client::Configuration} for a description of the configuration fields.

@example

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

@yield [config] Configure the Client client. @yieldparam config [Client::Configuration]

@return [Client::Configuration]

# 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
new() { |config| ... } click to toggle source

Create a new CloudBuild client object.

@example

# 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

@yield [config] Configure the CloudBuild client. @yieldparam config [Client::Configuration]

# 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

Public Instance Methods

approve_build(request, options = nil) { |response, operation| ... } click to toggle source

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.

@overload approve_build(request, options = nil)

Pass arguments to `approve_build` via a request object, either of type
{::Google::Cloud::Build::V1::ApproveBuildRequest} or an equivalent Hash.

@param 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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload approve_build(name: nil, approval_result: nil)

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

@param name [::String]
  Required. Name of the target build.
  For example: "projects/\\{$project_id}/builds/\\{$build_id}"
@param approval_result [::Google::Cloud::Build::V1::ApprovalResult, ::Hash]
  Approval decision and metadata.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::Operation] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Gapic::Operation]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# 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
  metadata = @config.rpcs.approve_build.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"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
  metadata[:"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("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

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

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         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) { |response, operation| ... } click to toggle source

Cancels a build in progress.

@overload cancel_build(request, options = nil)

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

@param 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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload cancel_build(name: nil, project_id: nil, id: nil)

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

@param name [::String]
  The name of the `Build` to cancel.
  Format: `projects/{project}/locations/{location}/builds/{build}`
@param project_id [::String]
  Required. ID of the project.
@param id [::String]
  Required. ID of the build.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Build::V1::Build] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Google::Cloud::Build::V1::Build]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# 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
  metadata = @config.rpcs.cancel_build.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"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
  metadata[:"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("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

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

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         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| ... } click to toggle source

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 {Client.configure}.

See {::Google::Cloud::Build::V1::CloudBuild::Client::Configuration} for a description of the configuration fields.

@yield [config] Configure the Client client. @yieldparam config [Client::Configuration]

@return [Client::Configuration]

# 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) { |response, operation| ... } click to toggle source

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

@overload create_build(request, options = nil)

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

@param 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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload create_build(parent: nil, project_id: nil, build: nil)

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

@param parent [::String]
  The parent resource where this build will be created.
  Format: `projects/{project}/locations/{location}`
@param project_id [::String]
  Required. ID of the project.
@param build [::Google::Cloud::Build::V1::Build, ::Hash]
  Required. Build resource to create.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::Operation] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Gapic::Operation]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# 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
  metadata = @config.rpcs.create_build.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"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
  metadata[:"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("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

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

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         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) { |response, operation| ... } click to toggle source

Creates a new `BuildTrigger`.

This API is experimental.

@overload create_build_trigger(request, options = nil)

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

@param 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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload create_build_trigger(parent: nil, project_id: nil, trigger: nil)

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

@param parent [::String]
  The parent resource where this trigger will be created.
  Format: `projects/{project}/locations/{location}`
@param project_id [::String]
  Required. ID of the project for which to configure automatic builds.
@param trigger [::Google::Cloud::Build::V1::BuildTrigger, ::Hash]
  Required. `BuildTrigger` to create.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Build::V1::BuildTrigger] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Google::Cloud::Build::V1::BuildTrigger]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# 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
  metadata = @config.rpcs.create_build_trigger.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"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
  metadata[:"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("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

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

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         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) { |response, operation| ... } click to toggle source

Creates a `WorkerPool`.

@overload create_worker_pool(request, options = nil)

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

@param 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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload create_worker_pool(parent: nil, worker_pool: nil, worker_pool_id: nil, validate_only: nil)

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

@param parent [::String]
  Required. The parent resource where this worker pool will be created.
  Format: `projects/{project}/locations/{location}`.
@param worker_pool [::Google::Cloud::Build::V1::WorkerPool, ::Hash]
  Required. `WorkerPool` resource to create.
@param worker_pool_id [::String]
  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]-/.
@param validate_only [::Boolean]
  If set, validate the request and preview the response, but do not actually
  post it.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::Operation] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Gapic::Operation]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# 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
  metadata = @config.rpcs.create_worker_pool.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"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
  metadata[:"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("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

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

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         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) { |response, operation| ... } click to toggle source

Deletes a `BuildTrigger` by its project ID and trigger ID.

This API is experimental.

@overload delete_build_trigger(request, options = nil)

Pass arguments to `delete_build_trigger` via a request object, either of type
{::Google::Cloud::Build::V1::DeleteBuildTriggerRequest} or an equivalent Hash.

@param 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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload delete_build_trigger(name: nil, project_id: nil, trigger_id: nil)

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

@param name [::String]
  The name of the `Trigger` to delete.
  Format: `projects/{project}/locations/{location}/triggers/{trigger}`
@param project_id [::String]
  Required. ID of the project that owns the trigger.
@param trigger_id [::String]
  Required. ID of the `BuildTrigger` to delete.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Protobuf::Empty] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Google::Protobuf::Empty]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# 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
  metadata = @config.rpcs.delete_build_trigger.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"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
  metadata[:"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("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

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

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         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) { |response, operation| ... } click to toggle source

Deletes a `WorkerPool`.

@overload delete_worker_pool(request, options = nil)

Pass arguments to `delete_worker_pool` via a request object, either of type
{::Google::Cloud::Build::V1::DeleteWorkerPoolRequest} or an equivalent Hash.

@param 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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload delete_worker_pool(name: nil, etag: nil, allow_missing: nil, validate_only: nil)

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

@param name [::String]
  Required. The name of the `WorkerPool` to delete.
  Format:
  `projects/{project}/locations/{workerPool}/workerPools/{workerPool}`.
@param etag [::String]
  Optional. If this is provided, it must match the server's etag on the
  workerpool for the request to be processed.
@param allow_missing [::Boolean]
  If set to true, and the `WorkerPool` is not found, the request will succeed
  but no action will be taken on the server.
@param validate_only [::Boolean]
  If set, validate the request and preview the response, but do not actually
  post it.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::Operation] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Gapic::Operation]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# 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
  metadata = @config.rpcs.delete_worker_pool.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"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
  metadata[:"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("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

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

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         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) { |response, operation| ... } click to toggle source

Returns information about a previously requested build.

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

@overload get_build(request, options = nil)

Pass arguments to `get_build` via a request object, either of type
{::Google::Cloud::Build::V1::GetBuildRequest} or an equivalent Hash.

@param 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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload get_build(name: nil, project_id: nil, id: nil)

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

@param name [::String]
  The name of the `Build` to retrieve.
  Format: `projects/{project}/locations/{location}/builds/{build}`
@param project_id [::String]
  Required. ID of the project.
@param id [::String]
  Required. ID of the build.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Build::V1::Build] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Google::Cloud::Build::V1::Build]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# 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
  metadata = @config.rpcs.get_build.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"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
  metadata[:"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("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

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

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         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) { |response, operation| ... } click to toggle source

Returns information about a `BuildTrigger`.

This API is experimental.

@overload get_build_trigger(request, options = nil)

Pass arguments to `get_build_trigger` via a request object, either of type
{::Google::Cloud::Build::V1::GetBuildTriggerRequest} or an equivalent Hash.

@param 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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload get_build_trigger(name: nil, project_id: nil, trigger_id: nil)

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

@param name [::String]
  The name of the `Trigger` to retrieve.
  Format: `projects/{project}/locations/{location}/triggers/{trigger}`
@param project_id [::String]
  Required. ID of the project that owns the trigger.
@param trigger_id [::String]
  Required. Identifier (`id` or `name`) of the `BuildTrigger` to get.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Build::V1::BuildTrigger] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Google::Cloud::Build::V1::BuildTrigger]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# 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
  metadata = @config.rpcs.get_build_trigger.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"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
  metadata[:"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("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

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

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         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) { |response, operation| ... } click to toggle source

Returns details of a `WorkerPool`.

@overload get_worker_pool(request, options = nil)

Pass arguments to `get_worker_pool` via a request object, either of type
{::Google::Cloud::Build::V1::GetWorkerPoolRequest} or an equivalent Hash.

@param 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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload get_worker_pool(name: nil)

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

@param name [::String]
  Required. The name of the `WorkerPool` to retrieve.
  Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Build::V1::WorkerPool] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Google::Cloud::Build::V1::WorkerPool]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# 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
  metadata = @config.rpcs.get_worker_pool.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"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
  metadata[:"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("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

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

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         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) { |response, operation| ... } click to toggle source

Lists existing `BuildTrigger`s.

This API is experimental.

@overload list_build_triggers(request, options = nil)

Pass arguments to `list_build_triggers` via a request object, either of type
{::Google::Cloud::Build::V1::ListBuildTriggersRequest} or an equivalent Hash.

@param 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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload list_build_triggers(parent: nil, project_id: nil, page_size: nil, page_token: nil)

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

@param parent [::String]
  The parent of the collection of `Triggers`.
  Format: `projects/{project}/locations/{location}`
@param project_id [::String]
  Required. ID of the project for which to list BuildTriggers.
@param page_size [::Integer]
  Number of results to return in the list.
@param page_token [::String]
  Token to provide to skip to a particular spot in the list.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Build::V1::BuildTrigger>] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Gapic::PagedEnumerable<::Google::Cloud::Build::V1::BuildTrigger>]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# 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
  metadata = @config.rpcs.list_build_triggers.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"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
  metadata[:"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("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

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

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         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) { |response, operation| ... } click to toggle source

Lists previously requested builds.

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

@overload list_builds(request, options = nil)

Pass arguments to `list_builds` via a request object, either of type
{::Google::Cloud::Build::V1::ListBuildsRequest} or an equivalent Hash.

@param 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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload list_builds(parent: nil, project_id: nil, page_size: nil, page_token: nil, filter: nil)

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

@param parent [::String]
  The parent of the collection of `Builds`.
  Format: `projects/{project}/locations/location`
@param project_id [::String]
  Required. ID of the project.
@param page_size [::Integer]
  Number of results to return in the list.
@param page_token [::String]
  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.
@param filter [::String]
  The raw filter text to constrain the results.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Build::V1::Build>] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Gapic::PagedEnumerable<::Google::Cloud::Build::V1::Build>]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# 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
  metadata = @config.rpcs.list_builds.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"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
  metadata[:"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("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

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

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         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) { |response, operation| ... } click to toggle source

Lists `WorkerPool`s.

@overload list_worker_pools(request, options = nil)

Pass arguments to `list_worker_pools` via a request object, either of type
{::Google::Cloud::Build::V1::ListWorkerPoolsRequest} or an equivalent Hash.

@param 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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload list_worker_pools(parent: nil, page_size: nil, page_token: nil)

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

@param parent [::String]
  Required. The parent of the collection of `WorkerPools`.
  Format: `projects/{project}/locations/{location}`.
@param page_size [::Integer]
  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.
@param page_token [::String]
  A page token, received from a previous `ListWorkerPools` call. Provide this
  to retrieve the subsequent page.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Build::V1::WorkerPool>] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Gapic::PagedEnumerable<::Google::Cloud::Build::V1::WorkerPool>]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# 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
  metadata = @config.rpcs.list_worker_pools.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"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
  metadata[:"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("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

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

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         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) { |response, operation| ... } click to toggle source

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

@overload receive_trigger_webhook(request, options = nil)

Pass arguments to `receive_trigger_webhook` via a request object, either of type
{::Google::Cloud::Build::V1::ReceiveTriggerWebhookRequest} or an equivalent Hash.

@param 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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload receive_trigger_webhook(name: nil, body: nil, project_id: nil, trigger: nil, secret: nil)

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

@param name [::String]
  The name of the `ReceiveTriggerWebhook` to retrieve.
  Format: `projects/{project}/locations/{location}/triggers/{trigger}`
@param body [::Google::Api::HttpBody, ::Hash]
  HTTP request body.
@param project_id [::String]
  Project in which the specified trigger lives
@param trigger [::String]
  Name of the trigger to run the payload against
@param secret [::String]
  Secret token used for authorization if an OAuth token isn't provided.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Build::V1::ReceiveTriggerWebhookResponse] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Google::Cloud::Build::V1::ReceiveTriggerWebhookResponse]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# 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
  metadata = @config.rpcs.receive_trigger_webhook.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"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
  metadata[:"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("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

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

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         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) { |response, operation| ... } click to toggle source

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.

@overload retry_build(request, options = nil)

Pass arguments to `retry_build` via a request object, either of type
{::Google::Cloud::Build::V1::RetryBuildRequest} or an equivalent Hash.

@param 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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload retry_build(name: nil, project_id: nil, id: nil)

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

@param name [::String]
  The name of the `Build` to retry.
  Format: `projects/{project}/locations/{location}/builds/{build}`
@param project_id [::String]
  Required. ID of the project.
@param id [::String]
  Required. Build ID of the original build.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::Operation] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Gapic::Operation]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# 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
  metadata = @config.rpcs.retry_build.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"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
  metadata[:"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("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

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

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         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) { |response, operation| ... } click to toggle source

Runs a `BuildTrigger` at a particular source revision.

@overload run_build_trigger(request, options = nil)

Pass arguments to `run_build_trigger` via a request object, either of type
{::Google::Cloud::Build::V1::RunBuildTriggerRequest} or an equivalent Hash.

@param 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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload run_build_trigger(name: nil, project_id: nil, trigger_id: nil, source: nil)

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

@param name [::String]
  The name of the `Trigger` to run.
  Format: `projects/{project}/locations/{location}/triggers/{trigger}`
@param project_id [::String]
  Required. ID of the project.
@param trigger_id [::String]
  Required. ID of the trigger.
@param source [::Google::Cloud::Build::V1::RepoSource, ::Hash]
  Source to build against this trigger.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::Operation] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Gapic::Operation]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# 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
  metadata = @config.rpcs.run_build_trigger.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"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
  metadata[:"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("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

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

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         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) { |response, operation| ... } click to toggle source

Updates a `BuildTrigger` by its project ID and trigger ID.

This API is experimental.

@overload update_build_trigger(request, options = nil)

Pass arguments to `update_build_trigger` via a request object, either of type
{::Google::Cloud::Build::V1::UpdateBuildTriggerRequest} or an equivalent Hash.

@param 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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload update_build_trigger(project_id: nil, trigger_id: nil, trigger: nil)

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

@param project_id [::String]
  Required. ID of the project that owns the trigger.
@param trigger_id [::String]
  Required. ID of the `BuildTrigger` to update.
@param trigger [::Google::Cloud::Build::V1::BuildTrigger, ::Hash]
  Required. `BuildTrigger` to update.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Build::V1::BuildTrigger] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Google::Cloud::Build::V1::BuildTrigger]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# 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
  metadata = @config.rpcs.update_build_trigger.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"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
  metadata[:"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("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

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

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         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) { |response, operation| ... } click to toggle source

Updates a `WorkerPool`.

@overload update_worker_pool(request, options = nil)

Pass arguments to `update_worker_pool` via a request object, either of type
{::Google::Cloud::Build::V1::UpdateWorkerPoolRequest} or an equivalent Hash.

@param 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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload update_worker_pool(worker_pool: nil, update_mask: nil, validate_only: nil)

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

@param worker_pool [::Google::Cloud::Build::V1::WorkerPool, ::Hash]
  Required. The `WorkerPool` to update.

  The `name` field is used to identify the `WorkerPool` to update.
  Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`.
@param update_mask [::Google::Protobuf::FieldMask, ::Hash]
  A mask specifying which fields in `worker_pool` to update.
@param validate_only [::Boolean]
  If set, validate the request and preview the response, but do not actually
  post it.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::Operation] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Gapic::Operation]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# 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
  metadata = @config.rpcs.update_worker_pool.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"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
  metadata[:"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("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

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

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         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