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,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/revision_pb"
20
+
21
+ module Google
22
+ module Cloud
23
+ module Run
24
+ module V2
25
+ module Revisions
26
+ module Rest
27
+ ##
28
+ # REST service stub for the Revisions 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_revision REST call
45
+ #
46
+ # @param request_pb [::Google::Cloud::Run::V2::GetRevisionRequest]
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::Revision]
53
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
54
+ #
55
+ # @return [::Google::Cloud::Run::V2::Revision]
56
+ # A result object deserialized from the server's reply
57
+ def get_revision 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_revision_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::Revision.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_revisions REST call
83
+ #
84
+ # @param request_pb [::Google::Cloud::Run::V2::ListRevisionsRequest]
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::ListRevisionsResponse]
91
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
92
+ #
93
+ # @return [::Google::Cloud::Run::V2::ListRevisionsResponse]
94
+ # A result object deserialized from the server's reply
95
+ def list_revisions 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_revisions_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::ListRevisionsResponse.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_revision REST call
121
+ #
122
+ # @param request_pb [::Google::Cloud::Run::V2::DeleteRevisionRequest]
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_revision 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_revision_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_revision REST call
161
+ #
162
+ # @param request_pb [::Google::Cloud::Run::V2::GetRevisionRequest]
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_revision_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/[^/]+/services/[^/]+/revisions/[^/]+/?$}, false]
173
+ ]
174
+ )
175
+ transcoder.transcode request_pb
176
+ end
177
+
178
+ ##
179
+ # @private
180
+ #
181
+ # GRPC transcoding helper method for the list_revisions REST call
182
+ #
183
+ # @param request_pb [::Google::Cloud::Run::V2::ListRevisionsRequest]
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_revisions_request request_pb
188
+ transcoder = Gapic::Rest::GrpcTranscoder.new
189
+ .with_bindings(
190
+ uri_method: :get,
191
+ uri_template: "/v2/{parent}/revisions",
192
+ matches: [
193
+ ["parent", %r{^projects/[^/]+/locations/[^/]+/services/[^/]+/?$}, false]
194
+ ]
195
+ )
196
+ transcoder.transcode request_pb
197
+ end
198
+
199
+ ##
200
+ # @private
201
+ #
202
+ # GRPC transcoding helper method for the delete_revision REST call
203
+ #
204
+ # @param request_pb [::Google::Cloud::Run::V2::DeleteRevisionRequest]
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_revision_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/[^/]+/services/[^/]+/revisions/[^/]+/?$}, 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/revisions/credentials"
26
+ require "google/cloud/run/v2/revisions/paths"
27
+ require "google/cloud/run/v2/revisions/rest/operations"
28
+ require "google/cloud/run/v2/revisions/rest/client"
29
+
30
+ module Google
31
+ module Cloud
32
+ module Run
33
+ module V2
34
+ ##
35
+ # Cloud Run Revision Control Plane API.
36
+ #
37
+ # To load this service and instantiate a REST client:
38
+ #
39
+ # require "google/cloud/run/v2/revisions/rest"
40
+ # client = ::Google::Cloud::Run::V2::Revisions::Rest::Client.new
41
+ #
42
+ module Revisions
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/revisions/rest/helpers" if ::File.file? helper_path
@@ -26,6 +26,7 @@ require "google/cloud/run/v2/revisions/credentials"
26
26
  require "google/cloud/run/v2/revisions/paths"
27
27
  require "google/cloud/run/v2/revisions/operations"
28
28
  require "google/cloud/run/v2/revisions/client"
29
+ require "google/cloud/run/v2/revisions/rest"
29
30
 
30
31
  module Google
31
32
  module Cloud
@@ -34,11 +35,16 @@ module Google
34
35
  ##
35
36
  # Cloud Run Revision Control Plane API.
36
37
  #
37
- # To load this service and instantiate a client:
38
+ # @example Load this service and instantiate a gRPC client
38
39
  #
39
40
  # require "google/cloud/run/v2/revisions"
40
41
  # client = ::Google::Cloud::Run::V2::Revisions::Client.new
41
42
  #
43
+ # @example Load this service and instantiate a REST client
44
+ #
45
+ # require "google/cloud/run/v2/revisions/rest"
46
+ # client = ::Google::Cloud::Run::V2::Revisions::Rest::Client.new
47
+ #
42
48
  module Revisions
43
49
  end
44
50
  end
@@ -239,14 +239,14 @@ module Google
239
239
  # # Call the create_service method.
240
240
  # result = client.create_service request
241
241
  #
242
- # # The returned object is of type Gapic::Operation. You can use this
243
- # # object to check the status of an operation, cancel it, or wait
244
- # # for results. Here is how to block until completion:
242
+ # # The returned object is of type Gapic::Operation. You can use it to
243
+ # # check the status of an operation, cancel it, or wait for results.
244
+ # # Here is how to wait for a response.
245
245
  # result.wait_until_done! timeout: 60
246
246
  # if result.response?
247
247
  # p result.response
248
248
  # else
249
- # puts "Error!"
249
+ # puts "No response received."
250
250
  # end
251
251
  #
252
252
  def create_service request, options = nil
@@ -404,9 +404,9 @@ module Google
404
404
  #
405
405
  # @param parent [::String]
406
406
  # Required. The location and project to list resources on.
407
- # Location must be a valid GCP region, and cannot be the "-" wildcard.
408
- # Format: projects/\\{project}/locations/\\{location}, where \\{project} can be
409
- # project id or number.
407
+ # Location must be a valid Google Cloud region, and cannot be the "-"
408
+ # wildcard. Format: projects/\\{project}/locations/\\{location}, where \\{project}
409
+ # can be project id or number.
410
410
  # @param page_size [::Integer]
411
411
  # Maximum number of Services to return in this call.
412
412
  # @param page_token [::String]
@@ -435,13 +435,11 @@ module Google
435
435
  # # Call the list_services method.
436
436
  # result = client.list_services request
437
437
  #
438
- # # The returned object is of type Gapic::PagedEnumerable. You can
439
- # # iterate over all elements by calling #each, and the enumerable
440
- # # will lazily make API calls to fetch subsequent pages. Other
441
- # # methods are also available for managing paging directly.
442
- # result.each do |response|
438
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
439
+ # # over elements, and API calls will be issued to fetch pages as needed.
440
+ # result.each do |item|
443
441
  # # Each element is of type ::Google::Cloud::Run::V2::Service.
444
- # p response
442
+ # p item
445
443
  # end
446
444
  #
447
445
  def list_services request, options = nil
@@ -537,14 +535,14 @@ module Google
537
535
  # # Call the update_service method.
538
536
  # result = client.update_service request
539
537
  #
540
- # # The returned object is of type Gapic::Operation. You can use this
541
- # # object to check the status of an operation, cancel it, or wait
542
- # # for results. Here is how to block until completion:
538
+ # # The returned object is of type Gapic::Operation. You can use it to
539
+ # # check the status of an operation, cancel it, or wait for results.
540
+ # # Here is how to wait for a response.
543
541
  # result.wait_until_done! timeout: 60
544
542
  # if result.response?
545
543
  # p result.response
546
544
  # else
547
- # puts "Error!"
545
+ # puts "No response received."
548
546
  # end
549
547
  #
550
548
  def update_service request, options = nil
@@ -643,14 +641,14 @@ module Google
643
641
  # # Call the delete_service method.
644
642
  # result = client.delete_service request
645
643
  #
646
- # # The returned object is of type Gapic::Operation. You can use this
647
- # # object to check the status of an operation, cancel it, or wait
648
- # # for results. Here is how to block until completion:
644
+ # # The returned object is of type Gapic::Operation. You can use it to
645
+ # # check the status of an operation, cancel it, or wait for results.
646
+ # # Here is how to wait for a response.
649
647
  # result.wait_until_done! timeout: 60
650
648
  # if result.response?
651
649
  # p result.response
652
650
  # else
653
- # puts "Error!"
651
+ # puts "No response received."
654
652
  # end
655
653
  #
656
654
  def delete_service 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
@@ -567,6 +565,14 @@ module Google
567
565
  gapic_version: ::Google::Cloud::Run::V2::VERSION
568
566
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
569
567
 
568
+ header_params = {}
569
+ if request.name
570
+ header_params["name"] = request.name
571
+ end
572
+
573
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
574
+ metadata[:"x-goog-request-params"] ||= request_params_header
575
+
570
576
  options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
571
577
  metadata: metadata,
572
578
  retry_policy: @config.rpcs.wait_operation.retry_policy