google-cloud-run-v2 0.30.0 → 0.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -6
  3. data/lib/google/cloud/run/v2/build_pb.rb +1 -1
  4. data/lib/google/cloud/run/v2/builds/client.rb +2 -2
  5. data/lib/google/cloud/run/v2/builds/credentials.rb +2 -1
  6. data/lib/google/cloud/run/v2/builds/rest/client.rb +2 -2
  7. data/lib/google/cloud/run/v2/condition_pb.rb +2 -1
  8. data/lib/google/cloud/run/v2/execution_pb.rb +1 -1
  9. data/lib/google/cloud/run/v2/execution_template_pb.rb +1 -1
  10. data/lib/google/cloud/run/v2/executions/credentials.rb +3 -1
  11. data/lib/google/cloud/run/v2/instance_pb.rb +7 -1
  12. data/lib/google/cloud/run/v2/instance_services_pb.rb +14 -2
  13. data/lib/google/cloud/run/v2/instances/client.rb +424 -12
  14. data/lib/google/cloud/run/v2/instances/credentials.rb +3 -1
  15. data/lib/google/cloud/run/v2/instances/rest/client.rb +393 -12
  16. data/lib/google/cloud/run/v2/instances/rest/service_stub.rb +247 -0
  17. data/lib/google/cloud/run/v2/job_pb.rb +1 -1
  18. data/lib/google/cloud/run/v2/jobs/client.rb +2 -1
  19. data/lib/google/cloud/run/v2/jobs/credentials.rb +3 -1
  20. data/lib/google/cloud/run/v2/jobs/rest/client.rb +2 -1
  21. data/lib/google/cloud/run/v2/k8s.min_pb.rb +3 -1
  22. data/lib/google/cloud/run/v2/rest.rb +1 -0
  23. data/lib/google/cloud/run/v2/revision_pb.rb +2 -1
  24. data/lib/google/cloud/run/v2/revision_template_pb.rb +2 -1
  25. data/lib/google/cloud/run/v2/revisions/credentials.rb +3 -1
  26. data/lib/google/cloud/run/v2/sandbox_pb.rb +25 -0
  27. data/lib/google/cloud/run/v2/service_pb.rb +1 -1
  28. data/lib/google/cloud/run/v2/services/client.rb +12 -2
  29. data/lib/google/cloud/run/v2/services/credentials.rb +3 -1
  30. data/lib/google/cloud/run/v2/services/rest/client.rb +12 -2
  31. data/lib/google/cloud/run/v2/source_upload/client.rb +505 -0
  32. data/lib/google/cloud/run/v2/source_upload/credentials.rb +48 -0
  33. data/lib/google/cloud/run/v2/source_upload/paths.rb +69 -0
  34. data/lib/google/cloud/run/v2/source_upload/rest/client.rb +452 -0
  35. data/lib/google/cloud/run/v2/source_upload/rest/service_stub.rb +143 -0
  36. data/lib/google/cloud/run/v2/source_upload/rest.rb +53 -0
  37. data/lib/google/cloud/run/v2/source_upload.rb +56 -0
  38. data/lib/google/cloud/run/v2/source_upload_pb.rb +29 -0
  39. data/lib/google/cloud/run/v2/source_upload_services_pb.rb +52 -0
  40. data/lib/google/cloud/run/v2/task_pb.rb +2 -1
  41. data/lib/google/cloud/run/v2/task_template_pb.rb +2 -1
  42. data/lib/google/cloud/run/v2/tasks/credentials.rb +3 -1
  43. data/lib/google/cloud/run/v2/vendor_settings_pb.rb +6 -1
  44. data/lib/google/cloud/run/v2/version.rb +1 -1
  45. data/lib/google/cloud/run/v2/worker_pool_pb.rb +1 -1
  46. data/lib/google/cloud/run/v2/worker_pool_revision_template_pb.rb +2 -1
  47. data/lib/google/cloud/run/v2/worker_pools/client.rb +2 -1
  48. data/lib/google/cloud/run/v2/worker_pools/credentials.rb +3 -1
  49. data/lib/google/cloud/run/v2/worker_pools/rest/client.rb +2 -1
  50. data/lib/google/cloud/run/v2.rb +1 -0
  51. data/proto_docs/google/cloud/run/v2/build.rb +2 -2
  52. data/proto_docs/google/cloud/run/v2/condition.rb +29 -3
  53. data/proto_docs/google/cloud/run/v2/execution.rb +7 -1
  54. data/proto_docs/google/cloud/run/v2/execution_template.rb +10 -0
  55. data/proto_docs/google/cloud/run/v2/instance.rb +74 -32
  56. data/proto_docs/google/cloud/run/v2/job.rb +9 -1
  57. data/proto_docs/google/cloud/run/v2/k8s.min.rb +78 -16
  58. data/proto_docs/google/cloud/run/v2/revision.rb +17 -2
  59. data/proto_docs/google/cloud/run/v2/revision_template.rb +16 -1
  60. data/proto_docs/google/cloud/run/v2/sandbox.rb +67 -0
  61. data/proto_docs/google/cloud/run/v2/service.rb +18 -1
  62. data/proto_docs/google/cloud/run/v2/source_upload.rb +48 -0
  63. data/proto_docs/google/cloud/run/v2/task.rb +6 -0
  64. data/proto_docs/google/cloud/run/v2/task_template.rb +6 -0
  65. data/proto_docs/google/cloud/run/v2/vendor_settings.rb +80 -2
  66. data/proto_docs/google/cloud/run/v2/worker_pool.rb +2 -1
  67. data/proto_docs/google/cloud/run/v2/worker_pool_revision_template.rb +9 -0
  68. metadata +13 -1
@@ -0,0 +1,452 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2026 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/run/v2/source_upload_pb"
21
+ require "google/cloud/run/v2/source_upload/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module Run
27
+ module V2
28
+ module SourceUpload
29
+ module Rest
30
+ ##
31
+ # REST client for the SourceUpload service.
32
+ #
33
+ # The Cloud Run Source Upload API allows you to upload source code to deploy
34
+ # Cloud Run resources.
35
+ #
36
+ class Client
37
+ # @private
38
+ API_VERSION = ""
39
+
40
+ # @private
41
+ DEFAULT_ENDPOINT_TEMPLATE = "run.$UNIVERSE_DOMAIN$"
42
+
43
+ include Paths
44
+
45
+ # @private
46
+ attr_reader :source_upload_stub
47
+
48
+ ##
49
+ # Configure the SourceUpload Client class.
50
+ #
51
+ # See {::Google::Cloud::Run::V2::SourceUpload::Rest::Client::Configuration}
52
+ # for a description of the configuration fields.
53
+ #
54
+ # @example
55
+ #
56
+ # # Modify the configuration for all SourceUpload clients
57
+ # ::Google::Cloud::Run::V2::SourceUpload::Rest::Client.configure do |config|
58
+ # config.timeout = 10.0
59
+ # end
60
+ #
61
+ # @yield [config] Configure the Client client.
62
+ # @yieldparam config [Client::Configuration]
63
+ #
64
+ # @return [Client::Configuration]
65
+ #
66
+ def self.configure
67
+ @configure ||= begin
68
+ namespace = ["Google", "Cloud", "Run", "V2"]
69
+ parent_config = while namespace.any?
70
+ parent_name = namespace.join "::"
71
+ parent_const = const_get parent_name
72
+ break parent_const.configure if parent_const.respond_to? :configure
73
+ namespace.pop
74
+ end
75
+ default_config = Client::Configuration.new parent_config
76
+
77
+ default_config
78
+ end
79
+ yield @configure if block_given?
80
+ @configure
81
+ end
82
+
83
+ ##
84
+ # Configure the SourceUpload Client instance.
85
+ #
86
+ # The configuration is set to the derived mode, meaning that values can be changed,
87
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
88
+ # should be made on {Client.configure}.
89
+ #
90
+ # See {::Google::Cloud::Run::V2::SourceUpload::Rest::Client::Configuration}
91
+ # for a description of the configuration fields.
92
+ #
93
+ # @yield [config] Configure the Client client.
94
+ # @yieldparam config [Client::Configuration]
95
+ #
96
+ # @return [Client::Configuration]
97
+ #
98
+ def configure
99
+ yield @config if block_given?
100
+ @config
101
+ end
102
+
103
+ ##
104
+ # The effective universe domain
105
+ #
106
+ # @return [String]
107
+ #
108
+ def universe_domain
109
+ @source_upload_stub.universe_domain
110
+ end
111
+
112
+ ##
113
+ # Create a new SourceUpload REST client object.
114
+ #
115
+ # @example
116
+ #
117
+ # # Create a client using the default configuration
118
+ # client = ::Google::Cloud::Run::V2::SourceUpload::Rest::Client.new
119
+ #
120
+ # # Create a client using a custom configuration
121
+ # client = ::Google::Cloud::Run::V2::SourceUpload::Rest::Client.new do |config|
122
+ # config.timeout = 10.0
123
+ # end
124
+ #
125
+ # @yield [config] Configure the SourceUpload client.
126
+ # @yieldparam config [Client::Configuration]
127
+ #
128
+ def initialize
129
+ # Create the configuration object
130
+ @config = Configuration.new Client.configure
131
+
132
+ # Yield the configuration if needed
133
+ yield @config if block_given?
134
+
135
+ # Create credentials
136
+ credentials = @config.credentials
137
+ # Use self-signed JWT if the endpoint is unchanged from default,
138
+ # but only if the default endpoint does not have a region prefix.
139
+ enable_self_signed_jwt = @config.endpoint.nil? ||
140
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
141
+ !@config.endpoint.split(".").first.include?("-"))
142
+ credentials ||= Credentials.default scope: @config.scope,
143
+ enable_self_signed_jwt: enable_self_signed_jwt
144
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
145
+ credentials = Credentials.new credentials, scope: @config.scope
146
+ end
147
+
148
+ @quota_project_id = @config.quota_project
149
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
150
+
151
+ @source_upload_stub = ::Google::Cloud::Run::V2::SourceUpload::Rest::ServiceStub.new(
152
+ endpoint: @config.endpoint,
153
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
154
+ universe_domain: @config.universe_domain,
155
+ credentials: credentials,
156
+ logger: @config.logger
157
+ )
158
+
159
+ @source_upload_stub.logger(stub: true)&.info do |entry|
160
+ entry.set_system_name
161
+ entry.set_service
162
+ entry.message = "Created client for #{entry.service}"
163
+ entry.set_credentials_fields credentials
164
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
165
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
166
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
167
+ end
168
+
169
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
170
+ config.credentials = credentials
171
+ config.quota_project = @quota_project_id
172
+ config.endpoint = @source_upload_stub.endpoint
173
+ config.universe_domain = @source_upload_stub.universe_domain
174
+ config.logger = @source_upload_stub.logger if config.respond_to? :logger=
175
+ end
176
+ end
177
+
178
+ ##
179
+ # Get the associated client for mix-in of the Locations.
180
+ #
181
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
182
+ #
183
+ attr_reader :location_client
184
+
185
+ ##
186
+ # The logger used for request/response debug logging.
187
+ #
188
+ # @return [Logger]
189
+ #
190
+ def logger
191
+ @source_upload_stub.logger
192
+ end
193
+
194
+ # Service calls
195
+
196
+ ##
197
+ # Uploads a source archive to a Google Cloud Storage bucket through Cloud
198
+ # Run. The uploaded source object should be used for Cloud Run resource
199
+ # deployments. User is responsible for managing the lifecycle of the uploaded
200
+ # object.
201
+ # If uploading through the Cloud Run API to Cloud Storage is not desired, you
202
+ # can use the IAM Deny Policy to deny the `run.locations.uploadSource`
203
+ # permission for all principals.
204
+ #
205
+ # @overload upload_source(request, options = nil)
206
+ # Pass arguments to `upload_source` via a request object, either of type
207
+ # {::Google::Cloud::Run::V2::UploadSourceRequest} or an equivalent Hash.
208
+ #
209
+ # @param request [::Google::Cloud::Run::V2::UploadSourceRequest, ::Hash]
210
+ # A request object representing the call parameters. Required. To specify no
211
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
212
+ # @param options [::Gapic::CallOptions, ::Hash]
213
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
214
+ #
215
+ # @overload upload_source(parent: nil, service: nil)
216
+ # Pass arguments to `upload_source` via keyword arguments. Note that at
217
+ # least one keyword argument is required. To specify no parameters, or to keep all
218
+ # the default parameter values, pass an empty Hash as a request object (see above).
219
+ #
220
+ # @param parent [::String]
221
+ # Required. The project and location in which the source archive should be
222
+ # uploaded to, specified in the format `projects/*/locations/*`.
223
+ # @param service [::String]
224
+ # The name of Cloud Run Service upload source archive will be used for.
225
+ # @yield [result, operation] Access the result along with the TransportOperation object
226
+ # @yieldparam result [::Google::Cloud::Run::V2::UploadSourceResponse]
227
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
228
+ #
229
+ # @return [::Google::Cloud::Run::V2::UploadSourceResponse]
230
+ #
231
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
232
+ #
233
+ # @example Basic example
234
+ # require "google/cloud/run/v2"
235
+ #
236
+ # # Create a client object. The client can be reused for multiple calls.
237
+ # client = Google::Cloud::Run::V2::SourceUpload::Rest::Client.new
238
+ #
239
+ # # Create a request. To set request fields, pass in keyword arguments.
240
+ # request = Google::Cloud::Run::V2::UploadSourceRequest.new
241
+ #
242
+ # # Call the upload_source method.
243
+ # result = client.upload_source request
244
+ #
245
+ # # The returned object is of type Google::Cloud::Run::V2::UploadSourceResponse.
246
+ # p result
247
+ #
248
+ def upload_source request, options = nil
249
+ raise ::ArgumentError, "request must be provided" if request.nil?
250
+
251
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::UploadSourceRequest
252
+
253
+ # Converts hash and nil to an options object
254
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
255
+
256
+ # Customize the options with defaults
257
+ call_metadata = @config.rpcs.upload_source.metadata.to_h
258
+
259
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
260
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
261
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
262
+ gapic_version: ::Google::Cloud::Run::V2::VERSION,
263
+ transports_version_send: [:rest]
264
+
265
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
266
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
267
+
268
+ options.apply_defaults timeout: @config.rpcs.upload_source.timeout,
269
+ metadata: call_metadata,
270
+ retry_policy: @config.rpcs.upload_source.retry_policy
271
+
272
+ options.apply_defaults timeout: @config.timeout,
273
+ metadata: @config.metadata,
274
+ retry_policy: @config.retry_policy
275
+
276
+ @source_upload_stub.upload_source request, options do |result, operation|
277
+ yield result, operation if block_given?
278
+ end
279
+ rescue ::Gapic::Rest::Error => e
280
+ raise ::Google::Cloud::Error.from_error(e)
281
+ end
282
+
283
+ ##
284
+ # Configuration class for the SourceUpload REST API.
285
+ #
286
+ # This class represents the configuration for SourceUpload REST,
287
+ # providing control over timeouts, retry behavior, logging, transport
288
+ # parameters, and other low-level controls. Certain parameters can also be
289
+ # applied individually to specific RPCs. See
290
+ # {::Google::Cloud::Run::V2::SourceUpload::Rest::Client::Configuration::Rpcs}
291
+ # for a list of RPCs that can be configured independently.
292
+ #
293
+ # Configuration can be applied globally to all clients, or to a single client
294
+ # on construction.
295
+ #
296
+ # @example
297
+ #
298
+ # # Modify the global config, setting the timeout for
299
+ # # upload_source to 20 seconds,
300
+ # # and all remaining timeouts to 10 seconds.
301
+ # ::Google::Cloud::Run::V2::SourceUpload::Rest::Client.configure do |config|
302
+ # config.timeout = 10.0
303
+ # config.rpcs.upload_source.timeout = 20.0
304
+ # end
305
+ #
306
+ # # Apply the above configuration only to a new client.
307
+ # client = ::Google::Cloud::Run::V2::SourceUpload::Rest::Client.new do |config|
308
+ # config.timeout = 10.0
309
+ # config.rpcs.upload_source.timeout = 20.0
310
+ # end
311
+ #
312
+ # @!attribute [rw] endpoint
313
+ # A custom service endpoint, as a hostname or hostname:port. The default is
314
+ # nil, indicating to use the default endpoint in the current universe domain.
315
+ # @return [::String,nil]
316
+ # @!attribute [rw] credentials
317
+ # Credentials to send with calls. You may provide any of the following types:
318
+ # * (`String`) The path to a service account key file in JSON format
319
+ # * (`Hash`) A service account key as a Hash
320
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
321
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
322
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
323
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
324
+ # * (`nil`) indicating no credentials
325
+ #
326
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
327
+ # external source for authentication to Google Cloud, you must validate it before
328
+ # providing it to a Google API client library. Providing an unvalidated credential
329
+ # configuration to Google APIs can compromise the security of your systems and data.
330
+ # For more information, refer to [Validate credential configurations from external
331
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
332
+ # @return [::Object]
333
+ # @!attribute [rw] scope
334
+ # The OAuth scopes
335
+ # @return [::Array<::String>]
336
+ # @!attribute [rw] lib_name
337
+ # The library name as recorded in instrumentation and logging
338
+ # @return [::String]
339
+ # @!attribute [rw] lib_version
340
+ # The library version as recorded in instrumentation and logging
341
+ # @return [::String]
342
+ # @!attribute [rw] timeout
343
+ # The call timeout in seconds.
344
+ # @return [::Numeric]
345
+ # @!attribute [rw] metadata
346
+ # Additional headers to be sent with the call.
347
+ # @return [::Hash{::Symbol=>::String}]
348
+ # @!attribute [rw] retry_policy
349
+ # The retry policy. The value is a hash with the following keys:
350
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
351
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
352
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
353
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
354
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
355
+ # trigger a retry.
356
+ # @return [::Hash]
357
+ # @!attribute [rw] quota_project
358
+ # A separate project against which to charge quota.
359
+ # @return [::String]
360
+ # @!attribute [rw] universe_domain
361
+ # The universe domain within which to make requests. This determines the
362
+ # default endpoint URL. The default value of nil uses the environment
363
+ # universe (usually the default "googleapis.com" universe).
364
+ # @return [::String,nil]
365
+ # @!attribute [rw] logger
366
+ # A custom logger to use for request/response debug logging, or the value
367
+ # `:default` (the default) to construct a default logger, or `nil` to
368
+ # explicitly disable logging.
369
+ # @return [::Logger,:default,nil]
370
+ #
371
+ class Configuration
372
+ extend ::Gapic::Config
373
+
374
+ # @private
375
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
376
+ DEFAULT_ENDPOINT = "run.googleapis.com"
377
+
378
+ config_attr :endpoint, nil, ::String, nil
379
+ config_attr :credentials, nil do |value|
380
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
381
+ allowed.any? { |klass| klass === value }
382
+ end
383
+ config_attr :scope, nil, ::String, ::Array, nil
384
+ config_attr :lib_name, nil, ::String, nil
385
+ config_attr :lib_version, nil, ::String, nil
386
+ config_attr :timeout, nil, ::Numeric, nil
387
+ config_attr :metadata, nil, ::Hash, nil
388
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
389
+ config_attr :quota_project, nil, ::String, nil
390
+ config_attr :universe_domain, nil, ::String, nil
391
+ config_attr :logger, :default, ::Logger, nil, :default
392
+
393
+ # @private
394
+ def initialize parent_config = nil
395
+ @parent_config = parent_config unless parent_config.nil?
396
+
397
+ yield self if block_given?
398
+ end
399
+
400
+ ##
401
+ # Configurations for individual RPCs
402
+ # @return [Rpcs]
403
+ #
404
+ def rpcs
405
+ @rpcs ||= begin
406
+ parent_rpcs = nil
407
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
408
+ Rpcs.new parent_rpcs
409
+ end
410
+ end
411
+
412
+ ##
413
+ # Configuration RPC class for the SourceUpload API.
414
+ #
415
+ # Includes fields providing the configuration for each RPC in this service.
416
+ # Each configuration object is of type `Gapic::Config::Method` and includes
417
+ # the following configuration fields:
418
+ #
419
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
420
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
421
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
422
+ # include the following keys:
423
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
424
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
425
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
426
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
427
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
428
+ # trigger a retry.
429
+ #
430
+ class Rpcs
431
+ ##
432
+ # RPC-specific configuration for `upload_source`
433
+ # @return [::Gapic::Config::Method]
434
+ #
435
+ attr_reader :upload_source
436
+
437
+ # @private
438
+ def initialize parent_rpcs = nil
439
+ upload_source_config = parent_rpcs.upload_source if parent_rpcs.respond_to? :upload_source
440
+ @upload_source = ::Gapic::Config::Method.new upload_source_config
441
+
442
+ yield self if block_given?
443
+ end
444
+ end
445
+ end
446
+ end
447
+ end
448
+ end
449
+ end
450
+ end
451
+ end
452
+ end
@@ -0,0 +1,143 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2026 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/run/v2/source_upload_pb"
20
+
21
+ module Google
22
+ module Cloud
23
+ module Run
24
+ module V2
25
+ module SourceUpload
26
+ module Rest
27
+ ##
28
+ # REST service stub for the SourceUpload service.
29
+ # Service stub contains baseline method implementations
30
+ # including transcoding, making the REST call, and deserialing the response.
31
+ #
32
+ class ServiceStub
33
+ # @private
34
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
35
+ # These require statements are intentionally placed here to initialize
36
+ # the REST modules only when it's required.
37
+ require "gapic/rest"
38
+
39
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
40
+ endpoint_template: endpoint_template,
41
+ universe_domain: universe_domain,
42
+ credentials: credentials,
43
+ numeric_enums: true,
44
+ service_name: self.class,
45
+ raise_faraday_errors: false,
46
+ logger: logger
47
+ end
48
+
49
+ ##
50
+ # The effective universe domain
51
+ #
52
+ # @return [String]
53
+ #
54
+ def universe_domain
55
+ @client_stub.universe_domain
56
+ end
57
+
58
+ ##
59
+ # The effective endpoint
60
+ #
61
+ # @return [String]
62
+ #
63
+ def endpoint
64
+ @client_stub.endpoint
65
+ end
66
+
67
+ ##
68
+ # The logger used for request/response debug logging.
69
+ #
70
+ # @return [Logger]
71
+ #
72
+ def logger stub: false
73
+ stub ? @client_stub.stub_logger : @client_stub.logger
74
+ end
75
+
76
+ ##
77
+ # Baseline implementation for the upload_source REST call
78
+ #
79
+ # @param request_pb [::Google::Cloud::Run::V2::UploadSourceRequest]
80
+ # A request object representing the call parameters. Required.
81
+ # @param options [::Gapic::CallOptions]
82
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
83
+ #
84
+ # @yield [result, operation] Access the result along with the TransportOperation object
85
+ # @yieldparam result [::Google::Cloud::Run::V2::UploadSourceResponse]
86
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
87
+ #
88
+ # @return [::Google::Cloud::Run::V2::UploadSourceResponse]
89
+ # A result object deserialized from the server's reply
90
+ def upload_source request_pb, options = nil
91
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
92
+
93
+ verb, uri, query_string_params, body = ServiceStub.transcode_upload_source_request request_pb
94
+ query_string_params = if query_string_params.any?
95
+ query_string_params.to_h { |p| p.split "=", 2 }
96
+ else
97
+ {}
98
+ end
99
+
100
+ response = @client_stub.make_http_request(
101
+ verb,
102
+ uri: uri,
103
+ body: body || "",
104
+ params: query_string_params,
105
+ method_name: "upload_source",
106
+ options: options
107
+ )
108
+ operation = ::Gapic::Rest::TransportOperation.new response
109
+ result = ::Google::Cloud::Run::V2::UploadSourceResponse.decode_json response.body, ignore_unknown_fields: true
110
+ catch :response do
111
+ yield result, operation if block_given?
112
+ result
113
+ end
114
+ end
115
+
116
+ ##
117
+ # @private
118
+ #
119
+ # GRPC transcoding helper method for the upload_source REST call
120
+ #
121
+ # @param request_pb [::Google::Cloud::Run::V2::UploadSourceRequest]
122
+ # A request object representing the call parameters. Required.
123
+ # @return [Array(String, [String, nil], Hash{String => String})]
124
+ # Uri, Body, Query string parameters
125
+ def self.transcode_upload_source_request request_pb
126
+ transcoder = Gapic::Rest::GrpcTranscoder.new
127
+ .with_bindings(
128
+ uri_method: :post,
129
+ uri_template: "/v2/{parent}:uploadSource",
130
+ body: "*",
131
+ matches: [
132
+ ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false]
133
+ ]
134
+ )
135
+ transcoder.transcode request_pb
136
+ end
137
+ end
138
+ end
139
+ end
140
+ end
141
+ end
142
+ end
143
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2026 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "gapic/rest"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/run/v2/version"
24
+
25
+ require "google/cloud/run/v2/source_upload/credentials"
26
+ require "google/cloud/run/v2/source_upload/paths"
27
+ require "google/cloud/run/v2/source_upload/rest/client"
28
+
29
+ module Google
30
+ module Cloud
31
+ module Run
32
+ module V2
33
+ ##
34
+ # The Cloud Run Source Upload API allows you to upload source code to deploy
35
+ # Cloud Run resources.
36
+ #
37
+ # To load this service and instantiate a REST client:
38
+ #
39
+ # require "google/cloud/run/v2/source_upload/rest"
40
+ # client = ::Google::Cloud::Run::V2::SourceUpload::Rest::Client.new
41
+ #
42
+ module SourceUpload
43
+ # Client for the REST transport
44
+ module Rest
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+
52
+ helper_path = ::File.join __dir__, "rest", "helpers.rb"
53
+ require "google/cloud/run/v2/source_upload/rest/helpers" if ::File.file? helper_path