google-cloud-dialogflow-cx-v3 1.2.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.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +30 -20
  3. data/lib/google/cloud/dialogflow/cx/v3/agents/client.rb +31 -12
  4. data/lib/google/cloud/dialogflow/cx/v3/agents/operations.rb +12 -15
  5. data/lib/google/cloud/dialogflow/cx/v3/agents/rest/client.rb +31 -12
  6. data/lib/google/cloud/dialogflow/cx/v3/agents/rest/operations.rb +43 -38
  7. data/lib/google/cloud/dialogflow/cx/v3/agents/rest/service_stub.rb +102 -68
  8. data/lib/google/cloud/dialogflow/cx/v3/changelogs/client.rb +29 -3
  9. data/lib/google/cloud/dialogflow/cx/v3/changelogs/rest/client.rb +29 -3
  10. data/lib/google/cloud/dialogflow/cx/v3/changelogs/rest/service_stub.rb +30 -14
  11. data/lib/google/cloud/dialogflow/cx/v3/deployments/client.rb +29 -3
  12. data/lib/google/cloud/dialogflow/cx/v3/deployments/rest/client.rb +29 -3
  13. data/lib/google/cloud/dialogflow/cx/v3/deployments/rest/service_stub.rb +30 -14
  14. data/lib/google/cloud/dialogflow/cx/v3/entity_types/client.rb +31 -8
  15. data/lib/google/cloud/dialogflow/cx/v3/entity_types/operations.rb +12 -15
  16. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest/client.rb +31 -8
  17. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest/operations.rb +43 -38
  18. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest/service_stub.rb +70 -44
  19. data/lib/google/cloud/dialogflow/cx/v3/environments/client.rb +35 -10
  20. data/lib/google/cloud/dialogflow/cx/v3/environments/operations.rb +12 -15
  21. data/lib/google/cloud/dialogflow/cx/v3/environments/rest/client.rb +35 -10
  22. data/lib/google/cloud/dialogflow/cx/v3/environments/rest/operations.rb +43 -38
  23. data/lib/google/cloud/dialogflow/cx/v3/environments/rest/service_stub.rb +86 -56
  24. data/lib/google/cloud/dialogflow/cx/v3/experiments/client.rb +29 -8
  25. data/lib/google/cloud/dialogflow/cx/v3/experiments/rest/client.rb +29 -8
  26. data/lib/google/cloud/dialogflow/cx/v3/experiments/rest/service_stub.rb +70 -44
  27. data/lib/google/cloud/dialogflow/cx/v3/flows/client.rb +32 -11
  28. data/lib/google/cloud/dialogflow/cx/v3/flows/operations.rb +12 -15
  29. data/lib/google/cloud/dialogflow/cx/v3/flows/rest/client.rb +32 -11
  30. data/lib/google/cloud/dialogflow/cx/v3/flows/rest/operations.rb +43 -38
  31. data/lib/google/cloud/dialogflow/cx/v3/flows/rest/service_stub.rb +94 -62
  32. data/lib/google/cloud/dialogflow/cx/v3/generators/client.rb +29 -6
  33. data/lib/google/cloud/dialogflow/cx/v3/generators/rest/client.rb +29 -6
  34. data/lib/google/cloud/dialogflow/cx/v3/generators/rest/service_stub.rb +54 -32
  35. data/lib/google/cloud/dialogflow/cx/v3/intents/client.rb +31 -8
  36. data/lib/google/cloud/dialogflow/cx/v3/intents/operations.rb +12 -15
  37. data/lib/google/cloud/dialogflow/cx/v3/intents/rest/client.rb +31 -8
  38. data/lib/google/cloud/dialogflow/cx/v3/intents/rest/operations.rb +43 -38
  39. data/lib/google/cloud/dialogflow/cx/v3/intents/rest/service_stub.rb +70 -44
  40. data/lib/google/cloud/dialogflow/cx/v3/pages/client.rb +29 -6
  41. data/lib/google/cloud/dialogflow/cx/v3/pages/rest/client.rb +29 -6
  42. data/lib/google/cloud/dialogflow/cx/v3/pages/rest/service_stub.rb +54 -32
  43. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/client.rb +29 -6
  44. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/rest/client.rb +29 -6
  45. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/rest/service_stub.rb +54 -32
  46. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/client.rb +29 -6
  47. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/rest/client.rb +29 -6
  48. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/rest/service_stub.rb +54 -32
  49. data/lib/google/cloud/dialogflow/cx/v3/sessions/client.rb +28 -7
  50. data/lib/google/cloud/dialogflow/cx/v3/sessions/rest/client.rb +28 -5
  51. data/lib/google/cloud/dialogflow/cx/v3/sessions/rest/service_stub.rb +47 -26
  52. data/lib/google/cloud/dialogflow/cx/v3/test_cases/client.rb +34 -13
  53. data/lib/google/cloud/dialogflow/cx/v3/test_cases/operations.rb +12 -15
  54. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest/client.rb +34 -13
  55. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest/operations.rb +43 -38
  56. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest/service_stub.rb +110 -74
  57. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/client.rb +29 -6
  58. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/rest/client.rb +29 -6
  59. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/rest/service_stub.rb +54 -32
  60. data/lib/google/cloud/dialogflow/cx/v3/version.rb +1 -1
  61. data/lib/google/cloud/dialogflow/cx/v3/versions/client.rb +31 -8
  62. data/lib/google/cloud/dialogflow/cx/v3/versions/operations.rb +12 -15
  63. data/lib/google/cloud/dialogflow/cx/v3/versions/rest/client.rb +31 -8
  64. data/lib/google/cloud/dialogflow/cx/v3/versions/rest/operations.rb +43 -38
  65. data/lib/google/cloud/dialogflow/cx/v3/versions/rest/service_stub.rb +70 -44
  66. data/lib/google/cloud/dialogflow/cx/v3/webhooks/client.rb +29 -6
  67. data/lib/google/cloud/dialogflow/cx/v3/webhooks/rest/client.rb +29 -6
  68. data/lib/google/cloud/dialogflow/cx/v3/webhooks/rest/service_stub.rb +54 -32
  69. data/proto_docs/google/api/client.rb +19 -0
  70. data/proto_docs/google/longrunning/operations.rb +19 -14
  71. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c46ff0e9cb89b964bef9d992e666935c56f471b74e2e8ffc852168d1f25f4be9
4
- data.tar.gz: 85a593dbcb4ca04a12983810db56fa3918af90716c3d0b0a1e86c4abff0ff61e
3
+ metadata.gz: 1025c7694b5c8f60bd817b2d5a4f203b0a6e9f3e78fb54f7bae192f076fc21d2
4
+ data.tar.gz: 6f29b3fe86d483693f73589b13f5c1f7ac991cc076316d382df5eabce1811623
5
5
  SHA512:
6
- metadata.gz: 4904b9d8454bac1ed77a4cec41556d0b8d6484eb68b2c6c44c19b6e4b3cd6b0cfeab52d423b101f28d7e98481b2306859f4828072235e902a905d18ef8d23639
7
- data.tar.gz: e551f2221fcc18e7a6a44bc7e9a4db48c33fd4cab366d9cab9ba1d6716160651d4cae1bd78ce7e5f76ce19a14df44293f6c31d04b8565fd19d09a5bb72e7de2f
6
+ metadata.gz: fe88b2dc4c15d999a6e9feccc4cc04f2a37da1d63a4500c27ea1105897bf5659f98b2c86af1aaeabf3502ef9c55a5dba6511321952049ec8961935a1f66098ef
7
+ data.tar.gz: fb14ceb5ced6749b939838fdce93b3708f2df16dd1e086ae7922b02795fefcaa19b5d417bd46cab8b8e666555bbba59cc1f45659cf6df4f2e27c88af661f5c5f
data/README.md CHANGED
@@ -43,33 +43,43 @@ for class and method documentation.
43
43
  See also the [Product Documentation](https://cloud.google.com/dialogflow)
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/dialogflow/cx/v3"
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::Dialogflow::CX::V3::Pages::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).
@@ -176,14 +176,26 @@ module Google
176
176
  universe_domain: @config.universe_domain,
177
177
  channel_args: @config.channel_args,
178
178
  interceptors: @config.interceptors,
179
- channel_pool_config: @config.channel_pool
179
+ channel_pool_config: @config.channel_pool,
180
+ logger: @config.logger
180
181
  )
181
182
 
183
+ @agents_stub.stub_logger&.info do |entry|
184
+ entry.set_system_name
185
+ entry.set_service
186
+ entry.message = "Created client for #{entry.service}"
187
+ entry.set_credentials_fields credentials
188
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
189
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
190
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
191
+ end
192
+
182
193
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
183
194
  config.credentials = credentials
184
195
  config.quota_project = @quota_project_id
185
196
  config.endpoint = @agents_stub.endpoint
186
197
  config.universe_domain = @agents_stub.universe_domain
198
+ config.logger = @agents_stub.logger if config.respond_to? :logger=
187
199
  end
188
200
  end
189
201
 
@@ -201,6 +213,15 @@ module Google
201
213
  #
202
214
  attr_reader :location_client
203
215
 
216
+ ##
217
+ # The logger used for request/response debug logging.
218
+ #
219
+ # @return [Logger]
220
+ #
221
+ def logger
222
+ @agents_stub.logger
223
+ end
224
+
204
225
  # Service calls
205
226
 
206
227
  ##
@@ -294,7 +315,7 @@ module Google
294
315
  @agents_stub.call_rpc :list_agents, request, options: options do |response, operation|
295
316
  response = ::Gapic::PagedEnumerable.new @agents_stub, :list_agents, request, response, operation, options
296
317
  yield response, operation if block_given?
297
- return response
318
+ throw :response, response
298
319
  end
299
320
  rescue ::GRPC::BadStatus => e
300
321
  raise ::Google::Cloud::Error.from_error(e)
@@ -381,7 +402,6 @@ module Google
381
402
 
382
403
  @agents_stub.call_rpc :get_agent, request, options: options do |response, operation|
383
404
  yield response, operation if block_given?
384
- return response
385
405
  end
386
406
  rescue ::GRPC::BadStatus => e
387
407
  raise ::Google::Cloud::Error.from_error(e)
@@ -474,7 +494,6 @@ module Google
474
494
 
475
495
  @agents_stub.call_rpc :create_agent, request, options: options do |response, operation|
476
496
  yield response, operation if block_given?
477
- return response
478
497
  end
479
498
  rescue ::GRPC::BadStatus => e
480
499
  raise ::Google::Cloud::Error.from_error(e)
@@ -567,7 +586,6 @@ module Google
567
586
 
568
587
  @agents_stub.call_rpc :update_agent, request, options: options do |response, operation|
569
588
  yield response, operation if block_given?
570
- return response
571
589
  end
572
590
  rescue ::GRPC::BadStatus => e
573
591
  raise ::Google::Cloud::Error.from_error(e)
@@ -654,7 +672,6 @@ module Google
654
672
 
655
673
  @agents_stub.call_rpc :delete_agent, request, options: options do |response, operation|
656
674
  yield response, operation if block_given?
657
- return response
658
675
  end
659
676
  rescue ::GRPC::BadStatus => e
660
677
  raise ::Google::Cloud::Error.from_error(e)
@@ -780,7 +797,7 @@ module Google
780
797
  @agents_stub.call_rpc :export_agent, request, options: options do |response, operation|
781
798
  response = ::Gapic::Operation.new response, @operations_client, options: options
782
799
  yield response, operation if block_given?
783
- return response
800
+ throw :response, response
784
801
  end
785
802
  rescue ::GRPC::BadStatus => e
786
803
  raise ::Google::Cloud::Error.from_error(e)
@@ -907,7 +924,7 @@ module Google
907
924
  @agents_stub.call_rpc :restore_agent, request, options: options do |response, operation|
908
925
  response = ::Gapic::Operation.new response, @operations_client, options: options
909
926
  yield response, operation if block_given?
910
- return response
927
+ throw :response, response
911
928
  end
912
929
  rescue ::GRPC::BadStatus => e
913
930
  raise ::Google::Cloud::Error.from_error(e)
@@ -998,7 +1015,6 @@ module Google
998
1015
 
999
1016
  @agents_stub.call_rpc :validate_agent, request, options: options do |response, operation|
1000
1017
  yield response, operation if block_given?
1001
- return response
1002
1018
  end
1003
1019
  rescue ::GRPC::BadStatus => e
1004
1020
  raise ::Google::Cloud::Error.from_error(e)
@@ -1089,7 +1105,6 @@ module Google
1089
1105
 
1090
1106
  @agents_stub.call_rpc :get_agent_validation_result, request, options: options do |response, operation|
1091
1107
  yield response, operation if block_given?
1092
- return response
1093
1108
  end
1094
1109
  rescue ::GRPC::BadStatus => e
1095
1110
  raise ::Google::Cloud::Error.from_error(e)
@@ -1178,7 +1193,6 @@ module Google
1178
1193
 
1179
1194
  @agents_stub.call_rpc :get_generative_settings, request, options: options do |response, operation|
1180
1195
  yield response, operation if block_given?
1181
- return response
1182
1196
  end
1183
1197
  rescue ::GRPC::BadStatus => e
1184
1198
  raise ::Google::Cloud::Error.from_error(e)
@@ -1267,7 +1281,6 @@ module Google
1267
1281
 
1268
1282
  @agents_stub.call_rpc :update_generative_settings, request, options: options do |response, operation|
1269
1283
  yield response, operation if block_given?
1270
- return response
1271
1284
  end
1272
1285
  rescue ::GRPC::BadStatus => e
1273
1286
  raise ::Google::Cloud::Error.from_error(e)
@@ -1356,6 +1369,11 @@ module Google
1356
1369
  # default endpoint URL. The default value of nil uses the environment
1357
1370
  # universe (usually the default "googleapis.com" universe).
1358
1371
  # @return [::String,nil]
1372
+ # @!attribute [rw] logger
1373
+ # A custom logger to use for request/response debug logging, or the value
1374
+ # `:default` (the default) to construct a default logger, or `nil` to
1375
+ # explicitly disable logging.
1376
+ # @return [::Logger,:default,nil]
1359
1377
  #
1360
1378
  class Configuration
1361
1379
  extend ::Gapic::Config
@@ -1380,6 +1398,7 @@ module Google
1380
1398
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1381
1399
  config_attr :quota_project, nil, ::String, nil
1382
1400
  config_attr :universe_domain, nil, ::String, nil
1401
+ config_attr :logger, :default, ::Logger, nil, :default
1383
1402
 
1384
1403
  # @private
1385
1404
  def initialize parent_config = nil
@@ -125,14 +125,6 @@ module Google
125
125
  # Lists operations that match the specified filter in the request. If the
126
126
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
127
127
  #
128
- # NOTE: the `name` binding allows API services to override the binding
129
- # to use different resource name schemes, such as `users/*/operations`. To
130
- # override the binding, API services can add a binding such as
131
- # `"/v1/{name=users/*}/operations"` to their service configuration.
132
- # For backwards compatibility, the default name includes the operations
133
- # collection id, however overriding users must ensure the name binding
134
- # is the parent resource, without the operations collection id.
135
- #
136
128
  # @overload list_operations(request, options = nil)
137
129
  # Pass arguments to `list_operations` via a request object, either of type
138
130
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -222,7 +214,7 @@ module Google
222
214
  wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
223
215
  response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
224
216
  yield response, operation if block_given?
225
- return response
217
+ throw :response, response
226
218
  end
227
219
  rescue ::GRPC::BadStatus => e
228
220
  raise ::Google::Cloud::Error.from_error(e)
@@ -318,7 +310,7 @@ module Google
318
310
  @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
319
311
  response = ::Gapic::Operation.new response, @operations_client, options: options
320
312
  yield response, operation if block_given?
321
- return response
313
+ throw :response, response
322
314
  end
323
315
  rescue ::GRPC::BadStatus => e
324
316
  raise ::Google::Cloud::Error.from_error(e)
@@ -407,7 +399,6 @@ module Google
407
399
 
408
400
  @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
409
401
  yield response, operation if block_given?
410
- return response
411
402
  end
412
403
  rescue ::GRPC::BadStatus => e
413
404
  raise ::Google::Cloud::Error.from_error(e)
@@ -422,8 +413,9 @@ module Google
422
413
  # other methods to check whether the cancellation succeeded or whether the
423
414
  # operation completed despite cancellation. On successful cancellation,
424
415
  # the operation is not deleted; instead, it becomes an operation with
425
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
426
- # corresponding to `Code.CANCELLED`.
416
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
417
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
418
+ # `Code.CANCELLED`.
427
419
  #
428
420
  # @overload cancel_operation(request, options = nil)
429
421
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -502,7 +494,6 @@ module Google
502
494
 
503
495
  @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
504
496
  yield response, operation if block_given?
505
- return response
506
497
  end
507
498
  rescue ::GRPC::BadStatus => e
508
499
  raise ::Google::Cloud::Error.from_error(e)
@@ -600,7 +591,7 @@ module Google
600
591
  @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
601
592
  response = ::Gapic::Operation.new response, @operations_client, options: options
602
593
  yield response, operation if block_given?
603
- return response
594
+ throw :response, response
604
595
  end
605
596
  rescue ::GRPC::BadStatus => e
606
597
  raise ::Google::Cloud::Error.from_error(e)
@@ -689,6 +680,11 @@ module Google
689
680
  # default endpoint URL. The default value of nil uses the environment
690
681
  # universe (usually the default "googleapis.com" universe).
691
682
  # @return [::String,nil]
683
+ # @!attribute [rw] logger
684
+ # A custom logger to use for request/response debug logging, or the value
685
+ # `:default` (the default) to construct a default logger, or `nil` to
686
+ # explicitly disable logging.
687
+ # @return [::Logger,:default,nil]
692
688
  #
693
689
  class Configuration
694
690
  extend ::Gapic::Config
@@ -713,6 +709,7 @@ module Google
713
709
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
714
710
  config_attr :quota_project, nil, ::String, nil
715
711
  config_attr :universe_domain, nil, ::String, nil
712
+ config_attr :logger, :default, ::Logger, nil, :default
716
713
 
717
714
  # @private
718
715
  def initialize parent_config = nil
@@ -169,15 +169,27 @@ module Google
169
169
  endpoint: @config.endpoint,
170
170
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
171
171
  universe_domain: @config.universe_domain,
172
- credentials: credentials
172
+ credentials: credentials,
173
+ logger: @config.logger
173
174
  )
174
175
 
176
+ @agents_stub.logger(stub: true)&.info do |entry|
177
+ entry.set_system_name
178
+ entry.set_service
179
+ entry.message = "Created client for #{entry.service}"
180
+ entry.set_credentials_fields credentials
181
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
182
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
183
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
184
+ end
185
+
175
186
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
176
187
  config.credentials = credentials
177
188
  config.quota_project = @quota_project_id
178
189
  config.endpoint = @agents_stub.endpoint
179
190
  config.universe_domain = @agents_stub.universe_domain
180
191
  config.bindings_override = @config.bindings_override
192
+ config.logger = @agents_stub.logger if config.respond_to? :logger=
181
193
  end
182
194
  end
183
195
 
@@ -195,6 +207,15 @@ module Google
195
207
  #
196
208
  attr_reader :location_client
197
209
 
210
+ ##
211
+ # The logger used for request/response debug logging.
212
+ #
213
+ # @return [Logger]
214
+ #
215
+ def logger
216
+ @agents_stub.logger
217
+ end
218
+
198
219
  # Service calls
199
220
 
200
221
  ##
@@ -281,7 +302,7 @@ module Google
281
302
  @agents_stub.list_agents request, options do |result, operation|
282
303
  result = ::Gapic::Rest::PagedEnumerable.new @agents_stub, :list_agents, "agents", request, result, options
283
304
  yield result, operation if block_given?
284
- return result
305
+ throw :response, result
285
306
  end
286
307
  rescue ::Gapic::Rest::Error => e
287
308
  raise ::Google::Cloud::Error.from_error(e)
@@ -361,7 +382,6 @@ module Google
361
382
 
362
383
  @agents_stub.get_agent request, options do |result, operation|
363
384
  yield result, operation if block_given?
364
- return result
365
385
  end
366
386
  rescue ::Gapic::Rest::Error => e
367
387
  raise ::Google::Cloud::Error.from_error(e)
@@ -447,7 +467,6 @@ module Google
447
467
 
448
468
  @agents_stub.create_agent request, options do |result, operation|
449
469
  yield result, operation if block_given?
450
- return result
451
470
  end
452
471
  rescue ::Gapic::Rest::Error => e
453
472
  raise ::Google::Cloud::Error.from_error(e)
@@ -533,7 +552,6 @@ module Google
533
552
 
534
553
  @agents_stub.update_agent request, options do |result, operation|
535
554
  yield result, operation if block_given?
536
- return result
537
555
  end
538
556
  rescue ::Gapic::Rest::Error => e
539
557
  raise ::Google::Cloud::Error.from_error(e)
@@ -613,7 +631,6 @@ module Google
613
631
 
614
632
  @agents_stub.delete_agent request, options do |result, operation|
615
633
  yield result, operation if block_given?
616
- return result
617
634
  end
618
635
  rescue ::Gapic::Rest::Error => e
619
636
  raise ::Google::Cloud::Error.from_error(e)
@@ -732,7 +749,7 @@ module Google
732
749
  @agents_stub.export_agent request, options do |result, operation|
733
750
  result = ::Gapic::Operation.new result, @operations_client, options: options
734
751
  yield result, operation if block_given?
735
- return result
752
+ throw :response, result
736
753
  end
737
754
  rescue ::Gapic::Rest::Error => e
738
755
  raise ::Google::Cloud::Error.from_error(e)
@@ -852,7 +869,7 @@ module Google
852
869
  @agents_stub.restore_agent request, options do |result, operation|
853
870
  result = ::Gapic::Operation.new result, @operations_client, options: options
854
871
  yield result, operation if block_given?
855
- return result
872
+ throw :response, result
856
873
  end
857
874
  rescue ::Gapic::Rest::Error => e
858
875
  raise ::Google::Cloud::Error.from_error(e)
@@ -936,7 +953,6 @@ module Google
936
953
 
937
954
  @agents_stub.validate_agent request, options do |result, operation|
938
955
  yield result, operation if block_given?
939
- return result
940
956
  end
941
957
  rescue ::Gapic::Rest::Error => e
942
958
  raise ::Google::Cloud::Error.from_error(e)
@@ -1020,7 +1036,6 @@ module Google
1020
1036
 
1021
1037
  @agents_stub.get_agent_validation_result request, options do |result, operation|
1022
1038
  yield result, operation if block_given?
1023
- return result
1024
1039
  end
1025
1040
  rescue ::Gapic::Rest::Error => e
1026
1041
  raise ::Google::Cloud::Error.from_error(e)
@@ -1102,7 +1117,6 @@ module Google
1102
1117
 
1103
1118
  @agents_stub.get_generative_settings request, options do |result, operation|
1104
1119
  yield result, operation if block_given?
1105
- return result
1106
1120
  end
1107
1121
  rescue ::Gapic::Rest::Error => e
1108
1122
  raise ::Google::Cloud::Error.from_error(e)
@@ -1184,7 +1198,6 @@ module Google
1184
1198
 
1185
1199
  @agents_stub.update_generative_settings request, options do |result, operation|
1186
1200
  yield result, operation if block_given?
1187
- return result
1188
1201
  end
1189
1202
  rescue ::Gapic::Rest::Error => e
1190
1203
  raise ::Google::Cloud::Error.from_error(e)
@@ -1264,6 +1277,11 @@ module Google
1264
1277
  # default endpoint URL. The default value of nil uses the environment
1265
1278
  # universe (usually the default "googleapis.com" universe).
1266
1279
  # @return [::String,nil]
1280
+ # @!attribute [rw] logger
1281
+ # A custom logger to use for request/response debug logging, or the value
1282
+ # `:default` (the default) to construct a default logger, or `nil` to
1283
+ # explicitly disable logging.
1284
+ # @return [::Logger,:default,nil]
1267
1285
  #
1268
1286
  class Configuration
1269
1287
  extend ::Gapic::Config
@@ -1292,6 +1310,7 @@ module Google
1292
1310
  # by the host service.
1293
1311
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
1294
1312
  config_attr :bindings_override, {}, ::Hash, nil
1313
+ config_attr :logger, :default, ::Logger, nil, :default
1295
1314
 
1296
1315
  # @private
1297
1316
  def initialize parent_config = nil
@@ -116,14 +116,6 @@ module Google
116
116
  # Lists operations that match the specified filter in the request. If the
117
117
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
118
118
  #
119
- # NOTE: the `name` binding allows API services to override the binding
120
- # to use different resource name schemes, such as `users/*/operations`. To
121
- # override the binding, API services can add a binding such as
122
- # `"/v1/{name=users/*}/operations"` to their service configuration.
123
- # For backwards compatibility, the default name includes the operations
124
- # collection id, however overriding users must ensure the name binding
125
- # is the parent resource, without the operations collection id.
126
- #
127
119
  # @overload list_operations(request, options = nil)
128
120
  # Pass arguments to `list_operations` via a request object, either of type
129
121
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -205,7 +197,7 @@ module Google
205
197
  @operations_stub.list_operations request, options do |result, operation|
206
198
  result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options
207
199
  yield result, operation if block_given?
208
- return result
200
+ throw :response, result
209
201
  end
210
202
  rescue ::Gapic::Rest::Error => e
211
203
  raise ::Google::Cloud::Error.from_error(e)
@@ -294,7 +286,7 @@ module Google
294
286
  @operations_stub.get_operation request, options do |result, operation|
295
287
  result = ::Gapic::Operation.new result, @operations_client, options: options
296
288
  yield result, operation if block_given?
297
- return result
289
+ throw :response, result
298
290
  end
299
291
  rescue ::Gapic::Rest::Error => e
300
292
  raise ::Google::Cloud::Error.from_error(e)
@@ -376,7 +368,6 @@ module Google
376
368
 
377
369
  @operations_stub.delete_operation request, options do |result, operation|
378
370
  yield result, operation if block_given?
379
- return result
380
371
  end
381
372
  rescue ::Gapic::Rest::Error => e
382
373
  raise ::Google::Cloud::Error.from_error(e)
@@ -391,8 +382,9 @@ module Google
391
382
  # other methods to check whether the cancellation succeeded or whether the
392
383
  # operation completed despite cancellation. On successful cancellation,
393
384
  # the operation is not deleted; instead, it becomes an operation with
394
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
395
- # corresponding to `Code.CANCELLED`.
385
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
386
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
387
+ # `Code.CANCELLED`.
396
388
  #
397
389
  # @overload cancel_operation(request, options = nil)
398
390
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -464,7 +456,6 @@ module Google
464
456
 
465
457
  @operations_stub.cancel_operation request, options do |result, operation|
466
458
  yield result, operation if block_given?
467
- return result
468
459
  end
469
460
  rescue ::Gapic::Rest::Error => e
470
461
  raise ::Google::Cloud::Error.from_error(e)
@@ -544,6 +535,11 @@ module Google
544
535
  # default endpoint URL. The default value of nil uses the environment
545
536
  # universe (usually the default "googleapis.com" universe).
546
537
  # @return [::String,nil]
538
+ # @!attribute [rw] logger
539
+ # A custom logger to use for request/response debug logging, or the value
540
+ # `:default` (the default) to construct a default logger, or `nil` to
541
+ # explicitly disable logging.
542
+ # @return [::Logger,:default,nil]
547
543
  #
548
544
  class Configuration
549
545
  extend ::Gapic::Config
@@ -565,6 +561,7 @@ module Google
565
561
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
566
562
  config_attr :quota_project, nil, ::String, nil
567
563
  config_attr :universe_domain, nil, ::String, nil
564
+ config_attr :logger, :default, ::Logger, nil, :default
568
565
 
569
566
  # @private
570
567
  def initialize parent_config = nil
@@ -684,16 +681,18 @@ module Google
684
681
 
685
682
  response = @client_stub.make_http_request(
686
683
  verb,
687
- uri: uri,
688
- body: body || "",
689
- params: query_string_params,
684
+ uri: uri,
685
+ body: body || "",
686
+ params: query_string_params,
687
+ method_name: "list_operations",
690
688
  options: options
691
689
  )
692
690
  operation = ::Gapic::Rest::TransportOperation.new response
693
691
  result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
694
-
695
- yield result, operation if block_given?
696
- result
692
+ catch :response do
693
+ yield result, operation if block_given?
694
+ result
695
+ end
697
696
  end
698
697
 
699
698
  ##
@@ -722,16 +721,18 @@ module Google
722
721
 
723
722
  response = @client_stub.make_http_request(
724
723
  verb,
725
- uri: uri,
726
- body: body || "",
727
- params: query_string_params,
724
+ uri: uri,
725
+ body: body || "",
726
+ params: query_string_params,
727
+ method_name: "get_operation",
728
728
  options: options
729
729
  )
730
730
  operation = ::Gapic::Rest::TransportOperation.new response
731
731
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
732
-
733
- yield result, operation if block_given?
734
- result
732
+ catch :response do
733
+ yield result, operation if block_given?
734
+ result
735
+ end
735
736
  end
736
737
 
737
738
  ##
@@ -760,16 +761,18 @@ module Google
760
761
 
761
762
  response = @client_stub.make_http_request(
762
763
  verb,
763
- uri: uri,
764
- body: body || "",
765
- params: query_string_params,
764
+ uri: uri,
765
+ body: body || "",
766
+ params: query_string_params,
767
+ method_name: "delete_operation",
766
768
  options: options
767
769
  )
768
770
  operation = ::Gapic::Rest::TransportOperation.new response
769
771
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
770
-
771
- yield result, operation if block_given?
772
- result
772
+ catch :response do
773
+ yield result, operation if block_given?
774
+ result
775
+ end
773
776
  end
774
777
 
775
778
  ##
@@ -798,16 +801,18 @@ module Google
798
801
 
799
802
  response = @client_stub.make_http_request(
800
803
  verb,
801
- uri: uri,
802
- body: body || "",
803
- params: query_string_params,
804
+ uri: uri,
805
+ body: body || "",
806
+ params: query_string_params,
807
+ method_name: "cancel_operation",
804
808
  options: options
805
809
  )
806
810
  operation = ::Gapic::Rest::TransportOperation.new response
807
811
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
808
-
809
- yield result, operation if block_given?
810
- result
812
+ catch :response do
813
+ yield result, operation if block_given?
814
+ result
815
+ end
811
816
  end
812
817
 
813
818
  ##