google-cloud-recommendation_engine-v1beta1 0.9.2 → 0.11.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 (25) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +31 -21
  3. data/lib/google/cloud/recommendation_engine/v1beta1/catalog_service/client.rb +36 -7
  4. data/lib/google/cloud/recommendation_engine/v1beta1/catalog_service/operations.rb +19 -15
  5. data/lib/google/cloud/recommendation_engine/v1beta1/catalog_service/rest/client.rb +36 -7
  6. data/lib/google/cloud/recommendation_engine/v1beta1/catalog_service/rest/operations.rb +50 -38
  7. data/lib/google/cloud/recommendation_engine/v1beta1/catalog_service/rest/service_stub.rb +62 -38
  8. data/lib/google/cloud/recommendation_engine/v1beta1/prediction_api_key_registry/client.rb +35 -4
  9. data/lib/google/cloud/recommendation_engine/v1beta1/prediction_api_key_registry/rest/client.rb +35 -4
  10. data/lib/google/cloud/recommendation_engine/v1beta1/prediction_api_key_registry/rest/service_stub.rb +38 -20
  11. data/lib/google/cloud/recommendation_engine/v1beta1/prediction_service/client.rb +35 -2
  12. data/lib/google/cloud/recommendation_engine/v1beta1/prediction_service/rest/client.rb +35 -2
  13. data/lib/google/cloud/recommendation_engine/v1beta1/prediction_service/rest/service_stub.rb +22 -8
  14. data/lib/google/cloud/recommendation_engine/v1beta1/user_event_service/client.rb +37 -6
  15. data/lib/google/cloud/recommendation_engine/v1beta1/user_event_service/operations.rb +19 -15
  16. data/lib/google/cloud/recommendation_engine/v1beta1/user_event_service/rest/client.rb +37 -6
  17. data/lib/google/cloud/recommendation_engine/v1beta1/user_event_service/rest/operations.rb +50 -38
  18. data/lib/google/cloud/recommendation_engine/v1beta1/user_event_service/rest/service_stub.rb +54 -32
  19. data/lib/google/cloud/recommendation_engine/v1beta1/version.rb +1 -1
  20. data/proto_docs/google/api/client.rb +39 -0
  21. data/proto_docs/google/cloud/recommendationengine/v1beta1/catalog.rb +4 -0
  22. data/proto_docs/google/cloud/recommendationengine/v1beta1/import.rb +6 -0
  23. data/proto_docs/google/longrunning/operations.rb +23 -14
  24. data/proto_docs/google/protobuf/struct.rb +12 -0
  25. metadata +6 -9
@@ -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_catalog_item 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_catalog_item",
93
106
  options: options
94
107
  )
95
108
  operation = ::Gapic::Rest::TransportOperation.new response
96
109
  result = ::Google::Cloud::RecommendationEngine::V1beta1::CatalogItem.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: "get_catalog_item",
131
146
  options: options
132
147
  )
133
148
  operation = ::Gapic::Rest::TransportOperation.new response
134
149
  result = ::Google::Cloud::RecommendationEngine::V1beta1::CatalogItem.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: "list_catalog_items",
169
186
  options: options
170
187
  )
171
188
  operation = ::Gapic::Rest::TransportOperation.new response
172
189
  result = ::Google::Cloud::RecommendationEngine::V1beta1::ListCatalogItemsResponse.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: "update_catalog_item",
207
226
  options: options
208
227
  )
209
228
  operation = ::Gapic::Rest::TransportOperation.new response
210
229
  result = ::Google::Cloud::RecommendationEngine::V1beta1::CatalogItem.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: "delete_catalog_item",
245
266
  options: options
246
267
  )
247
268
  operation = ::Gapic::Rest::TransportOperation.new response
248
269
  result = ::Google::Protobuf::Empty.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
  ##
@@ -277,16 +299,18 @@ module Google
277
299
 
278
300
  response = @client_stub.make_http_request(
279
301
  verb,
280
- uri: uri,
281
- body: body || "",
282
- params: query_string_params,
302
+ uri: uri,
303
+ body: body || "",
304
+ params: query_string_params,
305
+ method_name: "import_catalog_items",
283
306
  options: options
284
307
  )
285
308
  operation = ::Gapic::Rest::TransportOperation.new response
286
309
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
287
-
288
- yield result, operation if block_given?
289
- result
310
+ catch :response do
311
+ yield result, operation if block_given?
312
+ result
313
+ end
290
314
  end
291
315
 
292
316
  ##
@@ -176,8 +176,28 @@ 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
  )
182
+
183
+ @prediction_api_key_registry_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
+ end
193
+
194
+ ##
195
+ # The logger used for request/response debug logging.
196
+ #
197
+ # @return [Logger]
198
+ #
199
+ def logger
200
+ @prediction_api_key_registry_stub.logger
181
201
  end
182
202
 
183
203
  # Service calls
@@ -265,7 +285,6 @@ module Google
265
285
 
266
286
  @prediction_api_key_registry_stub.call_rpc :create_prediction_api_key_registration, request, options: options do |response, operation|
267
287
  yield response, operation if block_given?
268
- return response
269
288
  end
270
289
  rescue ::GRPC::BadStatus => e
271
290
  raise ::Google::Cloud::Error.from_error(e)
@@ -362,7 +381,7 @@ module Google
362
381
  @prediction_api_key_registry_stub.call_rpc :list_prediction_api_key_registrations, request, options: options do |response, operation|
363
382
  response = ::Gapic::PagedEnumerable.new @prediction_api_key_registry_stub, :list_prediction_api_key_registrations, request, response, operation, options
364
383
  yield response, operation if block_given?
365
- return response
384
+ throw :response, response
366
385
  end
367
386
  rescue ::GRPC::BadStatus => e
368
387
  raise ::Google::Cloud::Error.from_error(e)
@@ -449,7 +468,6 @@ module Google
449
468
 
450
469
  @prediction_api_key_registry_stub.call_rpc :delete_prediction_api_key_registration, request, options: options do |response, operation|
451
470
  yield response, operation if block_given?
452
- return response
453
471
  end
454
472
  rescue ::GRPC::BadStatus => e
455
473
  raise ::Google::Cloud::Error.from_error(e)
@@ -499,6 +517,13 @@ module Google
499
517
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
500
518
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
501
519
  # * (`nil`) indicating no credentials
520
+ #
521
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
522
+ # external source for authentication to Google Cloud, you must validate it before
523
+ # providing it to a Google API client library. Providing an unvalidated credential
524
+ # configuration to Google APIs can compromise the security of your systems and data.
525
+ # For more information, refer to [Validate credential configurations from external
526
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
502
527
  # @return [::Object]
503
528
  # @!attribute [rw] scope
504
529
  # The OAuth scopes
@@ -538,6 +563,11 @@ module Google
538
563
  # default endpoint URL. The default value of nil uses the environment
539
564
  # universe (usually the default "googleapis.com" universe).
540
565
  # @return [::String,nil]
566
+ # @!attribute [rw] logger
567
+ # A custom logger to use for request/response debug logging, or the value
568
+ # `:default` (the default) to construct a default logger, or `nil` to
569
+ # explicitly disable logging.
570
+ # @return [::Logger,:default,nil]
541
571
  #
542
572
  class Configuration
543
573
  extend ::Gapic::Config
@@ -562,6 +592,7 @@ module Google
562
592
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
563
593
  config_attr :quota_project, nil, ::String, nil
564
594
  config_attr :universe_domain, nil, ::String, nil
595
+ config_attr :logger, :default, ::Logger, nil, :default
565
596
 
566
597
  # @private
567
598
  def initialize parent_config = nil
@@ -169,8 +169,28 @@ 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
  )
175
+
176
+ @prediction_api_key_registry_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
+ end
186
+
187
+ ##
188
+ # The logger used for request/response debug logging.
189
+ #
190
+ # @return [Logger]
191
+ #
192
+ def logger
193
+ @prediction_api_key_registry_stub.logger
174
194
  end
175
195
 
176
196
  # Service calls
@@ -251,7 +271,6 @@ module Google
251
271
 
252
272
  @prediction_api_key_registry_stub.create_prediction_api_key_registration request, options do |result, operation|
253
273
  yield result, operation if block_given?
254
- return result
255
274
  end
256
275
  rescue ::Gapic::Rest::Error => e
257
276
  raise ::Google::Cloud::Error.from_error(e)
@@ -341,7 +360,7 @@ module Google
341
360
  @prediction_api_key_registry_stub.list_prediction_api_key_registrations request, options do |result, operation|
342
361
  result = ::Gapic::Rest::PagedEnumerable.new @prediction_api_key_registry_stub, :list_prediction_api_key_registrations, "prediction_api_key_registrations", request, result, options
343
362
  yield result, operation if block_given?
344
- return result
363
+ throw :response, result
345
364
  end
346
365
  rescue ::Gapic::Rest::Error => e
347
366
  raise ::Google::Cloud::Error.from_error(e)
@@ -421,7 +440,6 @@ module Google
421
440
 
422
441
  @prediction_api_key_registry_stub.delete_prediction_api_key_registration request, options do |result, operation|
423
442
  yield result, operation if block_given?
424
- return result
425
443
  end
426
444
  rescue ::Gapic::Rest::Error => e
427
445
  raise ::Google::Cloud::Error.from_error(e)
@@ -469,6 +487,13 @@ module Google
469
487
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
470
488
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
471
489
  # * (`nil`) indicating no credentials
490
+ #
491
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
492
+ # external source for authentication to Google Cloud, you must validate it before
493
+ # providing it to a Google API client library. Providing an unvalidated credential
494
+ # configuration to Google APIs can compromise the security of your systems and data.
495
+ # For more information, refer to [Validate credential configurations from external
496
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
472
497
  # @return [::Object]
473
498
  # @!attribute [rw] scope
474
499
  # The OAuth scopes
@@ -501,6 +526,11 @@ module Google
501
526
  # default endpoint URL. The default value of nil uses the environment
502
527
  # universe (usually the default "googleapis.com" universe).
503
528
  # @return [::String,nil]
529
+ # @!attribute [rw] logger
530
+ # A custom logger to use for request/response debug logging, or the value
531
+ # `:default` (the default) to construct a default logger, or `nil` to
532
+ # explicitly disable logging.
533
+ # @return [::Logger,:default,nil]
504
534
  #
505
535
  class Configuration
506
536
  extend ::Gapic::Config
@@ -522,6 +552,7 @@ module Google
522
552
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
523
553
  config_attr :quota_project, nil, ::String, nil
524
554
  config_attr :universe_domain, nil, ::String, nil
555
+ config_attr :logger, :default, ::Logger, nil, :default
525
556
 
526
557
  # @private
527
558
  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_prediction_api_key_registration 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_prediction_api_key_registration",
93
106
  options: options
94
107
  )
95
108
  operation = ::Gapic::Rest::TransportOperation.new response
96
109
  result = ::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration.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: "list_prediction_api_key_registrations",
131
146
  options: options
132
147
  )
133
148
  operation = ::Gapic::Rest::TransportOperation.new response
134
149
  result = ::Google::Cloud::RecommendationEngine::V1beta1::ListPredictionApiKeyRegistrationsResponse.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: "delete_prediction_api_key_registration",
169
186
  options: options
170
187
  )
171
188
  operation = ::Gapic::Rest::TransportOperation.new response
172
189
  result = ::Google::Protobuf::Empty.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
  ##
@@ -162,8 +162,28 @@ module Google
162
162
  universe_domain: @config.universe_domain,
163
163
  channel_args: @config.channel_args,
164
164
  interceptors: @config.interceptors,
165
- channel_pool_config: @config.channel_pool
165
+ channel_pool_config: @config.channel_pool,
166
+ logger: @config.logger
166
167
  )
168
+
169
+ @prediction_service_stub.stub_logger&.info do |entry|
170
+ entry.set_system_name
171
+ entry.set_service
172
+ entry.message = "Created client for #{entry.service}"
173
+ entry.set_credentials_fields credentials
174
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
175
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
176
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
177
+ end
178
+ end
179
+
180
+ ##
181
+ # The logger used for request/response debug logging.
182
+ #
183
+ # @return [Logger]
184
+ #
185
+ def logger
186
+ @prediction_service_stub.logger
167
187
  end
168
188
 
169
189
  # Service calls
@@ -343,7 +363,7 @@ module Google
343
363
  @prediction_service_stub.call_rpc :predict, request, options: options do |response, operation|
344
364
  response = ::Gapic::PagedEnumerable.new @prediction_service_stub, :predict, request, response, operation, options
345
365
  yield response, operation if block_given?
346
- return response
366
+ throw :response, response
347
367
  end
348
368
  rescue ::GRPC::BadStatus => e
349
369
  raise ::Google::Cloud::Error.from_error(e)
@@ -393,6 +413,13 @@ module Google
393
413
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
394
414
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
395
415
  # * (`nil`) indicating no credentials
416
+ #
417
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
418
+ # external source for authentication to Google Cloud, you must validate it before
419
+ # providing it to a Google API client library. Providing an unvalidated credential
420
+ # configuration to Google APIs can compromise the security of your systems and data.
421
+ # For more information, refer to [Validate credential configurations from external
422
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
396
423
  # @return [::Object]
397
424
  # @!attribute [rw] scope
398
425
  # The OAuth scopes
@@ -432,6 +459,11 @@ module Google
432
459
  # default endpoint URL. The default value of nil uses the environment
433
460
  # universe (usually the default "googleapis.com" universe).
434
461
  # @return [::String,nil]
462
+ # @!attribute [rw] logger
463
+ # A custom logger to use for request/response debug logging, or the value
464
+ # `:default` (the default) to construct a default logger, or `nil` to
465
+ # explicitly disable logging.
466
+ # @return [::Logger,:default,nil]
435
467
  #
436
468
  class Configuration
437
469
  extend ::Gapic::Config
@@ -456,6 +488,7 @@ module Google
456
488
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
457
489
  config_attr :quota_project, nil, ::String, nil
458
490
  config_attr :universe_domain, nil, ::String, nil
491
+ config_attr :logger, :default, ::Logger, nil, :default
459
492
 
460
493
  # @private
461
494
  def initialize parent_config = nil
@@ -155,8 +155,28 @@ module Google
155
155
  endpoint: @config.endpoint,
156
156
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
157
157
  universe_domain: @config.universe_domain,
158
- credentials: credentials
158
+ credentials: credentials,
159
+ logger: @config.logger
159
160
  )
161
+
162
+ @prediction_service_stub.logger(stub: true)&.info do |entry|
163
+ entry.set_system_name
164
+ entry.set_service
165
+ entry.message = "Created client for #{entry.service}"
166
+ entry.set_credentials_fields credentials
167
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
168
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
169
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
170
+ end
171
+ end
172
+
173
+ ##
174
+ # The logger used for request/response debug logging.
175
+ #
176
+ # @return [Logger]
177
+ #
178
+ def logger
179
+ @prediction_service_stub.logger
160
180
  end
161
181
 
162
182
  # Service calls
@@ -329,7 +349,7 @@ module Google
329
349
  @prediction_service_stub.predict request, options do |result, operation|
330
350
  result = ::Gapic::Rest::PagedEnumerable.new @prediction_service_stub, :predict, "metadata", request, result, options
331
351
  yield result, operation if block_given?
332
- return result
352
+ throw :response, result
333
353
  end
334
354
  rescue ::Gapic::Rest::Error => e
335
355
  raise ::Google::Cloud::Error.from_error(e)
@@ -377,6 +397,13 @@ module Google
377
397
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
378
398
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
379
399
  # * (`nil`) indicating no credentials
400
+ #
401
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
402
+ # external source for authentication to Google Cloud, you must validate it before
403
+ # providing it to a Google API client library. Providing an unvalidated credential
404
+ # configuration to Google APIs can compromise the security of your systems and data.
405
+ # For more information, refer to [Validate credential configurations from external
406
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
380
407
  # @return [::Object]
381
408
  # @!attribute [rw] scope
382
409
  # The OAuth scopes
@@ -409,6 +436,11 @@ module Google
409
436
  # default endpoint URL. The default value of nil uses the environment
410
437
  # universe (usually the default "googleapis.com" universe).
411
438
  # @return [::String,nil]
439
+ # @!attribute [rw] logger
440
+ # A custom logger to use for request/response debug logging, or the value
441
+ # `:default` (the default) to construct a default logger, or `nil` to
442
+ # explicitly disable logging.
443
+ # @return [::Logger,:default,nil]
412
444
  #
413
445
  class Configuration
414
446
  extend ::Gapic::Config
@@ -430,6 +462,7 @@ module Google
430
462
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
431
463
  config_attr :quota_project, nil, ::String, nil
432
464
  config_attr :universe_domain, nil, ::String, nil
465
+ config_attr :logger, :default, ::Logger, nil, :default
433
466
 
434
467
  # @private
435
468
  def initialize parent_config = nil