google-cloud-talent-v4beta1 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (24) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +30 -20
  3. data/lib/google/cloud/talent/v4beta1/company_service/client.rb +41 -11
  4. data/lib/google/cloud/talent/v4beta1/company_service/rest/client.rb +41 -11
  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 +32 -3
  7. data/lib/google/cloud/talent/v4beta1/completion/rest/client.rb +32 -3
  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 +32 -3
  10. data/lib/google/cloud/talent/v4beta1/event_service/rest/client.rb +32 -3
  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 +53 -21
  13. data/lib/google/cloud/talent/v4beta1/job_service/operations.rb +25 -20
  14. data/lib/google/cloud/talent/v4beta1/job_service/rest/client.rb +53 -21
  15. data/lib/google/cloud/talent/v4beta1/job_service/rest/operations.rb +54 -42
  16. data/lib/google/cloud/talent/v4beta1/job_service/rest/service_stub.rb +94 -62
  17. data/lib/google/cloud/talent/v4beta1/tenant_service/client.rb +41 -11
  18. data/lib/google/cloud/talent/v4beta1/tenant_service/rest/client.rb +41 -11
  19. data/lib/google/cloud/talent/v4beta1/tenant_service/rest/service_stub.rb +54 -32
  20. data/lib/google/cloud/talent/v4beta1/version.rb +1 -1
  21. data/proto_docs/google/api/client.rb +74 -10
  22. data/proto_docs/google/api/resource.rb +7 -2
  23. data/proto_docs/google/longrunning/operations.rb +19 -14
  24. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 282f005ae2114ef7c46ca9287291db3e1018dacb50a944509c7a9fd3bd15132a
4
- data.tar.gz: 0a33dae5f29eb4313c7eb425e00c987c29df2c93158fb9276d6e0ecc771469e8
3
+ metadata.gz: 410244d7b46c721e7ab75da1943984af3bd02c64d52fe2a0487a03a835f8b7c5
4
+ data.tar.gz: b8e9fd3430661a5f1318a3d735b942618c5e7b92446626ff337d6324729191fa
5
5
  SHA512:
6
- metadata.gz: cddddc05716fac49910260cfe6c690f9da07a114b5dc7dea64a6f7373398825d34e302b98199a24e1a6a1938ca660198118933de2aeb58fbe5d20de676104d86
7
- data.tar.gz: ecd076161b6ee153328959868bc795e99c57b159303d2d5b703f247c69a83d0693bea9fb0296b53f9b59d174e6a3f2cc11401c640658e7562061f0dc956d9729
6
+ metadata.gz: 8ac96e76fd02ce5ab9091e87bb84fd242004fd28ecc2bf93490733b754238a9a0253b1c4cd50140d2a95c3f97354de9bdf93e3560d53076053f89bba5d8ce97f
7
+ data.tar.gz: 56e3ce7ed41283d3149b9b0623fe6bb3d54cb3032fc4bcf0b8d19bb101a7040a53bacd53a6758a34ecdd5978663c227938bb349528269eb37394c5f3f41cbee2
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).
@@ -30,6 +30,9 @@ module Google
30
30
  # A service that handles company management, including CRUD and enumeration.
31
31
  #
32
32
  class Client
33
+ # @private
34
+ API_VERSION = ""
35
+
33
36
  # @private
34
37
  DEFAULT_ENDPOINT_TEMPLATE = "jobs.$UNIVERSE_DOMAIN$"
35
38
 
@@ -173,8 +176,28 @@ module Google
173
176
  universe_domain: @config.universe_domain,
174
177
  channel_args: @config.channel_args,
175
178
  interceptors: @config.interceptors,
176
- channel_pool_config: @config.channel_pool
179
+ channel_pool_config: @config.channel_pool,
180
+ logger: @config.logger
177
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
178
201
  end
179
202
 
180
203
  # Service calls
@@ -240,10 +263,11 @@ module Google
240
263
  # Customize the options with defaults
241
264
  metadata = @config.rpcs.create_company.metadata.to_h
242
265
 
243
- # Set x-goog-api-client and x-goog-user-project headers
266
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
244
267
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
245
268
  lib_name: @config.lib_name, lib_version: @config.lib_version,
246
269
  gapic_version: ::Google::Cloud::Talent::V4beta1::VERSION
270
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
247
271
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
248
272
 
249
273
  header_params = {}
@@ -264,7 +288,6 @@ module Google
264
288
 
265
289
  @company_service_stub.call_rpc :create_company, request, options: options do |response, operation|
266
290
  yield response, operation if block_given?
267
- return response
268
291
  end
269
292
  rescue ::GRPC::BadStatus => e
270
293
  raise ::Google::Cloud::Error.from_error(e)
@@ -332,10 +355,11 @@ module Google
332
355
  # Customize the options with defaults
333
356
  metadata = @config.rpcs.get_company.metadata.to_h
334
357
 
335
- # Set x-goog-api-client and x-goog-user-project headers
358
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
336
359
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
337
360
  lib_name: @config.lib_name, lib_version: @config.lib_version,
338
361
  gapic_version: ::Google::Cloud::Talent::V4beta1::VERSION
362
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
339
363
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
340
364
 
341
365
  header_params = {}
@@ -356,7 +380,6 @@ module Google
356
380
 
357
381
  @company_service_stub.call_rpc :get_company, request, options: options do |response, operation|
358
382
  yield response, operation if block_given?
359
- return response
360
383
  end
361
384
  rescue ::GRPC::BadStatus => e
362
385
  raise ::Google::Cloud::Error.from_error(e)
@@ -430,10 +453,11 @@ module Google
430
453
  # Customize the options with defaults
431
454
  metadata = @config.rpcs.update_company.metadata.to_h
432
455
 
433
- # Set x-goog-api-client and x-goog-user-project headers
456
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
434
457
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
435
458
  lib_name: @config.lib_name, lib_version: @config.lib_version,
436
459
  gapic_version: ::Google::Cloud::Talent::V4beta1::VERSION
460
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
437
461
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
438
462
 
439
463
  header_params = {}
@@ -454,7 +478,6 @@ module Google
454
478
 
455
479
  @company_service_stub.call_rpc :update_company, request, options: options do |response, operation|
456
480
  yield response, operation if block_given?
457
- return response
458
481
  end
459
482
  rescue ::GRPC::BadStatus => e
460
483
  raise ::Google::Cloud::Error.from_error(e)
@@ -523,10 +546,11 @@ module Google
523
546
  # Customize the options with defaults
524
547
  metadata = @config.rpcs.delete_company.metadata.to_h
525
548
 
526
- # Set x-goog-api-client and x-goog-user-project headers
549
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
527
550
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
528
551
  lib_name: @config.lib_name, lib_version: @config.lib_version,
529
552
  gapic_version: ::Google::Cloud::Talent::V4beta1::VERSION
553
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
530
554
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
531
555
 
532
556
  header_params = {}
@@ -547,7 +571,6 @@ module Google
547
571
 
548
572
  @company_service_stub.call_rpc :delete_company, request, options: options do |response, operation|
549
573
  yield response, operation if block_given?
550
- return response
551
574
  end
552
575
  rescue ::GRPC::BadStatus => e
553
576
  raise ::Google::Cloud::Error.from_error(e)
@@ -631,10 +654,11 @@ module Google
631
654
  # Customize the options with defaults
632
655
  metadata = @config.rpcs.list_companies.metadata.to_h
633
656
 
634
- # Set x-goog-api-client and x-goog-user-project headers
657
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
635
658
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
636
659
  lib_name: @config.lib_name, lib_version: @config.lib_version,
637
660
  gapic_version: ::Google::Cloud::Talent::V4beta1::VERSION
661
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
638
662
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
639
663
 
640
664
  header_params = {}
@@ -656,7 +680,7 @@ module Google
656
680
  @company_service_stub.call_rpc :list_companies, request, options: options do |response, operation|
657
681
  response = ::Gapic::PagedEnumerable.new @company_service_stub, :list_companies, request, response, operation, options
658
682
  yield response, operation if block_given?
659
- return response
683
+ throw :response, response
660
684
  end
661
685
  rescue ::GRPC::BadStatus => e
662
686
  raise ::Google::Cloud::Error.from_error(e)
@@ -745,6 +769,11 @@ module Google
745
769
  # default endpoint URL. The default value of nil uses the environment
746
770
  # universe (usually the default "googleapis.com" universe).
747
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]
748
777
  #
749
778
  class Configuration
750
779
  extend ::Gapic::Config
@@ -769,6 +798,7 @@ module Google
769
798
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
770
799
  config_attr :quota_project, nil, ::String, nil
771
800
  config_attr :universe_domain, nil, ::String, nil
801
+ config_attr :logger, :default, ::Logger, nil, :default
772
802
 
773
803
  # @private
774
804
  def initialize parent_config = nil
@@ -32,6 +32,9 @@ module Google
32
32
  # A service that handles company management, including CRUD and enumeration.
33
33
  #
34
34
  class Client
35
+ # @private
36
+ API_VERSION = ""
37
+
35
38
  # @private
36
39
  DEFAULT_ENDPOINT_TEMPLATE = "jobs.$UNIVERSE_DOMAIN$"
37
40
 
@@ -166,8 +169,28 @@ module Google
166
169
  endpoint: @config.endpoint,
167
170
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
168
171
  universe_domain: @config.universe_domain,
169
- credentials: credentials
172
+ credentials: credentials,
173
+ logger: @config.logger
170
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
171
194
  end
172
195
 
173
196
  # Service calls
@@ -232,12 +255,13 @@ module Google
232
255
  # Customize the options with defaults
233
256
  call_metadata = @config.rpcs.create_company.metadata.to_h
234
257
 
235
- # Set x-goog-api-client and x-goog-user-project headers
258
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
236
259
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
237
260
  lib_name: @config.lib_name, lib_version: @config.lib_version,
238
261
  gapic_version: ::Google::Cloud::Talent::V4beta1::VERSION,
239
262
  transports_version_send: [:rest]
240
263
 
264
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
241
265
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
242
266
 
243
267
  options.apply_defaults timeout: @config.rpcs.create_company.timeout,
@@ -250,7 +274,6 @@ module Google
250
274
 
251
275
  @company_service_stub.create_company request, options do |result, operation|
252
276
  yield result, operation if block_given?
253
- return result
254
277
  end
255
278
  rescue ::Gapic::Rest::Error => e
256
279
  raise ::Google::Cloud::Error.from_error(e)
@@ -317,12 +340,13 @@ module Google
317
340
  # Customize the options with defaults
318
341
  call_metadata = @config.rpcs.get_company.metadata.to_h
319
342
 
320
- # Set x-goog-api-client and x-goog-user-project headers
343
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
321
344
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
322
345
  lib_name: @config.lib_name, lib_version: @config.lib_version,
323
346
  gapic_version: ::Google::Cloud::Talent::V4beta1::VERSION,
324
347
  transports_version_send: [:rest]
325
348
 
349
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
326
350
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
327
351
 
328
352
  options.apply_defaults timeout: @config.rpcs.get_company.timeout,
@@ -335,7 +359,6 @@ module Google
335
359
 
336
360
  @company_service_stub.get_company request, options do |result, operation|
337
361
  yield result, operation if block_given?
338
- return result
339
362
  end
340
363
  rescue ::Gapic::Rest::Error => e
341
364
  raise ::Google::Cloud::Error.from_error(e)
@@ -408,12 +431,13 @@ module Google
408
431
  # Customize the options with defaults
409
432
  call_metadata = @config.rpcs.update_company.metadata.to_h
410
433
 
411
- # Set x-goog-api-client and x-goog-user-project headers
434
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
412
435
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
413
436
  lib_name: @config.lib_name, lib_version: @config.lib_version,
414
437
  gapic_version: ::Google::Cloud::Talent::V4beta1::VERSION,
415
438
  transports_version_send: [:rest]
416
439
 
440
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
417
441
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
418
442
 
419
443
  options.apply_defaults timeout: @config.rpcs.update_company.timeout,
@@ -426,7 +450,6 @@ module Google
426
450
 
427
451
  @company_service_stub.update_company request, options do |result, operation|
428
452
  yield result, operation if block_given?
429
- return result
430
453
  end
431
454
  rescue ::Gapic::Rest::Error => e
432
455
  raise ::Google::Cloud::Error.from_error(e)
@@ -494,12 +517,13 @@ module Google
494
517
  # Customize the options with defaults
495
518
  call_metadata = @config.rpcs.delete_company.metadata.to_h
496
519
 
497
- # Set x-goog-api-client and x-goog-user-project headers
520
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
498
521
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
499
522
  lib_name: @config.lib_name, lib_version: @config.lib_version,
500
523
  gapic_version: ::Google::Cloud::Talent::V4beta1::VERSION,
501
524
  transports_version_send: [:rest]
502
525
 
526
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
503
527
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
504
528
 
505
529
  options.apply_defaults timeout: @config.rpcs.delete_company.timeout,
@@ -512,7 +536,6 @@ module Google
512
536
 
513
537
  @company_service_stub.delete_company request, options do |result, operation|
514
538
  yield result, operation if block_given?
515
- return result
516
539
  end
517
540
  rescue ::Gapic::Rest::Error => e
518
541
  raise ::Google::Cloud::Error.from_error(e)
@@ -595,12 +618,13 @@ module Google
595
618
  # Customize the options with defaults
596
619
  call_metadata = @config.rpcs.list_companies.metadata.to_h
597
620
 
598
- # Set x-goog-api-client and x-goog-user-project headers
621
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
599
622
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
600
623
  lib_name: @config.lib_name, lib_version: @config.lib_version,
601
624
  gapic_version: ::Google::Cloud::Talent::V4beta1::VERSION,
602
625
  transports_version_send: [:rest]
603
626
 
627
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
604
628
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
605
629
 
606
630
  options.apply_defaults timeout: @config.rpcs.list_companies.timeout,
@@ -614,7 +638,7 @@ module Google
614
638
  @company_service_stub.list_companies request, options do |result, operation|
615
639
  result = ::Gapic::Rest::PagedEnumerable.new @company_service_stub, :list_companies, "companies", request, result, options
616
640
  yield result, operation if block_given?
617
- return result
641
+ throw :response, result
618
642
  end
619
643
  rescue ::Gapic::Rest::Error => e
620
644
  raise ::Google::Cloud::Error.from_error(e)
@@ -694,6 +718,11 @@ module Google
694
718
  # default endpoint URL. The default value of nil uses the environment
695
719
  # universe (usually the default "googleapis.com" universe).
696
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]
697
726
  #
698
727
  class Configuration
699
728
  extend ::Gapic::Config
@@ -715,6 +744,7 @@ module Google
715
744
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
716
745
  config_attr :quota_project, nil, ::String, nil
717
746
  config_attr :universe_domain, nil, ::String, nil
747
+ config_attr :logger, :default, ::Logger, nil, :default
718
748
 
719
749
  # @private
720
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
  ##
@@ -30,6 +30,9 @@ module Google
30
30
  # A service handles auto completion.
31
31
  #
32
32
  class Client
33
+ # @private
34
+ API_VERSION = ""
35
+
33
36
  # @private
34
37
  DEFAULT_ENDPOINT_TEMPLATE = "jobs.$UNIVERSE_DOMAIN$"
35
38
 
@@ -159,8 +162,28 @@ module Google
159
162
  universe_domain: @config.universe_domain,
160
163
  channel_args: @config.channel_args,
161
164
  interceptors: @config.interceptors,
162
- channel_pool_config: @config.channel_pool
165
+ channel_pool_config: @config.channel_pool,
166
+ logger: @config.logger
163
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
164
187
  end
165
188
 
166
189
  # Service calls
@@ -257,10 +280,11 @@ module Google
257
280
  # Customize the options with defaults
258
281
  metadata = @config.rpcs.complete_query.metadata.to_h
259
282
 
260
- # Set x-goog-api-client and x-goog-user-project headers
283
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
261
284
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
262
285
  lib_name: @config.lib_name, lib_version: @config.lib_version,
263
286
  gapic_version: ::Google::Cloud::Talent::V4beta1::VERSION
287
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
264
288
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
265
289
 
266
290
  header_params = {}
@@ -281,7 +305,6 @@ module Google
281
305
 
282
306
  @completion_stub.call_rpc :complete_query, request, options: options do |response, operation|
283
307
  yield response, operation if block_given?
284
- return response
285
308
  end
286
309
  rescue ::GRPC::BadStatus => e
287
310
  raise ::Google::Cloud::Error.from_error(e)
@@ -370,6 +393,11 @@ module Google
370
393
  # default endpoint URL. The default value of nil uses the environment
371
394
  # universe (usually the default "googleapis.com" universe).
372
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]
373
401
  #
374
402
  class Configuration
375
403
  extend ::Gapic::Config
@@ -394,6 +422,7 @@ module Google
394
422
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
395
423
  config_attr :quota_project, nil, ::String, nil
396
424
  config_attr :universe_domain, nil, ::String, nil
425
+ config_attr :logger, :default, ::Logger, nil, :default
397
426
 
398
427
  # @private
399
428
  def initialize parent_config = nil