google-cloud-run-v2 0.5.0 → 0.7.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 (58) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/lib/google/cloud/run/v2/condition_pb.rb +1 -0
  4. data/lib/google/cloud/run/v2/execution_pb.rb +3 -0
  5. data/lib/google/cloud/run/v2/executions/client.rb +8 -10
  6. data/lib/google/cloud/run/v2/executions/operations.rb +20 -14
  7. data/lib/google/cloud/run/v2/executions/rest/client.rb +533 -0
  8. data/lib/google/cloud/run/v2/executions/rest/operations.rb +935 -0
  9. data/lib/google/cloud/run/v2/executions/rest/service_stub.rb +225 -0
  10. data/lib/google/cloud/run/v2/executions/rest.rb +53 -0
  11. data/lib/google/cloud/run/v2/executions.rb +7 -1
  12. data/lib/google/cloud/run/v2/job_pb.rb +1 -0
  13. data/lib/google/cloud/run/v2/jobs/client.rb +20 -22
  14. data/lib/google/cloud/run/v2/jobs/operations.rb +20 -14
  15. data/lib/google/cloud/run/v2/jobs/rest/client.rb +998 -0
  16. data/lib/google/cloud/run/v2/jobs/rest/operations.rb +935 -0
  17. data/lib/google/cloud/run/v2/jobs/rest/service_stub.rb +584 -0
  18. data/lib/google/cloud/run/v2/jobs/rest.rb +53 -0
  19. data/lib/google/cloud/run/v2/jobs.rb +7 -1
  20. data/lib/google/cloud/run/v2/rest.rb +41 -0
  21. data/lib/google/cloud/run/v2/revision_pb.rb +2 -0
  22. data/lib/google/cloud/run/v2/revisions/client.rb +8 -10
  23. data/lib/google/cloud/run/v2/revisions/operations.rb +20 -14
  24. data/lib/google/cloud/run/v2/revisions/rest/client.rb +531 -0
  25. data/lib/google/cloud/run/v2/revisions/rest/operations.rb +935 -0
  26. data/lib/google/cloud/run/v2/revisions/rest/service_stub.rb +225 -0
  27. data/lib/google/cloud/run/v2/revisions/rest.rb +53 -0
  28. data/lib/google/cloud/run/v2/revisions.rb +7 -1
  29. data/lib/google/cloud/run/v2/services/client.rb +19 -21
  30. data/lib/google/cloud/run/v2/services/operations.rb +20 -14
  31. data/lib/google/cloud/run/v2/services/rest/client.rb +940 -0
  32. data/lib/google/cloud/run/v2/services/rest/operations.rb +935 -0
  33. data/lib/google/cloud/run/v2/services/rest/service_stub.rb +524 -0
  34. data/lib/google/cloud/run/v2/services/rest.rb +53 -0
  35. data/lib/google/cloud/run/v2/services.rb +7 -1
  36. data/lib/google/cloud/run/v2/task_pb.rb +1 -0
  37. data/lib/google/cloud/run/v2/tasks/client.rb +4 -6
  38. data/lib/google/cloud/run/v2/tasks/rest/client.rb +440 -0
  39. data/lib/google/cloud/run/v2/tasks/rest/service_stub.rb +166 -0
  40. data/lib/google/cloud/run/v2/tasks/rest.rb +52 -0
  41. data/lib/google/cloud/run/v2/tasks.rb +7 -1
  42. data/lib/google/cloud/run/v2/vendor_settings_pb.rb +6 -0
  43. data/lib/google/cloud/run/v2/version.rb +1 -1
  44. data/lib/google/cloud/run/v2.rb +7 -2
  45. data/proto_docs/google/api/client.rb +318 -0
  46. data/proto_docs/google/api/launch_stage.rb +3 -3
  47. data/proto_docs/google/cloud/run/v2/condition.rb +4 -0
  48. data/proto_docs/google/cloud/run/v2/execution.rb +30 -20
  49. data/proto_docs/google/cloud/run/v2/execution_template.rb +12 -1
  50. data/proto_docs/google/cloud/run/v2/job.rb +29 -21
  51. data/proto_docs/google/cloud/run/v2/k8s.min.rb +13 -8
  52. data/proto_docs/google/cloud/run/v2/revision.rb +19 -13
  53. data/proto_docs/google/cloud/run/v2/revision_template.rb +10 -0
  54. data/proto_docs/google/cloud/run/v2/service.rb +44 -34
  55. data/proto_docs/google/cloud/run/v2/task.rb +21 -18
  56. data/proto_docs/google/cloud/run/v2/vendor_settings.rb +12 -0
  57. data/proto_docs/google/rpc/status.rb +4 -2
  58. metadata +34 -10
@@ -0,0 +1,440 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 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/task_pb"
21
+ require "google/cloud/run/v2/tasks/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module Run
27
+ module V2
28
+ module Tasks
29
+ module Rest
30
+ ##
31
+ # REST client for the Tasks service.
32
+ #
33
+ # Cloud Run Task Control Plane API.
34
+ #
35
+ class Client
36
+ include Paths
37
+
38
+ # @private
39
+ attr_reader :tasks_stub
40
+
41
+ ##
42
+ # Configure the Tasks Client class.
43
+ #
44
+ # See {::Google::Cloud::Run::V2::Tasks::Rest::Client::Configuration}
45
+ # for a description of the configuration fields.
46
+ #
47
+ # @example
48
+ #
49
+ # # Modify the configuration for all Tasks clients
50
+ # ::Google::Cloud::Run::V2::Tasks::Rest::Client.configure do |config|
51
+ # config.timeout = 10.0
52
+ # end
53
+ #
54
+ # @yield [config] Configure the Client client.
55
+ # @yieldparam config [Client::Configuration]
56
+ #
57
+ # @return [Client::Configuration]
58
+ #
59
+ def self.configure
60
+ @configure ||= begin
61
+ namespace = ["Google", "Cloud", "Run", "V2"]
62
+ parent_config = while namespace.any?
63
+ parent_name = namespace.join "::"
64
+ parent_const = const_get parent_name
65
+ break parent_const.configure if parent_const.respond_to? :configure
66
+ namespace.pop
67
+ end
68
+ default_config = Client::Configuration.new parent_config
69
+
70
+ default_config
71
+ end
72
+ yield @configure if block_given?
73
+ @configure
74
+ end
75
+
76
+ ##
77
+ # Configure the Tasks Client instance.
78
+ #
79
+ # The configuration is set to the derived mode, meaning that values can be changed,
80
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
81
+ # should be made on {Client.configure}.
82
+ #
83
+ # See {::Google::Cloud::Run::V2::Tasks::Rest::Client::Configuration}
84
+ # for a description of the configuration fields.
85
+ #
86
+ # @yield [config] Configure the Client client.
87
+ # @yieldparam config [Client::Configuration]
88
+ #
89
+ # @return [Client::Configuration]
90
+ #
91
+ def configure
92
+ yield @config if block_given?
93
+ @config
94
+ end
95
+
96
+ ##
97
+ # Create a new Tasks REST client object.
98
+ #
99
+ # @example
100
+ #
101
+ # # Create a client using the default configuration
102
+ # client = ::Google::Cloud::Run::V2::Tasks::Rest::Client.new
103
+ #
104
+ # # Create a client using a custom configuration
105
+ # client = ::Google::Cloud::Run::V2::Tasks::Rest::Client.new do |config|
106
+ # config.timeout = 10.0
107
+ # end
108
+ #
109
+ # @yield [config] Configure the Tasks client.
110
+ # @yieldparam config [Client::Configuration]
111
+ #
112
+ def initialize
113
+ # Create the configuration object
114
+ @config = Configuration.new Client.configure
115
+
116
+ # Yield the configuration if needed
117
+ yield @config if block_given?
118
+
119
+ # Create credentials
120
+ credentials = @config.credentials
121
+ # Use self-signed JWT if the endpoint is unchanged from default,
122
+ # but only if the default endpoint does not have a region prefix.
123
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
124
+ !@config.endpoint.split(".").first.include?("-")
125
+ credentials ||= Credentials.default scope: @config.scope,
126
+ enable_self_signed_jwt: enable_self_signed_jwt
127
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
128
+ credentials = Credentials.new credentials, scope: @config.scope
129
+ end
130
+
131
+ @quota_project_id = @config.quota_project
132
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
133
+
134
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
135
+ config.credentials = credentials
136
+ config.quota_project = @quota_project_id
137
+ config.endpoint = @config.endpoint
138
+ end
139
+
140
+ @tasks_stub = ::Google::Cloud::Run::V2::Tasks::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
141
+ end
142
+
143
+ ##
144
+ # Get the associated client for mix-in of the Locations.
145
+ #
146
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
147
+ #
148
+ attr_reader :location_client
149
+
150
+ # Service calls
151
+
152
+ ##
153
+ # Gets information about a Task.
154
+ #
155
+ # @overload get_task(request, options = nil)
156
+ # Pass arguments to `get_task` via a request object, either of type
157
+ # {::Google::Cloud::Run::V2::GetTaskRequest} or an equivalent Hash.
158
+ #
159
+ # @param request [::Google::Cloud::Run::V2::GetTaskRequest, ::Hash]
160
+ # A request object representing the call parameters. Required. To specify no
161
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
162
+ # @param options [::Gapic::CallOptions, ::Hash]
163
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
164
+ #
165
+ # @overload get_task(name: nil)
166
+ # Pass arguments to `get_task` via keyword arguments. Note that at
167
+ # least one keyword argument is required. To specify no parameters, or to keep all
168
+ # the default parameter values, pass an empty Hash as a request object (see above).
169
+ #
170
+ # @param name [::String]
171
+ # Required. The full name of the Task.
172
+ # Format:
173
+ # projects/\\{project}/locations/\\{location}/jobs/\\{job}/executions/\\{execution}/tasks/\\{task}
174
+ # @yield [result, operation] Access the result along with the TransportOperation object
175
+ # @yieldparam result [::Google::Cloud::Run::V2::Task]
176
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
177
+ #
178
+ # @return [::Google::Cloud::Run::V2::Task]
179
+ #
180
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
181
+ def get_task request, options = nil
182
+ raise ::ArgumentError, "request must be provided" if request.nil?
183
+
184
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::GetTaskRequest
185
+
186
+ # Converts hash and nil to an options object
187
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
188
+
189
+ # Customize the options with defaults
190
+ call_metadata = @config.rpcs.get_task.metadata.to_h
191
+
192
+ # Set x-goog-api-client and x-goog-user-project headers
193
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
194
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
195
+ gapic_version: ::Google::Cloud::Run::V2::VERSION,
196
+ transports_version_send: [:rest]
197
+
198
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
199
+
200
+ options.apply_defaults timeout: @config.rpcs.get_task.timeout,
201
+ metadata: call_metadata,
202
+ retry_policy: @config.rpcs.get_task.retry_policy
203
+
204
+ options.apply_defaults timeout: @config.timeout,
205
+ metadata: @config.metadata,
206
+ retry_policy: @config.retry_policy
207
+
208
+ @tasks_stub.get_task request, options do |result, operation|
209
+ yield result, operation if block_given?
210
+ return result
211
+ end
212
+ rescue ::Gapic::Rest::Error => e
213
+ raise ::Google::Cloud::Error.from_error(e)
214
+ end
215
+
216
+ ##
217
+ # Lists Tasks from an Execution of a Job.
218
+ #
219
+ # @overload list_tasks(request, options = nil)
220
+ # Pass arguments to `list_tasks` via a request object, either of type
221
+ # {::Google::Cloud::Run::V2::ListTasksRequest} or an equivalent Hash.
222
+ #
223
+ # @param request [::Google::Cloud::Run::V2::ListTasksRequest, ::Hash]
224
+ # A request object representing the call parameters. Required. To specify no
225
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
226
+ # @param options [::Gapic::CallOptions, ::Hash]
227
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
228
+ #
229
+ # @overload list_tasks(parent: nil, page_size: nil, page_token: nil, show_deleted: nil)
230
+ # Pass arguments to `list_tasks` via keyword arguments. Note that at
231
+ # least one keyword argument is required. To specify no parameters, or to keep all
232
+ # the default parameter values, pass an empty Hash as a request object (see above).
233
+ #
234
+ # @param parent [::String]
235
+ # Required. The Execution from which the Tasks should be listed.
236
+ # To list all Tasks across Executions of a Job, use "-" instead of Execution
237
+ # name. To list all Tasks across Jobs, use "-" instead of Job name. Format:
238
+ # projects/\\{project}/locations/\\{location}/jobs/\\{job}/executions/\\{execution}
239
+ # @param page_size [::Integer]
240
+ # Maximum number of Tasks to return in this call.
241
+ # @param page_token [::String]
242
+ # A page token received from a previous call to ListTasks.
243
+ # All other parameters must match.
244
+ # @param show_deleted [::Boolean]
245
+ # If true, returns deleted (but unexpired) resources along with active ones.
246
+ # @yield [result, operation] Access the result along with the TransportOperation object
247
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Run::V2::Task>]
248
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
249
+ #
250
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Run::V2::Task>]
251
+ #
252
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
253
+ def list_tasks request, options = nil
254
+ raise ::ArgumentError, "request must be provided" if request.nil?
255
+
256
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::ListTasksRequest
257
+
258
+ # Converts hash and nil to an options object
259
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
260
+
261
+ # Customize the options with defaults
262
+ call_metadata = @config.rpcs.list_tasks.metadata.to_h
263
+
264
+ # Set x-goog-api-client and x-goog-user-project headers
265
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
266
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
267
+ gapic_version: ::Google::Cloud::Run::V2::VERSION,
268
+ transports_version_send: [:rest]
269
+
270
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
271
+
272
+ options.apply_defaults timeout: @config.rpcs.list_tasks.timeout,
273
+ metadata: call_metadata,
274
+ retry_policy: @config.rpcs.list_tasks.retry_policy
275
+
276
+ options.apply_defaults timeout: @config.timeout,
277
+ metadata: @config.metadata,
278
+ retry_policy: @config.retry_policy
279
+
280
+ @tasks_stub.list_tasks request, options do |result, operation|
281
+ result = ::Gapic::Rest::PagedEnumerable.new @tasks_stub, :list_tasks, "tasks", request, result, options
282
+ yield result, operation if block_given?
283
+ return result
284
+ end
285
+ rescue ::Gapic::Rest::Error => e
286
+ raise ::Google::Cloud::Error.from_error(e)
287
+ end
288
+
289
+ ##
290
+ # Configuration class for the Tasks REST API.
291
+ #
292
+ # This class represents the configuration for Tasks REST,
293
+ # providing control over timeouts, retry behavior, logging, transport
294
+ # parameters, and other low-level controls. Certain parameters can also be
295
+ # applied individually to specific RPCs. See
296
+ # {::Google::Cloud::Run::V2::Tasks::Rest::Client::Configuration::Rpcs}
297
+ # for a list of RPCs that can be configured independently.
298
+ #
299
+ # Configuration can be applied globally to all clients, or to a single client
300
+ # on construction.
301
+ #
302
+ # @example
303
+ #
304
+ # # Modify the global config, setting the timeout for
305
+ # # get_task to 20 seconds,
306
+ # # and all remaining timeouts to 10 seconds.
307
+ # ::Google::Cloud::Run::V2::Tasks::Rest::Client.configure do |config|
308
+ # config.timeout = 10.0
309
+ # config.rpcs.get_task.timeout = 20.0
310
+ # end
311
+ #
312
+ # # Apply the above configuration only to a new client.
313
+ # client = ::Google::Cloud::Run::V2::Tasks::Rest::Client.new do |config|
314
+ # config.timeout = 10.0
315
+ # config.rpcs.get_task.timeout = 20.0
316
+ # end
317
+ #
318
+ # @!attribute [rw] endpoint
319
+ # The hostname or hostname:port of the service endpoint.
320
+ # Defaults to `"run.googleapis.com"`.
321
+ # @return [::String]
322
+ # @!attribute [rw] credentials
323
+ # Credentials to send with calls. You may provide any of the following types:
324
+ # * (`String`) The path to a service account key file in JSON format
325
+ # * (`Hash`) A service account key as a Hash
326
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
327
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
328
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
329
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
330
+ # * (`nil`) indicating no credentials
331
+ # @return [::Object]
332
+ # @!attribute [rw] scope
333
+ # The OAuth scopes
334
+ # @return [::Array<::String>]
335
+ # @!attribute [rw] lib_name
336
+ # The library name as recorded in instrumentation and logging
337
+ # @return [::String]
338
+ # @!attribute [rw] lib_version
339
+ # The library version as recorded in instrumentation and logging
340
+ # @return [::String]
341
+ # @!attribute [rw] timeout
342
+ # The call timeout in seconds.
343
+ # @return [::Numeric]
344
+ # @!attribute [rw] metadata
345
+ # Additional headers to be sent with the call.
346
+ # @return [::Hash{::Symbol=>::String}]
347
+ # @!attribute [rw] retry_policy
348
+ # The retry policy. The value is a hash with the following keys:
349
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
350
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
351
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
352
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
353
+ # trigger a retry.
354
+ # @return [::Hash]
355
+ # @!attribute [rw] quota_project
356
+ # A separate project against which to charge quota.
357
+ # @return [::String]
358
+ #
359
+ class Configuration
360
+ extend ::Gapic::Config
361
+
362
+ config_attr :endpoint, "run.googleapis.com", ::String
363
+ config_attr :credentials, nil do |value|
364
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
365
+ allowed.any? { |klass| klass === value }
366
+ end
367
+ config_attr :scope, nil, ::String, ::Array, nil
368
+ config_attr :lib_name, nil, ::String, nil
369
+ config_attr :lib_version, nil, ::String, nil
370
+ config_attr :timeout, nil, ::Numeric, nil
371
+ config_attr :metadata, nil, ::Hash, nil
372
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
373
+ config_attr :quota_project, nil, ::String, nil
374
+
375
+ # @private
376
+ def initialize parent_config = nil
377
+ @parent_config = parent_config unless parent_config.nil?
378
+
379
+ yield self if block_given?
380
+ end
381
+
382
+ ##
383
+ # Configurations for individual RPCs
384
+ # @return [Rpcs]
385
+ #
386
+ def rpcs
387
+ @rpcs ||= begin
388
+ parent_rpcs = nil
389
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
390
+ Rpcs.new parent_rpcs
391
+ end
392
+ end
393
+
394
+ ##
395
+ # Configuration RPC class for the Tasks API.
396
+ #
397
+ # Includes fields providing the configuration for each RPC in this service.
398
+ # Each configuration object is of type `Gapic::Config::Method` and includes
399
+ # the following configuration fields:
400
+ #
401
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
402
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
403
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
404
+ # include the following keys:
405
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
406
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
407
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
408
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
409
+ # trigger a retry.
410
+ #
411
+ class Rpcs
412
+ ##
413
+ # RPC-specific configuration for `get_task`
414
+ # @return [::Gapic::Config::Method]
415
+ #
416
+ attr_reader :get_task
417
+ ##
418
+ # RPC-specific configuration for `list_tasks`
419
+ # @return [::Gapic::Config::Method]
420
+ #
421
+ attr_reader :list_tasks
422
+
423
+ # @private
424
+ def initialize parent_rpcs = nil
425
+ get_task_config = parent_rpcs.get_task if parent_rpcs.respond_to? :get_task
426
+ @get_task = ::Gapic::Config::Method.new get_task_config
427
+ list_tasks_config = parent_rpcs.list_tasks if parent_rpcs.respond_to? :list_tasks
428
+ @list_tasks = ::Gapic::Config::Method.new list_tasks_config
429
+
430
+ yield self if block_given?
431
+ end
432
+ end
433
+ end
434
+ end
435
+ end
436
+ end
437
+ end
438
+ end
439
+ end
440
+ end
@@ -0,0 +1,166 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 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/task_pb"
20
+
21
+ module Google
22
+ module Cloud
23
+ module Run
24
+ module V2
25
+ module Tasks
26
+ module Rest
27
+ ##
28
+ # REST service stub for the Tasks service.
29
+ # Service stub contains baseline method implementations
30
+ # including transcoding, making the REST call, and deserialing the response.
31
+ #
32
+ class ServiceStub
33
+ def initialize endpoint:, credentials:
34
+ # These require statements are intentionally placed here to initialize
35
+ # the REST modules only when it's required.
36
+ require "gapic/rest"
37
+
38
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials,
39
+ numeric_enums: true,
40
+ raise_faraday_errors: false
41
+ end
42
+
43
+ ##
44
+ # Baseline implementation for the get_task REST call
45
+ #
46
+ # @param request_pb [::Google::Cloud::Run::V2::GetTaskRequest]
47
+ # A request object representing the call parameters. Required.
48
+ # @param options [::Gapic::CallOptions]
49
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
50
+ #
51
+ # @yield [result, operation] Access the result along with the TransportOperation object
52
+ # @yieldparam result [::Google::Cloud::Run::V2::Task]
53
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
54
+ #
55
+ # @return [::Google::Cloud::Run::V2::Task]
56
+ # A result object deserialized from the server's reply
57
+ def get_task request_pb, options = nil
58
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
59
+
60
+ verb, uri, query_string_params, body = ServiceStub.transcode_get_task_request request_pb
61
+ query_string_params = if query_string_params.any?
62
+ query_string_params.to_h { |p| p.split("=", 2) }
63
+ else
64
+ {}
65
+ end
66
+
67
+ response = @client_stub.make_http_request(
68
+ verb,
69
+ uri: uri,
70
+ body: body || "",
71
+ params: query_string_params,
72
+ options: options
73
+ )
74
+ operation = ::Gapic::Rest::TransportOperation.new response
75
+ result = ::Google::Cloud::Run::V2::Task.decode_json response.body, ignore_unknown_fields: true
76
+
77
+ yield result, operation if block_given?
78
+ result
79
+ end
80
+
81
+ ##
82
+ # Baseline implementation for the list_tasks REST call
83
+ #
84
+ # @param request_pb [::Google::Cloud::Run::V2::ListTasksRequest]
85
+ # A request object representing the call parameters. Required.
86
+ # @param options [::Gapic::CallOptions]
87
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
88
+ #
89
+ # @yield [result, operation] Access the result along with the TransportOperation object
90
+ # @yieldparam result [::Google::Cloud::Run::V2::ListTasksResponse]
91
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
92
+ #
93
+ # @return [::Google::Cloud::Run::V2::ListTasksResponse]
94
+ # A result object deserialized from the server's reply
95
+ def list_tasks request_pb, options = nil
96
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
97
+
98
+ verb, uri, query_string_params, body = ServiceStub.transcode_list_tasks_request request_pb
99
+ query_string_params = if query_string_params.any?
100
+ query_string_params.to_h { |p| p.split("=", 2) }
101
+ else
102
+ {}
103
+ end
104
+
105
+ response = @client_stub.make_http_request(
106
+ verb,
107
+ uri: uri,
108
+ body: body || "",
109
+ params: query_string_params,
110
+ options: options
111
+ )
112
+ operation = ::Gapic::Rest::TransportOperation.new response
113
+ result = ::Google::Cloud::Run::V2::ListTasksResponse.decode_json response.body, ignore_unknown_fields: true
114
+
115
+ yield result, operation if block_given?
116
+ result
117
+ end
118
+
119
+ ##
120
+ # @private
121
+ #
122
+ # GRPC transcoding helper method for the get_task REST call
123
+ #
124
+ # @param request_pb [::Google::Cloud::Run::V2::GetTaskRequest]
125
+ # A request object representing the call parameters. Required.
126
+ # @return [Array(String, [String, nil], Hash{String => String})]
127
+ # Uri, Body, Query string parameters
128
+ def self.transcode_get_task_request request_pb
129
+ transcoder = Gapic::Rest::GrpcTranscoder.new
130
+ .with_bindings(
131
+ uri_method: :get,
132
+ uri_template: "/v2/{name}",
133
+ matches: [
134
+ ["name", %r{^projects/[^/]+/locations/[^/]+/jobs/[^/]+/executions/[^/]+/tasks/[^/]+/?$}, false]
135
+ ]
136
+ )
137
+ transcoder.transcode request_pb
138
+ end
139
+
140
+ ##
141
+ # @private
142
+ #
143
+ # GRPC transcoding helper method for the list_tasks REST call
144
+ #
145
+ # @param request_pb [::Google::Cloud::Run::V2::ListTasksRequest]
146
+ # A request object representing the call parameters. Required.
147
+ # @return [Array(String, [String, nil], Hash{String => String})]
148
+ # Uri, Body, Query string parameters
149
+ def self.transcode_list_tasks_request request_pb
150
+ transcoder = Gapic::Rest::GrpcTranscoder.new
151
+ .with_bindings(
152
+ uri_method: :get,
153
+ uri_template: "/v2/{parent}/tasks",
154
+ matches: [
155
+ ["parent", %r{^projects/[^/]+/locations/[^/]+/jobs/[^/]+/executions/[^/]+/?$}, false]
156
+ ]
157
+ )
158
+ transcoder.transcode request_pb
159
+ end
160
+ end
161
+ end
162
+ end
163
+ end
164
+ end
165
+ end
166
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 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/tasks/credentials"
26
+ require "google/cloud/run/v2/tasks/paths"
27
+ require "google/cloud/run/v2/tasks/rest/client"
28
+
29
+ module Google
30
+ module Cloud
31
+ module Run
32
+ module V2
33
+ ##
34
+ # Cloud Run Task Control Plane API.
35
+ #
36
+ # To load this service and instantiate a REST client:
37
+ #
38
+ # require "google/cloud/run/v2/tasks/rest"
39
+ # client = ::Google::Cloud::Run::V2::Tasks::Rest::Client.new
40
+ #
41
+ module Tasks
42
+ # Client for the REST transport
43
+ module Rest
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+
51
+ helper_path = ::File.join __dir__, "rest", "helpers.rb"
52
+ require "google/cloud/run/v2/tasks/rest/helpers" if ::File.file? helper_path
@@ -25,6 +25,7 @@ require "google/cloud/run/v2/version"
25
25
  require "google/cloud/run/v2/tasks/credentials"
26
26
  require "google/cloud/run/v2/tasks/paths"
27
27
  require "google/cloud/run/v2/tasks/client"
28
+ require "google/cloud/run/v2/tasks/rest"
28
29
 
29
30
  module Google
30
31
  module Cloud
@@ -33,11 +34,16 @@ module Google
33
34
  ##
34
35
  # Cloud Run Task Control Plane API.
35
36
  #
36
- # To load this service and instantiate a client:
37
+ # @example Load this service and instantiate a gRPC client
37
38
  #
38
39
  # require "google/cloud/run/v2/tasks"
39
40
  # client = ::Google::Cloud::Run::V2::Tasks::Client.new
40
41
  #
42
+ # @example Load this service and instantiate a REST client
43
+ #
44
+ # require "google/cloud/run/v2/tasks/rest"
45
+ # client = ::Google::Cloud::Run::V2::Tasks::Rest::Client.new
46
+ #
41
47
  module Tasks
42
48
  end
43
49
  end