google-cloud-run-v2 0.6.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 (39) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/google/cloud/run/v2/executions/client.rb +8 -10
  4. data/lib/google/cloud/run/v2/executions/operations.rb +12 -14
  5. data/lib/google/cloud/run/v2/executions/rest/client.rb +533 -0
  6. data/lib/google/cloud/run/v2/executions/rest/operations.rb +935 -0
  7. data/lib/google/cloud/run/v2/executions/rest/service_stub.rb +225 -0
  8. data/lib/google/cloud/run/v2/executions/rest.rb +53 -0
  9. data/lib/google/cloud/run/v2/executions.rb +6 -0
  10. data/lib/google/cloud/run/v2/jobs/client.rb +20 -22
  11. data/lib/google/cloud/run/v2/jobs/operations.rb +12 -14
  12. data/lib/google/cloud/run/v2/jobs/rest/client.rb +998 -0
  13. data/lib/google/cloud/run/v2/jobs/rest/operations.rb +935 -0
  14. data/lib/google/cloud/run/v2/jobs/rest/service_stub.rb +584 -0
  15. data/lib/google/cloud/run/v2/jobs/rest.rb +53 -0
  16. data/lib/google/cloud/run/v2/jobs.rb +6 -0
  17. data/lib/google/cloud/run/v2/rest.rb +41 -0
  18. data/lib/google/cloud/run/v2/revisions/client.rb +8 -10
  19. data/lib/google/cloud/run/v2/revisions/operations.rb +12 -14
  20. data/lib/google/cloud/run/v2/revisions/rest/client.rb +531 -0
  21. data/lib/google/cloud/run/v2/revisions/rest/operations.rb +935 -0
  22. data/lib/google/cloud/run/v2/revisions/rest/service_stub.rb +225 -0
  23. data/lib/google/cloud/run/v2/revisions/rest.rb +53 -0
  24. data/lib/google/cloud/run/v2/revisions.rb +6 -0
  25. data/lib/google/cloud/run/v2/services/client.rb +16 -18
  26. data/lib/google/cloud/run/v2/services/operations.rb +12 -14
  27. data/lib/google/cloud/run/v2/services/rest/client.rb +940 -0
  28. data/lib/google/cloud/run/v2/services/rest/operations.rb +935 -0
  29. data/lib/google/cloud/run/v2/services/rest/service_stub.rb +524 -0
  30. data/lib/google/cloud/run/v2/services/rest.rb +53 -0
  31. data/lib/google/cloud/run/v2/services.rb +6 -0
  32. data/lib/google/cloud/run/v2/tasks/client.rb +4 -6
  33. data/lib/google/cloud/run/v2/tasks/rest/client.rb +440 -0
  34. data/lib/google/cloud/run/v2/tasks/rest/service_stub.rb +166 -0
  35. data/lib/google/cloud/run/v2/tasks/rest.rb +52 -0
  36. data/lib/google/cloud/run/v2/tasks.rb +6 -0
  37. data/lib/google/cloud/run/v2/version.rb +1 -1
  38. data/lib/google/cloud/run/v2.rb +5 -0
  39. metadata +32 -9
@@ -0,0 +1,225 @@
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/execution_pb"
20
+
21
+ module Google
22
+ module Cloud
23
+ module Run
24
+ module V2
25
+ module Executions
26
+ module Rest
27
+ ##
28
+ # REST service stub for the Executions 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_execution REST call
45
+ #
46
+ # @param request_pb [::Google::Cloud::Run::V2::GetExecutionRequest]
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::Execution]
53
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
54
+ #
55
+ # @return [::Google::Cloud::Run::V2::Execution]
56
+ # A result object deserialized from the server's reply
57
+ def get_execution 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_execution_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::Execution.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_executions REST call
83
+ #
84
+ # @param request_pb [::Google::Cloud::Run::V2::ListExecutionsRequest]
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::ListExecutionsResponse]
91
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
92
+ #
93
+ # @return [::Google::Cloud::Run::V2::ListExecutionsResponse]
94
+ # A result object deserialized from the server's reply
95
+ def list_executions 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_executions_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::ListExecutionsResponse.decode_json response.body, ignore_unknown_fields: true
114
+
115
+ yield result, operation if block_given?
116
+ result
117
+ end
118
+
119
+ ##
120
+ # Baseline implementation for the delete_execution REST call
121
+ #
122
+ # @param request_pb [::Google::Cloud::Run::V2::DeleteExecutionRequest]
123
+ # A request object representing the call parameters. Required.
124
+ # @param options [::Gapic::CallOptions]
125
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
126
+ #
127
+ # @yield [result, operation] Access the result along with the TransportOperation object
128
+ # @yieldparam result [::Google::Longrunning::Operation]
129
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
130
+ #
131
+ # @return [::Google::Longrunning::Operation]
132
+ # A result object deserialized from the server's reply
133
+ def delete_execution request_pb, options = nil
134
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
135
+
136
+ verb, uri, query_string_params, body = ServiceStub.transcode_delete_execution_request request_pb
137
+ query_string_params = if query_string_params.any?
138
+ query_string_params.to_h { |p| p.split("=", 2) }
139
+ else
140
+ {}
141
+ end
142
+
143
+ response = @client_stub.make_http_request(
144
+ verb,
145
+ uri: uri,
146
+ body: body || "",
147
+ params: query_string_params,
148
+ options: options
149
+ )
150
+ operation = ::Gapic::Rest::TransportOperation.new response
151
+ result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
152
+
153
+ yield result, operation if block_given?
154
+ result
155
+ end
156
+
157
+ ##
158
+ # @private
159
+ #
160
+ # GRPC transcoding helper method for the get_execution REST call
161
+ #
162
+ # @param request_pb [::Google::Cloud::Run::V2::GetExecutionRequest]
163
+ # A request object representing the call parameters. Required.
164
+ # @return [Array(String, [String, nil], Hash{String => String})]
165
+ # Uri, Body, Query string parameters
166
+ def self.transcode_get_execution_request request_pb
167
+ transcoder = Gapic::Rest::GrpcTranscoder.new
168
+ .with_bindings(
169
+ uri_method: :get,
170
+ uri_template: "/v2/{name}",
171
+ matches: [
172
+ ["name", %r{^projects/[^/]+/locations/[^/]+/jobs/[^/]+/executions/[^/]+/?$}, false]
173
+ ]
174
+ )
175
+ transcoder.transcode request_pb
176
+ end
177
+
178
+ ##
179
+ # @private
180
+ #
181
+ # GRPC transcoding helper method for the list_executions REST call
182
+ #
183
+ # @param request_pb [::Google::Cloud::Run::V2::ListExecutionsRequest]
184
+ # A request object representing the call parameters. Required.
185
+ # @return [Array(String, [String, nil], Hash{String => String})]
186
+ # Uri, Body, Query string parameters
187
+ def self.transcode_list_executions_request request_pb
188
+ transcoder = Gapic::Rest::GrpcTranscoder.new
189
+ .with_bindings(
190
+ uri_method: :get,
191
+ uri_template: "/v2/{parent}/executions",
192
+ matches: [
193
+ ["parent", %r{^projects/[^/]+/locations/[^/]+/jobs/[^/]+/?$}, false]
194
+ ]
195
+ )
196
+ transcoder.transcode request_pb
197
+ end
198
+
199
+ ##
200
+ # @private
201
+ #
202
+ # GRPC transcoding helper method for the delete_execution REST call
203
+ #
204
+ # @param request_pb [::Google::Cloud::Run::V2::DeleteExecutionRequest]
205
+ # A request object representing the call parameters. Required.
206
+ # @return [Array(String, [String, nil], Hash{String => String})]
207
+ # Uri, Body, Query string parameters
208
+ def self.transcode_delete_execution_request request_pb
209
+ transcoder = Gapic::Rest::GrpcTranscoder.new
210
+ .with_bindings(
211
+ uri_method: :delete,
212
+ uri_template: "/v2/{name}",
213
+ matches: [
214
+ ["name", %r{^projects/[^/]+/locations/[^/]+/jobs/[^/]+/executions/[^/]+/?$}, false]
215
+ ]
216
+ )
217
+ transcoder.transcode request_pb
218
+ end
219
+ end
220
+ end
221
+ end
222
+ end
223
+ end
224
+ end
225
+ end
@@ -0,0 +1,53 @@
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/executions/credentials"
26
+ require "google/cloud/run/v2/executions/paths"
27
+ require "google/cloud/run/v2/executions/rest/operations"
28
+ require "google/cloud/run/v2/executions/rest/client"
29
+
30
+ module Google
31
+ module Cloud
32
+ module Run
33
+ module V2
34
+ ##
35
+ # Cloud Run Execution Control Plane API.
36
+ #
37
+ # To load this service and instantiate a REST client:
38
+ #
39
+ # require "google/cloud/run/v2/executions/rest"
40
+ # client = ::Google::Cloud::Run::V2::Executions::Rest::Client.new
41
+ #
42
+ module Executions
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/executions/rest/helpers" if ::File.file? helper_path
@@ -26,6 +26,7 @@ require "google/cloud/run/v2/executions/credentials"
26
26
  require "google/cloud/run/v2/executions/paths"
27
27
  require "google/cloud/run/v2/executions/operations"
28
28
  require "google/cloud/run/v2/executions/client"
29
+ require "google/cloud/run/v2/executions/rest"
29
30
 
30
31
  module Google
31
32
  module Cloud
@@ -39,6 +40,11 @@ module Google
39
40
  # require "google/cloud/run/v2/executions"
40
41
  # client = ::Google::Cloud::Run::V2::Executions::Client.new
41
42
  #
43
+ # @example Load this service and instantiate a REST client
44
+ #
45
+ # require "google/cloud/run/v2/executions/rest"
46
+ # client = ::Google::Cloud::Run::V2::Executions::Rest::Client.new
47
+ #
42
48
  module Executions
43
49
  end
44
50
  end
@@ -222,14 +222,14 @@ module Google
222
222
  # # Call the create_job method.
223
223
  # result = client.create_job request
224
224
  #
225
- # # The returned object is of type Gapic::Operation. You can use this
226
- # # object to check the status of an operation, cancel it, or wait
227
- # # for results. Here is how to block until completion:
225
+ # # The returned object is of type Gapic::Operation. You can use it to
226
+ # # check the status of an operation, cancel it, or wait for results.
227
+ # # Here is how to wait for a response.
228
228
  # result.wait_until_done! timeout: 60
229
229
  # if result.response?
230
230
  # p result.response
231
231
  # else
232
- # puts "Error!"
232
+ # puts "No response received."
233
233
  # end
234
234
  #
235
235
  def create_job request, options = nil
@@ -411,13 +411,11 @@ module Google
411
411
  # # Call the list_jobs method.
412
412
  # result = client.list_jobs request
413
413
  #
414
- # # The returned object is of type Gapic::PagedEnumerable. You can
415
- # # iterate over all elements by calling #each, and the enumerable
416
- # # will lazily make API calls to fetch subsequent pages. Other
417
- # # methods are also available for managing paging directly.
418
- # result.each do |response|
414
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
415
+ # # over elements, and API calls will be issued to fetch pages as needed.
416
+ # result.each do |item|
419
417
  # # Each element is of type ::Google::Cloud::Run::V2::Job.
420
- # p response
418
+ # p item
421
419
  # end
422
420
  #
423
421
  def list_jobs request, options = nil
@@ -510,14 +508,14 @@ module Google
510
508
  # # Call the update_job method.
511
509
  # result = client.update_job request
512
510
  #
513
- # # The returned object is of type Gapic::Operation. You can use this
514
- # # object to check the status of an operation, cancel it, or wait
515
- # # for results. Here is how to block until completion:
511
+ # # The returned object is of type Gapic::Operation. You can use it to
512
+ # # check the status of an operation, cancel it, or wait for results.
513
+ # # Here is how to wait for a response.
516
514
  # result.wait_until_done! timeout: 60
517
515
  # if result.response?
518
516
  # p result.response
519
517
  # else
520
- # puts "Error!"
518
+ # puts "No response received."
521
519
  # end
522
520
  #
523
521
  def update_job request, options = nil
@@ -611,14 +609,14 @@ module Google
611
609
  # # Call the delete_job method.
612
610
  # result = client.delete_job request
613
611
  #
614
- # # The returned object is of type Gapic::Operation. You can use this
615
- # # object to check the status of an operation, cancel it, or wait
616
- # # for results. Here is how to block until completion:
612
+ # # The returned object is of type Gapic::Operation. You can use it to
613
+ # # check the status of an operation, cancel it, or wait for results.
614
+ # # Here is how to wait for a response.
617
615
  # result.wait_until_done! timeout: 60
618
616
  # if result.response?
619
617
  # p result.response
620
618
  # else
621
- # puts "Error!"
619
+ # puts "No response received."
622
620
  # end
623
621
  #
624
622
  def delete_job request, options = nil
@@ -712,14 +710,14 @@ module Google
712
710
  # # Call the run_job method.
713
711
  # result = client.run_job request
714
712
  #
715
- # # The returned object is of type Gapic::Operation. You can use this
716
- # # object to check the status of an operation, cancel it, or wait
717
- # # for results. Here is how to block until completion:
713
+ # # The returned object is of type Gapic::Operation. You can use it to
714
+ # # check the status of an operation, cancel it, or wait for results.
715
+ # # Here is how to wait for a response.
718
716
  # result.wait_until_done! timeout: 60
719
717
  # if result.response?
720
718
  # p result.response
721
719
  # else
722
- # puts "Error!"
720
+ # puts "No response received."
723
721
  # end
724
722
  #
725
723
  def run_job request, options = nil
@@ -158,13 +158,11 @@ module Google
158
158
  # # Call the list_operations method.
159
159
  # result = client.list_operations request
160
160
  #
161
- # # The returned object is of type Gapic::PagedEnumerable. You can
162
- # # iterate over all elements by calling #each, and the enumerable
163
- # # will lazily make API calls to fetch subsequent pages. Other
164
- # # methods are also available for managing paging directly.
165
- # result.each do |response|
161
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
162
+ # # over elements, and API calls will be issued to fetch pages as needed.
163
+ # result.each do |item|
166
164
  # # Each element is of type ::Google::Longrunning::Operation.
167
- # p response
165
+ # p item
168
166
  # end
169
167
  #
170
168
  def list_operations request, options = nil
@@ -253,14 +251,14 @@ module Google
253
251
  # # Call the get_operation method.
254
252
  # result = client.get_operation request
255
253
  #
256
- # # The returned object is of type Gapic::Operation. You can use this
257
- # # object to check the status of an operation, cancel it, or wait
258
- # # for results. Here is how to block until completion:
254
+ # # The returned object is of type Gapic::Operation. You can use it to
255
+ # # check the status of an operation, cancel it, or wait for results.
256
+ # # Here is how to wait for a response.
259
257
  # result.wait_until_done! timeout: 60
260
258
  # if result.response?
261
259
  # p result.response
262
260
  # else
263
- # puts "Error!"
261
+ # puts "No response received."
264
262
  # end
265
263
  #
266
264
  def get_operation request, options = nil
@@ -540,14 +538,14 @@ module Google
540
538
  # # Call the wait_operation method.
541
539
  # result = client.wait_operation request
542
540
  #
543
- # # The returned object is of type Gapic::Operation. You can use this
544
- # # object to check the status of an operation, cancel it, or wait
545
- # # for results. Here is how to block until completion:
541
+ # # The returned object is of type Gapic::Operation. You can use it to
542
+ # # check the status of an operation, cancel it, or wait for results.
543
+ # # Here is how to wait for a response.
546
544
  # result.wait_until_done! timeout: 60
547
545
  # if result.response?
548
546
  # p result.response
549
547
  # else
550
- # puts "Error!"
548
+ # puts "No response received."
551
549
  # end
552
550
  #
553
551
  def wait_operation request, options = nil