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

Sign up to get free protection for your applications and to get access to all the features.
@@ -159,8 +159,19 @@ module Google
159
159
  endpoint: @config.endpoint,
160
160
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
161
161
  universe_domain: @config.universe_domain,
162
- credentials: credentials
162
+ credentials: credentials,
163
+ logger: @config.logger
163
164
  )
165
+
166
+ @environments_stub.logger(stub: true)&.info do |entry|
167
+ entry.set_system_name
168
+ entry.set_service
169
+ entry.message = "Created client for #{entry.service}"
170
+ entry.set_credentials_fields credentials
171
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
172
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
173
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
174
+ end
164
175
  end
165
176
 
166
177
  ##
@@ -170,6 +181,15 @@ module Google
170
181
  #
171
182
  attr_reader :operations_client
172
183
 
184
+ ##
185
+ # The logger used for request/response debug logging.
186
+ #
187
+ # @return [Logger]
188
+ #
189
+ def logger
190
+ @environments_stub.logger
191
+ end
192
+
173
193
  # Service calls
174
194
 
175
195
  ##
@@ -256,7 +276,7 @@ module Google
256
276
  @environments_stub.create_environment request, options do |result, operation|
257
277
  result = ::Gapic::Operation.new result, @operations_client, options: options
258
278
  yield result, operation if block_given?
259
- return result
279
+ throw :response, result
260
280
  end
261
281
  rescue ::Gapic::Rest::Error => e
262
282
  raise ::Google::Cloud::Error.from_error(e)
@@ -336,7 +356,6 @@ module Google
336
356
 
337
357
  @environments_stub.get_environment request, options do |result, operation|
338
358
  yield result, operation if block_given?
339
- return result
340
359
  end
341
360
  rescue ::Gapic::Rest::Error => e
342
361
  raise ::Google::Cloud::Error.from_error(e)
@@ -425,7 +444,7 @@ module Google
425
444
  @environments_stub.list_environments request, options do |result, operation|
426
445
  result = ::Gapic::Rest::PagedEnumerable.new @environments_stub, :list_environments, "environments", request, result, options
427
446
  yield result, operation if block_given?
428
- return result
447
+ throw :response, result
429
448
  end
430
449
  rescue ::Gapic::Rest::Error => e
431
450
  raise ::Google::Cloud::Error.from_error(e)
@@ -640,7 +659,7 @@ module Google
640
659
  @environments_stub.update_environment request, options do |result, operation|
641
660
  result = ::Gapic::Operation.new result, @operations_client, options: options
642
661
  yield result, operation if block_given?
643
- return result
662
+ throw :response, result
644
663
  end
645
664
  rescue ::Gapic::Rest::Error => e
646
665
  raise ::Google::Cloud::Error.from_error(e)
@@ -728,7 +747,7 @@ module Google
728
747
  @environments_stub.delete_environment request, options do |result, operation|
729
748
  result = ::Gapic::Operation.new result, @operations_client, options: options
730
749
  yield result, operation if block_given?
731
- return result
750
+ throw :response, result
732
751
  end
733
752
  rescue ::Gapic::Rest::Error => e
734
753
  raise ::Google::Cloud::Error.from_error(e)
@@ -817,7 +836,6 @@ module Google
817
836
 
818
837
  @environments_stub.execute_airflow_command request, options do |result, operation|
819
838
  yield result, operation if block_given?
820
- return result
821
839
  end
822
840
  rescue ::Gapic::Rest::Error => e
823
841
  raise ::Google::Cloud::Error.from_error(e)
@@ -906,7 +924,6 @@ module Google
906
924
 
907
925
  @environments_stub.stop_airflow_command request, options do |result, operation|
908
926
  yield result, operation if block_given?
909
- return result
910
927
  end
911
928
  rescue ::Gapic::Rest::Error => e
912
929
  raise ::Google::Cloud::Error.from_error(e)
@@ -994,7 +1011,6 @@ module Google
994
1011
 
995
1012
  @environments_stub.poll_airflow_command request, options do |result, operation|
996
1013
  yield result, operation if block_given?
997
- return result
998
1014
  end
999
1015
  rescue ::Gapic::Rest::Error => e
1000
1016
  raise ::Google::Cloud::Error.from_error(e)
@@ -1095,7 +1111,7 @@ module Google
1095
1111
  @environments_stub.list_workloads request, options do |result, operation|
1096
1112
  result = ::Gapic::Rest::PagedEnumerable.new @environments_stub, :list_workloads, "workloads", request, result, options
1097
1113
  yield result, operation if block_given?
1098
- return result
1114
+ throw :response, result
1099
1115
  end
1100
1116
  rescue ::Gapic::Rest::Error => e
1101
1117
  raise ::Google::Cloud::Error.from_error(e)
@@ -1211,7 +1227,7 @@ module Google
1211
1227
  @environments_stub.check_upgrade request, options do |result, operation|
1212
1228
  result = ::Gapic::Operation.new result, @operations_client, options: options
1213
1229
  yield result, operation if block_given?
1214
- return result
1230
+ throw :response, result
1215
1231
  end
1216
1232
  rescue ::Gapic::Rest::Error => e
1217
1233
  raise ::Google::Cloud::Error.from_error(e)
@@ -1296,7 +1312,6 @@ module Google
1296
1312
 
1297
1313
  @environments_stub.create_user_workloads_secret request, options do |result, operation|
1298
1314
  yield result, operation if block_given?
1299
- return result
1300
1315
  end
1301
1316
  rescue ::Gapic::Rest::Error => e
1302
1317
  raise ::Google::Cloud::Error.from_error(e)
@@ -1380,7 +1395,6 @@ module Google
1380
1395
 
1381
1396
  @environments_stub.get_user_workloads_secret request, options do |result, operation|
1382
1397
  yield result, operation if block_given?
1383
- return result
1384
1398
  end
1385
1399
  rescue ::Gapic::Rest::Error => e
1386
1400
  raise ::Google::Cloud::Error.from_error(e)
@@ -1473,7 +1487,7 @@ module Google
1473
1487
  @environments_stub.list_user_workloads_secrets request, options do |result, operation|
1474
1488
  result = ::Gapic::Rest::PagedEnumerable.new @environments_stub, :list_user_workloads_secrets, "user_workloads_secrets", request, result, options
1475
1489
  yield result, operation if block_given?
1476
- return result
1490
+ throw :response, result
1477
1491
  end
1478
1492
  rescue ::Gapic::Rest::Error => e
1479
1493
  raise ::Google::Cloud::Error.from_error(e)
@@ -1555,7 +1569,6 @@ module Google
1555
1569
 
1556
1570
  @environments_stub.update_user_workloads_secret request, options do |result, operation|
1557
1571
  yield result, operation if block_given?
1558
- return result
1559
1572
  end
1560
1573
  rescue ::Gapic::Rest::Error => e
1561
1574
  raise ::Google::Cloud::Error.from_error(e)
@@ -1638,7 +1651,6 @@ module Google
1638
1651
 
1639
1652
  @environments_stub.delete_user_workloads_secret request, options do |result, operation|
1640
1653
  yield result, operation if block_given?
1641
- return result
1642
1654
  end
1643
1655
  rescue ::Gapic::Rest::Error => e
1644
1656
  raise ::Google::Cloud::Error.from_error(e)
@@ -1723,7 +1735,6 @@ module Google
1723
1735
 
1724
1736
  @environments_stub.create_user_workloads_config_map request, options do |result, operation|
1725
1737
  yield result, operation if block_given?
1726
- return result
1727
1738
  end
1728
1739
  rescue ::Gapic::Rest::Error => e
1729
1740
  raise ::Google::Cloud::Error.from_error(e)
@@ -1806,7 +1817,6 @@ module Google
1806
1817
 
1807
1818
  @environments_stub.get_user_workloads_config_map request, options do |result, operation|
1808
1819
  yield result, operation if block_given?
1809
- return result
1810
1820
  end
1811
1821
  rescue ::Gapic::Rest::Error => e
1812
1822
  raise ::Google::Cloud::Error.from_error(e)
@@ -1899,7 +1909,7 @@ module Google
1899
1909
  @environments_stub.list_user_workloads_config_maps request, options do |result, operation|
1900
1910
  result = ::Gapic::Rest::PagedEnumerable.new @environments_stub, :list_user_workloads_config_maps, "user_workloads_config_maps", request, result, options
1901
1911
  yield result, operation if block_given?
1902
- return result
1912
+ throw :response, result
1903
1913
  end
1904
1914
  rescue ::Gapic::Rest::Error => e
1905
1915
  raise ::Google::Cloud::Error.from_error(e)
@@ -1981,7 +1991,6 @@ module Google
1981
1991
 
1982
1992
  @environments_stub.update_user_workloads_config_map request, options do |result, operation|
1983
1993
  yield result, operation if block_given?
1984
- return result
1985
1994
  end
1986
1995
  rescue ::Gapic::Rest::Error => e
1987
1996
  raise ::Google::Cloud::Error.from_error(e)
@@ -2064,7 +2073,6 @@ module Google
2064
2073
 
2065
2074
  @environments_stub.delete_user_workloads_config_map request, options do |result, operation|
2066
2075
  yield result, operation if block_given?
2067
- return result
2068
2076
  end
2069
2077
  rescue ::Gapic::Rest::Error => e
2070
2078
  raise ::Google::Cloud::Error.from_error(e)
@@ -2158,7 +2166,7 @@ module Google
2158
2166
  @environments_stub.save_snapshot request, options do |result, operation|
2159
2167
  result = ::Gapic::Operation.new result, @operations_client, options: options
2160
2168
  yield result, operation if block_given?
2161
- return result
2169
+ throw :response, result
2162
2170
  end
2163
2171
  rescue ::Gapic::Rest::Error => e
2164
2172
  raise ::Google::Cloud::Error.from_error(e)
@@ -2264,7 +2272,7 @@ module Google
2264
2272
  @environments_stub.load_snapshot request, options do |result, operation|
2265
2273
  result = ::Gapic::Operation.new result, @operations_client, options: options
2266
2274
  yield result, operation if block_given?
2267
- return result
2275
+ throw :response, result
2268
2276
  end
2269
2277
  rescue ::Gapic::Rest::Error => e
2270
2278
  raise ::Google::Cloud::Error.from_error(e)
@@ -2352,7 +2360,7 @@ module Google
2352
2360
  @environments_stub.database_failover request, options do |result, operation|
2353
2361
  result = ::Gapic::Operation.new result, @operations_client, options: options
2354
2362
  yield result, operation if block_given?
2355
- return result
2363
+ throw :response, result
2356
2364
  end
2357
2365
  rescue ::Gapic::Rest::Error => e
2358
2366
  raise ::Google::Cloud::Error.from_error(e)
@@ -2432,7 +2440,6 @@ module Google
2432
2440
 
2433
2441
  @environments_stub.fetch_database_properties request, options do |result, operation|
2434
2442
  yield result, operation if block_given?
2435
- return result
2436
2443
  end
2437
2444
  rescue ::Gapic::Rest::Error => e
2438
2445
  raise ::Google::Cloud::Error.from_error(e)
@@ -2512,6 +2519,11 @@ module Google
2512
2519
  # default endpoint URL. The default value of nil uses the environment
2513
2520
  # universe (usually the default "googleapis.com" universe).
2514
2521
  # @return [::String,nil]
2522
+ # @!attribute [rw] logger
2523
+ # A custom logger to use for request/response debug logging, or the value
2524
+ # `:default` (the default) to construct a default logger, or `nil` to
2525
+ # explicitly disable logging.
2526
+ # @return [::Logger,:default,nil]
2515
2527
  #
2516
2528
  class Configuration
2517
2529
  extend ::Gapic::Config
@@ -2533,6 +2545,7 @@ module Google
2533
2545
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
2534
2546
  config_attr :quota_project, nil, ::String, nil
2535
2547
  config_attr :universe_domain, nil, ::String, nil
2548
+ config_attr :logger, :default, ::Logger, nil, :default
2536
2549
 
2537
2550
  # @private
2538
2551
  def initialize parent_config = nil
@@ -117,14 +117,6 @@ module Google
117
117
  # Lists operations that match the specified filter in the request. If the
118
118
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
119
119
  #
120
- # NOTE: the `name` binding allows API services to override the binding
121
- # to use different resource name schemes, such as `users/*/operations`. To
122
- # override the binding, API services can add a binding such as
123
- # `"/v1/{name=users/*}/operations"` to their service configuration.
124
- # For backwards compatibility, the default name includes the operations
125
- # collection id, however overriding users must ensure the name binding
126
- # is the parent resource, without the operations collection id.
127
- #
128
120
  # @overload list_operations(request, options = nil)
129
121
  # Pass arguments to `list_operations` via a request object, either of type
130
122
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -206,7 +198,7 @@ module Google
206
198
  @operations_stub.list_operations request, options do |result, operation|
207
199
  result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options
208
200
  yield result, operation if block_given?
209
- return result
201
+ throw :response, result
210
202
  end
211
203
  rescue ::Gapic::Rest::Error => e
212
204
  raise ::Google::Cloud::Error.from_error(e)
@@ -295,7 +287,7 @@ module Google
295
287
  @operations_stub.get_operation request, options do |result, operation|
296
288
  result = ::Gapic::Operation.new result, @operations_client, options: options
297
289
  yield result, operation if block_given?
298
- return result
290
+ throw :response, result
299
291
  end
300
292
  rescue ::Gapic::Rest::Error => e
301
293
  raise ::Google::Cloud::Error.from_error(e)
@@ -377,7 +369,6 @@ module Google
377
369
 
378
370
  @operations_stub.delete_operation request, options do |result, operation|
379
371
  yield result, operation if block_given?
380
- return result
381
372
  end
382
373
  rescue ::Gapic::Rest::Error => e
383
374
  raise ::Google::Cloud::Error.from_error(e)
@@ -392,8 +383,9 @@ module Google
392
383
  # other methods to check whether the cancellation succeeded or whether the
393
384
  # operation completed despite cancellation. On successful cancellation,
394
385
  # the operation is not deleted; instead, it becomes an operation with
395
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
396
- # corresponding to `Code.CANCELLED`.
386
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
387
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
388
+ # `Code.CANCELLED`.
397
389
  #
398
390
  # @overload cancel_operation(request, options = nil)
399
391
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -465,7 +457,6 @@ module Google
465
457
 
466
458
  @operations_stub.cancel_operation request, options do |result, operation|
467
459
  yield result, operation if block_given?
468
- return result
469
460
  end
470
461
  rescue ::Gapic::Rest::Error => e
471
462
  raise ::Google::Cloud::Error.from_error(e)
@@ -545,6 +536,11 @@ module Google
545
536
  # default endpoint URL. The default value of nil uses the environment
546
537
  # universe (usually the default "googleapis.com" universe).
547
538
  # @return [::String,nil]
539
+ # @!attribute [rw] logger
540
+ # A custom logger to use for request/response debug logging, or the value
541
+ # `:default` (the default) to construct a default logger, or `nil` to
542
+ # explicitly disable logging.
543
+ # @return [::Logger,:default,nil]
548
544
  #
549
545
  class Configuration
550
546
  extend ::Gapic::Config
@@ -566,6 +562,7 @@ module Google
566
562
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
567
563
  config_attr :quota_project, nil, ::String, nil
568
564
  config_attr :universe_domain, nil, ::String, nil
565
+ config_attr :logger, :default, ::Logger, nil, :default
569
566
 
570
567
  # @private
571
568
  def initialize parent_config = nil
@@ -685,16 +682,18 @@ module Google
685
682
 
686
683
  response = @client_stub.make_http_request(
687
684
  verb,
688
- uri: uri,
689
- body: body || "",
690
- params: query_string_params,
685
+ uri: uri,
686
+ body: body || "",
687
+ params: query_string_params,
688
+ method_name: "list_operations",
691
689
  options: options
692
690
  )
693
691
  operation = ::Gapic::Rest::TransportOperation.new response
694
692
  result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
695
-
696
- yield result, operation if block_given?
697
- result
693
+ catch :response do
694
+ yield result, operation if block_given?
695
+ result
696
+ end
698
697
  end
699
698
 
700
699
  ##
@@ -723,16 +722,18 @@ module Google
723
722
 
724
723
  response = @client_stub.make_http_request(
725
724
  verb,
726
- uri: uri,
727
- body: body || "",
728
- params: query_string_params,
725
+ uri: uri,
726
+ body: body || "",
727
+ params: query_string_params,
728
+ method_name: "get_operation",
729
729
  options: options
730
730
  )
731
731
  operation = ::Gapic::Rest::TransportOperation.new response
732
732
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
733
-
734
- yield result, operation if block_given?
735
- result
733
+ catch :response do
734
+ yield result, operation if block_given?
735
+ result
736
+ end
736
737
  end
737
738
 
738
739
  ##
@@ -761,16 +762,18 @@ module Google
761
762
 
762
763
  response = @client_stub.make_http_request(
763
764
  verb,
764
- uri: uri,
765
- body: body || "",
766
- params: query_string_params,
765
+ uri: uri,
766
+ body: body || "",
767
+ params: query_string_params,
768
+ method_name: "delete_operation",
767
769
  options: options
768
770
  )
769
771
  operation = ::Gapic::Rest::TransportOperation.new response
770
772
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
771
-
772
- yield result, operation if block_given?
773
- result
773
+ catch :response do
774
+ yield result, operation if block_given?
775
+ result
776
+ end
774
777
  end
775
778
 
776
779
  ##
@@ -799,16 +802,18 @@ module Google
799
802
 
800
803
  response = @client_stub.make_http_request(
801
804
  verb,
802
- uri: uri,
803
- body: body || "",
804
- params: query_string_params,
805
+ uri: uri,
806
+ body: body || "",
807
+ params: query_string_params,
808
+ method_name: "cancel_operation",
805
809
  options: options
806
810
  )
807
811
  operation = ::Gapic::Rest::TransportOperation.new response
808
812
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
809
-
810
- yield result, operation if block_given?
811
- result
813
+ catch :response do
814
+ yield result, operation if block_given?
815
+ result
816
+ end
812
817
  end
813
818
 
814
819
  ##