google-cloud-talent-v4beta1 0.11.1 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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_job 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_job",
93
106
  options: options
94
107
  )
95
108
  operation = ::Gapic::Rest::TransportOperation.new response
96
109
  result = ::Google::Cloud::Talent::V4beta1::Job.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: "batch_create_jobs",
131
146
  options: options
132
147
  )
133
148
  operation = ::Gapic::Rest::TransportOperation.new response
134
149
  result = ::Google::Longrunning::Operation.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: "get_job",
169
186
  options: options
170
187
  )
171
188
  operation = ::Gapic::Rest::TransportOperation.new response
172
189
  result = ::Google::Cloud::Talent::V4beta1::Job.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_job",
207
226
  options: options
208
227
  )
209
228
  operation = ::Gapic::Rest::TransportOperation.new response
210
229
  result = ::Google::Cloud::Talent::V4beta1::Job.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: "batch_update_jobs",
245
266
  options: options
246
267
  )
247
268
  operation = ::Gapic::Rest::TransportOperation.new response
248
269
  result = ::Google::Longrunning::Operation.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: "delete_job",
283
306
  options: options
284
307
  )
285
308
  operation = ::Gapic::Rest::TransportOperation.new response
286
309
  result = ::Google::Protobuf::Empty.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
  ##
@@ -315,16 +339,18 @@ module Google
315
339
 
316
340
  response = @client_stub.make_http_request(
317
341
  verb,
318
- uri: uri,
319
- body: body || "",
320
- params: query_string_params,
342
+ uri: uri,
343
+ body: body || "",
344
+ params: query_string_params,
345
+ method_name: "batch_delete_jobs",
321
346
  options: options
322
347
  )
323
348
  operation = ::Gapic::Rest::TransportOperation.new response
324
349
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
325
-
326
- yield result, operation if block_given?
327
- result
350
+ catch :response do
351
+ yield result, operation if block_given?
352
+ result
353
+ end
328
354
  end
329
355
 
330
356
  ##
@@ -353,16 +379,18 @@ module Google
353
379
 
354
380
  response = @client_stub.make_http_request(
355
381
  verb,
356
- uri: uri,
357
- body: body || "",
358
- params: query_string_params,
382
+ uri: uri,
383
+ body: body || "",
384
+ params: query_string_params,
385
+ method_name: "list_jobs",
359
386
  options: options
360
387
  )
361
388
  operation = ::Gapic::Rest::TransportOperation.new response
362
389
  result = ::Google::Cloud::Talent::V4beta1::ListJobsResponse.decode_json response.body, ignore_unknown_fields: true
363
-
364
- yield result, operation if block_given?
365
- result
390
+ catch :response do
391
+ yield result, operation if block_given?
392
+ result
393
+ end
366
394
  end
367
395
 
368
396
  ##
@@ -391,16 +419,18 @@ module Google
391
419
 
392
420
  response = @client_stub.make_http_request(
393
421
  verb,
394
- uri: uri,
395
- body: body || "",
396
- params: query_string_params,
422
+ uri: uri,
423
+ body: body || "",
424
+ params: query_string_params,
425
+ method_name: "search_jobs",
397
426
  options: options
398
427
  )
399
428
  operation = ::Gapic::Rest::TransportOperation.new response
400
429
  result = ::Google::Cloud::Talent::V4beta1::SearchJobsResponse.decode_json response.body, ignore_unknown_fields: true
401
-
402
- yield result, operation if block_given?
403
- result
430
+ catch :response do
431
+ yield result, operation if block_given?
432
+ result
433
+ end
404
434
  end
405
435
 
406
436
  ##
@@ -429,16 +459,18 @@ module Google
429
459
 
430
460
  response = @client_stub.make_http_request(
431
461
  verb,
432
- uri: uri,
433
- body: body || "",
434
- params: query_string_params,
462
+ uri: uri,
463
+ body: body || "",
464
+ params: query_string_params,
465
+ method_name: "search_jobs_for_alert",
435
466
  options: options
436
467
  )
437
468
  operation = ::Gapic::Rest::TransportOperation.new response
438
469
  result = ::Google::Cloud::Talent::V4beta1::SearchJobsResponse.decode_json response.body, ignore_unknown_fields: true
439
-
440
- yield result, operation if block_given?
441
- result
470
+ catch :response do
471
+ yield result, operation if block_given?
472
+ result
473
+ end
442
474
  end
443
475
 
444
476
  ##
@@ -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
+ @tenant_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
+ @tenant_service_stub.logger
181
201
  end
182
202
 
183
203
  # Service calls
@@ -267,7 +287,6 @@ module Google
267
287
 
268
288
  @tenant_service_stub.call_rpc :create_tenant, 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)
@@ -356,7 +375,6 @@ module Google
356
375
 
357
376
  @tenant_service_stub.call_rpc :get_tenant, request, options: options do |response, operation|
358
377
  yield response, operation if block_given?
359
- return response
360
378
  end
361
379
  rescue ::GRPC::BadStatus => e
362
380
  raise ::Google::Cloud::Error.from_error(e)
@@ -455,7 +473,6 @@ module Google
455
473
 
456
474
  @tenant_service_stub.call_rpc :update_tenant, 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)
@@ -544,7 +561,6 @@ module Google
544
561
 
545
562
  @tenant_service_stub.call_rpc :delete_tenant, request, options: options do |response, operation|
546
563
  yield response, operation if block_given?
547
- return response
548
564
  end
549
565
  rescue ::GRPC::BadStatus => e
550
566
  raise ::Google::Cloud::Error.from_error(e)
@@ -643,7 +659,7 @@ module Google
643
659
  @tenant_service_stub.call_rpc :list_tenants, request, options: options do |response, operation|
644
660
  response = ::Gapic::PagedEnumerable.new @tenant_service_stub, :list_tenants, request, response, operation, options
645
661
  yield response, operation if block_given?
646
- return response
662
+ throw :response, response
647
663
  end
648
664
  rescue ::GRPC::BadStatus => e
649
665
  raise ::Google::Cloud::Error.from_error(e)
@@ -732,6 +748,11 @@ module Google
732
748
  # default endpoint URL. The default value of nil uses the environment
733
749
  # universe (usually the default "googleapis.com" universe).
734
750
  # @return [::String,nil]
751
+ # @!attribute [rw] logger
752
+ # A custom logger to use for request/response debug logging, or the value
753
+ # `:default` (the default) to construct a default logger, or `nil` to
754
+ # explicitly disable logging.
755
+ # @return [::Logger,:default,nil]
735
756
  #
736
757
  class Configuration
737
758
  extend ::Gapic::Config
@@ -756,6 +777,7 @@ module Google
756
777
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
757
778
  config_attr :quota_project, nil, ::String, nil
758
779
  config_attr :universe_domain, nil, ::String, nil
780
+ config_attr :logger, :default, ::Logger, nil, :default
759
781
 
760
782
  # @private
761
783
  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
+ @tenant_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
+ @tenant_service_stub.logger
174
194
  end
175
195
 
176
196
  # Service calls
@@ -253,7 +273,6 @@ module Google
253
273
 
254
274
  @tenant_service_stub.create_tenant 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)
@@ -335,7 +354,6 @@ module Google
335
354
 
336
355
  @tenant_service_stub.get_tenant request, options do |result, operation|
337
356
  yield result, operation if block_given?
338
- return result
339
357
  end
340
358
  rescue ::Gapic::Rest::Error => e
341
359
  raise ::Google::Cloud::Error.from_error(e)
@@ -427,7 +445,6 @@ module Google
427
445
 
428
446
  @tenant_service_stub.update_tenant 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)
@@ -509,7 +526,6 @@ module Google
509
526
 
510
527
  @tenant_service_stub.delete_tenant request, options do |result, operation|
511
528
  yield result, operation if block_given?
512
- return result
513
529
  end
514
530
  rescue ::Gapic::Rest::Error => e
515
531
  raise ::Google::Cloud::Error.from_error(e)
@@ -601,7 +617,7 @@ module Google
601
617
  @tenant_service_stub.list_tenants request, options do |result, operation|
602
618
  result = ::Gapic::Rest::PagedEnumerable.new @tenant_service_stub, :list_tenants, "tenants", request, result, options
603
619
  yield result, operation if block_given?
604
- return result
620
+ throw :response, result
605
621
  end
606
622
  rescue ::Gapic::Rest::Error => e
607
623
  raise ::Google::Cloud::Error.from_error(e)
@@ -681,6 +697,11 @@ module Google
681
697
  # default endpoint URL. The default value of nil uses the environment
682
698
  # universe (usually the default "googleapis.com" universe).
683
699
  # @return [::String,nil]
700
+ # @!attribute [rw] logger
701
+ # A custom logger to use for request/response debug logging, or the value
702
+ # `:default` (the default) to construct a default logger, or `nil` to
703
+ # explicitly disable logging.
704
+ # @return [::Logger,:default,nil]
684
705
  #
685
706
  class Configuration
686
707
  extend ::Gapic::Config
@@ -702,6 +723,7 @@ module Google
702
723
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
703
724
  config_attr :quota_project, nil, ::String, nil
704
725
  config_attr :universe_domain, nil, ::String, nil
726
+ config_attr :logger, :default, ::Logger, nil, :default
705
727
 
706
728
  # @private
707
729
  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_tenant 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_tenant",
93
106
  options: options
94
107
  )
95
108
  operation = ::Gapic::Rest::TransportOperation.new response
96
109
  result = ::Google::Cloud::Talent::V4beta1::Tenant.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_tenant",
131
146
  options: options
132
147
  )
133
148
  operation = ::Gapic::Rest::TransportOperation.new response
134
149
  result = ::Google::Cloud::Talent::V4beta1::Tenant.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_tenant",
169
186
  options: options
170
187
  )
171
188
  operation = ::Gapic::Rest::TransportOperation.new response
172
189
  result = ::Google::Cloud::Talent::V4beta1::Tenant.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_tenant",
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_tenants",
245
266
  options: options
246
267
  )
247
268
  operation = ::Gapic::Rest::TransportOperation.new response
248
269
  result = ::Google::Cloud::Talent::V4beta1::ListTenantsResponse.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
  ##
@@ -21,7 +21,7 @@ module Google
21
21
  module Cloud
22
22
  module Talent
23
23
  module V4beta1
24
- VERSION = "0.11.1"
24
+ VERSION = "0.12.0"
25
25
  end
26
26
  end
27
27
  end