Skip to content

Commit a1e2c60

Browse files
feat: Update GCB with latest proto changes (#32228)
* feat: Update GCB with latest proto changes PiperOrigin-RevId: 837135318 Source-Link: googleapis/googleapis@943025a Source-Link: googleapis/googleapis-gen@061d560 Copy-Tag: eyJwIjoiZ29vZ2xlLWNsb3VkLWJ1aWxkLXYxLy5Pd2xCb3QueWFtbCIsImgiOiIwNjFkNTYwNWNhOTc3MjUxMTYzOWQwMDk5OTQ3NGJlYWIwN2UxZDUyIn0= * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 055516f commit a1e2c60

File tree

14 files changed

+615
-77
lines changed

14 files changed

+615
-77
lines changed

google-cloud-build-v1/.owlbot-manifest.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"snippets/cloud_build/delete_worker_pool.rb",
5454
"snippets/cloud_build/get_build.rb",
5555
"snippets/cloud_build/get_build_trigger.rb",
56+
"snippets/cloud_build/get_default_service_account.rb",
5657
"snippets/cloud_build/get_worker_pool.rb",
5758
"snippets/cloud_build/list_build_triggers.rb",
5859
"snippets/cloud_build/list_builds.rb",

google-cloud-build-v1/gapic_metadata.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@
9999
"methods": [
100100
"list_worker_pools"
101101
]
102+
},
103+
"GetDefaultServiceAccount": {
104+
"methods": [
105+
"get_default_service_account"
106+
]
102107
}
103108
}
104109
}

google-cloud-build-v1/lib/google/cloud/build/v1/cloud_build/client.rb

Lines changed: 100 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -797,8 +797,8 @@ def retry_build request, options = nil
797797
##
798798
# Approves or rejects a pending build.
799799
#
800-
# If approved, the returned LRO will be analogous to the LRO returned from
801-
# a CreateBuild call.
800+
# If approved, the returned long-running operation (LRO) will be analogous to
801+
# the LRO returned from a CreateBuild call.
802802
#
803803
# If rejected, the returned LRO will be immediately done.
804804
#
@@ -902,8 +902,6 @@ def approve_build request, options = nil
902902
##
903903
# Creates a new `BuildTrigger`.
904904
#
905-
# This API is experimental.
906-
#
907905
# @overload create_build_trigger(request, options = nil)
908906
# Pass arguments to `create_build_trigger` via a request object, either of type
909907
# {::Google::Cloud::Build::V1::CreateBuildTriggerRequest} or an equivalent Hash.
@@ -997,8 +995,6 @@ def create_build_trigger request, options = nil
997995
##
998996
# Returns information about a `BuildTrigger`.
999997
#
1000-
# This API is experimental.
1001-
#
1002998
# @overload get_build_trigger(request, options = nil)
1003999
# Pass arguments to `get_build_trigger` via a request object, either of type
10041000
# {::Google::Cloud::Build::V1::GetBuildTriggerRequest} or an equivalent Hash.
@@ -1092,8 +1088,6 @@ def get_build_trigger request, options = nil
10921088
##
10931089
# Lists existing `BuildTrigger`s.
10941090
#
1095-
# This API is experimental.
1096-
#
10971091
# @overload list_build_triggers(request, options = nil)
10981092
# Pass arguments to `list_build_triggers` via a request object, either of type
10991093
# {::Google::Cloud::Build::V1::ListBuildTriggersRequest} or an equivalent Hash.
@@ -1195,8 +1189,6 @@ def list_build_triggers request, options = nil
11951189
##
11961190
# Deletes a `BuildTrigger` by its project ID and trigger ID.
11971191
#
1198-
# This API is experimental.
1199-
#
12001192
# @overload delete_build_trigger(request, options = nil)
12011193
# Pass arguments to `delete_build_trigger` via a request object, either of type
12021194
# {::Google::Cloud::Build::V1::DeleteBuildTriggerRequest} or an equivalent Hash.
@@ -1290,8 +1282,6 @@ def delete_build_trigger request, options = nil
12901282
##
12911283
# Updates a `BuildTrigger` by its project ID and trigger ID.
12921284
#
1293-
# This API is experimental.
1294-
#
12951285
# @overload update_build_trigger(request, options = nil)
12961286
# Pass arguments to `update_build_trigger` via a request object, either of type
12971287
# {::Google::Cloud::Build::V1::UpdateBuildTriggerRequest} or an equivalent Hash.
@@ -1924,7 +1914,7 @@ def delete_worker_pool request, options = nil
19241914
# The `name` field is used to identify the `WorkerPool` to update.
19251915
# Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`.
19261916
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
1927-
# A mask specifying which fields in `worker_pool` to update.
1917+
# Optional. A mask specifying which fields in `worker_pool` to update.
19281918
# @param validate_only [::Boolean]
19291919
# If set, validate the request and preview the response, but do not actually
19301920
# post it.
@@ -2106,6 +2096,96 @@ def list_worker_pools request, options = nil
21062096
raise ::Google::Cloud::Error.from_error(e)
21072097
end
21082098

2099+
##
2100+
# Returns the `DefaultServiceAccount` used by the project.
2101+
#
2102+
# @overload get_default_service_account(request, options = nil)
2103+
# Pass arguments to `get_default_service_account` via a request object, either of type
2104+
# {::Google::Cloud::Build::V1::GetDefaultServiceAccountRequest} or an equivalent Hash.
2105+
#
2106+
# @param request [::Google::Cloud::Build::V1::GetDefaultServiceAccountRequest, ::Hash]
2107+
# A request object representing the call parameters. Required. To specify no
2108+
# parameters, or to keep all the default parameter values, pass an empty Hash.
2109+
# @param options [::Gapic::CallOptions, ::Hash]
2110+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2111+
#
2112+
# @overload get_default_service_account(name: nil)
2113+
# Pass arguments to `get_default_service_account` via keyword arguments. Note that at
2114+
# least one keyword argument is required. To specify no parameters, or to keep all
2115+
# the default parameter values, pass an empty Hash as a request object (see above).
2116+
#
2117+
# @param name [::String]
2118+
# Required. The name of the `DefaultServiceAccount` to retrieve.
2119+
# Format:
2120+
# `projects/{project}/locations/{location}/defaultServiceAccount`
2121+
#
2122+
# @yield [response, operation] Access the result along with the RPC operation
2123+
# @yieldparam response [::Google::Cloud::Build::V1::DefaultServiceAccount]
2124+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
2125+
#
2126+
# @return [::Google::Cloud::Build::V1::DefaultServiceAccount]
2127+
#
2128+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
2129+
#
2130+
# @example Basic example
2131+
# require "google/cloud/build/v1"
2132+
#
2133+
# # Create a client object. The client can be reused for multiple calls.
2134+
# client = Google::Cloud::Build::V1::CloudBuild::Client.new
2135+
#
2136+
# # Create a request. To set request fields, pass in keyword arguments.
2137+
# request = Google::Cloud::Build::V1::GetDefaultServiceAccountRequest.new
2138+
#
2139+
# # Call the get_default_service_account method.
2140+
# result = client.get_default_service_account request
2141+
#
2142+
# # The returned object is of type Google::Cloud::Build::V1::DefaultServiceAccount.
2143+
# p result
2144+
#
2145+
def get_default_service_account request, options = nil
2146+
raise ::ArgumentError, "request must be provided" if request.nil?
2147+
2148+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::GetDefaultServiceAccountRequest
2149+
2150+
# Converts hash and nil to an options object
2151+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2152+
2153+
# Customize the options with defaults
2154+
metadata = @config.rpcs.get_default_service_account.metadata.to_h
2155+
2156+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2157+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2158+
lib_name: @config.lib_name, lib_version: @config.lib_version,
2159+
gapic_version: ::Google::Cloud::Build::V1::VERSION
2160+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2161+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2162+
2163+
header_params = {}
2164+
if request.name
2165+
regex_match = %r{^projects/[^/]+/locations/(?<location>[^/]+)/defaultServiceAccount/?$}.match request.name
2166+
if regex_match
2167+
header_params["location"] = regex_match["location".to_s]
2168+
end
2169+
end
2170+
2171+
request_params_header = URI.encode_www_form header_params
2172+
metadata[:"x-goog-request-params"] ||= request_params_header
2173+
2174+
options.apply_defaults timeout: @config.rpcs.get_default_service_account.timeout,
2175+
metadata: metadata,
2176+
retry_policy: @config.rpcs.get_default_service_account.retry_policy
2177+
2178+
options.apply_defaults timeout: @config.timeout,
2179+
metadata: @config.metadata,
2180+
retry_policy: @config.retry_policy
2181+
2182+
@cloud_build_stub.call_rpc :get_default_service_account, request, options: options do |response, operation|
2183+
yield response, operation if block_given?
2184+
end
2185+
rescue ::GRPC::BadStatus => e
2186+
raise ::Google::Cloud::Error.from_error(e)
2187+
end
2188+
21092189
##
21102190
# Configuration class for the CloudBuild API.
21112191
#
@@ -2379,6 +2459,11 @@ class Rpcs
23792459
# @return [::Gapic::Config::Method]
23802460
#
23812461
attr_reader :list_worker_pools
2462+
##
2463+
# RPC-specific configuration for `get_default_service_account`
2464+
# @return [::Gapic::Config::Method]
2465+
#
2466+
attr_reader :get_default_service_account
23822467

23832468
# @private
23842469
def initialize parent_rpcs = nil
@@ -2418,6 +2503,8 @@ def initialize parent_rpcs = nil
24182503
@update_worker_pool = ::Gapic::Config::Method.new update_worker_pool_config
24192504
list_worker_pools_config = parent_rpcs.list_worker_pools if parent_rpcs.respond_to? :list_worker_pools
24202505
@list_worker_pools = ::Gapic::Config::Method.new list_worker_pools_config
2506+
get_default_service_account_config = parent_rpcs.get_default_service_account if parent_rpcs.respond_to? :get_default_service_account
2507+
@get_default_service_account = ::Gapic::Config::Method.new get_default_service_account_config
24212508

24222509
yield self if block_given?
24232510
end

google-cloud-build-v1/lib/google/cloud/build/v1/cloud_build/paths.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,23 @@ def crypto_key_path project:, location:, keyring:, key:
127127
"projects/#{project}/locations/#{location}/keyRings/#{keyring}/cryptoKeys/#{key}"
128128
end
129129

130+
##
131+
# Create a fully-qualified DefaultServiceAccount resource string.
132+
#
133+
# The resource will be in the following format:
134+
#
135+
# `projects/{project}/locations/{location}/defaultServiceAccount`
136+
#
137+
# @param project [String]
138+
# @param location [String]
139+
#
140+
# @return [::String]
141+
def default_service_account_path project:, location:
142+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
143+
144+
"projects/#{project}/locations/#{location}/defaultServiceAccount"
145+
end
146+
130147
##
131148
# Create a fully-qualified GitRepositoryLink resource string.
132149
#

0 commit comments

Comments
 (0)