google-cloud-dialogflow-cx-v3 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -158,15 +158,27 @@ module Google
158
158
  endpoint: @config.endpoint,
159
159
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
160
160
  universe_domain: @config.universe_domain,
161
- credentials: credentials
161
+ credentials: credentials,
162
+ logger: @config.logger
162
163
  )
163
164
 
165
+ @transition_route_groups_stub.logger(stub: true)&.info do |entry|
166
+ entry.set_system_name
167
+ entry.set_service
168
+ entry.message = "Created client for #{entry.service}"
169
+ entry.set_credentials_fields credentials
170
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
171
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
172
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
173
+ end
174
+
164
175
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
165
176
  config.credentials = credentials
166
177
  config.quota_project = @quota_project_id
167
178
  config.endpoint = @transition_route_groups_stub.endpoint
168
179
  config.universe_domain = @transition_route_groups_stub.universe_domain
169
180
  config.bindings_override = @config.bindings_override
181
+ config.logger = @transition_route_groups_stub.logger if config.respond_to? :logger=
170
182
  end
171
183
  end
172
184
 
@@ -177,6 +189,15 @@ module Google
177
189
  #
178
190
  attr_reader :location_client
179
191
 
192
+ ##
193
+ # The logger used for request/response debug logging.
194
+ #
195
+ # @return [Logger]
196
+ #
197
+ def logger
198
+ @transition_route_groups_stub.logger
199
+ end
200
+
180
201
  # Service calls
181
202
 
182
203
  ##
@@ -278,7 +299,7 @@ module Google
278
299
  @transition_route_groups_stub.list_transition_route_groups request, options do |result, operation|
279
300
  result = ::Gapic::Rest::PagedEnumerable.new @transition_route_groups_stub, :list_transition_route_groups, "transition_route_groups", request, result, options
280
301
  yield result, operation if block_given?
281
- return result
302
+ throw :response, result
282
303
  end
283
304
  rescue ::Gapic::Rest::Error => e
284
305
  raise ::Google::Cloud::Error.from_error(e)
@@ -376,7 +397,6 @@ module Google
376
397
 
377
398
  @transition_route_groups_stub.get_transition_route_group request, options do |result, operation|
378
399
  yield result, operation if block_given?
379
- return result
380
400
  end
381
401
  rescue ::Gapic::Rest::Error => e
382
402
  raise ::Google::Cloud::Error.from_error(e)
@@ -480,7 +500,6 @@ module Google
480
500
 
481
501
  @transition_route_groups_stub.create_transition_route_group request, options do |result, operation|
482
502
  yield result, operation if block_given?
483
- return result
484
503
  end
485
504
  rescue ::Gapic::Rest::Error => e
486
505
  raise ::Google::Cloud::Error.from_error(e)
@@ -578,7 +597,6 @@ module Google
578
597
 
579
598
  @transition_route_groups_stub.update_transition_route_group request, options do |result, operation|
580
599
  yield result, operation if block_given?
581
- return result
582
600
  end
583
601
  rescue ::Gapic::Rest::Error => e
584
602
  raise ::Google::Cloud::Error.from_error(e)
@@ -675,7 +693,6 @@ module Google
675
693
 
676
694
  @transition_route_groups_stub.delete_transition_route_group request, options do |result, operation|
677
695
  yield result, operation if block_given?
678
- return result
679
696
  end
680
697
  rescue ::Gapic::Rest::Error => e
681
698
  raise ::Google::Cloud::Error.from_error(e)
@@ -755,6 +772,11 @@ module Google
755
772
  # default endpoint URL. The default value of nil uses the environment
756
773
  # universe (usually the default "googleapis.com" universe).
757
774
  # @return [::String,nil]
775
+ # @!attribute [rw] logger
776
+ # A custom logger to use for request/response debug logging, or the value
777
+ # `:default` (the default) to construct a default logger, or `nil` to
778
+ # explicitly disable logging.
779
+ # @return [::Logger,:default,nil]
758
780
  #
759
781
  class Configuration
760
782
  extend ::Gapic::Config
@@ -783,6 +805,7 @@ module Google
783
805
  # by the host service.
784
806
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
785
807
  config_attr :bindings_override, {}, ::Hash, nil
808
+ config_attr :logger, :default, ::Logger, nil, :default
786
809
 
787
810
  # @private
788
811
  def initialize parent_config = nil
@@ -31,7 +31,8 @@ module Google
31
31
  # including transcoding, making the REST call, and deserialing the response.
32
32
  #
33
33
  class ServiceStub
34
- def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
34
+ # @private
35
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
35
36
  # These require statements are intentionally placed here to initialize
36
37
  # the REST modules only when it's required.
37
38
  require "gapic/rest"
@@ -41,7 +42,9 @@ module Google
41
42
  universe_domain: universe_domain,
42
43
  credentials: credentials,
43
44
  numeric_enums: true,
44
- raise_faraday_errors: false
45
+ service_name: self.class,
46
+ raise_faraday_errors: false,
47
+ logger: logger
45
48
  end
46
49
 
47
50
  ##
@@ -62,6 +65,15 @@ module Google
62
65
  @client_stub.endpoint
63
66
  end
64
67
 
68
+ ##
69
+ # The logger used for request/response debug logging.
70
+ #
71
+ # @return [Logger]
72
+ #
73
+ def logger stub: false
74
+ stub ? @client_stub.stub_logger : @client_stub.logger
75
+ end
76
+
65
77
  ##
66
78
  # Baseline implementation for the list_transition_route_groups REST call
67
79
  #
@@ -88,16 +100,18 @@ module Google
88
100
 
89
101
  response = @client_stub.make_http_request(
90
102
  verb,
91
- uri: uri,
92
- body: body || "",
93
- params: query_string_params,
103
+ uri: uri,
104
+ body: body || "",
105
+ params: query_string_params,
106
+ method_name: "list_transition_route_groups",
94
107
  options: options
95
108
  )
96
109
  operation = ::Gapic::Rest::TransportOperation.new response
97
110
  result = ::Google::Cloud::Dialogflow::CX::V3::ListTransitionRouteGroupsResponse.decode_json response.body, ignore_unknown_fields: true
98
-
99
- yield result, operation if block_given?
100
- result
111
+ catch :response do
112
+ yield result, operation if block_given?
113
+ result
114
+ end
101
115
  end
102
116
 
103
117
  ##
@@ -126,16 +140,18 @@ module Google
126
140
 
127
141
  response = @client_stub.make_http_request(
128
142
  verb,
129
- uri: uri,
130
- body: body || "",
131
- params: query_string_params,
143
+ uri: uri,
144
+ body: body || "",
145
+ params: query_string_params,
146
+ method_name: "get_transition_route_group",
132
147
  options: options
133
148
  )
134
149
  operation = ::Gapic::Rest::TransportOperation.new response
135
150
  result = ::Google::Cloud::Dialogflow::CX::V3::TransitionRouteGroup.decode_json response.body, ignore_unknown_fields: true
136
-
137
- yield result, operation if block_given?
138
- result
151
+ catch :response do
152
+ yield result, operation if block_given?
153
+ result
154
+ end
139
155
  end
140
156
 
141
157
  ##
@@ -164,16 +180,18 @@ module Google
164
180
 
165
181
  response = @client_stub.make_http_request(
166
182
  verb,
167
- uri: uri,
168
- body: body || "",
169
- params: query_string_params,
183
+ uri: uri,
184
+ body: body || "",
185
+ params: query_string_params,
186
+ method_name: "create_transition_route_group",
170
187
  options: options
171
188
  )
172
189
  operation = ::Gapic::Rest::TransportOperation.new response
173
190
  result = ::Google::Cloud::Dialogflow::CX::V3::TransitionRouteGroup.decode_json response.body, ignore_unknown_fields: true
174
-
175
- yield result, operation if block_given?
176
- result
191
+ catch :response do
192
+ yield result, operation if block_given?
193
+ result
194
+ end
177
195
  end
178
196
 
179
197
  ##
@@ -202,16 +220,18 @@ module Google
202
220
 
203
221
  response = @client_stub.make_http_request(
204
222
  verb,
205
- uri: uri,
206
- body: body || "",
207
- params: query_string_params,
223
+ uri: uri,
224
+ body: body || "",
225
+ params: query_string_params,
226
+ method_name: "update_transition_route_group",
208
227
  options: options
209
228
  )
210
229
  operation = ::Gapic::Rest::TransportOperation.new response
211
230
  result = ::Google::Cloud::Dialogflow::CX::V3::TransitionRouteGroup.decode_json response.body, ignore_unknown_fields: true
212
-
213
- yield result, operation if block_given?
214
- result
231
+ catch :response do
232
+ yield result, operation if block_given?
233
+ result
234
+ end
215
235
  end
216
236
 
217
237
  ##
@@ -240,16 +260,18 @@ module Google
240
260
 
241
261
  response = @client_stub.make_http_request(
242
262
  verb,
243
- uri: uri,
244
- body: body || "",
245
- params: query_string_params,
263
+ uri: uri,
264
+ body: body || "",
265
+ params: query_string_params,
266
+ method_name: "delete_transition_route_group",
246
267
  options: options
247
268
  )
248
269
  operation = ::Gapic::Rest::TransportOperation.new response
249
270
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
250
-
251
- yield result, operation if block_given?
252
- result
271
+ catch :response do
272
+ yield result, operation if block_given?
273
+ result
274
+ end
253
275
  end
254
276
 
255
277
  ##
@@ -22,7 +22,7 @@ module Google
22
22
  module Dialogflow
23
23
  module CX
24
24
  module V3
25
- VERSION = "1.2.0"
25
+ VERSION = "1.3.0"
26
26
  end
27
27
  end
28
28
  end
@@ -171,14 +171,26 @@ module Google
171
171
  universe_domain: @config.universe_domain,
172
172
  channel_args: @config.channel_args,
173
173
  interceptors: @config.interceptors,
174
- channel_pool_config: @config.channel_pool
174
+ channel_pool_config: @config.channel_pool,
175
+ logger: @config.logger
175
176
  )
176
177
 
178
+ @versions_stub.stub_logger&.info do |entry|
179
+ entry.set_system_name
180
+ entry.set_service
181
+ entry.message = "Created client for #{entry.service}"
182
+ entry.set_credentials_fields credentials
183
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
184
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
185
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
186
+ end
187
+
177
188
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
178
189
  config.credentials = credentials
179
190
  config.quota_project = @quota_project_id
180
191
  config.endpoint = @versions_stub.endpoint
181
192
  config.universe_domain = @versions_stub.universe_domain
193
+ config.logger = @versions_stub.logger if config.respond_to? :logger=
182
194
  end
183
195
  end
184
196
 
@@ -196,6 +208,15 @@ module Google
196
208
  #
197
209
  attr_reader :location_client
198
210
 
211
+ ##
212
+ # The logger used for request/response debug logging.
213
+ #
214
+ # @return [Logger]
215
+ #
216
+ def logger
217
+ @versions_stub.logger
218
+ end
219
+
199
220
  # Service calls
200
221
 
201
222
  ##
@@ -291,7 +312,7 @@ module Google
291
312
  @versions_stub.call_rpc :list_versions, request, options: options do |response, operation|
292
313
  response = ::Gapic::PagedEnumerable.new @versions_stub, :list_versions, request, response, operation, options
293
314
  yield response, operation if block_given?
294
- return response
315
+ throw :response, response
295
316
  end
296
317
  rescue ::GRPC::BadStatus => e
297
318
  raise ::Google::Cloud::Error.from_error(e)
@@ -379,7 +400,6 @@ module Google
379
400
 
380
401
  @versions_stub.call_rpc :get_version, request, options: options do |response, operation|
381
402
  yield response, operation if block_given?
382
- return response
383
403
  end
384
404
  rescue ::GRPC::BadStatus => e
385
405
  raise ::Google::Cloud::Error.from_error(e)
@@ -486,7 +506,7 @@ module Google
486
506
  @versions_stub.call_rpc :create_version, request, options: options do |response, operation|
487
507
  response = ::Gapic::Operation.new response, @operations_client, options: options
488
508
  yield response, operation if block_given?
489
- return response
509
+ throw :response, response
490
510
  end
491
511
  rescue ::GRPC::BadStatus => e
492
512
  raise ::Google::Cloud::Error.from_error(e)
@@ -575,7 +595,6 @@ module Google
575
595
 
576
596
  @versions_stub.call_rpc :update_version, request, options: options do |response, operation|
577
597
  yield response, operation if block_given?
578
- return response
579
598
  end
580
599
  rescue ::GRPC::BadStatus => e
581
600
  raise ::Google::Cloud::Error.from_error(e)
@@ -663,7 +682,6 @@ module Google
663
682
 
664
683
  @versions_stub.call_rpc :delete_version, request, options: options do |response, operation|
665
684
  yield response, operation if block_given?
666
- return response
667
685
  end
668
686
  rescue ::GRPC::BadStatus => e
669
687
  raise ::Google::Cloud::Error.from_error(e)
@@ -773,7 +791,7 @@ module Google
773
791
  @versions_stub.call_rpc :load_version, request, options: options do |response, operation|
774
792
  response = ::Gapic::Operation.new response, @operations_client, options: options
775
793
  yield response, operation if block_given?
776
- return response
794
+ throw :response, response
777
795
  end
778
796
  rescue ::GRPC::BadStatus => e
779
797
  raise ::Google::Cloud::Error.from_error(e)
@@ -876,7 +894,6 @@ module Google
876
894
 
877
895
  @versions_stub.call_rpc :compare_versions, request, options: options do |response, operation|
878
896
  yield response, operation if block_given?
879
- return response
880
897
  end
881
898
  rescue ::GRPC::BadStatus => e
882
899
  raise ::Google::Cloud::Error.from_error(e)
@@ -965,6 +982,11 @@ module Google
965
982
  # default endpoint URL. The default value of nil uses the environment
966
983
  # universe (usually the default "googleapis.com" universe).
967
984
  # @return [::String,nil]
985
+ # @!attribute [rw] logger
986
+ # A custom logger to use for request/response debug logging, or the value
987
+ # `:default` (the default) to construct a default logger, or `nil` to
988
+ # explicitly disable logging.
989
+ # @return [::Logger,:default,nil]
968
990
  #
969
991
  class Configuration
970
992
  extend ::Gapic::Config
@@ -989,6 +1011,7 @@ module Google
989
1011
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
990
1012
  config_attr :quota_project, nil, ::String, nil
991
1013
  config_attr :universe_domain, nil, ::String, nil
1014
+ config_attr :logger, :default, ::Logger, nil, :default
992
1015
 
993
1016
  # @private
994
1017
  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
@@ -164,15 +164,27 @@ module Google
164
164
  endpoint: @config.endpoint,
165
165
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
166
166
  universe_domain: @config.universe_domain,
167
- credentials: credentials
167
+ credentials: credentials,
168
+ logger: @config.logger
168
169
  )
169
170
 
171
+ @versions_stub.logger(stub: true)&.info do |entry|
172
+ entry.set_system_name
173
+ entry.set_service
174
+ entry.message = "Created client for #{entry.service}"
175
+ entry.set_credentials_fields credentials
176
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
177
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
178
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
179
+ end
180
+
170
181
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
171
182
  config.credentials = credentials
172
183
  config.quota_project = @quota_project_id
173
184
  config.endpoint = @versions_stub.endpoint
174
185
  config.universe_domain = @versions_stub.universe_domain
175
186
  config.bindings_override = @config.bindings_override
187
+ config.logger = @versions_stub.logger if config.respond_to? :logger=
176
188
  end
177
189
  end
178
190
 
@@ -190,6 +202,15 @@ module Google
190
202
  #
191
203
  attr_reader :location_client
192
204
 
205
+ ##
206
+ # The logger used for request/response debug logging.
207
+ #
208
+ # @return [Logger]
209
+ #
210
+ def logger
211
+ @versions_stub.logger
212
+ end
213
+
193
214
  # Service calls
194
215
 
195
216
  ##
@@ -278,7 +299,7 @@ module Google
278
299
  @versions_stub.list_versions request, options do |result, operation|
279
300
  result = ::Gapic::Rest::PagedEnumerable.new @versions_stub, :list_versions, "versions", request, result, options
280
301
  yield result, operation if block_given?
281
- return result
302
+ throw :response, result
282
303
  end
283
304
  rescue ::Gapic::Rest::Error => e
284
305
  raise ::Google::Cloud::Error.from_error(e)
@@ -359,7 +380,6 @@ module Google
359
380
 
360
381
  @versions_stub.get_version request, options do |result, operation|
361
382
  yield result, operation if block_given?
362
- return result
363
383
  end
364
384
  rescue ::Gapic::Rest::Error => e
365
385
  raise ::Google::Cloud::Error.from_error(e)
@@ -459,7 +479,7 @@ module Google
459
479
  @versions_stub.create_version request, options do |result, operation|
460
480
  result = ::Gapic::Operation.new result, @operations_client, options: options
461
481
  yield result, operation if block_given?
462
- return result
482
+ throw :response, result
463
483
  end
464
484
  rescue ::Gapic::Rest::Error => e
465
485
  raise ::Google::Cloud::Error.from_error(e)
@@ -541,7 +561,6 @@ module Google
541
561
 
542
562
  @versions_stub.update_version request, options do |result, operation|
543
563
  yield result, operation if block_given?
544
- return result
545
564
  end
546
565
  rescue ::Gapic::Rest::Error => e
547
566
  raise ::Google::Cloud::Error.from_error(e)
@@ -622,7 +641,6 @@ module Google
622
641
 
623
642
  @versions_stub.delete_version request, options do |result, operation|
624
643
  yield result, operation if block_given?
625
- return result
626
644
  end
627
645
  rescue ::Gapic::Rest::Error => e
628
646
  raise ::Google::Cloud::Error.from_error(e)
@@ -725,7 +743,7 @@ module Google
725
743
  @versions_stub.load_version request, options do |result, operation|
726
744
  result = ::Gapic::Operation.new result, @operations_client, options: options
727
745
  yield result, operation if block_given?
728
- return result
746
+ throw :response, result
729
747
  end
730
748
  rescue ::Gapic::Rest::Error => e
731
749
  raise ::Google::Cloud::Error.from_error(e)
@@ -821,7 +839,6 @@ module Google
821
839
 
822
840
  @versions_stub.compare_versions request, options do |result, operation|
823
841
  yield result, operation if block_given?
824
- return result
825
842
  end
826
843
  rescue ::Gapic::Rest::Error => e
827
844
  raise ::Google::Cloud::Error.from_error(e)
@@ -901,6 +918,11 @@ module Google
901
918
  # default endpoint URL. The default value of nil uses the environment
902
919
  # universe (usually the default "googleapis.com" universe).
903
920
  # @return [::String,nil]
921
+ # @!attribute [rw] logger
922
+ # A custom logger to use for request/response debug logging, or the value
923
+ # `:default` (the default) to construct a default logger, or `nil` to
924
+ # explicitly disable logging.
925
+ # @return [::Logger,:default,nil]
904
926
  #
905
927
  class Configuration
906
928
  extend ::Gapic::Config
@@ -929,6 +951,7 @@ module Google
929
951
  # by the host service.
930
952
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
931
953
  config_attr :bindings_override, {}, ::Hash, nil
954
+ config_attr :logger, :default, ::Logger, nil, :default
932
955
 
933
956
  # @private
934
957
  def initialize parent_config = nil