google-cloud-orchestration-airflow-service-v1 1.1.0 → 1.3.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.
@@ -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)
@@ -1005,7 +1021,7 @@ module Google
1005
1021
  # runs a single Composer component.
1006
1022
  #
1007
1023
  # This method is supported for Cloud Composer environments in versions
1008
- # composer-3.*.*-airflow-*.*.* and newer.
1024
+ # composer-2.*.*-airflow-*.*.* and newer.
1009
1025
  #
1010
1026
  # @overload list_workloads(request, options = nil)
1011
1027
  # Pass arguments to `list_workloads` via a request object, either of type
@@ -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)
@@ -2480,6 +2487,13 @@ module Google
2480
2487
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
2481
2488
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
2482
2489
  # * (`nil`) indicating no credentials
2490
+ #
2491
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
2492
+ # external source for authentication to Google Cloud, you must validate it before
2493
+ # providing it to a Google API client library. Providing an unvalidated credential
2494
+ # configuration to Google APIs can compromise the security of your systems and data.
2495
+ # For more information, refer to [Validate credential configurations from external
2496
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
2483
2497
  # @return [::Object]
2484
2498
  # @!attribute [rw] scope
2485
2499
  # The OAuth scopes
@@ -2512,6 +2526,11 @@ module Google
2512
2526
  # default endpoint URL. The default value of nil uses the environment
2513
2527
  # universe (usually the default "googleapis.com" universe).
2514
2528
  # @return [::String,nil]
2529
+ # @!attribute [rw] logger
2530
+ # A custom logger to use for request/response debug logging, or the value
2531
+ # `:default` (the default) to construct a default logger, or `nil` to
2532
+ # explicitly disable logging.
2533
+ # @return [::Logger,:default,nil]
2515
2534
  #
2516
2535
  class Configuration
2517
2536
  extend ::Gapic::Config
@@ -2533,6 +2552,7 @@ module Google
2533
2552
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
2534
2553
  config_attr :quota_project, nil, ::String, nil
2535
2554
  config_attr :universe_domain, nil, ::String, nil
2555
+ config_attr :logger, :default, ::Logger, nil, :default
2536
2556
 
2537
2557
  # @private
2538
2558
  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)
@@ -513,6 +504,13 @@ module Google
513
504
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
514
505
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
515
506
  # * (`nil`) indicating no credentials
507
+ #
508
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
509
+ # external source for authentication to Google Cloud, you must validate it before
510
+ # providing it to a Google API client library. Providing an unvalidated credential
511
+ # configuration to Google APIs can compromise the security of your systems and data.
512
+ # For more information, refer to [Validate credential configurations from external
513
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
516
514
  # @return [::Object]
517
515
  # @!attribute [rw] scope
518
516
  # The OAuth scopes
@@ -545,6 +543,11 @@ module Google
545
543
  # default endpoint URL. The default value of nil uses the environment
546
544
  # universe (usually the default "googleapis.com" universe).
547
545
  # @return [::String,nil]
546
+ # @!attribute [rw] logger
547
+ # A custom logger to use for request/response debug logging, or the value
548
+ # `:default` (the default) to construct a default logger, or `nil` to
549
+ # explicitly disable logging.
550
+ # @return [::Logger,:default,nil]
548
551
  #
549
552
  class Configuration
550
553
  extend ::Gapic::Config
@@ -566,6 +569,7 @@ module Google
566
569
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
567
570
  config_attr :quota_project, nil, ::String, nil
568
571
  config_attr :universe_domain, nil, ::String, nil
572
+ config_attr :logger, :default, ::Logger, nil, :default
569
573
 
570
574
  # @private
571
575
  def initialize parent_config = nil
@@ -685,16 +689,18 @@ module Google
685
689
 
686
690
  response = @client_stub.make_http_request(
687
691
  verb,
688
- uri: uri,
689
- body: body || "",
690
- params: query_string_params,
692
+ uri: uri,
693
+ body: body || "",
694
+ params: query_string_params,
695
+ method_name: "list_operations",
691
696
  options: options
692
697
  )
693
698
  operation = ::Gapic::Rest::TransportOperation.new response
694
699
  result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
695
-
696
- yield result, operation if block_given?
697
- result
700
+ catch :response do
701
+ yield result, operation if block_given?
702
+ result
703
+ end
698
704
  end
699
705
 
700
706
  ##
@@ -723,16 +729,18 @@ module Google
723
729
 
724
730
  response = @client_stub.make_http_request(
725
731
  verb,
726
- uri: uri,
727
- body: body || "",
728
- params: query_string_params,
732
+ uri: uri,
733
+ body: body || "",
734
+ params: query_string_params,
735
+ method_name: "get_operation",
729
736
  options: options
730
737
  )
731
738
  operation = ::Gapic::Rest::TransportOperation.new response
732
739
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
733
-
734
- yield result, operation if block_given?
735
- result
740
+ catch :response do
741
+ yield result, operation if block_given?
742
+ result
743
+ end
736
744
  end
737
745
 
738
746
  ##
@@ -761,16 +769,18 @@ module Google
761
769
 
762
770
  response = @client_stub.make_http_request(
763
771
  verb,
764
- uri: uri,
765
- body: body || "",
766
- params: query_string_params,
772
+ uri: uri,
773
+ body: body || "",
774
+ params: query_string_params,
775
+ method_name: "delete_operation",
767
776
  options: options
768
777
  )
769
778
  operation = ::Gapic::Rest::TransportOperation.new response
770
779
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
771
-
772
- yield result, operation if block_given?
773
- result
780
+ catch :response do
781
+ yield result, operation if block_given?
782
+ result
783
+ end
774
784
  end
775
785
 
776
786
  ##
@@ -799,16 +809,18 @@ module Google
799
809
 
800
810
  response = @client_stub.make_http_request(
801
811
  verb,
802
- uri: uri,
803
- body: body || "",
804
- params: query_string_params,
812
+ uri: uri,
813
+ body: body || "",
814
+ params: query_string_params,
815
+ method_name: "cancel_operation",
805
816
  options: options
806
817
  )
807
818
  operation = ::Gapic::Rest::TransportOperation.new response
808
819
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
809
-
810
- yield result, operation if block_given?
811
- result
820
+ catch :response do
821
+ yield result, operation if block_given?
822
+ result
823
+ end
812
824
  end
813
825
 
814
826
  ##