google-cloud-retail-v2 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +31 -21
  3. data/lib/google/cloud/retail/v2/analytics_service/client.rb +36 -2
  4. data/lib/google/cloud/retail/v2/analytics_service/operations.rb +19 -15
  5. data/lib/google/cloud/retail/v2/analytics_service/rest/client.rb +36 -2
  6. data/lib/google/cloud/retail/v2/analytics_service/rest/operations.rb +50 -38
  7. data/lib/google/cloud/retail/v2/analytics_service/rest/service_stub.rb +22 -8
  8. data/lib/google/cloud/retail/v2/catalog_service/client.rb +36 -12
  9. data/lib/google/cloud/retail/v2/catalog_service/rest/client.rb +36 -12
  10. data/lib/google/cloud/retail/v2/catalog_service/rest/service_stub.rb +102 -68
  11. data/lib/google/cloud/retail/v2/completion_service/client.rb +36 -3
  12. data/lib/google/cloud/retail/v2/completion_service/operations.rb +19 -15
  13. data/lib/google/cloud/retail/v2/completion_service/rest/client.rb +36 -3
  14. data/lib/google/cloud/retail/v2/completion_service/rest/operations.rb +50 -38
  15. data/lib/google/cloud/retail/v2/completion_service/rest/service_stub.rb +30 -14
  16. data/lib/google/cloud/retail/v2/control_service/client.rb +36 -6
  17. data/lib/google/cloud/retail/v2/control_service/rest/client.rb +36 -6
  18. data/lib/google/cloud/retail/v2/control_service/rest/service_stub.rb +54 -32
  19. data/lib/google/cloud/retail/v2/generative_question_service/client.rb +35 -6
  20. data/lib/google/cloud/retail/v2/generative_question_service/rest/client.rb +35 -6
  21. data/lib/google/cloud/retail/v2/generative_question_service/rest/service_stub.rb +54 -32
  22. data/lib/google/cloud/retail/v2/model_service/client.rb +38 -9
  23. data/lib/google/cloud/retail/v2/model_service/operations.rb +19 -15
  24. data/lib/google/cloud/retail/v2/model_service/rest/client.rb +38 -9
  25. data/lib/google/cloud/retail/v2/model_service/rest/operations.rb +50 -38
  26. data/lib/google/cloud/retail/v2/model_service/rest/service_stub.rb +78 -50
  27. data/lib/google/cloud/retail/v2/prediction_service/client.rb +35 -2
  28. data/lib/google/cloud/retail/v2/prediction_service/rest/client.rb +35 -2
  29. data/lib/google/cloud/retail/v2/prediction_service/rest/service_stub.rb +22 -8
  30. data/lib/google/cloud/retail/v2/product_service/client.rb +43 -13
  31. data/lib/google/cloud/retail/v2/product_service/operations.rb +19 -15
  32. data/lib/google/cloud/retail/v2/product_service/rest/client.rb +43 -13
  33. data/lib/google/cloud/retail/v2/product_service/rest/operations.rb +50 -38
  34. data/lib/google/cloud/retail/v2/product_service/rest/service_stub.rb +110 -74
  35. data/lib/google/cloud/retail/v2/search_service/client.rb +36 -2
  36. data/lib/google/cloud/retail/v2/search_service/rest/client.rb +35 -2
  37. data/lib/google/cloud/retail/v2/search_service/rest/service_stub.rb +22 -8
  38. data/lib/google/cloud/retail/v2/serving_config_service/client.rb +36 -8
  39. data/lib/google/cloud/retail/v2/serving_config_service/rest/client.rb +36 -8
  40. data/lib/google/cloud/retail/v2/serving_config_service/rest/service_stub.rb +70 -44
  41. data/lib/google/cloud/retail/v2/user_event_service/client.rb +38 -6
  42. data/lib/google/cloud/retail/v2/user_event_service/operations.rb +19 -15
  43. data/lib/google/cloud/retail/v2/user_event_service/rest/client.rb +38 -6
  44. data/lib/google/cloud/retail/v2/user_event_service/rest/operations.rb +50 -38
  45. data/lib/google/cloud/retail/v2/user_event_service/rest/service_stub.rb +54 -32
  46. data/lib/google/cloud/retail/v2/version.rb +1 -1
  47. data/proto_docs/google/api/client.rb +39 -0
  48. data/proto_docs/google/cloud/retail/v2/common.rb +28 -0
  49. data/proto_docs/google/cloud/retail/v2/export_config.rb +4 -0
  50. data/proto_docs/google/cloud/retail/v2/import_config.rb +12 -0
  51. data/proto_docs/google/cloud/retail/v2/product.rb +4 -0
  52. data/proto_docs/google/cloud/retail/v2/search_service.rb +12 -0
  53. data/proto_docs/google/longrunning/operations.rb +23 -14
  54. data/proto_docs/google/protobuf/struct.rb +12 -0
  55. metadata +6 -9
@@ -158,14 +158,26 @@ module Google
158
158
  universe_domain: @config.universe_domain,
159
159
  channel_args: @config.channel_args,
160
160
  interceptors: @config.interceptors,
161
- channel_pool_config: @config.channel_pool
161
+ channel_pool_config: @config.channel_pool,
162
+ logger: @config.logger
162
163
  )
163
164
 
165
+ @control_service_stub.stub_logger&.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::Client.new do |config|
165
176
  config.credentials = credentials
166
177
  config.quota_project = @quota_project_id
167
178
  config.endpoint = @control_service_stub.endpoint
168
179
  config.universe_domain = @control_service_stub.universe_domain
180
+ config.logger = @control_service_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
+ @control_service_stub.logger
198
+ end
199
+
179
200
  # Service calls
180
201
 
181
202
  ##
@@ -270,7 +291,6 @@ module Google
270
291
 
271
292
  @control_service_stub.call_rpc :create_control, request, options: options do |response, operation|
272
293
  yield response, operation if block_given?
273
- return response
274
294
  end
275
295
  rescue ::GRPC::BadStatus => e
276
296
  raise ::Google::Cloud::Error.from_error(e)
@@ -360,7 +380,6 @@ module Google
360
380
 
361
381
  @control_service_stub.call_rpc :delete_control, request, options: options do |response, operation|
362
382
  yield response, operation if block_given?
363
- return response
364
383
  end
365
384
  rescue ::GRPC::BadStatus => e
366
385
  raise ::Google::Cloud::Error.from_error(e)
@@ -459,7 +478,6 @@ module Google
459
478
 
460
479
  @control_service_stub.call_rpc :update_control, request, options: options do |response, operation|
461
480
  yield response, operation if block_given?
462
- return response
463
481
  end
464
482
  rescue ::GRPC::BadStatus => e
465
483
  raise ::Google::Cloud::Error.from_error(e)
@@ -546,7 +564,6 @@ module Google
546
564
 
547
565
  @control_service_stub.call_rpc :get_control, request, options: options do |response, operation|
548
566
  yield response, operation if block_given?
549
- return response
550
567
  end
551
568
  rescue ::GRPC::BadStatus => e
552
569
  raise ::Google::Cloud::Error.from_error(e)
@@ -652,7 +669,7 @@ module Google
652
669
  @control_service_stub.call_rpc :list_controls, request, options: options do |response, operation|
653
670
  response = ::Gapic::PagedEnumerable.new @control_service_stub, :list_controls, request, response, operation, options
654
671
  yield response, operation if block_given?
655
- return response
672
+ throw :response, response
656
673
  end
657
674
  rescue ::GRPC::BadStatus => e
658
675
  raise ::Google::Cloud::Error.from_error(e)
@@ -702,6 +719,13 @@ module Google
702
719
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
703
720
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
704
721
  # * (`nil`) indicating no credentials
722
+ #
723
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
724
+ # external source for authentication to Google Cloud, you must validate it before
725
+ # providing it to a Google API client library. Providing an unvalidated credential
726
+ # configuration to Google APIs can compromise the security of your systems and data.
727
+ # For more information, refer to [Validate credential configurations from external
728
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
705
729
  # @return [::Object]
706
730
  # @!attribute [rw] scope
707
731
  # The OAuth scopes
@@ -741,6 +765,11 @@ module Google
741
765
  # default endpoint URL. The default value of nil uses the environment
742
766
  # universe (usually the default "googleapis.com" universe).
743
767
  # @return [::String,nil]
768
+ # @!attribute [rw] logger
769
+ # A custom logger to use for request/response debug logging, or the value
770
+ # `:default` (the default) to construct a default logger, or `nil` to
771
+ # explicitly disable logging.
772
+ # @return [::Logger,:default,nil]
744
773
  #
745
774
  class Configuration
746
775
  extend ::Gapic::Config
@@ -765,6 +794,7 @@ module Google
765
794
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
766
795
  config_attr :quota_project, nil, ::String, nil
767
796
  config_attr :universe_domain, nil, ::String, nil
797
+ config_attr :logger, :default, ::Logger, nil, :default
768
798
 
769
799
  # @private
770
800
  def initialize parent_config = nil
@@ -151,14 +151,26 @@ module Google
151
151
  endpoint: @config.endpoint,
152
152
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
153
153
  universe_domain: @config.universe_domain,
154
- credentials: credentials
154
+ credentials: credentials,
155
+ logger: @config.logger
155
156
  )
156
157
 
158
+ @control_service_stub.logger(stub: true)&.info do |entry|
159
+ entry.set_system_name
160
+ entry.set_service
161
+ entry.message = "Created client for #{entry.service}"
162
+ entry.set_credentials_fields credentials
163
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
164
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
165
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
166
+ end
167
+
157
168
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
158
169
  config.credentials = credentials
159
170
  config.quota_project = @quota_project_id
160
171
  config.endpoint = @control_service_stub.endpoint
161
172
  config.universe_domain = @control_service_stub.universe_domain
173
+ config.logger = @control_service_stub.logger if config.respond_to? :logger=
162
174
  end
163
175
  end
164
176
 
@@ -169,6 +181,15 @@ module Google
169
181
  #
170
182
  attr_reader :location_client
171
183
 
184
+ ##
185
+ # The logger used for request/response debug logging.
186
+ #
187
+ # @return [Logger]
188
+ #
189
+ def logger
190
+ @control_service_stub.logger
191
+ end
192
+
172
193
  # Service calls
173
194
 
174
195
  ##
@@ -256,7 +277,6 @@ module Google
256
277
 
257
278
  @control_service_stub.create_control request, options do |result, operation|
258
279
  yield result, operation if block_given?
259
- return result
260
280
  end
261
281
  rescue ::Gapic::Rest::Error => e
262
282
  raise ::Google::Cloud::Error.from_error(e)
@@ -339,7 +359,6 @@ module Google
339
359
 
340
360
  @control_service_stub.delete_control request, options do |result, operation|
341
361
  yield result, operation if block_given?
342
- return result
343
362
  end
344
363
  rescue ::Gapic::Rest::Error => e
345
364
  raise ::Google::Cloud::Error.from_error(e)
@@ -431,7 +450,6 @@ module Google
431
450
 
432
451
  @control_service_stub.update_control request, options do |result, operation|
433
452
  yield result, operation if block_given?
434
- return result
435
453
  end
436
454
  rescue ::Gapic::Rest::Error => e
437
455
  raise ::Google::Cloud::Error.from_error(e)
@@ -511,7 +529,6 @@ module Google
511
529
 
512
530
  @control_service_stub.get_control request, options do |result, operation|
513
531
  yield result, operation if block_given?
514
- return result
515
532
  end
516
533
  rescue ::Gapic::Rest::Error => e
517
534
  raise ::Google::Cloud::Error.from_error(e)
@@ -610,7 +627,7 @@ module Google
610
627
  @control_service_stub.list_controls request, options do |result, operation|
611
628
  result = ::Gapic::Rest::PagedEnumerable.new @control_service_stub, :list_controls, "controls", request, result, options
612
629
  yield result, operation if block_given?
613
- return result
630
+ throw :response, result
614
631
  end
615
632
  rescue ::Gapic::Rest::Error => e
616
633
  raise ::Google::Cloud::Error.from_error(e)
@@ -658,6 +675,13 @@ module Google
658
675
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
659
676
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
660
677
  # * (`nil`) indicating no credentials
678
+ #
679
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
680
+ # external source for authentication to Google Cloud, you must validate it before
681
+ # providing it to a Google API client library. Providing an unvalidated credential
682
+ # configuration to Google APIs can compromise the security of your systems and data.
683
+ # For more information, refer to [Validate credential configurations from external
684
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
661
685
  # @return [::Object]
662
686
  # @!attribute [rw] scope
663
687
  # The OAuth scopes
@@ -690,6 +714,11 @@ module Google
690
714
  # default endpoint URL. The default value of nil uses the environment
691
715
  # universe (usually the default "googleapis.com" universe).
692
716
  # @return [::String,nil]
717
+ # @!attribute [rw] logger
718
+ # A custom logger to use for request/response debug logging, or the value
719
+ # `:default` (the default) to construct a default logger, or `nil` to
720
+ # explicitly disable logging.
721
+ # @return [::Logger,:default,nil]
693
722
  #
694
723
  class Configuration
695
724
  extend ::Gapic::Config
@@ -711,6 +740,7 @@ module Google
711
740
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
712
741
  config_attr :quota_project, nil, ::String, nil
713
742
  config_attr :universe_domain, nil, ::String, nil
743
+ config_attr :logger, :default, ::Logger, nil, :default
714
744
 
715
745
  # @private
716
746
  def initialize parent_config = nil
@@ -30,7 +30,8 @@ module Google
30
30
  # including transcoding, making the REST call, and deserialing the response.
31
31
  #
32
32
  class ServiceStub
33
- def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
33
+ # @private
34
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
34
35
  # These require statements are intentionally placed here to initialize
35
36
  # the REST modules only when it's required.
36
37
  require "gapic/rest"
@@ -40,7 +41,9 @@ module Google
40
41
  universe_domain: universe_domain,
41
42
  credentials: credentials,
42
43
  numeric_enums: true,
43
- raise_faraday_errors: false
44
+ service_name: self.class,
45
+ raise_faraday_errors: false,
46
+ logger: logger
44
47
  end
45
48
 
46
49
  ##
@@ -61,6 +64,15 @@ module Google
61
64
  @client_stub.endpoint
62
65
  end
63
66
 
67
+ ##
68
+ # The logger used for request/response debug logging.
69
+ #
70
+ # @return [Logger]
71
+ #
72
+ def logger stub: false
73
+ stub ? @client_stub.stub_logger : @client_stub.logger
74
+ end
75
+
64
76
  ##
65
77
  # Baseline implementation for the create_control REST call
66
78
  #
@@ -87,16 +99,18 @@ module Google
87
99
 
88
100
  response = @client_stub.make_http_request(
89
101
  verb,
90
- uri: uri,
91
- body: body || "",
92
- params: query_string_params,
102
+ uri: uri,
103
+ body: body || "",
104
+ params: query_string_params,
105
+ method_name: "create_control",
93
106
  options: options
94
107
  )
95
108
  operation = ::Gapic::Rest::TransportOperation.new response
96
109
  result = ::Google::Cloud::Retail::V2::Control.decode_json response.body, ignore_unknown_fields: true
97
-
98
- yield result, operation if block_given?
99
- result
110
+ catch :response do
111
+ yield result, operation if block_given?
112
+ result
113
+ end
100
114
  end
101
115
 
102
116
  ##
@@ -125,16 +139,18 @@ module Google
125
139
 
126
140
  response = @client_stub.make_http_request(
127
141
  verb,
128
- uri: uri,
129
- body: body || "",
130
- params: query_string_params,
142
+ uri: uri,
143
+ body: body || "",
144
+ params: query_string_params,
145
+ method_name: "delete_control",
131
146
  options: options
132
147
  )
133
148
  operation = ::Gapic::Rest::TransportOperation.new response
134
149
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
135
-
136
- yield result, operation if block_given?
137
- result
150
+ catch :response do
151
+ yield result, operation if block_given?
152
+ result
153
+ end
138
154
  end
139
155
 
140
156
  ##
@@ -163,16 +179,18 @@ module Google
163
179
 
164
180
  response = @client_stub.make_http_request(
165
181
  verb,
166
- uri: uri,
167
- body: body || "",
168
- params: query_string_params,
182
+ uri: uri,
183
+ body: body || "",
184
+ params: query_string_params,
185
+ method_name: "update_control",
169
186
  options: options
170
187
  )
171
188
  operation = ::Gapic::Rest::TransportOperation.new response
172
189
  result = ::Google::Cloud::Retail::V2::Control.decode_json response.body, ignore_unknown_fields: true
173
-
174
- yield result, operation if block_given?
175
- result
190
+ catch :response do
191
+ yield result, operation if block_given?
192
+ result
193
+ end
176
194
  end
177
195
 
178
196
  ##
@@ -201,16 +219,18 @@ module Google
201
219
 
202
220
  response = @client_stub.make_http_request(
203
221
  verb,
204
- uri: uri,
205
- body: body || "",
206
- params: query_string_params,
222
+ uri: uri,
223
+ body: body || "",
224
+ params: query_string_params,
225
+ method_name: "get_control",
207
226
  options: options
208
227
  )
209
228
  operation = ::Gapic::Rest::TransportOperation.new response
210
229
  result = ::Google::Cloud::Retail::V2::Control.decode_json response.body, ignore_unknown_fields: true
211
-
212
- yield result, operation if block_given?
213
- result
230
+ catch :response do
231
+ yield result, operation if block_given?
232
+ result
233
+ end
214
234
  end
215
235
 
216
236
  ##
@@ -239,16 +259,18 @@ module Google
239
259
 
240
260
  response = @client_stub.make_http_request(
241
261
  verb,
242
- uri: uri,
243
- body: body || "",
244
- params: query_string_params,
262
+ uri: uri,
263
+ body: body || "",
264
+ params: query_string_params,
265
+ method_name: "list_controls",
245
266
  options: options
246
267
  )
247
268
  operation = ::Gapic::Rest::TransportOperation.new response
248
269
  result = ::Google::Cloud::Retail::V2::ListControlsResponse.decode_json response.body, ignore_unknown_fields: true
249
-
250
- yield result, operation if block_given?
251
- result
270
+ catch :response do
271
+ yield result, operation if block_given?
272
+ result
273
+ end
252
274
  end
253
275
 
254
276
  ##
@@ -158,14 +158,26 @@ module Google
158
158
  universe_domain: @config.universe_domain,
159
159
  channel_args: @config.channel_args,
160
160
  interceptors: @config.interceptors,
161
- channel_pool_config: @config.channel_pool
161
+ channel_pool_config: @config.channel_pool,
162
+ logger: @config.logger
162
163
  )
163
164
 
165
+ @generative_question_service_stub.stub_logger&.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::Client.new do |config|
165
176
  config.credentials = credentials
166
177
  config.quota_project = @quota_project_id
167
178
  config.endpoint = @generative_question_service_stub.endpoint
168
179
  config.universe_domain = @generative_question_service_stub.universe_domain
180
+ config.logger = @generative_question_service_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
+ @generative_question_service_stub.logger
198
+ end
199
+
179
200
  # Service calls
180
201
 
181
202
  ##
@@ -263,7 +284,6 @@ module Google
263
284
 
264
285
  @generative_question_service_stub.call_rpc :update_generative_questions_feature_config, request, options: options do |response, operation|
265
286
  yield response, operation if block_given?
266
- return response
267
287
  end
268
288
  rescue ::GRPC::BadStatus => e
269
289
  raise ::Google::Cloud::Error.from_error(e)
@@ -351,7 +371,6 @@ module Google
351
371
 
352
372
  @generative_question_service_stub.call_rpc :get_generative_questions_feature_config, request, options: options do |response, operation|
353
373
  yield response, operation if block_given?
354
- return response
355
374
  end
356
375
  rescue ::GRPC::BadStatus => e
357
376
  raise ::Google::Cloud::Error.from_error(e)
@@ -438,7 +457,6 @@ module Google
438
457
 
439
458
  @generative_question_service_stub.call_rpc :list_generative_question_configs, request, options: options do |response, operation|
440
459
  yield response, operation if block_given?
441
- return response
442
460
  end
443
461
  rescue ::GRPC::BadStatus => e
444
462
  raise ::Google::Cloud::Error.from_error(e)
@@ -532,7 +550,6 @@ module Google
532
550
 
533
551
  @generative_question_service_stub.call_rpc :update_generative_question_config, request, options: options do |response, operation|
534
552
  yield response, operation if block_given?
535
- return response
536
553
  end
537
554
  rescue ::GRPC::BadStatus => e
538
555
  raise ::Google::Cloud::Error.from_error(e)
@@ -621,7 +638,6 @@ module Google
621
638
 
622
639
  @generative_question_service_stub.call_rpc :batch_update_generative_question_configs, request, options: options do |response, operation|
623
640
  yield response, operation if block_given?
624
- return response
625
641
  end
626
642
  rescue ::GRPC::BadStatus => e
627
643
  raise ::Google::Cloud::Error.from_error(e)
@@ -671,6 +687,13 @@ module Google
671
687
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
672
688
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
673
689
  # * (`nil`) indicating no credentials
690
+ #
691
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
692
+ # external source for authentication to Google Cloud, you must validate it before
693
+ # providing it to a Google API client library. Providing an unvalidated credential
694
+ # configuration to Google APIs can compromise the security of your systems and data.
695
+ # For more information, refer to [Validate credential configurations from external
696
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
674
697
  # @return [::Object]
675
698
  # @!attribute [rw] scope
676
699
  # The OAuth scopes
@@ -710,6 +733,11 @@ module Google
710
733
  # default endpoint URL. The default value of nil uses the environment
711
734
  # universe (usually the default "googleapis.com" universe).
712
735
  # @return [::String,nil]
736
+ # @!attribute [rw] logger
737
+ # A custom logger to use for request/response debug logging, or the value
738
+ # `:default` (the default) to construct a default logger, or `nil` to
739
+ # explicitly disable logging.
740
+ # @return [::Logger,:default,nil]
713
741
  #
714
742
  class Configuration
715
743
  extend ::Gapic::Config
@@ -734,6 +762,7 @@ module Google
734
762
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
735
763
  config_attr :quota_project, nil, ::String, nil
736
764
  config_attr :universe_domain, nil, ::String, nil
765
+ config_attr :logger, :default, ::Logger, nil, :default
737
766
 
738
767
  # @private
739
768
  def initialize parent_config = nil
@@ -151,14 +151,26 @@ module Google
151
151
  endpoint: @config.endpoint,
152
152
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
153
153
  universe_domain: @config.universe_domain,
154
- credentials: credentials
154
+ credentials: credentials,
155
+ logger: @config.logger
155
156
  )
156
157
 
158
+ @generative_question_service_stub.logger(stub: true)&.info do |entry|
159
+ entry.set_system_name
160
+ entry.set_service
161
+ entry.message = "Created client for #{entry.service}"
162
+ entry.set_credentials_fields credentials
163
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
164
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
165
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
166
+ end
167
+
157
168
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
158
169
  config.credentials = credentials
159
170
  config.quota_project = @quota_project_id
160
171
  config.endpoint = @generative_question_service_stub.endpoint
161
172
  config.universe_domain = @generative_question_service_stub.universe_domain
173
+ config.logger = @generative_question_service_stub.logger if config.respond_to? :logger=
162
174
  end
163
175
  end
164
176
 
@@ -169,6 +181,15 @@ module Google
169
181
  #
170
182
  attr_reader :location_client
171
183
 
184
+ ##
185
+ # The logger used for request/response debug logging.
186
+ #
187
+ # @return [Logger]
188
+ #
189
+ def logger
190
+ @generative_question_service_stub.logger
191
+ end
192
+
172
193
  # Service calls
173
194
 
174
195
  ##
@@ -249,7 +270,6 @@ module Google
249
270
 
250
271
  @generative_question_service_stub.update_generative_questions_feature_config request, options do |result, operation|
251
272
  yield result, operation if block_given?
252
- return result
253
273
  end
254
274
  rescue ::Gapic::Rest::Error => e
255
275
  raise ::Google::Cloud::Error.from_error(e)
@@ -330,7 +350,6 @@ module Google
330
350
 
331
351
  @generative_question_service_stub.get_generative_questions_feature_config request, options do |result, operation|
332
352
  yield result, operation if block_given?
333
- return result
334
353
  end
335
354
  rescue ::Gapic::Rest::Error => e
336
355
  raise ::Google::Cloud::Error.from_error(e)
@@ -410,7 +429,6 @@ module Google
410
429
 
411
430
  @generative_question_service_stub.list_generative_question_configs request, options do |result, operation|
412
431
  yield result, operation if block_given?
413
- return result
414
432
  end
415
433
  rescue ::Gapic::Rest::Error => e
416
434
  raise ::Google::Cloud::Error.from_error(e)
@@ -497,7 +515,6 @@ module Google
497
515
 
498
516
  @generative_question_service_stub.update_generative_question_config request, options do |result, operation|
499
517
  yield result, operation if block_given?
500
- return result
501
518
  end
502
519
  rescue ::Gapic::Rest::Error => e
503
520
  raise ::Google::Cloud::Error.from_error(e)
@@ -579,7 +596,6 @@ module Google
579
596
 
580
597
  @generative_question_service_stub.batch_update_generative_question_configs request, options do |result, operation|
581
598
  yield result, operation if block_given?
582
- return result
583
599
  end
584
600
  rescue ::Gapic::Rest::Error => e
585
601
  raise ::Google::Cloud::Error.from_error(e)
@@ -627,6 +643,13 @@ module Google
627
643
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
628
644
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
629
645
  # * (`nil`) indicating no credentials
646
+ #
647
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
648
+ # external source for authentication to Google Cloud, you must validate it before
649
+ # providing it to a Google API client library. Providing an unvalidated credential
650
+ # configuration to Google APIs can compromise the security of your systems and data.
651
+ # For more information, refer to [Validate credential configurations from external
652
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
630
653
  # @return [::Object]
631
654
  # @!attribute [rw] scope
632
655
  # The OAuth scopes
@@ -659,6 +682,11 @@ module Google
659
682
  # default endpoint URL. The default value of nil uses the environment
660
683
  # universe (usually the default "googleapis.com" universe).
661
684
  # @return [::String,nil]
685
+ # @!attribute [rw] logger
686
+ # A custom logger to use for request/response debug logging, or the value
687
+ # `:default` (the default) to construct a default logger, or `nil` to
688
+ # explicitly disable logging.
689
+ # @return [::Logger,:default,nil]
662
690
  #
663
691
  class Configuration
664
692
  extend ::Gapic::Config
@@ -680,6 +708,7 @@ module Google
680
708
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
681
709
  config_attr :quota_project, nil, ::String, nil
682
710
  config_attr :universe_domain, nil, ::String, nil
711
+ config_attr :logger, :default, ::Logger, nil, :default
683
712
 
684
713
  # @private
685
714
  def initialize parent_config = nil