lib/google/cloud/build/v1/cloud_build/client.rb in google-cloud-build-v1-0.19.0 vs lib/google/cloud/build/v1/cloud_build/client.rb in google-cloud-build-v1-0.20.0

- old
+ new

@@ -293,15 +293,18 @@ 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 = {} - if request.project_id - header_params["project_id"] = request.project_id + 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 = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + request_params_header = URI.encode_www_form header_params 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 @@ -387,18 +390,18 @@ 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 = {} - if request.project_id - header_params["project_id"] = request.project_id + 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 - if request.id - header_params["id"] = request.id - end - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + request_params_header = URI.encode_www_form header_params 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 @@ -499,15 +502,18 @@ 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 = {} - if request.project_id - header_params["project_id"] = request.project_id + 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 = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + request_params_header = URI.encode_www_form header_params 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 @@ -590,18 +596,18 @@ 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 = {} - if request.project_id - header_params["project_id"] = request.project_id + 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 - if request.id - header_params["id"] = request.id - end - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + request_params_header = URI.encode_www_form header_params 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 @@ -637,11 +643,11 @@ # * 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 + # * 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 @@ -716,18 +722,18 @@ 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 = {} - if request.project_id - header_params["project_id"] = request.project_id + 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 - if request.id - header_params["id"] = request.id - end - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + request_params_header = URI.encode_www_form header_params 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 @@ -821,14 +827,17 @@ gapic_version: ::Google::Cloud::Build::V1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name - header_params["name"] = 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 = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + request_params_header = URI.encode_www_form header_params 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 @@ -913,15 +922,18 @@ 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 = {} - if request.project_id - header_params["project_id"] = request.project_id + 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 = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + request_params_header = URI.encode_www_form header_params 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 @@ -1005,18 +1017,18 @@ 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 = {} - if request.project_id - header_params["project_id"] = request.project_id + 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 - if request.trigger_id - header_params["trigger_id"] = request.trigger_id - end - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + request_params_header = URI.encode_www_form header_params 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 @@ -1106,15 +1118,18 @@ 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 = {} - if request.project_id - header_params["project_id"] = request.project_id + 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 = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + request_params_header = URI.encode_www_form header_params 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 @@ -1199,18 +1214,18 @@ 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 = {} - if request.project_id - header_params["project_id"] = request.project_id + 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 - if request.trigger_id - header_params["trigger_id"] = request.trigger_id - end - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + request_params_header = URI.encode_www_form header_params 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 @@ -1293,18 +1308,18 @@ 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 = {} - if request.project_id - header_params["project_id"] = request.project_id + 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 - if request.trigger_id - header_params["trigger_id"] = request.trigger_id - end - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + request_params_header = URI.encode_www_form header_params 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 @@ -1322,10 +1337,16 @@ end ## # 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. + # # @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] @@ -1346,10 +1367,11 @@ # 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. + # Branch and tag names cannot consist of regular expressions. # # @yield [response, operation] Access the result along with the RPC operation # @yieldparam response [::Gapic::Operation] # @yieldparam operation [::GRPC::ActiveCall::Operation] # @@ -1395,18 +1417,18 @@ 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 = {} - if request.project_id - header_params["project_id"] = request.project_id + 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 - if request.trigger_id - header_params["trigger_id"] = request.trigger_id - end - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + request_params_header = URI.encode_www_form header_params 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 @@ -1602,14 +1624,17 @@ gapic_version: ::Google::Cloud::Build::V1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.parent - header_params["parent"] = 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 = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + request_params_header = URI.encode_www_form header_params 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 @@ -1689,14 +1714,17 @@ gapic_version: ::Google::Cloud::Build::V1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name - header_params["name"] = 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 = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + request_params_header = URI.encode_www_form header_params 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 @@ -1734,12 +1762,12 @@ # @param name [::String] # Required. The name of the `WorkerPool` to delete. # Format: # `projects/{project}/locations/{location}/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. + # Optional. If 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 @@ -1792,14 +1820,17 @@ gapic_version: ::Google::Cloud::Build::V1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name - header_params["name"] = 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 = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + request_params_header = URI.encode_www_form header_params 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 @@ -1893,14 +1924,17 @@ gapic_version: ::Google::Cloud::Build::V1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.worker_pool&.name - header_params["worker_pool.name"] = 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 = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + request_params_header = URI.encode_www_form header_params 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 @@ -1990,13 +2024,16 @@ gapic_version: ::Google::Cloud::Build::V1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.parent - header_params["parent"] = 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 = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + request_params_header = URI.encode_www_form header_params 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