google-cloud-orchestration-airflow-service-v1 1.1.0 → 1.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f9e6e1908980271403424f8ac3a2a8eeb3aecf9c181a9b5420542014c94521f8
4
- data.tar.gz: 927640a9253003e178d01e340e554cdbdfe39566b72d33d8d4de2086c035a663
3
+ metadata.gz: c411e9f695752f45669790ed3b511f4c5e0c29388eaff1c8342fb7745b8af6e1
4
+ data.tar.gz: bbb9f309c3fa2a3718be646910090c67aa206445f0c2d9485a5b1e6f4383f066
5
5
  SHA512:
6
- metadata.gz: e24ed3f43d34dcc3b109fcf61a5aeca33cf55f14da87d33ac0ce52bdeba5247d7e6ed47d828bebed1c42328fa5503a1c91d65ddc9812952e11291f43d7122ec7
7
- data.tar.gz: 412072bc76396cd0d2ba7ca9d7847c8a8ebc0a0d751934546b1261af613c1c80a6c7d4f0e41e826e0e891248516749b6f101c95a425d57841a45b6af718dc72b
6
+ metadata.gz: 65423544ab160aba75cea83f546ed1da815966a6b97c43a2607b71551592e3ce1e0994e84685e6943ca1ab3cbc7874f203cdc9e9dbcd7754c0ba448442b6fa15
7
+ data.tar.gz: 4096130f5bf4b332bdb2e6387ad61a16a4fed0982bd8eadd7ce09a42df07d0ee7362f8c164e51c1b1e5655ccc83641ea424181678afa4c1b431738ae89037158
data/README.md CHANGED
@@ -43,33 +43,43 @@ for class and method documentation.
43
43
  See also the [Product Documentation](https://cloud.google.com/composer)
44
44
  for general usage information.
45
45
 
46
- ## Enabling Logging
47
-
48
- To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
49
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
50
- or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
51
- that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
52
- and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
53
-
54
- Configuring a Ruby stdlib logger:
46
+ ## Debug Logging
47
+
48
+ This library comes with opt-in Debug Logging that can help you troubleshoot
49
+ your application's integration with the API. When logging is activated, key
50
+ events such as requests and responses, along with data payloads and metadata
51
+ such as headers and client configuration, are logged to the standard error
52
+ stream.
53
+
54
+ **WARNING:** Client Library Debug Logging includes your data payloads in
55
+ plaintext, which could include sensitive data such as PII for yourself or your
56
+ customers, private keys, or other security data that could be compromising if
57
+ leaked. Always practice good data hygiene with your application logs, and follow
58
+ the principle of least access. Google also recommends that Client Library Debug
59
+ Logging be enabled only temporarily during active debugging, and not used
60
+ permanently in production.
61
+
62
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
63
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
64
+ list of client library gem names. This will select the default logging behavior,
65
+ which writes logs to the standard error stream. On a local workstation, this may
66
+ result in logs appearing on the console. When running on a Google Cloud hosting
67
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
68
+ results in logs appearing alongside your application logs in the
69
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
70
+
71
+ You can customize logging by modifying the `logger` configuration when
72
+ constructing a client object. For example:
55
73
 
56
74
  ```ruby
75
+ require "google/cloud/orchestration/airflow/service/v1"
57
76
  require "logger"
58
77
 
59
- module MyLogger
60
- LOGGER = Logger.new $stderr, level: Logger::WARN
61
- def logger
62
- LOGGER
63
- end
64
- end
65
-
66
- # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
67
- module GRPC
68
- extend MyLogger
78
+ client = ::Google::Cloud::Orchestration::Airflow::Service::V1::Environments::Client.new do |config|
79
+ config.logger = Logger.new "my-app.log"
69
80
  end
70
81
  ```
71
82
 
72
-
73
83
  ## Google Cloud Samples
74
84
 
75
85
  To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
@@ -166,8 +166,19 @@ module Google
166
166
  universe_domain: @config.universe_domain,
167
167
  channel_args: @config.channel_args,
168
168
  interceptors: @config.interceptors,
169
- channel_pool_config: @config.channel_pool
169
+ channel_pool_config: @config.channel_pool,
170
+ logger: @config.logger
170
171
  )
172
+
173
+ @environments_stub.stub_logger&.info do |entry|
174
+ entry.set_system_name
175
+ entry.set_service
176
+ entry.message = "Created client for #{entry.service}"
177
+ entry.set_credentials_fields credentials
178
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
179
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
180
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
181
+ end
171
182
  end
172
183
 
173
184
  ##
@@ -177,6 +188,15 @@ module Google
177
188
  #
178
189
  attr_reader :operations_client
179
190
 
191
+ ##
192
+ # The logger used for request/response debug logging.
193
+ #
194
+ # @return [Logger]
195
+ #
196
+ def logger
197
+ @environments_stub.logger
198
+ end
199
+
180
200
  # Service calls
181
201
 
182
202
  ##
@@ -270,7 +290,7 @@ module Google
270
290
  @environments_stub.call_rpc :create_environment, request, options: options do |response, operation|
271
291
  response = ::Gapic::Operation.new response, @operations_client, options: options
272
292
  yield response, operation if block_given?
273
- return response
293
+ throw :response, response
274
294
  end
275
295
  rescue ::GRPC::BadStatus => e
276
296
  raise ::Google::Cloud::Error.from_error(e)
@@ -357,7 +377,6 @@ module Google
357
377
 
358
378
  @environments_stub.call_rpc :get_environment, request, options: options do |response, operation|
359
379
  yield response, operation if block_given?
360
- return response
361
380
  end
362
381
  rescue ::GRPC::BadStatus => e
363
382
  raise ::Google::Cloud::Error.from_error(e)
@@ -453,7 +472,7 @@ module Google
453
472
  @environments_stub.call_rpc :list_environments, request, options: options do |response, operation|
454
473
  response = ::Gapic::PagedEnumerable.new @environments_stub, :list_environments, request, response, operation, options
455
474
  yield response, operation if block_given?
456
- return response
475
+ throw :response, response
457
476
  end
458
477
  rescue ::GRPC::BadStatus => e
459
478
  raise ::Google::Cloud::Error.from_error(e)
@@ -675,7 +694,7 @@ module Google
675
694
  @environments_stub.call_rpc :update_environment, request, options: options do |response, operation|
676
695
  response = ::Gapic::Operation.new response, @operations_client, options: options
677
696
  yield response, operation if block_given?
678
- return response
697
+ throw :response, response
679
698
  end
680
699
  rescue ::GRPC::BadStatus => e
681
700
  raise ::Google::Cloud::Error.from_error(e)
@@ -770,7 +789,7 @@ module Google
770
789
  @environments_stub.call_rpc :delete_environment, request, options: options do |response, operation|
771
790
  response = ::Gapic::Operation.new response, @operations_client, options: options
772
791
  yield response, operation if block_given?
773
- return response
792
+ throw :response, response
774
793
  end
775
794
  rescue ::GRPC::BadStatus => e
776
795
  raise ::Google::Cloud::Error.from_error(e)
@@ -866,7 +885,6 @@ module Google
866
885
 
867
886
  @environments_stub.call_rpc :execute_airflow_command, request, options: options do |response, operation|
868
887
  yield response, operation if block_given?
869
- return response
870
888
  end
871
889
  rescue ::GRPC::BadStatus => e
872
890
  raise ::Google::Cloud::Error.from_error(e)
@@ -962,7 +980,6 @@ module Google
962
980
 
963
981
  @environments_stub.call_rpc :stop_airflow_command, request, options: options do |response, operation|
964
982
  yield response, operation if block_given?
965
- return response
966
983
  end
967
984
  rescue ::GRPC::BadStatus => e
968
985
  raise ::Google::Cloud::Error.from_error(e)
@@ -1057,7 +1074,6 @@ module Google
1057
1074
 
1058
1075
  @environments_stub.call_rpc :poll_airflow_command, request, options: options do |response, operation|
1059
1076
  yield response, operation if block_given?
1060
- return response
1061
1077
  end
1062
1078
  rescue ::GRPC::BadStatus => e
1063
1079
  raise ::Google::Cloud::Error.from_error(e)
@@ -1165,7 +1181,7 @@ module Google
1165
1181
  @environments_stub.call_rpc :list_workloads, request, options: options do |response, operation|
1166
1182
  response = ::Gapic::PagedEnumerable.new @environments_stub, :list_workloads, request, response, operation, options
1167
1183
  yield response, operation if block_given?
1168
- return response
1184
+ throw :response, response
1169
1185
  end
1170
1186
  rescue ::GRPC::BadStatus => e
1171
1187
  raise ::Google::Cloud::Error.from_error(e)
@@ -1288,7 +1304,7 @@ module Google
1288
1304
  @environments_stub.call_rpc :check_upgrade, request, options: options do |response, operation|
1289
1305
  response = ::Gapic::Operation.new response, @operations_client, options: options
1290
1306
  yield response, operation if block_given?
1291
- return response
1307
+ throw :response, response
1292
1308
  end
1293
1309
  rescue ::GRPC::BadStatus => e
1294
1310
  raise ::Google::Cloud::Error.from_error(e)
@@ -1380,7 +1396,6 @@ module Google
1380
1396
 
1381
1397
  @environments_stub.call_rpc :create_user_workloads_secret, request, options: options do |response, operation|
1382
1398
  yield response, operation if block_given?
1383
- return response
1384
1399
  end
1385
1400
  rescue ::GRPC::BadStatus => e
1386
1401
  raise ::Google::Cloud::Error.from_error(e)
@@ -1471,7 +1486,6 @@ module Google
1471
1486
 
1472
1487
  @environments_stub.call_rpc :get_user_workloads_secret, request, options: options do |response, operation|
1473
1488
  yield response, operation if block_given?
1474
- return response
1475
1489
  end
1476
1490
  rescue ::GRPC::BadStatus => e
1477
1491
  raise ::Google::Cloud::Error.from_error(e)
@@ -1571,7 +1585,7 @@ module Google
1571
1585
  @environments_stub.call_rpc :list_user_workloads_secrets, request, options: options do |response, operation|
1572
1586
  response = ::Gapic::PagedEnumerable.new @environments_stub, :list_user_workloads_secrets, request, response, operation, options
1573
1587
  yield response, operation if block_given?
1574
- return response
1588
+ throw :response, response
1575
1589
  end
1576
1590
  rescue ::GRPC::BadStatus => e
1577
1591
  raise ::Google::Cloud::Error.from_error(e)
@@ -1660,7 +1674,6 @@ module Google
1660
1674
 
1661
1675
  @environments_stub.call_rpc :update_user_workloads_secret, request, options: options do |response, operation|
1662
1676
  yield response, operation if block_given?
1663
- return response
1664
1677
  end
1665
1678
  rescue ::GRPC::BadStatus => e
1666
1679
  raise ::Google::Cloud::Error.from_error(e)
@@ -1750,7 +1763,6 @@ module Google
1750
1763
 
1751
1764
  @environments_stub.call_rpc :delete_user_workloads_secret, request, options: options do |response, operation|
1752
1765
  yield response, operation if block_given?
1753
- return response
1754
1766
  end
1755
1767
  rescue ::GRPC::BadStatus => e
1756
1768
  raise ::Google::Cloud::Error.from_error(e)
@@ -1842,7 +1854,6 @@ module Google
1842
1854
 
1843
1855
  @environments_stub.call_rpc :create_user_workloads_config_map, request, options: options do |response, operation|
1844
1856
  yield response, operation if block_given?
1845
- return response
1846
1857
  end
1847
1858
  rescue ::GRPC::BadStatus => e
1848
1859
  raise ::Google::Cloud::Error.from_error(e)
@@ -1932,7 +1943,6 @@ module Google
1932
1943
 
1933
1944
  @environments_stub.call_rpc :get_user_workloads_config_map, request, options: options do |response, operation|
1934
1945
  yield response, operation if block_given?
1935
- return response
1936
1946
  end
1937
1947
  rescue ::GRPC::BadStatus => e
1938
1948
  raise ::Google::Cloud::Error.from_error(e)
@@ -2032,7 +2042,7 @@ module Google
2032
2042
  @environments_stub.call_rpc :list_user_workloads_config_maps, request, options: options do |response, operation|
2033
2043
  response = ::Gapic::PagedEnumerable.new @environments_stub, :list_user_workloads_config_maps, request, response, operation, options
2034
2044
  yield response, operation if block_given?
2035
- return response
2045
+ throw :response, response
2036
2046
  end
2037
2047
  rescue ::GRPC::BadStatus => e
2038
2048
  raise ::Google::Cloud::Error.from_error(e)
@@ -2121,7 +2131,6 @@ module Google
2121
2131
 
2122
2132
  @environments_stub.call_rpc :update_user_workloads_config_map, request, options: options do |response, operation|
2123
2133
  yield response, operation if block_given?
2124
- return response
2125
2134
  end
2126
2135
  rescue ::GRPC::BadStatus => e
2127
2136
  raise ::Google::Cloud::Error.from_error(e)
@@ -2211,7 +2220,6 @@ module Google
2211
2220
 
2212
2221
  @environments_stub.call_rpc :delete_user_workloads_config_map, request, options: options do |response, operation|
2213
2222
  yield response, operation if block_given?
2214
- return response
2215
2223
  end
2216
2224
  rescue ::GRPC::BadStatus => e
2217
2225
  raise ::Google::Cloud::Error.from_error(e)
@@ -2312,7 +2320,7 @@ module Google
2312
2320
  @environments_stub.call_rpc :save_snapshot, request, options: options do |response, operation|
2313
2321
  response = ::Gapic::Operation.new response, @operations_client, options: options
2314
2322
  yield response, operation if block_given?
2315
- return response
2323
+ throw :response, response
2316
2324
  end
2317
2325
  rescue ::GRPC::BadStatus => e
2318
2326
  raise ::Google::Cloud::Error.from_error(e)
@@ -2425,7 +2433,7 @@ module Google
2425
2433
  @environments_stub.call_rpc :load_snapshot, request, options: options do |response, operation|
2426
2434
  response = ::Gapic::Operation.new response, @operations_client, options: options
2427
2435
  yield response, operation if block_given?
2428
- return response
2436
+ throw :response, response
2429
2437
  end
2430
2438
  rescue ::GRPC::BadStatus => e
2431
2439
  raise ::Google::Cloud::Error.from_error(e)
@@ -2520,7 +2528,7 @@ module Google
2520
2528
  @environments_stub.call_rpc :database_failover, request, options: options do |response, operation|
2521
2529
  response = ::Gapic::Operation.new response, @operations_client, options: options
2522
2530
  yield response, operation if block_given?
2523
- return response
2531
+ throw :response, response
2524
2532
  end
2525
2533
  rescue ::GRPC::BadStatus => e
2526
2534
  raise ::Google::Cloud::Error.from_error(e)
@@ -2607,7 +2615,6 @@ module Google
2607
2615
 
2608
2616
  @environments_stub.call_rpc :fetch_database_properties, request, options: options do |response, operation|
2609
2617
  yield response, operation if block_given?
2610
- return response
2611
2618
  end
2612
2619
  rescue ::GRPC::BadStatus => e
2613
2620
  raise ::Google::Cloud::Error.from_error(e)
@@ -2696,6 +2703,11 @@ module Google
2696
2703
  # default endpoint URL. The default value of nil uses the environment
2697
2704
  # universe (usually the default "googleapis.com" universe).
2698
2705
  # @return [::String,nil]
2706
+ # @!attribute [rw] logger
2707
+ # A custom logger to use for request/response debug logging, or the value
2708
+ # `:default` (the default) to construct a default logger, or `nil` to
2709
+ # explicitly disable logging.
2710
+ # @return [::Logger,:default,nil]
2699
2711
  #
2700
2712
  class Configuration
2701
2713
  extend ::Gapic::Config
@@ -2720,6 +2732,7 @@ module Google
2720
2732
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
2721
2733
  config_attr :quota_project, nil, ::String, nil
2722
2734
  config_attr :universe_domain, nil, ::String, nil
2735
+ config_attr :logger, :default, ::Logger, nil, :default
2723
2736
 
2724
2737
  # @private
2725
2738
  def initialize parent_config = nil
@@ -126,14 +126,6 @@ module Google
126
126
  # Lists operations that match the specified filter in the request. If the
127
127
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
128
128
  #
129
- # NOTE: the `name` binding allows API services to override the binding
130
- # to use different resource name schemes, such as `users/*/operations`. To
131
- # override the binding, API services can add a binding such as
132
- # `"/v1/{name=users/*}/operations"` to their service configuration.
133
- # For backwards compatibility, the default name includes the operations
134
- # collection id, however overriding users must ensure the name binding
135
- # is the parent resource, without the operations collection id.
136
- #
137
129
  # @overload list_operations(request, options = nil)
138
130
  # Pass arguments to `list_operations` via a request object, either of type
139
131
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -223,7 +215,7 @@ module Google
223
215
  wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
224
216
  response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
225
217
  yield response, operation if block_given?
226
- return response
218
+ throw :response, response
227
219
  end
228
220
  rescue ::GRPC::BadStatus => e
229
221
  raise ::Google::Cloud::Error.from_error(e)
@@ -319,7 +311,7 @@ module Google
319
311
  @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
320
312
  response = ::Gapic::Operation.new response, @operations_client, options: options
321
313
  yield response, operation if block_given?
322
- return response
314
+ throw :response, response
323
315
  end
324
316
  rescue ::GRPC::BadStatus => e
325
317
  raise ::Google::Cloud::Error.from_error(e)
@@ -408,7 +400,6 @@ module Google
408
400
 
409
401
  @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
410
402
  yield response, operation if block_given?
411
- return response
412
403
  end
413
404
  rescue ::GRPC::BadStatus => e
414
405
  raise ::Google::Cloud::Error.from_error(e)
@@ -423,8 +414,9 @@ module Google
423
414
  # other methods to check whether the cancellation succeeded or whether the
424
415
  # operation completed despite cancellation. On successful cancellation,
425
416
  # the operation is not deleted; instead, it becomes an operation with
426
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
427
- # corresponding to `Code.CANCELLED`.
417
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
418
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
419
+ # `Code.CANCELLED`.
428
420
  #
429
421
  # @overload cancel_operation(request, options = nil)
430
422
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -503,7 +495,6 @@ module Google
503
495
 
504
496
  @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
505
497
  yield response, operation if block_given?
506
- return response
507
498
  end
508
499
  rescue ::GRPC::BadStatus => e
509
500
  raise ::Google::Cloud::Error.from_error(e)
@@ -601,7 +592,7 @@ module Google
601
592
  @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
602
593
  response = ::Gapic::Operation.new response, @operations_client, options: options
603
594
  yield response, operation if block_given?
604
- return response
595
+ throw :response, response
605
596
  end
606
597
  rescue ::GRPC::BadStatus => e
607
598
  raise ::Google::Cloud::Error.from_error(e)
@@ -690,6 +681,11 @@ module Google
690
681
  # default endpoint URL. The default value of nil uses the environment
691
682
  # universe (usually the default "googleapis.com" universe).
692
683
  # @return [::String,nil]
684
+ # @!attribute [rw] logger
685
+ # A custom logger to use for request/response debug logging, or the value
686
+ # `:default` (the default) to construct a default logger, or `nil` to
687
+ # explicitly disable logging.
688
+ # @return [::Logger,:default,nil]
693
689
  #
694
690
  class Configuration
695
691
  extend ::Gapic::Config
@@ -714,6 +710,7 @@ module Google
714
710
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
715
711
  config_attr :quota_project, nil, ::String, nil
716
712
  config_attr :universe_domain, nil, ::String, nil
713
+ config_attr :logger, :default, ::Logger, nil, :default
717
714
 
718
715
  # @private
719
716
  def initialize parent_config = nil