google-cloud-orchestration-airflow-service-v1 1.0.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -32,7 +32,8 @@ module Google
32
32
  # including transcoding, making the REST call, and deserialing the response.
33
33
  #
34
34
  class ServiceStub
35
- def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
35
+ # @private
36
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
36
37
  # These require statements are intentionally placed here to initialize
37
38
  # the REST modules only when it's required.
38
39
  require "gapic/rest"
@@ -42,7 +43,9 @@ module Google
42
43
  universe_domain: universe_domain,
43
44
  credentials: credentials,
44
45
  numeric_enums: true,
45
- raise_faraday_errors: false
46
+ service_name: self.class,
47
+ raise_faraday_errors: false,
48
+ logger: logger
46
49
  end
47
50
 
48
51
  ##
@@ -63,6 +66,15 @@ module Google
63
66
  @client_stub.endpoint
64
67
  end
65
68
 
69
+ ##
70
+ # The logger used for request/response debug logging.
71
+ #
72
+ # @return [Logger]
73
+ #
74
+ def logger stub: false
75
+ stub ? @client_stub.stub_logger : @client_stub.logger
76
+ end
77
+
66
78
  ##
67
79
  # Baseline implementation for the create_environment REST call
68
80
  #
@@ -89,16 +101,18 @@ module Google
89
101
 
90
102
  response = @client_stub.make_http_request(
91
103
  verb,
92
- uri: uri,
93
- body: body || "",
94
- params: query_string_params,
104
+ uri: uri,
105
+ body: body || "",
106
+ params: query_string_params,
107
+ method_name: "create_environment",
95
108
  options: options
96
109
  )
97
110
  operation = ::Gapic::Rest::TransportOperation.new response
98
111
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
99
-
100
- yield result, operation if block_given?
101
- result
112
+ catch :response do
113
+ yield result, operation if block_given?
114
+ result
115
+ end
102
116
  end
103
117
 
104
118
  ##
@@ -127,16 +141,18 @@ module Google
127
141
 
128
142
  response = @client_stub.make_http_request(
129
143
  verb,
130
- uri: uri,
131
- body: body || "",
132
- params: query_string_params,
144
+ uri: uri,
145
+ body: body || "",
146
+ params: query_string_params,
147
+ method_name: "get_environment",
133
148
  options: options
134
149
  )
135
150
  operation = ::Gapic::Rest::TransportOperation.new response
136
151
  result = ::Google::Cloud::Orchestration::Airflow::Service::V1::Environment.decode_json response.body, ignore_unknown_fields: true
137
-
138
- yield result, operation if block_given?
139
- result
152
+ catch :response do
153
+ yield result, operation if block_given?
154
+ result
155
+ end
140
156
  end
141
157
 
142
158
  ##
@@ -165,16 +181,18 @@ module Google
165
181
 
166
182
  response = @client_stub.make_http_request(
167
183
  verb,
168
- uri: uri,
169
- body: body || "",
170
- params: query_string_params,
184
+ uri: uri,
185
+ body: body || "",
186
+ params: query_string_params,
187
+ method_name: "list_environments",
171
188
  options: options
172
189
  )
173
190
  operation = ::Gapic::Rest::TransportOperation.new response
174
191
  result = ::Google::Cloud::Orchestration::Airflow::Service::V1::ListEnvironmentsResponse.decode_json response.body, ignore_unknown_fields: true
175
-
176
- yield result, operation if block_given?
177
- result
192
+ catch :response do
193
+ yield result, operation if block_given?
194
+ result
195
+ end
178
196
  end
179
197
 
180
198
  ##
@@ -203,16 +221,18 @@ module Google
203
221
 
204
222
  response = @client_stub.make_http_request(
205
223
  verb,
206
- uri: uri,
207
- body: body || "",
208
- params: query_string_params,
224
+ uri: uri,
225
+ body: body || "",
226
+ params: query_string_params,
227
+ method_name: "update_environment",
209
228
  options: options
210
229
  )
211
230
  operation = ::Gapic::Rest::TransportOperation.new response
212
231
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
213
-
214
- yield result, operation if block_given?
215
- result
232
+ catch :response do
233
+ yield result, operation if block_given?
234
+ result
235
+ end
216
236
  end
217
237
 
218
238
  ##
@@ -241,16 +261,18 @@ module Google
241
261
 
242
262
  response = @client_stub.make_http_request(
243
263
  verb,
244
- uri: uri,
245
- body: body || "",
246
- params: query_string_params,
264
+ uri: uri,
265
+ body: body || "",
266
+ params: query_string_params,
267
+ method_name: "delete_environment",
247
268
  options: options
248
269
  )
249
270
  operation = ::Gapic::Rest::TransportOperation.new response
250
271
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
251
-
252
- yield result, operation if block_given?
253
- result
272
+ catch :response do
273
+ yield result, operation if block_given?
274
+ result
275
+ end
254
276
  end
255
277
 
256
278
  ##
@@ -279,16 +301,18 @@ module Google
279
301
 
280
302
  response = @client_stub.make_http_request(
281
303
  verb,
282
- uri: uri,
283
- body: body || "",
284
- params: query_string_params,
304
+ uri: uri,
305
+ body: body || "",
306
+ params: query_string_params,
307
+ method_name: "execute_airflow_command",
285
308
  options: options
286
309
  )
287
310
  operation = ::Gapic::Rest::TransportOperation.new response
288
311
  result = ::Google::Cloud::Orchestration::Airflow::Service::V1::ExecuteAirflowCommandResponse.decode_json response.body, ignore_unknown_fields: true
289
-
290
- yield result, operation if block_given?
291
- result
312
+ catch :response do
313
+ yield result, operation if block_given?
314
+ result
315
+ end
292
316
  end
293
317
 
294
318
  ##
@@ -317,16 +341,18 @@ module Google
317
341
 
318
342
  response = @client_stub.make_http_request(
319
343
  verb,
320
- uri: uri,
321
- body: body || "",
322
- params: query_string_params,
344
+ uri: uri,
345
+ body: body || "",
346
+ params: query_string_params,
347
+ method_name: "stop_airflow_command",
323
348
  options: options
324
349
  )
325
350
  operation = ::Gapic::Rest::TransportOperation.new response
326
351
  result = ::Google::Cloud::Orchestration::Airflow::Service::V1::StopAirflowCommandResponse.decode_json response.body, ignore_unknown_fields: true
327
-
328
- yield result, operation if block_given?
329
- result
352
+ catch :response do
353
+ yield result, operation if block_given?
354
+ result
355
+ end
330
356
  end
331
357
 
332
358
  ##
@@ -355,16 +381,18 @@ module Google
355
381
 
356
382
  response = @client_stub.make_http_request(
357
383
  verb,
358
- uri: uri,
359
- body: body || "",
360
- params: query_string_params,
384
+ uri: uri,
385
+ body: body || "",
386
+ params: query_string_params,
387
+ method_name: "poll_airflow_command",
361
388
  options: options
362
389
  )
363
390
  operation = ::Gapic::Rest::TransportOperation.new response
364
391
  result = ::Google::Cloud::Orchestration::Airflow::Service::V1::PollAirflowCommandResponse.decode_json response.body, ignore_unknown_fields: true
365
-
366
- yield result, operation if block_given?
367
- result
392
+ catch :response do
393
+ yield result, operation if block_given?
394
+ result
395
+ end
368
396
  end
369
397
 
370
398
  ##
@@ -393,16 +421,58 @@ module Google
393
421
 
394
422
  response = @client_stub.make_http_request(
395
423
  verb,
396
- uri: uri,
397
- body: body || "",
398
- params: query_string_params,
424
+ uri: uri,
425
+ body: body || "",
426
+ params: query_string_params,
427
+ method_name: "list_workloads",
399
428
  options: options
400
429
  )
401
430
  operation = ::Gapic::Rest::TransportOperation.new response
402
431
  result = ::Google::Cloud::Orchestration::Airflow::Service::V1::ListWorkloadsResponse.decode_json response.body, ignore_unknown_fields: true
432
+ catch :response do
433
+ yield result, operation if block_given?
434
+ result
435
+ end
436
+ end
403
437
 
404
- yield result, operation if block_given?
405
- result
438
+ ##
439
+ # Baseline implementation for the check_upgrade REST call
440
+ #
441
+ # @param request_pb [::Google::Cloud::Orchestration::Airflow::Service::V1::CheckUpgradeRequest]
442
+ # A request object representing the call parameters. Required.
443
+ # @param options [::Gapic::CallOptions]
444
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
445
+ #
446
+ # @yield [result, operation] Access the result along with the TransportOperation object
447
+ # @yieldparam result [::Google::Longrunning::Operation]
448
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
449
+ #
450
+ # @return [::Google::Longrunning::Operation]
451
+ # A result object deserialized from the server's reply
452
+ def check_upgrade request_pb, options = nil
453
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
454
+
455
+ verb, uri, query_string_params, body = ServiceStub.transcode_check_upgrade_request request_pb
456
+ query_string_params = if query_string_params.any?
457
+ query_string_params.to_h { |p| p.split "=", 2 }
458
+ else
459
+ {}
460
+ end
461
+
462
+ response = @client_stub.make_http_request(
463
+ verb,
464
+ uri: uri,
465
+ body: body || "",
466
+ params: query_string_params,
467
+ method_name: "check_upgrade",
468
+ options: options
469
+ )
470
+ operation = ::Gapic::Rest::TransportOperation.new response
471
+ result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
472
+ catch :response do
473
+ yield result, operation if block_given?
474
+ result
475
+ end
406
476
  end
407
477
 
408
478
  ##
@@ -431,16 +501,18 @@ module Google
431
501
 
432
502
  response = @client_stub.make_http_request(
433
503
  verb,
434
- uri: uri,
435
- body: body || "",
436
- params: query_string_params,
504
+ uri: uri,
505
+ body: body || "",
506
+ params: query_string_params,
507
+ method_name: "create_user_workloads_secret",
437
508
  options: options
438
509
  )
439
510
  operation = ::Gapic::Rest::TransportOperation.new response
440
511
  result = ::Google::Cloud::Orchestration::Airflow::Service::V1::UserWorkloadsSecret.decode_json response.body, ignore_unknown_fields: true
441
-
442
- yield result, operation if block_given?
443
- result
512
+ catch :response do
513
+ yield result, operation if block_given?
514
+ result
515
+ end
444
516
  end
445
517
 
446
518
  ##
@@ -469,16 +541,18 @@ module Google
469
541
 
470
542
  response = @client_stub.make_http_request(
471
543
  verb,
472
- uri: uri,
473
- body: body || "",
474
- params: query_string_params,
544
+ uri: uri,
545
+ body: body || "",
546
+ params: query_string_params,
547
+ method_name: "get_user_workloads_secret",
475
548
  options: options
476
549
  )
477
550
  operation = ::Gapic::Rest::TransportOperation.new response
478
551
  result = ::Google::Cloud::Orchestration::Airflow::Service::V1::UserWorkloadsSecret.decode_json response.body, ignore_unknown_fields: true
479
-
480
- yield result, operation if block_given?
481
- result
552
+ catch :response do
553
+ yield result, operation if block_given?
554
+ result
555
+ end
482
556
  end
483
557
 
484
558
  ##
@@ -507,16 +581,18 @@ module Google
507
581
 
508
582
  response = @client_stub.make_http_request(
509
583
  verb,
510
- uri: uri,
511
- body: body || "",
512
- params: query_string_params,
584
+ uri: uri,
585
+ body: body || "",
586
+ params: query_string_params,
587
+ method_name: "list_user_workloads_secrets",
513
588
  options: options
514
589
  )
515
590
  operation = ::Gapic::Rest::TransportOperation.new response
516
591
  result = ::Google::Cloud::Orchestration::Airflow::Service::V1::ListUserWorkloadsSecretsResponse.decode_json response.body, ignore_unknown_fields: true
517
-
518
- yield result, operation if block_given?
519
- result
592
+ catch :response do
593
+ yield result, operation if block_given?
594
+ result
595
+ end
520
596
  end
521
597
 
522
598
  ##
@@ -545,16 +621,18 @@ module Google
545
621
 
546
622
  response = @client_stub.make_http_request(
547
623
  verb,
548
- uri: uri,
549
- body: body || "",
550
- params: query_string_params,
624
+ uri: uri,
625
+ body: body || "",
626
+ params: query_string_params,
627
+ method_name: "update_user_workloads_secret",
551
628
  options: options
552
629
  )
553
630
  operation = ::Gapic::Rest::TransportOperation.new response
554
631
  result = ::Google::Cloud::Orchestration::Airflow::Service::V1::UserWorkloadsSecret.decode_json response.body, ignore_unknown_fields: true
555
-
556
- yield result, operation if block_given?
557
- result
632
+ catch :response do
633
+ yield result, operation if block_given?
634
+ result
635
+ end
558
636
  end
559
637
 
560
638
  ##
@@ -583,16 +661,18 @@ module Google
583
661
 
584
662
  response = @client_stub.make_http_request(
585
663
  verb,
586
- uri: uri,
587
- body: body || "",
588
- params: query_string_params,
664
+ uri: uri,
665
+ body: body || "",
666
+ params: query_string_params,
667
+ method_name: "delete_user_workloads_secret",
589
668
  options: options
590
669
  )
591
670
  operation = ::Gapic::Rest::TransportOperation.new response
592
671
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
593
-
594
- yield result, operation if block_given?
595
- result
672
+ catch :response do
673
+ yield result, operation if block_given?
674
+ result
675
+ end
596
676
  end
597
677
 
598
678
  ##
@@ -621,16 +701,18 @@ module Google
621
701
 
622
702
  response = @client_stub.make_http_request(
623
703
  verb,
624
- uri: uri,
625
- body: body || "",
626
- params: query_string_params,
704
+ uri: uri,
705
+ body: body || "",
706
+ params: query_string_params,
707
+ method_name: "create_user_workloads_config_map",
627
708
  options: options
628
709
  )
629
710
  operation = ::Gapic::Rest::TransportOperation.new response
630
711
  result = ::Google::Cloud::Orchestration::Airflow::Service::V1::UserWorkloadsConfigMap.decode_json response.body, ignore_unknown_fields: true
631
-
632
- yield result, operation if block_given?
633
- result
712
+ catch :response do
713
+ yield result, operation if block_given?
714
+ result
715
+ end
634
716
  end
635
717
 
636
718
  ##
@@ -659,16 +741,18 @@ module Google
659
741
 
660
742
  response = @client_stub.make_http_request(
661
743
  verb,
662
- uri: uri,
663
- body: body || "",
664
- params: query_string_params,
744
+ uri: uri,
745
+ body: body || "",
746
+ params: query_string_params,
747
+ method_name: "get_user_workloads_config_map",
665
748
  options: options
666
749
  )
667
750
  operation = ::Gapic::Rest::TransportOperation.new response
668
751
  result = ::Google::Cloud::Orchestration::Airflow::Service::V1::UserWorkloadsConfigMap.decode_json response.body, ignore_unknown_fields: true
669
-
670
- yield result, operation if block_given?
671
- result
752
+ catch :response do
753
+ yield result, operation if block_given?
754
+ result
755
+ end
672
756
  end
673
757
 
674
758
  ##
@@ -697,16 +781,18 @@ module Google
697
781
 
698
782
  response = @client_stub.make_http_request(
699
783
  verb,
700
- uri: uri,
701
- body: body || "",
702
- params: query_string_params,
784
+ uri: uri,
785
+ body: body || "",
786
+ params: query_string_params,
787
+ method_name: "list_user_workloads_config_maps",
703
788
  options: options
704
789
  )
705
790
  operation = ::Gapic::Rest::TransportOperation.new response
706
791
  result = ::Google::Cloud::Orchestration::Airflow::Service::V1::ListUserWorkloadsConfigMapsResponse.decode_json response.body, ignore_unknown_fields: true
707
-
708
- yield result, operation if block_given?
709
- result
792
+ catch :response do
793
+ yield result, operation if block_given?
794
+ result
795
+ end
710
796
  end
711
797
 
712
798
  ##
@@ -735,16 +821,18 @@ module Google
735
821
 
736
822
  response = @client_stub.make_http_request(
737
823
  verb,
738
- uri: uri,
739
- body: body || "",
740
- params: query_string_params,
824
+ uri: uri,
825
+ body: body || "",
826
+ params: query_string_params,
827
+ method_name: "update_user_workloads_config_map",
741
828
  options: options
742
829
  )
743
830
  operation = ::Gapic::Rest::TransportOperation.new response
744
831
  result = ::Google::Cloud::Orchestration::Airflow::Service::V1::UserWorkloadsConfigMap.decode_json response.body, ignore_unknown_fields: true
745
-
746
- yield result, operation if block_given?
747
- result
832
+ catch :response do
833
+ yield result, operation if block_given?
834
+ result
835
+ end
748
836
  end
749
837
 
750
838
  ##
@@ -773,16 +861,18 @@ module Google
773
861
 
774
862
  response = @client_stub.make_http_request(
775
863
  verb,
776
- uri: uri,
777
- body: body || "",
778
- params: query_string_params,
864
+ uri: uri,
865
+ body: body || "",
866
+ params: query_string_params,
867
+ method_name: "delete_user_workloads_config_map",
779
868
  options: options
780
869
  )
781
870
  operation = ::Gapic::Rest::TransportOperation.new response
782
871
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
783
-
784
- yield result, operation if block_given?
785
- result
872
+ catch :response do
873
+ yield result, operation if block_given?
874
+ result
875
+ end
786
876
  end
787
877
 
788
878
  ##
@@ -811,16 +901,18 @@ module Google
811
901
 
812
902
  response = @client_stub.make_http_request(
813
903
  verb,
814
- uri: uri,
815
- body: body || "",
816
- params: query_string_params,
904
+ uri: uri,
905
+ body: body || "",
906
+ params: query_string_params,
907
+ method_name: "save_snapshot",
817
908
  options: options
818
909
  )
819
910
  operation = ::Gapic::Rest::TransportOperation.new response
820
911
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
821
-
822
- yield result, operation if block_given?
823
- result
912
+ catch :response do
913
+ yield result, operation if block_given?
914
+ result
915
+ end
824
916
  end
825
917
 
826
918
  ##
@@ -849,16 +941,18 @@ module Google
849
941
 
850
942
  response = @client_stub.make_http_request(
851
943
  verb,
852
- uri: uri,
853
- body: body || "",
854
- params: query_string_params,
944
+ uri: uri,
945
+ body: body || "",
946
+ params: query_string_params,
947
+ method_name: "load_snapshot",
855
948
  options: options
856
949
  )
857
950
  operation = ::Gapic::Rest::TransportOperation.new response
858
951
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
859
-
860
- yield result, operation if block_given?
861
- result
952
+ catch :response do
953
+ yield result, operation if block_given?
954
+ result
955
+ end
862
956
  end
863
957
 
864
958
  ##
@@ -887,16 +981,18 @@ module Google
887
981
 
888
982
  response = @client_stub.make_http_request(
889
983
  verb,
890
- uri: uri,
891
- body: body || "",
892
- params: query_string_params,
984
+ uri: uri,
985
+ body: body || "",
986
+ params: query_string_params,
987
+ method_name: "database_failover",
893
988
  options: options
894
989
  )
895
990
  operation = ::Gapic::Rest::TransportOperation.new response
896
991
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
897
-
898
- yield result, operation if block_given?
899
- result
992
+ catch :response do
993
+ yield result, operation if block_given?
994
+ result
995
+ end
900
996
  end
901
997
 
902
998
  ##
@@ -925,16 +1021,18 @@ module Google
925
1021
 
926
1022
  response = @client_stub.make_http_request(
927
1023
  verb,
928
- uri: uri,
929
- body: body || "",
930
- params: query_string_params,
1024
+ uri: uri,
1025
+ body: body || "",
1026
+ params: query_string_params,
1027
+ method_name: "fetch_database_properties",
931
1028
  options: options
932
1029
  )
933
1030
  operation = ::Gapic::Rest::TransportOperation.new response
934
1031
  result = ::Google::Cloud::Orchestration::Airflow::Service::V1::FetchDatabasePropertiesResponse.decode_json response.body, ignore_unknown_fields: true
935
-
936
- yield result, operation if block_given?
937
- result
1032
+ catch :response do
1033
+ yield result, operation if block_given?
1034
+ result
1035
+ end
938
1036
  end
939
1037
 
940
1038
  ##
@@ -1131,6 +1229,28 @@ module Google
1131
1229
  transcoder.transcode request_pb
1132
1230
  end
1133
1231
 
1232
+ ##
1233
+ # @private
1234
+ #
1235
+ # GRPC transcoding helper method for the check_upgrade REST call
1236
+ #
1237
+ # @param request_pb [::Google::Cloud::Orchestration::Airflow::Service::V1::CheckUpgradeRequest]
1238
+ # A request object representing the call parameters. Required.
1239
+ # @return [Array(String, [String, nil], Hash{String => String})]
1240
+ # Uri, Body, Query string parameters
1241
+ def self.transcode_check_upgrade_request request_pb
1242
+ transcoder = Gapic::Rest::GrpcTranscoder.new
1243
+ .with_bindings(
1244
+ uri_method: :post,
1245
+ uri_template: "/v1/{environment}:checkUpgrade",
1246
+ body: "*",
1247
+ matches: [
1248
+ ["environment", %r{^projects/[^/]+/locations/[^/]+/environments/[^/]+/?$}, false]
1249
+ ]
1250
+ )
1251
+ transcoder.transcode request_pb
1252
+ end
1253
+
1134
1254
  ##
1135
1255
  # @private
1136
1256
  #