google-cloud-talent-v4 1.0.1 → 1.2.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 (27) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +30 -20
  3. data/lib/google/cloud/talent/v4/company_service/client.rb +28 -6
  4. data/lib/google/cloud/talent/v4/company_service/rest/client.rb +28 -6
  5. data/lib/google/cloud/talent/v4/company_service/rest/service_stub.rb +54 -32
  6. data/lib/google/cloud/talent/v4/completion/client.rb +27 -2
  7. data/lib/google/cloud/talent/v4/completion/rest/client.rb +27 -2
  8. data/lib/google/cloud/talent/v4/completion/rest/service_stub.rb +22 -8
  9. data/lib/google/cloud/talent/v4/event_service/client.rb +27 -2
  10. data/lib/google/cloud/talent/v4/event_service/rest/client.rb +27 -2
  11. data/lib/google/cloud/talent/v4/event_service/rest/service_stub.rb +22 -8
  12. data/lib/google/cloud/talent/v4/job_service/client.rb +46 -14
  13. data/lib/google/cloud/talent/v4/job_service/operations.rb +12 -15
  14. data/lib/google/cloud/talent/v4/job_service/rest/client.rb +46 -14
  15. data/lib/google/cloud/talent/v4/job_service/rest/operations.rb +43 -38
  16. data/lib/google/cloud/talent/v4/job_service/rest/service_stub.rb +94 -62
  17. data/lib/google/cloud/talent/v4/job_service_pb.rb +2 -1
  18. data/lib/google/cloud/talent/v4/tenant_service/client.rb +28 -6
  19. data/lib/google/cloud/talent/v4/tenant_service/rest/client.rb +28 -6
  20. data/lib/google/cloud/talent/v4/tenant_service/rest/service_stub.rb +54 -32
  21. data/lib/google/cloud/talent/v4/version.rb +1 -1
  22. data/proto_docs/google/api/client.rb +39 -0
  23. data/proto_docs/google/cloud/talent/v4/filters.rb +2 -1
  24. data/proto_docs/google/cloud/talent/v4/job.rb +15 -11
  25. data/proto_docs/google/cloud/talent/v4/job_service.rb +29 -1
  26. data/proto_docs/google/longrunning/operations.rb +19 -14
  27. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 07b15f5999a4c2b69de89eba9034b83047aabe221a87cd2496bb7d7d7b622e17
4
- data.tar.gz: 61eb31909706e5dfc414ffe525b5ad1a2fdf8bcd01e991f87d80a19471c5799b
3
+ metadata.gz: f416bb0c8f41336f79801c7fce3159b2ea044c1a7e4709c28674ad96fb370510
4
+ data.tar.gz: c691a3fd0e2ac2456fab8470d56236456bd9e046fbff2af35dcaaaa38477d49f
5
5
  SHA512:
6
- metadata.gz: 82d0904e2cd743ecfed3fca56a0e31889935a57079d471eebdfc71aaad2a12ee0cca7d5de84451220610f2a44bc30f04d0f6bba6770dcc4abe1481cfa4dada5e
7
- data.tar.gz: 5ae6924a37291e4cd367d40725c0b7ad1be5d3eb5fdae0f2d87437fe0ffa6089747d1e40e2b31ec3d39a6277e760f86684fd40c95a97c1a0c533f4800ba2a9ae
6
+ metadata.gz: 04d05efcb6c898976a60e9fdaee573a52e9536ec5e4fcff40f0c31ff5cd4514ce4210f5d587712a4d69f6361416a54c8976a399991d01daec95c73e984c74993
7
+ data.tar.gz: 30130f6777f1a9a19d1ea2f94b9420d93c03ea88e45a6a4481428c628fb92ea5e8295ed12c4008070019f7435828b26ae6423561ce90315d13ddcfceb0118c5f
data/README.md CHANGED
@@ -43,33 +43,43 @@ for class and method documentation.
43
43
  See also the [Product Documentation](https://cloud.google.com/solutions/talent-solution)
44
44
  for general usage information.
45
45
 
46
- ## Enabling Logging
47
-
48
- To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
49
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
50
- or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
51
- that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
52
- and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
53
-
54
- Configuring a Ruby stdlib logger:
46
+ ## Debug Logging
47
+
48
+ This library comes with opt-in Debug Logging that can help you troubleshoot
49
+ your application's integration with the API. When logging is activated, key
50
+ events such as requests and responses, along with data payloads and metadata
51
+ such as headers and client configuration, are logged to the standard error
52
+ stream.
53
+
54
+ **WARNING:** Client Library Debug Logging includes your data payloads in
55
+ plaintext, which could include sensitive data such as PII for yourself or your
56
+ customers, private keys, or other security data that could be compromising if
57
+ leaked. Always practice good data hygiene with your application logs, and follow
58
+ the principle of least access. Google also recommends that Client Library Debug
59
+ Logging be enabled only temporarily during active debugging, and not used
60
+ permanently in production.
61
+
62
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
63
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
64
+ list of client library gem names. This will select the default logging behavior,
65
+ which writes logs to the standard error stream. On a local workstation, this may
66
+ result in logs appearing on the console. When running on a Google Cloud hosting
67
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
68
+ results in logs appearing alongside your application logs in the
69
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
70
+
71
+ You can customize logging by modifying the `logger` configuration when
72
+ constructing a client object. For example:
55
73
 
56
74
  ```ruby
75
+ require "google/cloud/talent/v4"
57
76
  require "logger"
58
77
 
59
- module MyLogger
60
- LOGGER = Logger.new $stderr, level: Logger::WARN
61
- def logger
62
- LOGGER
63
- end
64
- end
65
-
66
- # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
67
- module GRPC
68
- extend MyLogger
78
+ client = ::Google::Cloud::Talent::V4::CompanyService::Client.new do |config|
79
+ config.logger = Logger.new "my-app.log"
69
80
  end
70
81
  ```
71
82
 
72
-
73
83
  ## Google Cloud Samples
74
84
 
75
85
  To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
@@ -176,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
+ @company_service_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
+ @company_service_stub.logger
181
201
  end
182
202
 
183
203
  # Service calls
@@ -267,7 +287,6 @@ module Google
267
287
 
268
288
  @company_service_stub.call_rpc :create_company, request, options: options do |response, operation|
269
289
  yield response, operation if block_given?
270
- return response
271
290
  end
272
291
  rescue ::GRPC::BadStatus => e
273
292
  raise ::Google::Cloud::Error.from_error(e)
@@ -357,7 +376,6 @@ module Google
357
376
 
358
377
  @company_service_stub.call_rpc :get_company, request, options: options do |response, operation|
359
378
  yield response, operation if block_given?
360
- return response
361
379
  end
362
380
  rescue ::GRPC::BadStatus => e
363
381
  raise ::Google::Cloud::Error.from_error(e)
@@ -455,7 +473,6 @@ module Google
455
473
 
456
474
  @company_service_stub.call_rpc :update_company, request, options: options do |response, operation|
457
475
  yield response, operation if block_given?
458
- return response
459
476
  end
460
477
  rescue ::GRPC::BadStatus => e
461
478
  raise ::Google::Cloud::Error.from_error(e)
@@ -546,7 +563,6 @@ module Google
546
563
 
547
564
  @company_service_stub.call_rpc :delete_company, request, options: options do |response, operation|
548
565
  yield response, operation if block_given?
549
- return response
550
566
  end
551
567
  rescue ::GRPC::BadStatus => e
552
568
  raise ::Google::Cloud::Error.from_error(e)
@@ -653,7 +669,7 @@ module Google
653
669
  @company_service_stub.call_rpc :list_companies, request, options: options do |response, operation|
654
670
  response = ::Gapic::PagedEnumerable.new @company_service_stub, :list_companies, request, response, operation, options
655
671
  yield response, operation if block_given?
656
- return response
672
+ throw :response, response
657
673
  end
658
674
  rescue ::GRPC::BadStatus => e
659
675
  raise ::Google::Cloud::Error.from_error(e)
@@ -742,6 +758,11 @@ module Google
742
758
  # default endpoint URL. The default value of nil uses the environment
743
759
  # universe (usually the default "googleapis.com" universe).
744
760
  # @return [::String,nil]
761
+ # @!attribute [rw] logger
762
+ # A custom logger to use for request/response debug logging, or the value
763
+ # `:default` (the default) to construct a default logger, or `nil` to
764
+ # explicitly disable logging.
765
+ # @return [::Logger,:default,nil]
745
766
  #
746
767
  class Configuration
747
768
  extend ::Gapic::Config
@@ -766,6 +787,7 @@ module Google
766
787
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
767
788
  config_attr :quota_project, nil, ::String, nil
768
789
  config_attr :universe_domain, nil, ::String, nil
790
+ config_attr :logger, :default, ::Logger, nil, :default
769
791
 
770
792
  # @private
771
793
  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
+ @company_service_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
+ @company_service_stub.logger
174
194
  end
175
195
 
176
196
  # Service calls
@@ -253,7 +273,6 @@ module Google
253
273
 
254
274
  @company_service_stub.create_company request, options do |result, operation|
255
275
  yield result, operation if block_given?
256
- return result
257
276
  end
258
277
  rescue ::Gapic::Rest::Error => e
259
278
  raise ::Google::Cloud::Error.from_error(e)
@@ -336,7 +355,6 @@ module Google
336
355
 
337
356
  @company_service_stub.get_company request, options do |result, operation|
338
357
  yield result, operation if block_given?
339
- return result
340
358
  end
341
359
  rescue ::Gapic::Rest::Error => e
342
360
  raise ::Google::Cloud::Error.from_error(e)
@@ -427,7 +445,6 @@ module Google
427
445
 
428
446
  @company_service_stub.update_company request, options do |result, operation|
429
447
  yield result, operation if block_given?
430
- return result
431
448
  end
432
449
  rescue ::Gapic::Rest::Error => e
433
450
  raise ::Google::Cloud::Error.from_error(e)
@@ -511,7 +528,6 @@ module Google
511
528
 
512
529
  @company_service_stub.delete_company request, options do |result, operation|
513
530
  yield result, operation if block_given?
514
- return result
515
531
  end
516
532
  rescue ::Gapic::Rest::Error => e
517
533
  raise ::Google::Cloud::Error.from_error(e)
@@ -611,7 +627,7 @@ module Google
611
627
  @company_service_stub.list_companies request, options do |result, operation|
612
628
  result = ::Gapic::Rest::PagedEnumerable.new @company_service_stub, :list_companies, "companies", request, result, options
613
629
  yield result, operation if block_given?
614
- return result
630
+ throw :response, result
615
631
  end
616
632
  rescue ::Gapic::Rest::Error => e
617
633
  raise ::Google::Cloud::Error.from_error(e)
@@ -691,6 +707,11 @@ module Google
691
707
  # default endpoint URL. The default value of nil uses the environment
692
708
  # universe (usually the default "googleapis.com" universe).
693
709
  # @return [::String,nil]
710
+ # @!attribute [rw] logger
711
+ # A custom logger to use for request/response debug logging, or the value
712
+ # `:default` (the default) to construct a default logger, or `nil` to
713
+ # explicitly disable logging.
714
+ # @return [::Logger,:default,nil]
694
715
  #
695
716
  class Configuration
696
717
  extend ::Gapic::Config
@@ -712,6 +733,7 @@ module Google
712
733
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
713
734
  config_attr :quota_project, nil, ::String, nil
714
735
  config_attr :universe_domain, nil, ::String, nil
736
+ config_attr :logger, :default, ::Logger, nil, :default
715
737
 
716
738
  # @private
717
739
  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_company 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_company",
93
106
  options: options
94
107
  )
95
108
  operation = ::Gapic::Rest::TransportOperation.new response
96
109
  result = ::Google::Cloud::Talent::V4::Company.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_company",
131
146
  options: options
132
147
  )
133
148
  operation = ::Gapic::Rest::TransportOperation.new response
134
149
  result = ::Google::Cloud::Talent::V4::Company.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_company",
169
186
  options: options
170
187
  )
171
188
  operation = ::Gapic::Rest::TransportOperation.new response
172
189
  result = ::Google::Cloud::Talent::V4::Company.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: "delete_company",
207
226
  options: options
208
227
  )
209
228
  operation = ::Gapic::Rest::TransportOperation.new response
210
229
  result = ::Google::Protobuf::Empty.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_companies",
245
266
  options: options
246
267
  )
247
268
  operation = ::Gapic::Rest::TransportOperation.new response
248
269
  result = ::Google::Cloud::Talent::V4::ListCompaniesResponse.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
  ##
@@ -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
+ @completion_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
+ @completion_stub.logger
167
187
  end
168
188
 
169
189
  # Service calls
@@ -279,7 +299,6 @@ module Google
279
299
 
280
300
  @completion_stub.call_rpc :complete_query, request, options: options do |response, operation|
281
301
  yield response, operation if block_given?
282
- return response
283
302
  end
284
303
  rescue ::GRPC::BadStatus => e
285
304
  raise ::Google::Cloud::Error.from_error(e)
@@ -368,6 +387,11 @@ module Google
368
387
  # default endpoint URL. The default value of nil uses the environment
369
388
  # universe (usually the default "googleapis.com" universe).
370
389
  # @return [::String,nil]
390
+ # @!attribute [rw] logger
391
+ # A custom logger to use for request/response debug logging, or the value
392
+ # `:default` (the default) to construct a default logger, or `nil` to
393
+ # explicitly disable logging.
394
+ # @return [::Logger,:default,nil]
371
395
  #
372
396
  class Configuration
373
397
  extend ::Gapic::Config
@@ -392,6 +416,7 @@ module Google
392
416
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
393
417
  config_attr :quota_project, nil, ::String, nil
394
418
  config_attr :universe_domain, nil, ::String, nil
419
+ config_attr :logger, :default, ::Logger, nil, :default
395
420
 
396
421
  # @private
397
422
  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
+ @completion_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
+ @completion_stub.logger
160
180
  end
161
181
 
162
182
  # Service calls
@@ -265,7 +285,6 @@ module Google
265
285
 
266
286
  @completion_stub.complete_query request, options do |result, operation|
267
287
  yield result, operation if block_given?
268
- return result
269
288
  end
270
289
  rescue ::Gapic::Rest::Error => e
271
290
  raise ::Google::Cloud::Error.from_error(e)
@@ -345,6 +364,11 @@ module Google
345
364
  # default endpoint URL. The default value of nil uses the environment
346
365
  # universe (usually the default "googleapis.com" universe).
347
366
  # @return [::String,nil]
367
+ # @!attribute [rw] logger
368
+ # A custom logger to use for request/response debug logging, or the value
369
+ # `:default` (the default) to construct a default logger, or `nil` to
370
+ # explicitly disable logging.
371
+ # @return [::Logger,:default,nil]
348
372
  #
349
373
  class Configuration
350
374
  extend ::Gapic::Config
@@ -366,6 +390,7 @@ module Google
366
390
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
367
391
  config_attr :quota_project, nil, ::String, nil
368
392
  config_attr :universe_domain, nil, ::String, nil
393
+ config_attr :logger, :default, ::Logger, nil, :default
369
394
 
370
395
  # @private
371
396
  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 complete_query 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: "complete_query",
93
106
  options: options
94
107
  )
95
108
  operation = ::Gapic::Rest::TransportOperation.new response
96
109
  result = ::Google::Cloud::Talent::V4::CompleteQueryResponse.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
  ##
@@ -159,8 +159,28 @@ module Google
159
159
  universe_domain: @config.universe_domain,
160
160
  channel_args: @config.channel_args,
161
161
  interceptors: @config.interceptors,
162
- channel_pool_config: @config.channel_pool
162
+ channel_pool_config: @config.channel_pool,
163
+ logger: @config.logger
163
164
  )
165
+
166
+ @event_service_stub.stub_logger&.info do |entry|
167
+ entry.set_system_name
168
+ entry.set_service
169
+ entry.message = "Created client for #{entry.service}"
170
+ entry.set_credentials_fields credentials
171
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
172
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
173
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
174
+ end
175
+ end
176
+
177
+ ##
178
+ # The logger used for request/response debug logging.
179
+ #
180
+ # @return [Logger]
181
+ #
182
+ def logger
183
+ @event_service_stub.logger
164
184
  end
165
185
 
166
186
  # Service calls
@@ -257,7 +277,6 @@ module Google
257
277
 
258
278
  @event_service_stub.call_rpc :create_client_event, request, options: options do |response, operation|
259
279
  yield response, operation if block_given?
260
- return response
261
280
  end
262
281
  rescue ::GRPC::BadStatus => e
263
282
  raise ::Google::Cloud::Error.from_error(e)
@@ -346,6 +365,11 @@ module Google
346
365
  # default endpoint URL. The default value of nil uses the environment
347
366
  # universe (usually the default "googleapis.com" universe).
348
367
  # @return [::String,nil]
368
+ # @!attribute [rw] logger
369
+ # A custom logger to use for request/response debug logging, or the value
370
+ # `:default` (the default) to construct a default logger, or `nil` to
371
+ # explicitly disable logging.
372
+ # @return [::Logger,:default,nil]
349
373
  #
350
374
  class Configuration
351
375
  extend ::Gapic::Config
@@ -370,6 +394,7 @@ module Google
370
394
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
371
395
  config_attr :quota_project, nil, ::String, nil
372
396
  config_attr :universe_domain, nil, ::String, nil
397
+ config_attr :logger, :default, ::Logger, nil, :default
373
398
 
374
399
  # @private
375
400
  def initialize parent_config = nil