google-cloud-talent-v4beta1 0.11.1 → 0.13.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 +30 -20
  3. data/lib/google/cloud/talent/v4beta1/company_service/client.rb +28 -6
  4. data/lib/google/cloud/talent/v4beta1/company_service/rest/client.rb +28 -6
  5. data/lib/google/cloud/talent/v4beta1/company_service/rest/service_stub.rb +54 -32
  6. data/lib/google/cloud/talent/v4beta1/completion/client.rb +27 -2
  7. data/lib/google/cloud/talent/v4beta1/completion/rest/client.rb +27 -2
  8. data/lib/google/cloud/talent/v4beta1/completion/rest/service_stub.rb +22 -8
  9. data/lib/google/cloud/talent/v4beta1/event_service/client.rb +27 -2
  10. data/lib/google/cloud/talent/v4beta1/event_service/rest/client.rb +27 -2
  11. data/lib/google/cloud/talent/v4beta1/event_service/rest/service_stub.rb +22 -8
  12. data/lib/google/cloud/talent/v4beta1/job_service/client.rb +44 -13
  13. data/lib/google/cloud/talent/v4beta1/job_service/operations.rb +12 -15
  14. data/lib/google/cloud/talent/v4beta1/job_service/rest/client.rb +44 -13
  15. data/lib/google/cloud/talent/v4beta1/job_service/rest/operations.rb +43 -38
  16. data/lib/google/cloud/talent/v4beta1/job_service/rest/service_stub.rb +94 -62
  17. data/lib/google/cloud/talent/v4beta1/job_service_pb.rb +2 -1
  18. data/lib/google/cloud/talent/v4beta1/tenant_service/client.rb +28 -6
  19. data/lib/google/cloud/talent/v4beta1/tenant_service/rest/client.rb +28 -6
  20. data/lib/google/cloud/talent/v4beta1/tenant_service/rest/service_stub.rb +54 -32
  21. data/lib/google/cloud/talent/v4beta1/version.rb +1 -1
  22. data/proto_docs/google/api/client.rb +39 -0
  23. data/proto_docs/google/cloud/talent/v4beta1/job_service.rb +28 -0
  24. data/proto_docs/google/longrunning/operations.rb +19 -14
  25. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cea876fa4a434f27414c144de8b78b7173b6bd297526914e1a2c6b3728558a09
4
- data.tar.gz: 1e35e2eefd16531e24e55c8855f529da201496c976cc749dcaac1c5196184579
3
+ metadata.gz: aa809d5f9a92f2e99bde45f48a0228899f30526fe45621fd32b3b557099ff225
4
+ data.tar.gz: 3c717d70f8f450d0fb4af91e633d95fe7ef42f8f28e3a85eb90f9eb864cabc33
5
5
  SHA512:
6
- metadata.gz: 41cf5cc8954160da520e343e29f273146fcb8526e9f6dc66dfc696b561616d8abb991a8f457b0c81218965b58da5634b16bbff815a1840e74721efec930dcd1b
7
- data.tar.gz: 6d0fbea1749663b2c502254828b88e919fca8f623d3b57ce51d74a63779f79618a23a0b11508c0270173dc2f0d5ec1fa456d1a941b49daa3dfc319ca07096ae9
6
+ metadata.gz: 45208aacedf4bb78f4157df2c71c6345d4dafe5fe40b769f5d2f1ac2667f0d759f846f7948a08dcc518a9dc4c94cbcef53c71e76d8d0f846ef0b6badb13cf9a7
7
+ data.tar.gz: '08d3e29ea7c9deccf8052e2cc12f65efecd83cd336e0c118ba0db858956302f095eac92b51dca2650677243063b9d8d7839953cd541fa1a1e6c64cd364db0997'
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/v4beta1"
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::V4beta1::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
@@ -268,7 +288,6 @@ module Google
268
288
 
269
289
  @company_service_stub.call_rpc :create_company, request, options: options do |response, operation|
270
290
  yield response, operation if block_given?
271
- return response
272
291
  end
273
292
  rescue ::GRPC::BadStatus => e
274
293
  raise ::Google::Cloud::Error.from_error(e)
@@ -361,7 +380,6 @@ module Google
361
380
 
362
381
  @company_service_stub.call_rpc :get_company, request, options: options do |response, operation|
363
382
  yield response, operation if block_given?
364
- return response
365
383
  end
366
384
  rescue ::GRPC::BadStatus => e
367
385
  raise ::Google::Cloud::Error.from_error(e)
@@ -460,7 +478,6 @@ module Google
460
478
 
461
479
  @company_service_stub.call_rpc :update_company, request, options: options do |response, operation|
462
480
  yield response, operation if block_given?
463
- return response
464
481
  end
465
482
  rescue ::GRPC::BadStatus => e
466
483
  raise ::Google::Cloud::Error.from_error(e)
@@ -554,7 +571,6 @@ module Google
554
571
 
555
572
  @company_service_stub.call_rpc :delete_company, request, options: options do |response, operation|
556
573
  yield response, operation if block_given?
557
- return response
558
574
  end
559
575
  rescue ::GRPC::BadStatus => e
560
576
  raise ::Google::Cloud::Error.from_error(e)
@@ -664,7 +680,7 @@ module Google
664
680
  @company_service_stub.call_rpc :list_companies, request, options: options do |response, operation|
665
681
  response = ::Gapic::PagedEnumerable.new @company_service_stub, :list_companies, request, response, operation, options
666
682
  yield response, operation if block_given?
667
- return response
683
+ throw :response, response
668
684
  end
669
685
  rescue ::GRPC::BadStatus => e
670
686
  raise ::Google::Cloud::Error.from_error(e)
@@ -753,6 +769,11 @@ module Google
753
769
  # default endpoint URL. The default value of nil uses the environment
754
770
  # universe (usually the default "googleapis.com" universe).
755
771
  # @return [::String,nil]
772
+ # @!attribute [rw] logger
773
+ # A custom logger to use for request/response debug logging, or the value
774
+ # `:default` (the default) to construct a default logger, or `nil` to
775
+ # explicitly disable logging.
776
+ # @return [::Logger,:default,nil]
756
777
  #
757
778
  class Configuration
758
779
  extend ::Gapic::Config
@@ -777,6 +798,7 @@ module Google
777
798
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
778
799
  config_attr :quota_project, nil, ::String, nil
779
800
  config_attr :universe_domain, nil, ::String, nil
801
+ config_attr :logger, :default, ::Logger, nil, :default
780
802
 
781
803
  # @private
782
804
  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
@@ -254,7 +274,6 @@ module Google
254
274
 
255
275
  @company_service_stub.create_company request, options do |result, operation|
256
276
  yield result, operation if block_given?
257
- return result
258
277
  end
259
278
  rescue ::Gapic::Rest::Error => e
260
279
  raise ::Google::Cloud::Error.from_error(e)
@@ -340,7 +359,6 @@ module Google
340
359
 
341
360
  @company_service_stub.get_company request, options do |result, operation|
342
361
  yield result, operation if block_given?
343
- return result
344
362
  end
345
363
  rescue ::Gapic::Rest::Error => e
346
364
  raise ::Google::Cloud::Error.from_error(e)
@@ -432,7 +450,6 @@ module Google
432
450
 
433
451
  @company_service_stub.update_company request, options do |result, operation|
434
452
  yield result, operation if block_given?
435
- return result
436
453
  end
437
454
  rescue ::Gapic::Rest::Error => e
438
455
  raise ::Google::Cloud::Error.from_error(e)
@@ -519,7 +536,6 @@ module Google
519
536
 
520
537
  @company_service_stub.delete_company request, options do |result, operation|
521
538
  yield result, operation if block_given?
522
- return result
523
539
  end
524
540
  rescue ::Gapic::Rest::Error => e
525
541
  raise ::Google::Cloud::Error.from_error(e)
@@ -622,7 +638,7 @@ module Google
622
638
  @company_service_stub.list_companies request, options do |result, operation|
623
639
  result = ::Gapic::Rest::PagedEnumerable.new @company_service_stub, :list_companies, "companies", request, result, options
624
640
  yield result, operation if block_given?
625
- return result
641
+ throw :response, result
626
642
  end
627
643
  rescue ::Gapic::Rest::Error => e
628
644
  raise ::Google::Cloud::Error.from_error(e)
@@ -702,6 +718,11 @@ module Google
702
718
  # default endpoint URL. The default value of nil uses the environment
703
719
  # universe (usually the default "googleapis.com" universe).
704
720
  # @return [::String,nil]
721
+ # @!attribute [rw] logger
722
+ # A custom logger to use for request/response debug logging, or the value
723
+ # `:default` (the default) to construct a default logger, or `nil` to
724
+ # explicitly disable logging.
725
+ # @return [::Logger,:default,nil]
705
726
  #
706
727
  class Configuration
707
728
  extend ::Gapic::Config
@@ -723,6 +744,7 @@ module Google
723
744
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
724
745
  config_attr :quota_project, nil, ::String, nil
725
746
  config_attr :universe_domain, nil, ::String, nil
747
+ config_attr :logger, :default, ::Logger, nil, :default
726
748
 
727
749
  # @private
728
750
  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::V4beta1::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::V4beta1::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::V4beta1::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::V4beta1::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
@@ -285,7 +305,6 @@ module Google
285
305
 
286
306
  @completion_stub.call_rpc :complete_query, request, options: options do |response, operation|
287
307
  yield response, operation if block_given?
288
- return response
289
308
  end
290
309
  rescue ::GRPC::BadStatus => e
291
310
  raise ::Google::Cloud::Error.from_error(e)
@@ -374,6 +393,11 @@ module Google
374
393
  # default endpoint URL. The default value of nil uses the environment
375
394
  # universe (usually the default "googleapis.com" universe).
376
395
  # @return [::String,nil]
396
+ # @!attribute [rw] logger
397
+ # A custom logger to use for request/response debug logging, or the value
398
+ # `:default` (the default) to construct a default logger, or `nil` to
399
+ # explicitly disable logging.
400
+ # @return [::Logger,:default,nil]
377
401
  #
378
402
  class Configuration
379
403
  extend ::Gapic::Config
@@ -398,6 +422,7 @@ module Google
398
422
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
399
423
  config_attr :quota_project, nil, ::String, nil
400
424
  config_attr :universe_domain, nil, ::String, nil
425
+ config_attr :logger, :default, ::Logger, nil, :default
401
426
 
402
427
  # @private
403
428
  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
@@ -271,7 +291,6 @@ module Google
271
291
 
272
292
  @completion_stub.complete_query request, options do |result, operation|
273
293
  yield result, operation if block_given?
274
- return result
275
294
  end
276
295
  rescue ::Gapic::Rest::Error => e
277
296
  raise ::Google::Cloud::Error.from_error(e)
@@ -351,6 +370,11 @@ module Google
351
370
  # default endpoint URL. The default value of nil uses the environment
352
371
  # universe (usually the default "googleapis.com" universe).
353
372
  # @return [::String,nil]
373
+ # @!attribute [rw] logger
374
+ # A custom logger to use for request/response debug logging, or the value
375
+ # `:default` (the default) to construct a default logger, or `nil` to
376
+ # explicitly disable logging.
377
+ # @return [::Logger,:default,nil]
354
378
  #
355
379
  class Configuration
356
380
  extend ::Gapic::Config
@@ -372,6 +396,7 @@ module Google
372
396
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
373
397
  config_attr :quota_project, nil, ::String, nil
374
398
  config_attr :universe_domain, nil, ::String, nil
399
+ config_attr :logger, :default, ::Logger, nil, :default
375
400
 
376
401
  # @private
377
402
  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::V4beta1::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
@@ -258,7 +278,6 @@ module Google
258
278
 
259
279
  @event_service_stub.call_rpc :create_client_event, request, options: options do |response, operation|
260
280
  yield response, operation if block_given?
261
- return response
262
281
  end
263
282
  rescue ::GRPC::BadStatus => e
264
283
  raise ::Google::Cloud::Error.from_error(e)
@@ -347,6 +366,11 @@ module Google
347
366
  # default endpoint URL. The default value of nil uses the environment
348
367
  # universe (usually the default "googleapis.com" universe).
349
368
  # @return [::String,nil]
369
+ # @!attribute [rw] logger
370
+ # A custom logger to use for request/response debug logging, or the value
371
+ # `:default` (the default) to construct a default logger, or `nil` to
372
+ # explicitly disable logging.
373
+ # @return [::Logger,:default,nil]
350
374
  #
351
375
  class Configuration
352
376
  extend ::Gapic::Config
@@ -371,6 +395,7 @@ module Google
371
395
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
372
396
  config_attr :quota_project, nil, ::String, nil
373
397
  config_attr :universe_domain, nil, ::String, nil
398
+ config_attr :logger, :default, ::Logger, nil, :default
374
399
 
375
400
  # @private
376
401
  def initialize parent_config = nil