Class: Google::Cloud::Build::V1::CloudBuild::Client
- Inherits:
-
Object
- Object
- Google::Cloud::Build::V1::CloudBuild::Client
- 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
-
#operations_client ⇒ ::Google::Cloud::Build::V1::CloudBuild::Operations
readonly
Get the associated client for long-running operations.
Class Method Summary collapse
-
.configure {|config| ... } ⇒ Client::Configuration
Configure the CloudBuild Client class.
Instance Method Summary collapse
-
#approve_build(request, options = nil) {|response, operation| ... } ⇒ ::Gapic::Operation
Approves or rejects a pending build.
-
#cancel_build(request, options = nil) {|response, operation| ... } ⇒ ::Google::Cloud::Build::V1::Build
Cancels a build in progress.
-
#configure {|config| ... } ⇒ Client::Configuration
Configure the CloudBuild Client instance.
-
#create_build(request, options = nil) {|response, operation| ... } ⇒ ::Gapic::Operation
Starts a build with the specified configuration.
-
#create_build_trigger(request, options = nil) {|response, operation| ... } ⇒ ::Google::Cloud::Build::V1::BuildTrigger
Creates a new
BuildTrigger
. -
#create_worker_pool(request, options = nil) {|response, operation| ... } ⇒ ::Gapic::Operation
Creates a
WorkerPool
. -
#delete_build_trigger(request, options = nil) {|response, operation| ... } ⇒ ::Google::Protobuf::Empty
Deletes a
BuildTrigger
by its project ID and trigger ID. -
#delete_worker_pool(request, options = nil) {|response, operation| ... } ⇒ ::Gapic::Operation
Deletes a
WorkerPool
. -
#get_build(request, options = nil) {|response, operation| ... } ⇒ ::Google::Cloud::Build::V1::Build
Returns information about a previously requested build.
-
#get_build_trigger(request, options = nil) {|response, operation| ... } ⇒ ::Google::Cloud::Build::V1::BuildTrigger
Returns information about a
BuildTrigger
. -
#get_worker_pool(request, options = nil) {|response, operation| ... } ⇒ ::Google::Cloud::Build::V1::WorkerPool
Returns details of a
WorkerPool
. -
#initialize {|config| ... } ⇒ Client
constructor
Create a new CloudBuild client object.
-
#list_build_triggers(request, options = nil) {|response, operation| ... } ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Build::V1::BuildTrigger>
Lists existing
BuildTrigger
s. -
#list_builds(request, options = nil) {|response, operation| ... } ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Build::V1::Build>
Lists previously requested builds.
-
#list_worker_pools(request, options = nil) {|response, operation| ... } ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Build::V1::WorkerPool>
Lists
WorkerPool
s. -
#logger ⇒ Logger
The logger used for request/response debug logging.
-
#receive_trigger_webhook(request, options = nil) {|response, operation| ... } ⇒ ::Google::Cloud::Build::V1::ReceiveTriggerWebhookResponse
ReceiveTriggerWebhook [Experimental] is called when the API receives a webhook request targeted at a specific trigger.
-
#retry_build(request, options = nil) {|response, operation| ... } ⇒ ::Gapic::Operation
Creates a new build based on the specified build.
-
#run_build_trigger(request, options = nil) {|response, operation| ... } ⇒ ::Gapic::Operation
Runs a
BuildTrigger
at a particular source revision. -
#universe_domain ⇒ String
The effective universe domain.
-
#update_build_trigger(request, options = nil) {|response, operation| ... } ⇒ ::Google::Cloud::Build::V1::BuildTrigger
Updates a
BuildTrigger
by its project ID and trigger ID. -
#update_worker_pool(request, options = nil) {|response, operation| ... } ⇒ ::Gapic::Operation
Updates a
WorkerPool
.
Methods included from Paths
#build_path, #build_trigger_path, #crypto_key_path, #github_enterprise_config_path, #location_path, #network_attachment_path, #network_path, #project_path, #repository_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.
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 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 184 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.nil? || (@config.endpoint == Configuration::DEFAULT_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.quota_project = @quota_project_id config.endpoint = @config.endpoint config.universe_domain = @config.universe_domain end @cloud_build_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::Build::V1::CloudBuild::Stub, credentials: credentials, endpoint: @config.endpoint, endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, universe_domain: @config.universe_domain, channel_args: @config.channel_args, interceptors: @config.interceptors, channel_pool_config: @config.channel_pool, logger: @config.logger ) @cloud_build_stub.stub_logger&.info do |entry| entry.set_system_name entry.set_service entry. = "Created client for #{entry.service}" entry.set_credentials_fields credentials entry.set "customEndpoint", @config.endpoint if @config.endpoint entry.set "defaultTimeout", @config.timeout if @config.timeout entry.set "quotaProject", @quota_project_id if @quota_project_id end end |
Instance Attribute Details
#operations_client ⇒ ::Google::Cloud::Build::V1::CloudBuild::Operations (readonly)
Get the associated client for long-running operations.
247 248 249 |
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 247 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.
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 132 133 134 135 136 137 |
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 69 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.
856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 |
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 856 def approve_build request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.approve_build..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name regex_match = %r{^projects/[^/]+/locations/(?<location>[^/]+)/builds/[^/]+/?$}.match request.name if regex_match header_params["location"] = regex_match["location".to_s] end end request_params_header = URI.encode_www_form header_params [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.approve_build.timeout, metadata: , retry_policy: @config.rpcs.approve_build.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @cloud_build_stub.call_rpc :approve_build, request, options: do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: yield response, operation if block_given? throw :response, 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.
625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 |
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 625 def cancel_build request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.cancel_build..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name regex_match = %r{^projects/[^/]+/locations/(?<location>[^/]+)/builds/[^/]+/?$}.match request.name if regex_match header_params["location"] = regex_match["location".to_s] end end request_params_header = URI.encode_www_form header_params [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.cancel_build.timeout, metadata: , retry_policy: @config.rpcs.cancel_build.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @cloud_build_stub.call_rpc :cancel_build, request, options: do |response, operation| yield response, operation if block_given? 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.
154 155 156 157 |
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 154 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
).
320 321 322 323 324 325 326 327 328 329 330 331 332 333 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 |
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 320 def create_build request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.create_build..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.parent regex_match = %r{^projects/[^/]+/locations/(?<location>[^/]+)/?$}.match request.parent if regex_match header_params["location"] = regex_match["location".to_s] end end request_params_header = URI.encode_www_form header_params [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.create_build.timeout, metadata: , retry_policy: @config.rpcs.create_build.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @cloud_build_stub.call_rpc :create_build, request, options: do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: yield response, operation if block_given? throw :response, 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.
953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 |
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 953 def create_build_trigger request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.create_build_trigger..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.parent regex_match = %r{^projects/[^/]+/locations/(?<location>[^/]+)/?$}.match request.parent if regex_match header_params["location"] = regex_match["location".to_s] end end request_params_header = URI.encode_www_form header_params [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.create_build_trigger.timeout, metadata: , retry_policy: @config.rpcs.create_build_trigger.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @cloud_build_stub.call_rpc :create_build_trigger, request, options: do |response, operation| yield response, operation if block_given? 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
.
1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 |
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 1660 def create_worker_pool request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.create_worker_pool..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.parent regex_match = %r{^projects/[^/]+/locations/(?<location>[^/]+)/?$}.match request.parent if regex_match header_params["location"] = regex_match["location".to_s] end end request_params_header = URI.encode_www_form header_params [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.create_worker_pool.timeout, metadata: , retry_policy: @config.rpcs.create_worker_pool.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @cloud_build_stub.call_rpc :create_worker_pool, request, options: do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: yield response, operation if block_given? throw :response, 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.
1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 |
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 1246 def delete_build_trigger request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.delete_build_trigger..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name regex_match = %r{^projects/[^/]+/locations/(?<location>[^/]+)/triggers/[^/]+/?$}.match request.name if regex_match header_params["location"] = regex_match["location".to_s] end end request_params_header = URI.encode_www_form header_params [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.delete_build_trigger.timeout, metadata: , retry_policy: @config.rpcs.delete_build_trigger.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @cloud_build_stub.call_rpc :delete_build_trigger, request, options: do |response, operation| yield response, operation if block_given? 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
.
1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 |
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 1857 def delete_worker_pool request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.delete_worker_pool..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name regex_match = %r{^projects/[^/]+/locations/(?<location>[^/]+)/workerPools/[^/]+/?$}.match request.name if regex_match header_params["location"] = regex_match["location".to_s] end end request_params_header = URI.encode_www_form header_params [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.delete_worker_pool.timeout, metadata: , retry_policy: @config.rpcs.delete_worker_pool.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @cloud_build_stub.call_rpc :delete_worker_pool, request, options: do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: yield response, operation if block_given? throw :response, 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.
418 419 420 421 422 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 |
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 418 def get_build request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.get_build..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name regex_match = %r{^projects/[^/]+/locations/(?<location>[^/]+)/builds/[^/]+/?$}.match request.name if regex_match header_params["location"] = regex_match["location".to_s] end end request_params_header = URI.encode_www_form header_params [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.get_build.timeout, metadata: , retry_policy: @config.rpcs.get_build.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @cloud_build_stub.call_rpc :get_build, request, options: do |response, operation| yield response, operation if block_given? 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.
1048 1049 1050 1051 1052 1053 1054 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 |
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 1048 def get_build_trigger request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.get_build_trigger..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name regex_match = %r{^projects/[^/]+/locations/(?<location>[^/]+)/triggers/[^/]+/?$}.match request.name if regex_match header_params["location"] = regex_match["location".to_s] end end request_params_header = URI.encode_www_form header_params [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.get_build_trigger.timeout, metadata: , retry_policy: @config.rpcs.get_build_trigger.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @cloud_build_stub.call_rpc :get_build_trigger, request, options: do |response, operation| yield response, operation if block_given? 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
.
1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 |
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 1751 def get_worker_pool request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.get_worker_pool..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name regex_match = %r{^projects/[^/]+/locations/(?<location>[^/]+)/workerPools/[^/]+/?$}.match request.name if regex_match header_params["location"] = regex_match["location".to_s] end end request_params_header = URI.encode_www_form header_params [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.get_worker_pool.timeout, metadata: , retry_policy: @config.rpcs.get_worker_pool.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @cloud_build_stub.call_rpc :get_worker_pool, request, options: do |response, operation| yield response, operation if block_given? 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 BuildTrigger
s.
This API is experimental.
1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 |
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 1149 def list_build_triggers request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.list_build_triggers..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.parent regex_match = %r{^projects/[^/]+/locations/(?<location>[^/]+)/?$}.match request.parent if regex_match header_params["location"] = regex_match["location".to_s] end end request_params_header = URI.encode_www_form header_params [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.list_build_triggers.timeout, metadata: , retry_policy: @config.rpcs.list_build_triggers.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @cloud_build_stub.call_rpc :list_build_triggers, request, options: do |response, operation| response = ::Gapic::PagedEnumerable.new @cloud_build_stub, :list_build_triggers, request, response, operation, yield response, operation if block_given? throw :response, 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.
530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 |
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 530 def list_builds request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.list_builds..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.parent regex_match = %r{^projects/[^/]+/locations/(?<location>[^/]+)/?$}.match request.parent if regex_match header_params["location"] = regex_match["location".to_s] end end request_params_header = URI.encode_www_form header_params [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.list_builds.timeout, metadata: , retry_policy: @config.rpcs.list_builds.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @cloud_build_stub.call_rpc :list_builds, request, options: do |response, operation| response = ::Gapic::PagedEnumerable.new @cloud_build_stub, :list_builds, request, response, operation, yield response, operation if block_given? throw :response, 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 WorkerPool
s.
2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 |
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 2063 def list_worker_pools request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.list_worker_pools..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.parent regex_match = %r{^projects/[^/]+/locations/(?<location>[^/]+)/?$}.match request.parent if regex_match header_params["location"] = regex_match["location".to_s] end end request_params_header = URI.encode_www_form header_params [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.list_worker_pools.timeout, metadata: , retry_policy: @config.rpcs.list_worker_pools.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @cloud_build_stub.call_rpc :list_worker_pools, request, options: do |response, operation| response = ::Gapic::PagedEnumerable.new @cloud_build_stub, :list_worker_pools, request, response, operation, yield response, operation if block_given? throw :response, response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#logger ⇒ Logger
The logger used for request/response debug logging.
254 255 256 |
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 254 def logger @cloud_build_stub.logger 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.
1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 |
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 1553 def receive_trigger_webhook request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.receive_trigger_webhook..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.project_id header_params["project_id"] = request.project_id end if request.trigger header_params["trigger"] = request.trigger end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.receive_trigger_webhook.timeout, metadata: , retry_policy: @config.rpcs.receive_trigger_webhook.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @cloud_build_stub.call_rpc :receive_trigger_webhook, request, options: do |response, operation| yield response, operation if block_given? 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 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.
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 789 790 791 792 793 794 795 |
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 751 def retry_build request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.retry_build..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name regex_match = %r{^projects/[^/]+/locations/(?<location>[^/]+)/builds/[^/]+/?$}.match request.name if regex_match header_params["location"] = regex_match["location".to_s] end end request_params_header = URI.encode_www_form header_params [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.retry_build.timeout, metadata: , retry_policy: @config.rpcs.retry_build.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @cloud_build_stub.call_rpc :retry_build, request, options: do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: yield response, operation if block_given? throw :response, 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.
To run a regional or global trigger, use the POST request that includes the location endpoint in the path (ex. v1/projects/{projectId}/locations/{region}/triggers/{triggerId}:run). The POST request that does not include the location endpoint in the path can only be used when running global triggers.
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 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 |
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 1453 def run_build_trigger request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.run_build_trigger..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name regex_match = %r{^projects/[^/]+/locations/(?<location>[^/]+)/triggers/[^/]+/?$}.match request.name if regex_match header_params["location"] = regex_match["location".to_s] end end request_params_header = URI.encode_www_form header_params [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.run_build_trigger.timeout, metadata: , retry_policy: @config.rpcs.run_build_trigger.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @cloud_build_stub.call_rpc :run_build_trigger, request, options: do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: yield response, operation if block_given? throw :response, response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#universe_domain ⇒ String
The effective universe domain
164 165 166 |
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 164 def universe_domain @cloud_build_stub.universe_domain end |
#update_build_trigger(request, options = nil) ⇒ ::Google::Cloud::Build::V1::BuildTrigger #update_build_trigger(project_id: nil, trigger_id: nil, trigger: nil, update_mask: nil) ⇒ ::Google::Cloud::Build::V1::BuildTrigger
Updates a BuildTrigger
by its project ID and trigger ID.
This API is experimental.
1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 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 |
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 1344 def update_build_trigger request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.update_build_trigger..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.trigger&.resource_name regex_match = %r{^projects/[^/]+/locations/(?<location>[^/]+)/triggers/[^/]+/?$}.match request.trigger.resource_name if regex_match header_params["location"] = regex_match["location".to_s] end end request_params_header = URI.encode_www_form header_params [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.update_build_trigger.timeout, metadata: , retry_policy: @config.rpcs.update_build_trigger.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @cloud_build_stub.call_rpc :update_build_trigger, request, options: do |response, operation| yield response, operation if block_given? 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
.
1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 |
# File 'lib/google/cloud/build/v1/cloud_build/client.rb', line 1962 def update_worker_pool request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.update_worker_pool..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.worker_pool&.name regex_match = %r{^projects/[^/]+/locations/(?<location>[^/]+)/workerPools/[^/]+/?$}.match request.worker_pool.name if regex_match header_params["location"] = regex_match["location".to_s] end end request_params_header = URI.encode_www_form header_params [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.update_worker_pool.timeout, metadata: , retry_policy: @config.rpcs.update_worker_pool.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @cloud_build_stub.call_rpc :update_worker_pool, request, options: do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: yield response, operation if block_given? throw :response, response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |