google-cloud-orchestration-airflow-service-v1 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,469 @@
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/orchestration/airflow/service/v1/environments_pb"
20
+
21
+ module Google
22
+ module Cloud
23
+ module Orchestration
24
+ module Airflow
25
+ module Service
26
+ module V1
27
+ module Environments
28
+ module Rest
29
+ ##
30
+ # REST service stub for the Environments service.
31
+ # Service stub contains baseline method implementations
32
+ # including transcoding, making the REST call, and deserialing the response.
33
+ #
34
+ class ServiceStub
35
+ def initialize endpoint:, credentials:
36
+ # These require statements are intentionally placed here to initialize
37
+ # the REST modules only when it's required.
38
+ require "gapic/rest"
39
+
40
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials,
41
+ numeric_enums: true,
42
+ raise_faraday_errors: false
43
+ end
44
+
45
+ ##
46
+ # Baseline implementation for the create_environment REST call
47
+ #
48
+ # @param request_pb [::Google::Cloud::Orchestration::Airflow::Service::V1::CreateEnvironmentRequest]
49
+ # A request object representing the call parameters. Required.
50
+ # @param options [::Gapic::CallOptions]
51
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
52
+ #
53
+ # @yield [result, operation] Access the result along with the TransportOperation object
54
+ # @yieldparam result [::Google::Longrunning::Operation]
55
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
56
+ #
57
+ # @return [::Google::Longrunning::Operation]
58
+ # A result object deserialized from the server's reply
59
+ def create_environment request_pb, options = nil
60
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
61
+
62
+ verb, uri, query_string_params, body = ServiceStub.transcode_create_environment_request request_pb
63
+ query_string_params = if query_string_params.any?
64
+ query_string_params.to_h { |p| p.split("=", 2) }
65
+ else
66
+ {}
67
+ end
68
+
69
+ response = @client_stub.make_http_request(
70
+ verb,
71
+ uri: uri,
72
+ body: body || "",
73
+ params: query_string_params,
74
+ options: options
75
+ )
76
+ operation = ::Gapic::Rest::TransportOperation.new response
77
+ result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
78
+
79
+ yield result, operation if block_given?
80
+ result
81
+ end
82
+
83
+ ##
84
+ # Baseline implementation for the get_environment REST call
85
+ #
86
+ # @param request_pb [::Google::Cloud::Orchestration::Airflow::Service::V1::GetEnvironmentRequest]
87
+ # A request object representing the call parameters. Required.
88
+ # @param options [::Gapic::CallOptions]
89
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
90
+ #
91
+ # @yield [result, operation] Access the result along with the TransportOperation object
92
+ # @yieldparam result [::Google::Cloud::Orchestration::Airflow::Service::V1::Environment]
93
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
94
+ #
95
+ # @return [::Google::Cloud::Orchestration::Airflow::Service::V1::Environment]
96
+ # A result object deserialized from the server's reply
97
+ def get_environment request_pb, options = nil
98
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
99
+
100
+ verb, uri, query_string_params, body = ServiceStub.transcode_get_environment_request request_pb
101
+ query_string_params = if query_string_params.any?
102
+ query_string_params.to_h { |p| p.split("=", 2) }
103
+ else
104
+ {}
105
+ end
106
+
107
+ response = @client_stub.make_http_request(
108
+ verb,
109
+ uri: uri,
110
+ body: body || "",
111
+ params: query_string_params,
112
+ options: options
113
+ )
114
+ operation = ::Gapic::Rest::TransportOperation.new response
115
+ result = ::Google::Cloud::Orchestration::Airflow::Service::V1::Environment.decode_json response.body, ignore_unknown_fields: true
116
+
117
+ yield result, operation if block_given?
118
+ result
119
+ end
120
+
121
+ ##
122
+ # Baseline implementation for the list_environments REST call
123
+ #
124
+ # @param request_pb [::Google::Cloud::Orchestration::Airflow::Service::V1::ListEnvironmentsRequest]
125
+ # A request object representing the call parameters. Required.
126
+ # @param options [::Gapic::CallOptions]
127
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
128
+ #
129
+ # @yield [result, operation] Access the result along with the TransportOperation object
130
+ # @yieldparam result [::Google::Cloud::Orchestration::Airflow::Service::V1::ListEnvironmentsResponse]
131
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
132
+ #
133
+ # @return [::Google::Cloud::Orchestration::Airflow::Service::V1::ListEnvironmentsResponse]
134
+ # A result object deserialized from the server's reply
135
+ def list_environments request_pb, options = nil
136
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
137
+
138
+ verb, uri, query_string_params, body = ServiceStub.transcode_list_environments_request request_pb
139
+ query_string_params = if query_string_params.any?
140
+ query_string_params.to_h { |p| p.split("=", 2) }
141
+ else
142
+ {}
143
+ end
144
+
145
+ response = @client_stub.make_http_request(
146
+ verb,
147
+ uri: uri,
148
+ body: body || "",
149
+ params: query_string_params,
150
+ options: options
151
+ )
152
+ operation = ::Gapic::Rest::TransportOperation.new response
153
+ result = ::Google::Cloud::Orchestration::Airflow::Service::V1::ListEnvironmentsResponse.decode_json response.body, ignore_unknown_fields: true
154
+
155
+ yield result, operation if block_given?
156
+ result
157
+ end
158
+
159
+ ##
160
+ # Baseline implementation for the update_environment REST call
161
+ #
162
+ # @param request_pb [::Google::Cloud::Orchestration::Airflow::Service::V1::UpdateEnvironmentRequest]
163
+ # A request object representing the call parameters. Required.
164
+ # @param options [::Gapic::CallOptions]
165
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
166
+ #
167
+ # @yield [result, operation] Access the result along with the TransportOperation object
168
+ # @yieldparam result [::Google::Longrunning::Operation]
169
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
170
+ #
171
+ # @return [::Google::Longrunning::Operation]
172
+ # A result object deserialized from the server's reply
173
+ def update_environment request_pb, options = nil
174
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
175
+
176
+ verb, uri, query_string_params, body = ServiceStub.transcode_update_environment_request request_pb
177
+ query_string_params = if query_string_params.any?
178
+ query_string_params.to_h { |p| p.split("=", 2) }
179
+ else
180
+ {}
181
+ end
182
+
183
+ response = @client_stub.make_http_request(
184
+ verb,
185
+ uri: uri,
186
+ body: body || "",
187
+ params: query_string_params,
188
+ options: options
189
+ )
190
+ operation = ::Gapic::Rest::TransportOperation.new response
191
+ result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
192
+
193
+ yield result, operation if block_given?
194
+ result
195
+ end
196
+
197
+ ##
198
+ # Baseline implementation for the delete_environment REST call
199
+ #
200
+ # @param request_pb [::Google::Cloud::Orchestration::Airflow::Service::V1::DeleteEnvironmentRequest]
201
+ # A request object representing the call parameters. Required.
202
+ # @param options [::Gapic::CallOptions]
203
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
204
+ #
205
+ # @yield [result, operation] Access the result along with the TransportOperation object
206
+ # @yieldparam result [::Google::Longrunning::Operation]
207
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
208
+ #
209
+ # @return [::Google::Longrunning::Operation]
210
+ # A result object deserialized from the server's reply
211
+ def delete_environment request_pb, options = nil
212
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
213
+
214
+ verb, uri, query_string_params, body = ServiceStub.transcode_delete_environment_request request_pb
215
+ query_string_params = if query_string_params.any?
216
+ query_string_params.to_h { |p| p.split("=", 2) }
217
+ else
218
+ {}
219
+ end
220
+
221
+ response = @client_stub.make_http_request(
222
+ verb,
223
+ uri: uri,
224
+ body: body || "",
225
+ params: query_string_params,
226
+ options: options
227
+ )
228
+ operation = ::Gapic::Rest::TransportOperation.new response
229
+ result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
230
+
231
+ yield result, operation if block_given?
232
+ result
233
+ end
234
+
235
+ ##
236
+ # Baseline implementation for the save_snapshot REST call
237
+ #
238
+ # @param request_pb [::Google::Cloud::Orchestration::Airflow::Service::V1::SaveSnapshotRequest]
239
+ # A request object representing the call parameters. Required.
240
+ # @param options [::Gapic::CallOptions]
241
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
242
+ #
243
+ # @yield [result, operation] Access the result along with the TransportOperation object
244
+ # @yieldparam result [::Google::Longrunning::Operation]
245
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
246
+ #
247
+ # @return [::Google::Longrunning::Operation]
248
+ # A result object deserialized from the server's reply
249
+ def save_snapshot request_pb, options = nil
250
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
251
+
252
+ verb, uri, query_string_params, body = ServiceStub.transcode_save_snapshot_request request_pb
253
+ query_string_params = if query_string_params.any?
254
+ query_string_params.to_h { |p| p.split("=", 2) }
255
+ else
256
+ {}
257
+ end
258
+
259
+ response = @client_stub.make_http_request(
260
+ verb,
261
+ uri: uri,
262
+ body: body || "",
263
+ params: query_string_params,
264
+ options: options
265
+ )
266
+ operation = ::Gapic::Rest::TransportOperation.new response
267
+ result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
268
+
269
+ yield result, operation if block_given?
270
+ result
271
+ end
272
+
273
+ ##
274
+ # Baseline implementation for the load_snapshot REST call
275
+ #
276
+ # @param request_pb [::Google::Cloud::Orchestration::Airflow::Service::V1::LoadSnapshotRequest]
277
+ # A request object representing the call parameters. Required.
278
+ # @param options [::Gapic::CallOptions]
279
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
280
+ #
281
+ # @yield [result, operation] Access the result along with the TransportOperation object
282
+ # @yieldparam result [::Google::Longrunning::Operation]
283
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
284
+ #
285
+ # @return [::Google::Longrunning::Operation]
286
+ # A result object deserialized from the server's reply
287
+ def load_snapshot request_pb, options = nil
288
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
289
+
290
+ verb, uri, query_string_params, body = ServiceStub.transcode_load_snapshot_request request_pb
291
+ query_string_params = if query_string_params.any?
292
+ query_string_params.to_h { |p| p.split("=", 2) }
293
+ else
294
+ {}
295
+ end
296
+
297
+ response = @client_stub.make_http_request(
298
+ verb,
299
+ uri: uri,
300
+ body: body || "",
301
+ params: query_string_params,
302
+ options: options
303
+ )
304
+ operation = ::Gapic::Rest::TransportOperation.new response
305
+ result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
306
+
307
+ yield result, operation if block_given?
308
+ result
309
+ end
310
+
311
+ ##
312
+ # @private
313
+ #
314
+ # GRPC transcoding helper method for the create_environment REST call
315
+ #
316
+ # @param request_pb [::Google::Cloud::Orchestration::Airflow::Service::V1::CreateEnvironmentRequest]
317
+ # A request object representing the call parameters. Required.
318
+ # @return [Array(String, [String, nil], Hash{String => String})]
319
+ # Uri, Body, Query string parameters
320
+ def self.transcode_create_environment_request request_pb
321
+ transcoder = Gapic::Rest::GrpcTranscoder.new
322
+ .with_bindings(
323
+ uri_method: :post,
324
+ uri_template: "/v1/{parent}/environments",
325
+ body: "environment",
326
+ matches: [
327
+ ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false]
328
+ ]
329
+ )
330
+ transcoder.transcode request_pb
331
+ end
332
+
333
+ ##
334
+ # @private
335
+ #
336
+ # GRPC transcoding helper method for the get_environment REST call
337
+ #
338
+ # @param request_pb [::Google::Cloud::Orchestration::Airflow::Service::V1::GetEnvironmentRequest]
339
+ # A request object representing the call parameters. Required.
340
+ # @return [Array(String, [String, nil], Hash{String => String})]
341
+ # Uri, Body, Query string parameters
342
+ def self.transcode_get_environment_request request_pb
343
+ transcoder = Gapic::Rest::GrpcTranscoder.new
344
+ .with_bindings(
345
+ uri_method: :get,
346
+ uri_template: "/v1/{name}",
347
+ matches: [
348
+ ["name", %r{^projects/[^/]+/locations/[^/]+/environments/[^/]+/?$}, false]
349
+ ]
350
+ )
351
+ transcoder.transcode request_pb
352
+ end
353
+
354
+ ##
355
+ # @private
356
+ #
357
+ # GRPC transcoding helper method for the list_environments REST call
358
+ #
359
+ # @param request_pb [::Google::Cloud::Orchestration::Airflow::Service::V1::ListEnvironmentsRequest]
360
+ # A request object representing the call parameters. Required.
361
+ # @return [Array(String, [String, nil], Hash{String => String})]
362
+ # Uri, Body, Query string parameters
363
+ def self.transcode_list_environments_request request_pb
364
+ transcoder = Gapic::Rest::GrpcTranscoder.new
365
+ .with_bindings(
366
+ uri_method: :get,
367
+ uri_template: "/v1/{parent}/environments",
368
+ matches: [
369
+ ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false]
370
+ ]
371
+ )
372
+ transcoder.transcode request_pb
373
+ end
374
+
375
+ ##
376
+ # @private
377
+ #
378
+ # GRPC transcoding helper method for the update_environment REST call
379
+ #
380
+ # @param request_pb [::Google::Cloud::Orchestration::Airflow::Service::V1::UpdateEnvironmentRequest]
381
+ # A request object representing the call parameters. Required.
382
+ # @return [Array(String, [String, nil], Hash{String => String})]
383
+ # Uri, Body, Query string parameters
384
+ def self.transcode_update_environment_request request_pb
385
+ transcoder = Gapic::Rest::GrpcTranscoder.new
386
+ .with_bindings(
387
+ uri_method: :patch,
388
+ uri_template: "/v1/{name}",
389
+ body: "environment",
390
+ matches: [
391
+ ["name", %r{^projects/[^/]+/locations/[^/]+/environments/[^/]+/?$}, false]
392
+ ]
393
+ )
394
+ transcoder.transcode request_pb
395
+ end
396
+
397
+ ##
398
+ # @private
399
+ #
400
+ # GRPC transcoding helper method for the delete_environment REST call
401
+ #
402
+ # @param request_pb [::Google::Cloud::Orchestration::Airflow::Service::V1::DeleteEnvironmentRequest]
403
+ # A request object representing the call parameters. Required.
404
+ # @return [Array(String, [String, nil], Hash{String => String})]
405
+ # Uri, Body, Query string parameters
406
+ def self.transcode_delete_environment_request request_pb
407
+ transcoder = Gapic::Rest::GrpcTranscoder.new
408
+ .with_bindings(
409
+ uri_method: :delete,
410
+ uri_template: "/v1/{name}",
411
+ matches: [
412
+ ["name", %r{^projects/[^/]+/locations/[^/]+/environments/[^/]+/?$}, false]
413
+ ]
414
+ )
415
+ transcoder.transcode request_pb
416
+ end
417
+
418
+ ##
419
+ # @private
420
+ #
421
+ # GRPC transcoding helper method for the save_snapshot REST call
422
+ #
423
+ # @param request_pb [::Google::Cloud::Orchestration::Airflow::Service::V1::SaveSnapshotRequest]
424
+ # A request object representing the call parameters. Required.
425
+ # @return [Array(String, [String, nil], Hash{String => String})]
426
+ # Uri, Body, Query string parameters
427
+ def self.transcode_save_snapshot_request request_pb
428
+ transcoder = Gapic::Rest::GrpcTranscoder.new
429
+ .with_bindings(
430
+ uri_method: :post,
431
+ uri_template: "/v1/{environment}:saveSnapshot",
432
+ body: "*",
433
+ matches: [
434
+ ["environment", %r{^projects/[^/]+/locations/[^/]+/environments/[^/]+/?$}, false]
435
+ ]
436
+ )
437
+ transcoder.transcode request_pb
438
+ end
439
+
440
+ ##
441
+ # @private
442
+ #
443
+ # GRPC transcoding helper method for the load_snapshot REST call
444
+ #
445
+ # @param request_pb [::Google::Cloud::Orchestration::Airflow::Service::V1::LoadSnapshotRequest]
446
+ # A request object representing the call parameters. Required.
447
+ # @return [Array(String, [String, nil], Hash{String => String})]
448
+ # Uri, Body, Query string parameters
449
+ def self.transcode_load_snapshot_request request_pb
450
+ transcoder = Gapic::Rest::GrpcTranscoder.new
451
+ .with_bindings(
452
+ uri_method: :post,
453
+ uri_template: "/v1/{environment}:loadSnapshot",
454
+ body: "*",
455
+ matches: [
456
+ ["environment", %r{^projects/[^/]+/locations/[^/]+/environments/[^/]+/?$}, false]
457
+ ]
458
+ )
459
+ transcoder.transcode request_pb
460
+ end
461
+ end
462
+ end
463
+ end
464
+ end
465
+ end
466
+ end
467
+ end
468
+ end
469
+ end
@@ -0,0 +1,57 @@
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/orchestration/airflow/service/v1/version"
24
+
25
+ require "google/cloud/orchestration/airflow/service/v1/environments/credentials"
26
+ require "google/cloud/orchestration/airflow/service/v1/environments/paths"
27
+ require "google/cloud/orchestration/airflow/service/v1/environments/rest/operations"
28
+ require "google/cloud/orchestration/airflow/service/v1/environments/rest/client"
29
+
30
+ module Google
31
+ module Cloud
32
+ module Orchestration
33
+ module Airflow
34
+ module Service
35
+ module V1
36
+ ##
37
+ # Managed Apache Airflow Environments.
38
+ #
39
+ # To load this service and instantiate a REST client:
40
+ #
41
+ # require "google/cloud/orchestration/airflow/service/v1/environments/rest"
42
+ # client = ::Google::Cloud::Orchestration::Airflow::Service::V1::Environments::Rest::Client.new
43
+ #
44
+ module Environments
45
+ # Client for the REST transport
46
+ module Rest
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+
56
+ helper_path = ::File.join __dir__, "rest", "helpers.rb"
57
+ require "google/cloud/orchestration/airflow/service/v1/environments/rest/helpers" if ::File.file? helper_path
@@ -26,6 +26,7 @@ require "google/cloud/orchestration/airflow/service/v1/environments/credentials"
26
26
  require "google/cloud/orchestration/airflow/service/v1/environments/paths"
27
27
  require "google/cloud/orchestration/airflow/service/v1/environments/operations"
28
28
  require "google/cloud/orchestration/airflow/service/v1/environments/client"
29
+ require "google/cloud/orchestration/airflow/service/v1/environments/rest"
29
30
 
30
31
  module Google
31
32
  module Cloud
@@ -41,6 +42,11 @@ module Google
41
42
  # require "google/cloud/orchestration/airflow/service/v1/environments"
42
43
  # client = ::Google::Cloud::Orchestration::Airflow::Service::V1::Environments::Client.new
43
44
  #
45
+ # @example Load this service and instantiate a REST client
46
+ #
47
+ # require "google/cloud/orchestration/airflow/service/v1/environments/rest"
48
+ # client = ::Google::Cloud::Orchestration::Airflow::Service::V1::Environments::Rest::Client.new
49
+ #
44
50
  module Environments
45
51
  end
46
52
  end
@@ -192,13 +192,11 @@ module Google
192
192
  # # Call the list_image_versions method.
193
193
  # result = client.list_image_versions request
194
194
  #
195
- # # The returned object is of type Gapic::PagedEnumerable. You can
196
- # # iterate over all elements by calling #each, and the enumerable
197
- # # will lazily make API calls to fetch subsequent pages. Other
198
- # # methods are also available for managing paging directly.
199
- # result.each do |response|
195
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
196
+ # # over elements, and API calls will be issued to fetch pages as needed.
197
+ # result.each do |item|
200
198
  # # Each element is of type ::Google::Cloud::Orchestration::Airflow::Service::V1::ImageVersion.
201
- # p response
199
+ # p item
202
200
  # end
203
201
  #
204
202
  def list_image_versions request, options = nil