google-cloud-dialogflow-cx-v3 1.2.0 → 1.4.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 (84) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +31 -21
  3. data/lib/google/cloud/dialogflow/cx/v3/agents/client.rb +44 -12
  4. data/lib/google/cloud/dialogflow/cx/v3/agents/operations.rb +19 -15
  5. data/lib/google/cloud/dialogflow/cx/v3/agents/rest/client.rb +44 -12
  6. data/lib/google/cloud/dialogflow/cx/v3/agents/rest/operations.rb +50 -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 +36 -3
  9. data/lib/google/cloud/dialogflow/cx/v3/changelogs/rest/client.rb +36 -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 +36 -3
  12. data/lib/google/cloud/dialogflow/cx/v3/deployments/rest/client.rb +36 -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 +46 -8
  15. data/lib/google/cloud/dialogflow/cx/v3/entity_types/operations.rb +19 -15
  16. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest/client.rb +46 -8
  17. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest/operations.rb +50 -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 +42 -10
  20. data/lib/google/cloud/dialogflow/cx/v3/environments/operations.rb +19 -15
  21. data/lib/google/cloud/dialogflow/cx/v3/environments/rest/client.rb +42 -10
  22. data/lib/google/cloud/dialogflow/cx/v3/environments/rest/operations.rb +50 -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 +36 -8
  25. data/lib/google/cloud/dialogflow/cx/v3/experiments/rest/client.rb +36 -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 +43 -11
  28. data/lib/google/cloud/dialogflow/cx/v3/flows/operations.rb +19 -15
  29. data/lib/google/cloud/dialogflow/cx/v3/flows/rest/client.rb +43 -11
  30. data/lib/google/cloud/dialogflow/cx/v3/flows/rest/operations.rb +50 -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 +36 -6
  33. data/lib/google/cloud/dialogflow/cx/v3/generators/rest/client.rb +36 -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 +46 -8
  36. data/lib/google/cloud/dialogflow/cx/v3/intents/operations.rb +19 -15
  37. data/lib/google/cloud/dialogflow/cx/v3/intents/rest/client.rb +46 -8
  38. data/lib/google/cloud/dialogflow/cx/v3/intents/rest/operations.rb +50 -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 +36 -6
  41. data/lib/google/cloud/dialogflow/cx/v3/pages/rest/client.rb +36 -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 +36 -6
  44. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/rest/client.rb +36 -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 +36 -6
  47. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/rest/client.rb +36 -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 +35 -7
  50. data/lib/google/cloud/dialogflow/cx/v3/sessions/rest/client.rb +35 -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 +45 -13
  53. data/lib/google/cloud/dialogflow/cx/v3/test_cases/operations.rb +19 -15
  54. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest/client.rb +45 -13
  55. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest/operations.rb +50 -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 +36 -6
  58. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/rest/client.rb +36 -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 +38 -8
  62. data/lib/google/cloud/dialogflow/cx/v3/versions/operations.rb +19 -15
  63. data/lib/google/cloud/dialogflow/cx/v3/versions/rest/client.rb +38 -8
  64. data/lib/google/cloud/dialogflow/cx/v3/versions/rest/operations.rb +50 -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 +36 -6
  67. data/lib/google/cloud/dialogflow/cx/v3/webhooks/rest/client.rb +36 -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/cloud/dialogflow/cx/v3/agent.rb +12 -0
  71. data/proto_docs/google/cloud/dialogflow/cx/v3/entity_type.rb +12 -0
  72. data/proto_docs/google/cloud/dialogflow/cx/v3/experiment.rb +4 -0
  73. data/proto_docs/google/cloud/dialogflow/cx/v3/flow.rb +8 -0
  74. data/proto_docs/google/cloud/dialogflow/cx/v3/fulfillment.rb +4 -0
  75. data/proto_docs/google/cloud/dialogflow/cx/v3/intent.rb +12 -0
  76. data/proto_docs/google/cloud/dialogflow/cx/v3/page.rb +12 -0
  77. data/proto_docs/google/cloud/dialogflow/cx/v3/response_message.rb +28 -0
  78. data/proto_docs/google/cloud/dialogflow/cx/v3/security_settings.rb +4 -0
  79. data/proto_docs/google/cloud/dialogflow/cx/v3/session.rb +32 -0
  80. data/proto_docs/google/cloud/dialogflow/cx/v3/test_case.rb +22 -0
  81. data/proto_docs/google/cloud/dialogflow/cx/v3/webhook.rb +18 -0
  82. data/proto_docs/google/longrunning/operations.rb +23 -14
  83. data/proto_docs/google/protobuf/struct.rb +12 -0
  84. metadata +6 -9
@@ -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)
@@ -512,6 +503,13 @@ module Google
512
503
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
513
504
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
514
505
  # * (`nil`) indicating no credentials
506
+ #
507
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
508
+ # external source for authentication to Google Cloud, you must validate it before
509
+ # providing it to a Google API client library. Providing an unvalidated credential
510
+ # configuration to Google APIs can compromise the security of your systems and data.
511
+ # For more information, refer to [Validate credential configurations from external
512
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
515
513
  # @return [::Object]
516
514
  # @!attribute [rw] scope
517
515
  # The OAuth scopes
@@ -544,6 +542,11 @@ module Google
544
542
  # default endpoint URL. The default value of nil uses the environment
545
543
  # universe (usually the default "googleapis.com" universe).
546
544
  # @return [::String,nil]
545
+ # @!attribute [rw] logger
546
+ # A custom logger to use for request/response debug logging, or the value
547
+ # `:default` (the default) to construct a default logger, or `nil` to
548
+ # explicitly disable logging.
549
+ # @return [::Logger,:default,nil]
547
550
  #
548
551
  class Configuration
549
552
  extend ::Gapic::Config
@@ -565,6 +568,7 @@ module Google
565
568
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
566
569
  config_attr :quota_project, nil, ::String, nil
567
570
  config_attr :universe_domain, nil, ::String, nil
571
+ config_attr :logger, :default, ::Logger, nil, :default
568
572
 
569
573
  # @private
570
574
  def initialize parent_config = nil
@@ -684,16 +688,18 @@ module Google
684
688
 
685
689
  response = @client_stub.make_http_request(
686
690
  verb,
687
- uri: uri,
688
- body: body || "",
689
- params: query_string_params,
691
+ uri: uri,
692
+ body: body || "",
693
+ params: query_string_params,
694
+ method_name: "list_operations",
690
695
  options: options
691
696
  )
692
697
  operation = ::Gapic::Rest::TransportOperation.new response
693
698
  result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
694
-
695
- yield result, operation if block_given?
696
- result
699
+ catch :response do
700
+ yield result, operation if block_given?
701
+ result
702
+ end
697
703
  end
698
704
 
699
705
  ##
@@ -722,16 +728,18 @@ module Google
722
728
 
723
729
  response = @client_stub.make_http_request(
724
730
  verb,
725
- uri: uri,
726
- body: body || "",
727
- params: query_string_params,
731
+ uri: uri,
732
+ body: body || "",
733
+ params: query_string_params,
734
+ method_name: "get_operation",
728
735
  options: options
729
736
  )
730
737
  operation = ::Gapic::Rest::TransportOperation.new response
731
738
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
732
-
733
- yield result, operation if block_given?
734
- result
739
+ catch :response do
740
+ yield result, operation if block_given?
741
+ result
742
+ end
735
743
  end
736
744
 
737
745
  ##
@@ -760,16 +768,18 @@ module Google
760
768
 
761
769
  response = @client_stub.make_http_request(
762
770
  verb,
763
- uri: uri,
764
- body: body || "",
765
- params: query_string_params,
771
+ uri: uri,
772
+ body: body || "",
773
+ params: query_string_params,
774
+ method_name: "delete_operation",
766
775
  options: options
767
776
  )
768
777
  operation = ::Gapic::Rest::TransportOperation.new response
769
778
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
770
-
771
- yield result, operation if block_given?
772
- result
779
+ catch :response do
780
+ yield result, operation if block_given?
781
+ result
782
+ end
773
783
  end
774
784
 
775
785
  ##
@@ -798,16 +808,18 @@ module Google
798
808
 
799
809
  response = @client_stub.make_http_request(
800
810
  verb,
801
- uri: uri,
802
- body: body || "",
803
- params: query_string_params,
811
+ uri: uri,
812
+ body: body || "",
813
+ params: query_string_params,
814
+ method_name: "cancel_operation",
804
815
  options: options
805
816
  )
806
817
  operation = ::Gapic::Rest::TransportOperation.new response
807
818
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
808
-
809
- yield result, operation if block_given?
810
- result
819
+ catch :response do
820
+ yield result, operation if block_given?
821
+ result
822
+ end
811
823
  end
812
824
 
813
825
  ##
@@ -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_versions 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_versions",
94
107
  options: options
95
108
  )
96
109
  operation = ::Gapic::Rest::TransportOperation.new response
97
110
  result = ::Google::Cloud::Dialogflow::CX::V3::ListVersionsResponse.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_version",
132
147
  options: options
133
148
  )
134
149
  operation = ::Gapic::Rest::TransportOperation.new response
135
150
  result = ::Google::Cloud::Dialogflow::CX::V3::Version.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_version",
170
187
  options: options
171
188
  )
172
189
  operation = ::Gapic::Rest::TransportOperation.new response
173
190
  result = ::Google::Longrunning::Operation.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_version",
208
227
  options: options
209
228
  )
210
229
  operation = ::Gapic::Rest::TransportOperation.new response
211
230
  result = ::Google::Cloud::Dialogflow::CX::V3::Version.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_version",
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
  ##
@@ -278,16 +300,18 @@ module Google
278
300
 
279
301
  response = @client_stub.make_http_request(
280
302
  verb,
281
- uri: uri,
282
- body: body || "",
283
- params: query_string_params,
303
+ uri: uri,
304
+ body: body || "",
305
+ params: query_string_params,
306
+ method_name: "load_version",
284
307
  options: options
285
308
  )
286
309
  operation = ::Gapic::Rest::TransportOperation.new response
287
310
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
288
-
289
- yield result, operation if block_given?
290
- result
311
+ catch :response do
312
+ yield result, operation if block_given?
313
+ result
314
+ end
291
315
  end
292
316
 
293
317
  ##
@@ -316,16 +340,18 @@ module Google
316
340
 
317
341
  response = @client_stub.make_http_request(
318
342
  verb,
319
- uri: uri,
320
- body: body || "",
321
- params: query_string_params,
343
+ uri: uri,
344
+ body: body || "",
345
+ params: query_string_params,
346
+ method_name: "compare_versions",
322
347
  options: options
323
348
  )
324
349
  operation = ::Gapic::Rest::TransportOperation.new response
325
350
  result = ::Google::Cloud::Dialogflow::CX::V3::CompareVersionsResponse.decode_json response.body, ignore_unknown_fields: true
326
-
327
- yield result, operation if block_given?
328
- result
351
+ catch :response do
352
+ yield result, operation if block_given?
353
+ result
354
+ end
329
355
  end
330
356
 
331
357
  ##
@@ -164,14 +164,26 @@ module Google
164
164
  universe_domain: @config.universe_domain,
165
165
  channel_args: @config.channel_args,
166
166
  interceptors: @config.interceptors,
167
- channel_pool_config: @config.channel_pool
167
+ channel_pool_config: @config.channel_pool,
168
+ logger: @config.logger
168
169
  )
169
170
 
171
+ @webhooks_stub.stub_logger&.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::Client.new do |config|
171
182
  config.credentials = credentials
172
183
  config.quota_project = @quota_project_id
173
184
  config.endpoint = @webhooks_stub.endpoint
174
185
  config.universe_domain = @webhooks_stub.universe_domain
186
+ config.logger = @webhooks_stub.logger if config.respond_to? :logger=
175
187
  end
176
188
  end
177
189
 
@@ -182,6 +194,15 @@ module Google
182
194
  #
183
195
  attr_reader :location_client
184
196
 
197
+ ##
198
+ # The logger used for request/response debug logging.
199
+ #
200
+ # @return [Logger]
201
+ #
202
+ def logger
203
+ @webhooks_stub.logger
204
+ end
205
+
185
206
  # Service calls
186
207
 
187
208
  ##
@@ -275,7 +296,7 @@ module Google
275
296
  @webhooks_stub.call_rpc :list_webhooks, request, options: options do |response, operation|
276
297
  response = ::Gapic::PagedEnumerable.new @webhooks_stub, :list_webhooks, request, response, operation, options
277
298
  yield response, operation if block_given?
278
- return response
299
+ throw :response, response
279
300
  end
280
301
  rescue ::GRPC::BadStatus => e
281
302
  raise ::Google::Cloud::Error.from_error(e)
@@ -363,7 +384,6 @@ module Google
363
384
 
364
385
  @webhooks_stub.call_rpc :get_webhook, request, options: options do |response, operation|
365
386
  yield response, operation if block_given?
366
- return response
367
387
  end
368
388
  rescue ::GRPC::BadStatus => e
369
389
  raise ::Google::Cloud::Error.from_error(e)
@@ -452,7 +472,6 @@ module Google
452
472
 
453
473
  @webhooks_stub.call_rpc :create_webhook, request, options: options do |response, operation|
454
474
  yield response, operation if block_given?
455
- return response
456
475
  end
457
476
  rescue ::GRPC::BadStatus => e
458
477
  raise ::Google::Cloud::Error.from_error(e)
@@ -541,7 +560,6 @@ module Google
541
560
 
542
561
  @webhooks_stub.call_rpc :update_webhook, request, options: options do |response, operation|
543
562
  yield response, operation if block_given?
544
- return response
545
563
  end
546
564
  rescue ::GRPC::BadStatus => e
547
565
  raise ::Google::Cloud::Error.from_error(e)
@@ -640,7 +658,6 @@ module Google
640
658
 
641
659
  @webhooks_stub.call_rpc :delete_webhook, request, options: options do |response, operation|
642
660
  yield response, operation if block_given?
643
- return response
644
661
  end
645
662
  rescue ::GRPC::BadStatus => e
646
663
  raise ::Google::Cloud::Error.from_error(e)
@@ -690,6 +707,13 @@ module Google
690
707
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
691
708
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
692
709
  # * (`nil`) indicating no credentials
710
+ #
711
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
712
+ # external source for authentication to Google Cloud, you must validate it before
713
+ # providing it to a Google API client library. Providing an unvalidated credential
714
+ # configuration to Google APIs can compromise the security of your systems and data.
715
+ # For more information, refer to [Validate credential configurations from external
716
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
693
717
  # @return [::Object]
694
718
  # @!attribute [rw] scope
695
719
  # The OAuth scopes
@@ -729,6 +753,11 @@ module Google
729
753
  # default endpoint URL. The default value of nil uses the environment
730
754
  # universe (usually the default "googleapis.com" universe).
731
755
  # @return [::String,nil]
756
+ # @!attribute [rw] logger
757
+ # A custom logger to use for request/response debug logging, or the value
758
+ # `:default` (the default) to construct a default logger, or `nil` to
759
+ # explicitly disable logging.
760
+ # @return [::Logger,:default,nil]
732
761
  #
733
762
  class Configuration
734
763
  extend ::Gapic::Config
@@ -753,6 +782,7 @@ module Google
753
782
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
754
783
  config_attr :quota_project, nil, ::String, nil
755
784
  config_attr :universe_domain, nil, ::String, nil
785
+ config_attr :logger, :default, ::Logger, nil, :default
756
786
 
757
787
  # @private
758
788
  def initialize parent_config = nil
@@ -157,15 +157,27 @@ module Google
157
157
  endpoint: @config.endpoint,
158
158
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
159
159
  universe_domain: @config.universe_domain,
160
- credentials: credentials
160
+ credentials: credentials,
161
+ logger: @config.logger
161
162
  )
162
163
 
164
+ @webhooks_stub.logger(stub: true)&.info do |entry|
165
+ entry.set_system_name
166
+ entry.set_service
167
+ entry.message = "Created client for #{entry.service}"
168
+ entry.set_credentials_fields credentials
169
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
170
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
171
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
172
+ end
173
+
163
174
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
164
175
  config.credentials = credentials
165
176
  config.quota_project = @quota_project_id
166
177
  config.endpoint = @webhooks_stub.endpoint
167
178
  config.universe_domain = @webhooks_stub.universe_domain
168
179
  config.bindings_override = @config.bindings_override
180
+ config.logger = @webhooks_stub.logger if config.respond_to? :logger=
169
181
  end
170
182
  end
171
183
 
@@ -176,6 +188,15 @@ module Google
176
188
  #
177
189
  attr_reader :location_client
178
190
 
191
+ ##
192
+ # The logger used for request/response debug logging.
193
+ #
194
+ # @return [Logger]
195
+ #
196
+ def logger
197
+ @webhooks_stub.logger
198
+ end
199
+
179
200
  # Service calls
180
201
 
181
202
  ##
@@ -262,7 +283,7 @@ module Google
262
283
  @webhooks_stub.list_webhooks request, options do |result, operation|
263
284
  result = ::Gapic::Rest::PagedEnumerable.new @webhooks_stub, :list_webhooks, "webhooks", request, result, options
264
285
  yield result, operation if block_given?
265
- return result
286
+ throw :response, result
266
287
  end
267
288
  rescue ::Gapic::Rest::Error => e
268
289
  raise ::Google::Cloud::Error.from_error(e)
@@ -343,7 +364,6 @@ module Google
343
364
 
344
365
  @webhooks_stub.get_webhook request, options do |result, operation|
345
366
  yield result, operation if block_given?
346
- return result
347
367
  end
348
368
  rescue ::Gapic::Rest::Error => e
349
369
  raise ::Google::Cloud::Error.from_error(e)
@@ -425,7 +445,6 @@ module Google
425
445
 
426
446
  @webhooks_stub.create_webhook request, options do |result, operation|
427
447
  yield result, operation if block_given?
428
- return result
429
448
  end
430
449
  rescue ::Gapic::Rest::Error => e
431
450
  raise ::Google::Cloud::Error.from_error(e)
@@ -507,7 +526,6 @@ module Google
507
526
 
508
527
  @webhooks_stub.update_webhook request, options do |result, operation|
509
528
  yield result, operation if block_given?
510
- return result
511
529
  end
512
530
  rescue ::Gapic::Rest::Error => e
513
531
  raise ::Google::Cloud::Error.from_error(e)
@@ -599,7 +617,6 @@ module Google
599
617
 
600
618
  @webhooks_stub.delete_webhook request, options do |result, operation|
601
619
  yield result, operation if block_given?
602
- return result
603
620
  end
604
621
  rescue ::Gapic::Rest::Error => e
605
622
  raise ::Google::Cloud::Error.from_error(e)
@@ -647,6 +664,13 @@ module Google
647
664
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
648
665
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
649
666
  # * (`nil`) indicating no credentials
667
+ #
668
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
669
+ # external source for authentication to Google Cloud, you must validate it before
670
+ # providing it to a Google API client library. Providing an unvalidated credential
671
+ # configuration to Google APIs can compromise the security of your systems and data.
672
+ # For more information, refer to [Validate credential configurations from external
673
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
650
674
  # @return [::Object]
651
675
  # @!attribute [rw] scope
652
676
  # The OAuth scopes
@@ -679,6 +703,11 @@ module Google
679
703
  # default endpoint URL. The default value of nil uses the environment
680
704
  # universe (usually the default "googleapis.com" universe).
681
705
  # @return [::String,nil]
706
+ # @!attribute [rw] logger
707
+ # A custom logger to use for request/response debug logging, or the value
708
+ # `:default` (the default) to construct a default logger, or `nil` to
709
+ # explicitly disable logging.
710
+ # @return [::Logger,:default,nil]
682
711
  #
683
712
  class Configuration
684
713
  extend ::Gapic::Config
@@ -707,6 +736,7 @@ module Google
707
736
  # by the host service.
708
737
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
709
738
  config_attr :bindings_override, {}, ::Hash, nil
739
+ config_attr :logger, :default, ::Logger, nil, :default
710
740
 
711
741
  # @private
712
742
  def initialize parent_config = nil