google-cloud-batch-v1 0.19.2 → 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 987b72cf1605fb0c1150f2c3c67fb1bbb4a3fe30f2a21f27400a7c6938d041a0
4
- data.tar.gz: 590be726a4b911bf978a1084e9a2afbfeea29654427b130b233e5b5eec99244d
3
+ metadata.gz: 3295ffb42bc81bdcc492bc4b55a8078aa5c9dffaec542b41ab963dd964eea42c
4
+ data.tar.gz: e47e5c9047f237a4ae5ca26ee7ff234d43912f31fe73b95901d0e7ff8f4e53f7
5
5
  SHA512:
6
- metadata.gz: 7cf0d962382d01d297ff67af49670840bae76e58a6a59ea478dd1dd4a60480595fb44387f212104b0e8bd037141cb39867258912b4768b434732053cf21f331b
7
- data.tar.gz: ccdbd0a332bbccc8be3d2e3fa95d6d35e61a9f4cf842321b0a385944349b5e74272ea447ce93b424a4273842829a8996a6140350c56bd3ae566b44f290c1e39c
6
+ metadata.gz: d42a80210f285f76587c68d223406797b8e055a9325ae2cceddb25a3fd9d8cd7f171fb6340ea6bec5f13c7c9ff9acc001bd4703c2015345df97d2b36a1320c7b
7
+ data.tar.gz: af380b3b61345011d4e5ad2182a0769800b7a52198446bc451aa486ca600e900244bcbb071f11eca8cfbd5cce85850ce9e1dd1ac6a9e5d2c5a1b8b2ca871e3bb
data/README.md CHANGED
@@ -40,33 +40,43 @@ response = client.create_job request
40
40
  View the [Client Library Documentation](https://cloud.google.com/ruby/docs/reference/google-cloud-batch-v1/latest)
41
41
  for class and method documentation.
42
42
 
43
- ## Enabling Logging
44
-
45
- To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
46
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
47
- or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
48
- 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)
49
- and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
50
-
51
- Configuring a Ruby stdlib logger:
43
+ ## Debug Logging
44
+
45
+ This library comes with opt-in Debug Logging that can help you troubleshoot
46
+ your application's integration with the API. When logging is activated, key
47
+ events such as requests and responses, along with data payloads and metadata
48
+ such as headers and client configuration, are logged to the standard error
49
+ stream.
50
+
51
+ **WARNING:** Client Library Debug Logging includes your data payloads in
52
+ plaintext, which could include sensitive data such as PII for yourself or your
53
+ customers, private keys, or other security data that could be compromising if
54
+ leaked. Always practice good data hygiene with your application logs, and follow
55
+ the principle of least access. Google also recommends that Client Library Debug
56
+ Logging be enabled only temporarily during active debugging, and not used
57
+ permanently in production.
58
+
59
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
60
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
61
+ list of client library gem names. This will select the default logging behavior,
62
+ which writes logs to the standard error stream. On a local workstation, this may
63
+ result in logs appearing on the console. When running on a Google Cloud hosting
64
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
65
+ results in logs appearing alongside your application logs in the
66
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
67
+
68
+ You can customize logging by modifying the `logger` configuration when
69
+ constructing a client object. For example:
52
70
 
53
71
  ```ruby
72
+ require "google/cloud/batch/v1"
54
73
  require "logger"
55
74
 
56
- module MyLogger
57
- LOGGER = Logger.new $stderr, level: Logger::WARN
58
- def logger
59
- LOGGER
60
- end
61
- end
62
-
63
- # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
64
- module GRPC
65
- extend MyLogger
75
+ client = ::Google::Cloud::Batch::V1::BatchService::Client.new do |config|
76
+ config.logger = Logger.new "my-app.log"
66
77
  end
67
78
  ```
68
79
 
69
-
70
80
  ## Google Cloud Samples
71
81
 
72
82
  To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
@@ -191,14 +191,26 @@ module Google
191
191
  universe_domain: @config.universe_domain,
192
192
  channel_args: @config.channel_args,
193
193
  interceptors: @config.interceptors,
194
- channel_pool_config: @config.channel_pool
194
+ channel_pool_config: @config.channel_pool,
195
+ logger: @config.logger
195
196
  )
196
197
 
198
+ @batch_service_stub.stub_logger&.info do |entry|
199
+ entry.set_system_name
200
+ entry.set_service
201
+ entry.message = "Created client for #{entry.service}"
202
+ entry.set_credentials_fields credentials
203
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
204
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
205
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
206
+ end
207
+
197
208
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
198
209
  config.credentials = credentials
199
210
  config.quota_project = @quota_project_id
200
211
  config.endpoint = @batch_service_stub.endpoint
201
212
  config.universe_domain = @batch_service_stub.universe_domain
213
+ config.logger = @batch_service_stub.logger if config.respond_to? :logger=
202
214
  end
203
215
  end
204
216
 
@@ -216,6 +228,15 @@ module Google
216
228
  #
217
229
  attr_reader :location_client
218
230
 
231
+ ##
232
+ # The logger used for request/response debug logging.
233
+ #
234
+ # @return [Logger]
235
+ #
236
+ def logger
237
+ @batch_service_stub.logger
238
+ end
239
+
219
240
  # Service calls
220
241
 
221
242
  ##
@@ -325,7 +346,6 @@ module Google
325
346
 
326
347
  @batch_service_stub.call_rpc :create_job, request, options: options do |response, operation|
327
348
  yield response, operation if block_given?
328
- return response
329
349
  end
330
350
  rescue ::GRPC::BadStatus => e
331
351
  raise ::Google::Cloud::Error.from_error(e)
@@ -411,7 +431,6 @@ module Google
411
431
 
412
432
  @batch_service_stub.call_rpc :get_job, request, options: options do |response, operation|
413
433
  yield response, operation if block_given?
414
- return response
415
434
  end
416
435
  rescue ::GRPC::BadStatus => e
417
436
  raise ::Google::Cloud::Error.from_error(e)
@@ -521,7 +540,7 @@ module Google
521
540
  @batch_service_stub.call_rpc :delete_job, request, options: options do |response, operation|
522
541
  response = ::Gapic::Operation.new response, @operations_client, options: options
523
542
  yield response, operation if block_given?
524
- return response
543
+ throw :response, response
525
544
  end
526
545
  rescue ::GRPC::BadStatus => e
527
546
  raise ::Google::Cloud::Error.from_error(e)
@@ -621,7 +640,7 @@ module Google
621
640
  @batch_service_stub.call_rpc :list_jobs, request, options: options do |response, operation|
622
641
  response = ::Gapic::PagedEnumerable.new @batch_service_stub, :list_jobs, request, response, operation, options
623
642
  yield response, operation if block_given?
624
- return response
643
+ throw :response, response
625
644
  end
626
645
  rescue ::GRPC::BadStatus => e
627
646
  raise ::Google::Cloud::Error.from_error(e)
@@ -707,7 +726,6 @@ module Google
707
726
 
708
727
  @batch_service_stub.call_rpc :get_task, request, options: options do |response, operation|
709
728
  yield response, operation if block_given?
710
- return response
711
729
  end
712
730
  rescue ::GRPC::BadStatus => e
713
731
  raise ::Google::Cloud::Error.from_error(e)
@@ -808,7 +826,7 @@ module Google
808
826
  @batch_service_stub.call_rpc :list_tasks, request, options: options do |response, operation|
809
827
  response = ::Gapic::PagedEnumerable.new @batch_service_stub, :list_tasks, request, response, operation, options
810
828
  yield response, operation if block_given?
811
- return response
829
+ throw :response, response
812
830
  end
813
831
  rescue ::GRPC::BadStatus => e
814
832
  raise ::Google::Cloud::Error.from_error(e)
@@ -897,6 +915,11 @@ module Google
897
915
  # default endpoint URL. The default value of nil uses the environment
898
916
  # universe (usually the default "googleapis.com" universe).
899
917
  # @return [::String,nil]
918
+ # @!attribute [rw] logger
919
+ # A custom logger to use for request/response debug logging, or the value
920
+ # `:default` (the default) to construct a default logger, or `nil` to
921
+ # explicitly disable logging.
922
+ # @return [::Logger,:default,nil]
900
923
  #
901
924
  class Configuration
902
925
  extend ::Gapic::Config
@@ -921,6 +944,7 @@ module Google
921
944
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
922
945
  config_attr :quota_project, nil, ::String, nil
923
946
  config_attr :universe_domain, nil, ::String, nil
947
+ config_attr :logger, :default, ::Logger, nil, :default
924
948
 
925
949
  # @private
926
950
  def initialize parent_config = nil
@@ -213,7 +213,7 @@ module Google
213
213
  wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
214
214
  response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
215
215
  yield response, operation if block_given?
216
- return response
216
+ throw :response, response
217
217
  end
218
218
  rescue ::GRPC::BadStatus => e
219
219
  raise ::Google::Cloud::Error.from_error(e)
@@ -309,7 +309,7 @@ module Google
309
309
  @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
310
310
  response = ::Gapic::Operation.new response, @operations_client, options: options
311
311
  yield response, operation if block_given?
312
- return response
312
+ throw :response, response
313
313
  end
314
314
  rescue ::GRPC::BadStatus => e
315
315
  raise ::Google::Cloud::Error.from_error(e)
@@ -398,7 +398,6 @@ module Google
398
398
 
399
399
  @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
400
400
  yield response, operation if block_given?
401
- return response
402
401
  end
403
402
  rescue ::GRPC::BadStatus => e
404
403
  raise ::Google::Cloud::Error.from_error(e)
@@ -494,7 +493,6 @@ module Google
494
493
 
495
494
  @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
496
495
  yield response, operation if block_given?
497
- return response
498
496
  end
499
497
  rescue ::GRPC::BadStatus => e
500
498
  raise ::Google::Cloud::Error.from_error(e)
@@ -592,7 +590,7 @@ module Google
592
590
  @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
593
591
  response = ::Gapic::Operation.new response, @operations_client, options: options
594
592
  yield response, operation if block_given?
595
- return response
593
+ throw :response, response
596
594
  end
597
595
  rescue ::GRPC::BadStatus => e
598
596
  raise ::Google::Cloud::Error.from_error(e)
@@ -681,6 +679,11 @@ module Google
681
679
  # default endpoint URL. The default value of nil uses the environment
682
680
  # universe (usually the default "googleapis.com" universe).
683
681
  # @return [::String,nil]
682
+ # @!attribute [rw] logger
683
+ # A custom logger to use for request/response debug logging, or the value
684
+ # `:default` (the default) to construct a default logger, or `nil` to
685
+ # explicitly disable logging.
686
+ # @return [::Logger,:default,nil]
684
687
  #
685
688
  class Configuration
686
689
  extend ::Gapic::Config
@@ -705,6 +708,7 @@ module Google
705
708
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
706
709
  config_attr :quota_project, nil, ::String, nil
707
710
  config_attr :universe_domain, nil, ::String, nil
711
+ config_attr :logger, :default, ::Logger, nil, :default
708
712
 
709
713
  # @private
710
714
  def initialize parent_config = nil
@@ -184,15 +184,27 @@ module Google
184
184
  endpoint: @config.endpoint,
185
185
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
186
186
  universe_domain: @config.universe_domain,
187
- credentials: credentials
187
+ credentials: credentials,
188
+ logger: @config.logger
188
189
  )
189
190
 
191
+ @batch_service_stub.logger(stub: true)&.info do |entry|
192
+ entry.set_system_name
193
+ entry.set_service
194
+ entry.message = "Created client for #{entry.service}"
195
+ entry.set_credentials_fields credentials
196
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
197
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
198
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
199
+ end
200
+
190
201
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
191
202
  config.credentials = credentials
192
203
  config.quota_project = @quota_project_id
193
204
  config.endpoint = @batch_service_stub.endpoint
194
205
  config.universe_domain = @batch_service_stub.universe_domain
195
206
  config.bindings_override = @config.bindings_override
207
+ config.logger = @batch_service_stub.logger if config.respond_to? :logger=
196
208
  end
197
209
  end
198
210
 
@@ -210,6 +222,15 @@ module Google
210
222
  #
211
223
  attr_reader :location_client
212
224
 
225
+ ##
226
+ # The logger used for request/response debug logging.
227
+ #
228
+ # @return [Logger]
229
+ #
230
+ def logger
231
+ @batch_service_stub.logger
232
+ end
233
+
213
234
  # Service calls
214
235
 
215
236
  ##
@@ -312,7 +333,6 @@ module Google
312
333
 
313
334
  @batch_service_stub.create_job request, options do |result, operation|
314
335
  yield result, operation if block_given?
315
- return result
316
336
  end
317
337
  rescue ::Gapic::Rest::Error => e
318
338
  raise ::Google::Cloud::Error.from_error(e)
@@ -391,7 +411,6 @@ module Google
391
411
 
392
412
  @batch_service_stub.get_job request, options do |result, operation|
393
413
  yield result, operation if block_given?
394
- return result
395
414
  end
396
415
  rescue ::Gapic::Rest::Error => e
397
416
  raise ::Google::Cloud::Error.from_error(e)
@@ -494,7 +513,7 @@ module Google
494
513
  @batch_service_stub.delete_job request, options do |result, operation|
495
514
  result = ::Gapic::Operation.new result, @operations_client, options: options
496
515
  yield result, operation if block_given?
497
- return result
516
+ throw :response, result
498
517
  end
499
518
  rescue ::Gapic::Rest::Error => e
500
519
  raise ::Google::Cloud::Error.from_error(e)
@@ -586,7 +605,6 @@ module Google
586
605
 
587
606
  @batch_service_stub.list_jobs request, options do |result, operation|
588
607
  yield result, operation if block_given?
589
- return result
590
608
  end
591
609
  rescue ::Gapic::Rest::Error => e
592
610
  raise ::Google::Cloud::Error.from_error(e)
@@ -665,7 +683,6 @@ module Google
665
683
 
666
684
  @batch_service_stub.get_task request, options do |result, operation|
667
685
  yield result, operation if block_given?
668
- return result
669
686
  end
670
687
  rescue ::Gapic::Rest::Error => e
671
688
  raise ::Google::Cloud::Error.from_error(e)
@@ -758,7 +775,6 @@ module Google
758
775
 
759
776
  @batch_service_stub.list_tasks request, options do |result, operation|
760
777
  yield result, operation if block_given?
761
- return result
762
778
  end
763
779
  rescue ::Gapic::Rest::Error => e
764
780
  raise ::Google::Cloud::Error.from_error(e)
@@ -838,6 +854,11 @@ module Google
838
854
  # default endpoint URL. The default value of nil uses the environment
839
855
  # universe (usually the default "googleapis.com" universe).
840
856
  # @return [::String,nil]
857
+ # @!attribute [rw] logger
858
+ # A custom logger to use for request/response debug logging, or the value
859
+ # `:default` (the default) to construct a default logger, or `nil` to
860
+ # explicitly disable logging.
861
+ # @return [::Logger,:default,nil]
841
862
  #
842
863
  class Configuration
843
864
  extend ::Gapic::Config
@@ -866,6 +887,7 @@ module Google
866
887
  # by the host service.
867
888
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
868
889
  config_attr :bindings_override, {}, ::Hash, nil
890
+ config_attr :logger, :default, ::Logger, nil, :default
869
891
 
870
892
  # @private
871
893
  def initialize parent_config = nil
@@ -196,7 +196,7 @@ module Google
196
196
  @operations_stub.list_operations request, options do |result, operation|
197
197
  result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options
198
198
  yield result, operation if block_given?
199
- return result
199
+ throw :response, result
200
200
  end
201
201
  rescue ::Gapic::Rest::Error => e
202
202
  raise ::Google::Cloud::Error.from_error(e)
@@ -285,7 +285,7 @@ module Google
285
285
  @operations_stub.get_operation request, options do |result, operation|
286
286
  result = ::Gapic::Operation.new result, @operations_client, options: options
287
287
  yield result, operation if block_given?
288
- return result
288
+ throw :response, result
289
289
  end
290
290
  rescue ::Gapic::Rest::Error => e
291
291
  raise ::Google::Cloud::Error.from_error(e)
@@ -367,7 +367,6 @@ module Google
367
367
 
368
368
  @operations_stub.delete_operation request, options do |result, operation|
369
369
  yield result, operation if block_given?
370
- return result
371
370
  end
372
371
  rescue ::Gapic::Rest::Error => e
373
372
  raise ::Google::Cloud::Error.from_error(e)
@@ -456,7 +455,6 @@ module Google
456
455
 
457
456
  @operations_stub.cancel_operation request, options do |result, operation|
458
457
  yield result, operation if block_given?
459
- return result
460
458
  end
461
459
  rescue ::Gapic::Rest::Error => e
462
460
  raise ::Google::Cloud::Error.from_error(e)
@@ -536,6 +534,11 @@ module Google
536
534
  # default endpoint URL. The default value of nil uses the environment
537
535
  # universe (usually the default "googleapis.com" universe).
538
536
  # @return [::String,nil]
537
+ # @!attribute [rw] logger
538
+ # A custom logger to use for request/response debug logging, or the value
539
+ # `:default` (the default) to construct a default logger, or `nil` to
540
+ # explicitly disable logging.
541
+ # @return [::Logger,:default,nil]
539
542
  #
540
543
  class Configuration
541
544
  extend ::Gapic::Config
@@ -557,6 +560,7 @@ module Google
557
560
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
558
561
  config_attr :quota_project, nil, ::String, nil
559
562
  config_attr :universe_domain, nil, ::String, nil
563
+ config_attr :logger, :default, ::Logger, nil, :default
560
564
 
561
565
  # @private
562
566
  def initialize parent_config = nil
@@ -676,16 +680,18 @@ module Google
676
680
 
677
681
  response = @client_stub.make_http_request(
678
682
  verb,
679
- uri: uri,
680
- body: body || "",
681
- params: query_string_params,
683
+ uri: uri,
684
+ body: body || "",
685
+ params: query_string_params,
686
+ method_name: "list_operations",
682
687
  options: options
683
688
  )
684
689
  operation = ::Gapic::Rest::TransportOperation.new response
685
690
  result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
686
-
687
- yield result, operation if block_given?
688
- result
691
+ catch :response do
692
+ yield result, operation if block_given?
693
+ result
694
+ end
689
695
  end
690
696
 
691
697
  ##
@@ -714,16 +720,18 @@ module Google
714
720
 
715
721
  response = @client_stub.make_http_request(
716
722
  verb,
717
- uri: uri,
718
- body: body || "",
719
- params: query_string_params,
723
+ uri: uri,
724
+ body: body || "",
725
+ params: query_string_params,
726
+ method_name: "get_operation",
720
727
  options: options
721
728
  )
722
729
  operation = ::Gapic::Rest::TransportOperation.new response
723
730
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
724
-
725
- yield result, operation if block_given?
726
- result
731
+ catch :response do
732
+ yield result, operation if block_given?
733
+ result
734
+ end
727
735
  end
728
736
 
729
737
  ##
@@ -752,16 +760,18 @@ module Google
752
760
 
753
761
  response = @client_stub.make_http_request(
754
762
  verb,
755
- uri: uri,
756
- body: body || "",
757
- params: query_string_params,
763
+ uri: uri,
764
+ body: body || "",
765
+ params: query_string_params,
766
+ method_name: "delete_operation",
758
767
  options: options
759
768
  )
760
769
  operation = ::Gapic::Rest::TransportOperation.new response
761
770
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
762
-
763
- yield result, operation if block_given?
764
- result
771
+ catch :response do
772
+ yield result, operation if block_given?
773
+ result
774
+ end
765
775
  end
766
776
 
767
777
  ##
@@ -790,16 +800,18 @@ module Google
790
800
 
791
801
  response = @client_stub.make_http_request(
792
802
  verb,
793
- uri: uri,
794
- body: body || "",
795
- params: query_string_params,
803
+ uri: uri,
804
+ body: body || "",
805
+ params: query_string_params,
806
+ method_name: "cancel_operation",
796
807
  options: options
797
808
  )
798
809
  operation = ::Gapic::Rest::TransportOperation.new response
799
810
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
800
-
801
- yield result, operation if block_given?
802
- result
811
+ catch :response do
812
+ yield result, operation if block_given?
813
+ result
814
+ end
803
815
  end
804
816
 
805
817
  ##
@@ -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::Batch::V1::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: "get_job",
131
146
  options: options
132
147
  )
133
148
  operation = ::Gapic::Rest::TransportOperation.new response
134
149
  result = ::Google::Cloud::Batch::V1::Job.decode_json response.body, ignore_unknown_fields: true
135
-
136
- yield result, operation if block_given?
137
- result
150
+ catch :response do
151
+ yield result, operation if block_given?
152
+ result
153
+ end
138
154
  end
139
155
 
140
156
  ##
@@ -163,16 +179,18 @@ module Google
163
179
 
164
180
  response = @client_stub.make_http_request(
165
181
  verb,
166
- uri: uri,
167
- body: body || "",
168
- params: query_string_params,
182
+ uri: uri,
183
+ body: body || "",
184
+ params: query_string_params,
185
+ method_name: "delete_job",
169
186
  options: options
170
187
  )
171
188
  operation = ::Gapic::Rest::TransportOperation.new response
172
189
  result = ::Google::Longrunning::Operation.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: "list_jobs",
207
226
  options: options
208
227
  )
209
228
  operation = ::Gapic::Rest::TransportOperation.new response
210
229
  result = ::Google::Cloud::Batch::V1::ListJobsResponse.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: "get_task",
245
266
  options: options
246
267
  )
247
268
  operation = ::Gapic::Rest::TransportOperation.new response
248
269
  result = ::Google::Cloud::Batch::V1::Task.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: "list_tasks",
283
306
  options: options
284
307
  )
285
308
  operation = ::Gapic::Rest::TransportOperation.new response
286
309
  result = ::Google::Cloud::Batch::V1::ListTasksResponse.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
  ##
@@ -21,7 +21,7 @@ module Google
21
21
  module Cloud
22
22
  module Batch
23
23
  module V1
24
- VERSION = "0.19.2"
24
+ VERSION = "0.20.0"
25
25
  end
26
26
  end
27
27
  end
@@ -179,14 +179,26 @@ module Google
179
179
  universe_domain: @config.universe_domain,
180
180
  channel_args: @config.channel_args,
181
181
  interceptors: @config.interceptors,
182
- channel_pool_config: @config.channel_pool
182
+ channel_pool_config: @config.channel_pool,
183
+ logger: @config.logger
183
184
  )
184
185
 
186
+ @iam_policy_stub.stub_logger&.info do |entry|
187
+ entry.set_system_name
188
+ entry.set_service
189
+ entry.message = "Created client for #{entry.service}"
190
+ entry.set_credentials_fields credentials
191
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
192
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
193
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
194
+ end
195
+
185
196
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
186
197
  config.credentials = credentials
187
198
  config.quota_project = @quota_project_id
188
199
  config.endpoint = @iam_policy_stub.endpoint
189
200
  config.universe_domain = @iam_policy_stub.universe_domain
201
+ config.logger = @iam_policy_stub.logger if config.respond_to? :logger=
190
202
  end
191
203
  end
192
204
 
@@ -197,6 +209,15 @@ module Google
197
209
  #
198
210
  attr_reader :location_client
199
211
 
212
+ ##
213
+ # The logger used for request/response debug logging.
214
+ #
215
+ # @return [Logger]
216
+ #
217
+ def logger
218
+ @iam_policy_stub.logger
219
+ end
220
+
200
221
  # Service calls
201
222
 
202
223
  ##
@@ -294,7 +315,6 @@ module Google
294
315
 
295
316
  @iam_policy_stub.call_rpc :set_iam_policy, request, options: options do |response, operation|
296
317
  yield response, operation if block_given?
297
- return response
298
318
  end
299
319
  rescue ::GRPC::BadStatus => e
300
320
  raise ::Google::Cloud::Error.from_error(e)
@@ -386,7 +406,6 @@ module Google
386
406
 
387
407
  @iam_policy_stub.call_rpc :get_iam_policy, request, options: options do |response, operation|
388
408
  yield response, operation if block_given?
389
- return response
390
409
  end
391
410
  rescue ::GRPC::BadStatus => e
392
411
  raise ::Google::Cloud::Error.from_error(e)
@@ -484,7 +503,6 @@ module Google
484
503
 
485
504
  @iam_policy_stub.call_rpc :test_iam_permissions, request, options: options do |response, operation|
486
505
  yield response, operation if block_given?
487
- return response
488
506
  end
489
507
  rescue ::GRPC::BadStatus => e
490
508
  raise ::Google::Cloud::Error.from_error(e)
@@ -573,6 +591,11 @@ module Google
573
591
  # default endpoint URL. The default value of nil uses the environment
574
592
  # universe (usually the default "googleapis.com" universe).
575
593
  # @return [::String,nil]
594
+ # @!attribute [rw] logger
595
+ # A custom logger to use for request/response debug logging, or the value
596
+ # `:default` (the default) to construct a default logger, or `nil` to
597
+ # explicitly disable logging.
598
+ # @return [::Logger,:default,nil]
576
599
  #
577
600
  class Configuration
578
601
  extend ::Gapic::Config
@@ -597,6 +620,7 @@ module Google
597
620
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
598
621
  config_attr :quota_project, nil, ::String, nil
599
622
  config_attr :universe_domain, nil, ::String, nil
623
+ config_attr :logger, :default, ::Logger, nil, :default
600
624
 
601
625
  # @private
602
626
  def initialize parent_config = nil
@@ -172,15 +172,27 @@ module Google
172
172
  endpoint: @config.endpoint,
173
173
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
174
174
  universe_domain: @config.universe_domain,
175
- credentials: credentials
175
+ credentials: credentials,
176
+ logger: @config.logger
176
177
  )
177
178
 
179
+ @iam_policy_stub.logger(stub: true)&.info do |entry|
180
+ entry.set_system_name
181
+ entry.set_service
182
+ entry.message = "Created client for #{entry.service}"
183
+ entry.set_credentials_fields credentials
184
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
185
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
186
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
187
+ end
188
+
178
189
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
179
190
  config.credentials = credentials
180
191
  config.quota_project = @quota_project_id
181
192
  config.endpoint = @iam_policy_stub.endpoint
182
193
  config.universe_domain = @iam_policy_stub.universe_domain
183
194
  config.bindings_override = @config.bindings_override
195
+ config.logger = @iam_policy_stub.logger if config.respond_to? :logger=
184
196
  end
185
197
  end
186
198
 
@@ -191,6 +203,15 @@ module Google
191
203
  #
192
204
  attr_reader :location_client
193
205
 
206
+ ##
207
+ # The logger used for request/response debug logging.
208
+ #
209
+ # @return [Logger]
210
+ #
211
+ def logger
212
+ @iam_policy_stub.logger
213
+ end
214
+
194
215
  # Service calls
195
216
 
196
217
  ##
@@ -281,7 +302,6 @@ module Google
281
302
 
282
303
  @iam_policy_stub.set_iam_policy request, options do |result, operation|
283
304
  yield result, operation if block_given?
284
- return result
285
305
  end
286
306
  rescue ::Gapic::Rest::Error => e
287
307
  raise ::Google::Cloud::Error.from_error(e)
@@ -366,7 +386,6 @@ module Google
366
386
 
367
387
  @iam_policy_stub.get_iam_policy request, options do |result, operation|
368
388
  yield result, operation if block_given?
369
- return result
370
389
  end
371
390
  rescue ::Gapic::Rest::Error => e
372
391
  raise ::Google::Cloud::Error.from_error(e)
@@ -457,7 +476,6 @@ module Google
457
476
 
458
477
  @iam_policy_stub.test_iam_permissions request, options do |result, operation|
459
478
  yield result, operation if block_given?
460
- return result
461
479
  end
462
480
  rescue ::Gapic::Rest::Error => e
463
481
  raise ::Google::Cloud::Error.from_error(e)
@@ -537,6 +555,11 @@ module Google
537
555
  # default endpoint URL. The default value of nil uses the environment
538
556
  # universe (usually the default "googleapis.com" universe).
539
557
  # @return [::String,nil]
558
+ # @!attribute [rw] logger
559
+ # A custom logger to use for request/response debug logging, or the value
560
+ # `:default` (the default) to construct a default logger, or `nil` to
561
+ # explicitly disable logging.
562
+ # @return [::Logger,:default,nil]
540
563
  #
541
564
  class Configuration
542
565
  extend ::Gapic::Config
@@ -565,6 +588,7 @@ module Google
565
588
  # by the host service.
566
589
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
567
590
  config_attr :bindings_override, {}, ::Hash, nil
591
+ config_attr :logger, :default, ::Logger, nil, :default
568
592
 
569
593
  # @private
570
594
  def initialize parent_config = nil
@@ -29,7 +29,8 @@ module Google
29
29
  # including transcoding, making the REST call, and deserialing the response.
30
30
  #
31
31
  class ServiceStub
32
- def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
32
+ # @private
33
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
33
34
  # These require statements are intentionally placed here to initialize
34
35
  # the REST modules only when it's required.
35
36
  require "gapic/rest"
@@ -39,7 +40,9 @@ module Google
39
40
  universe_domain: universe_domain,
40
41
  credentials: credentials,
41
42
  numeric_enums: true,
42
- raise_faraday_errors: false
43
+ service_name: self.class,
44
+ raise_faraday_errors: false,
45
+ logger: logger
43
46
  end
44
47
 
45
48
  ##
@@ -60,6 +63,15 @@ module Google
60
63
  @client_stub.endpoint
61
64
  end
62
65
 
66
+ ##
67
+ # The logger used for request/response debug logging.
68
+ #
69
+ # @return [Logger]
70
+ #
71
+ def logger stub: false
72
+ stub ? @client_stub.stub_logger : @client_stub.logger
73
+ end
74
+
63
75
  ##
64
76
  # Baseline implementation for the set_iam_policy REST call
65
77
  #
@@ -86,16 +98,18 @@ module Google
86
98
 
87
99
  response = @client_stub.make_http_request(
88
100
  verb,
89
- uri: uri,
90
- body: body || "",
91
- params: query_string_params,
101
+ uri: uri,
102
+ body: body || "",
103
+ params: query_string_params,
104
+ method_name: "set_iam_policy",
92
105
  options: options
93
106
  )
94
107
  operation = ::Gapic::Rest::TransportOperation.new response
95
108
  result = ::Google::Iam::V1::Policy.decode_json response.body, ignore_unknown_fields: true
96
-
97
- yield result, operation if block_given?
98
- result
109
+ catch :response do
110
+ yield result, operation if block_given?
111
+ result
112
+ end
99
113
  end
100
114
 
101
115
  ##
@@ -124,16 +138,18 @@ module Google
124
138
 
125
139
  response = @client_stub.make_http_request(
126
140
  verb,
127
- uri: uri,
128
- body: body || "",
129
- params: query_string_params,
141
+ uri: uri,
142
+ body: body || "",
143
+ params: query_string_params,
144
+ method_name: "get_iam_policy",
130
145
  options: options
131
146
  )
132
147
  operation = ::Gapic::Rest::TransportOperation.new response
133
148
  result = ::Google::Iam::V1::Policy.decode_json response.body, ignore_unknown_fields: true
134
-
135
- yield result, operation if block_given?
136
- result
149
+ catch :response do
150
+ yield result, operation if block_given?
151
+ result
152
+ end
137
153
  end
138
154
 
139
155
  ##
@@ -162,16 +178,18 @@ module Google
162
178
 
163
179
  response = @client_stub.make_http_request(
164
180
  verb,
165
- uri: uri,
166
- body: body || "",
167
- params: query_string_params,
181
+ uri: uri,
182
+ body: body || "",
183
+ params: query_string_params,
184
+ method_name: "test_iam_permissions",
168
185
  options: options
169
186
  )
170
187
  operation = ::Gapic::Rest::TransportOperation.new response
171
188
  result = ::Google::Iam::V1::TestIamPermissionsResponse.decode_json response.body, ignore_unknown_fields: true
172
-
173
- yield result, operation if block_given?
174
- result
189
+ catch :response do
190
+ yield result, operation if block_given?
191
+ result
192
+ end
175
193
  end
176
194
 
177
195
  ##
@@ -306,9 +306,28 @@ module Google
306
306
  # @!attribute [rw] common
307
307
  # @return [::Google::Api::CommonLanguageSettings]
308
308
  # Some settings.
309
+ # @!attribute [rw] renamed_services
310
+ # @return [::Google::Protobuf::Map{::String => ::String}]
311
+ # Map of service names to renamed services. Keys are the package relative
312
+ # service names and values are the name to be used for the service client
313
+ # and call options.
314
+ #
315
+ # publishing:
316
+ # go_settings:
317
+ # renamed_services:
318
+ # Publisher: TopicAdmin
309
319
  class GoSettings
310
320
  include ::Google::Protobuf::MessageExts
311
321
  extend ::Google::Protobuf::MessageExts::ClassMethods
322
+
323
+ # @!attribute [rw] key
324
+ # @return [::String]
325
+ # @!attribute [rw] value
326
+ # @return [::String]
327
+ class RenamedServicesEntry
328
+ include ::Google::Protobuf::MessageExts
329
+ extend ::Google::Protobuf::MessageExts::ClassMethods
330
+ end
312
331
  end
313
332
 
314
333
  # Describes the generator configuration for a method.
@@ -85,20 +85,27 @@ module Google
85
85
  end
86
86
  end
87
87
 
88
- # LogsPolicy describes how outputs from a Job's Tasks (stdout/stderr) will be
89
- # preserved.
88
+ # LogsPolicy describes if and how a job's logs are preserved. Logs include
89
+ # information that is automatically written by the Batch service agent and any
90
+ # information that you configured the job's runnables to write to the `stdout`
91
+ # or `stderr` streams.
90
92
  # @!attribute [rw] destination
91
93
  # @return [::Google::Cloud::Batch::V1::LogsPolicy::Destination]
92
- # Where logs should be saved.
94
+ # If and where logs should be saved.
93
95
  # @!attribute [rw] logs_path
94
96
  # @return [::String]
95
- # The path to which logs are saved when the destination = PATH. This can be a
96
- # local file path on the VM, or under the mount point of a Persistent Disk or
97
- # Filestore, or a Cloud Storage path.
97
+ # When `destination` is set to `PATH`, you must set this field to the path
98
+ # where you want logs to be saved. This path can point to a local directory
99
+ # on the VM or (if congifured) a directory under the mount path of any
100
+ # Cloud Storage bucket, network file system (NFS), or writable persistent
101
+ # disk that is mounted to the job. For example, if the job has a bucket with
102
+ # `mountPath` set to `/mnt/disks/my-bucket`, you can write logs to the
103
+ # root directory of the `remotePath` of that bucket by setting this field to
104
+ # `/mnt/disks/my-bucket/`.
98
105
  # @!attribute [rw] cloud_logging_option
99
106
  # @return [::Google::Cloud::Batch::V1::LogsPolicy::CloudLoggingOption]
100
- # Optional. Additional settings for Cloud Logging. It will only take effect
101
- # when the destination of `LogsPolicy` is set to `CLOUD_LOGGING`.
107
+ # Optional. When `destination` is set to `CLOUD_LOGGING`, you can optionally
108
+ # set this field to configure additional settings for Cloud Logging.
102
109
  class LogsPolicy
103
110
  include ::Google::Protobuf::MessageExts
104
111
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -107,7 +114,7 @@ module Google
107
114
  # generated by Batch job.
108
115
  # @!attribute [rw] use_generic_task_monitored_resource
109
116
  # @return [::Boolean]
110
- # Optional. Set this flag to true to change the [monitored resource
117
+ # Optional. Set this field to `true` to change the [monitored resource
111
118
  # type](https://cloud.google.com/monitoring/api/resources) for
112
119
  # Cloud Logging logs generated by this Batch job from
113
120
  # the
@@ -122,13 +129,14 @@ module Google
122
129
 
123
130
  # The destination (if any) for logs.
124
131
  module Destination
125
- # Logs are not preserved.
132
+ # (Default) Logs are not preserved.
126
133
  DESTINATION_UNSPECIFIED = 0
127
134
 
128
- # Logs are streamed to Cloud Logging.
135
+ # Logs are streamed to Cloud Logging. Optionally, you can configure
136
+ # additional settings in the `cloudLoggingOption` field.
129
137
  CLOUD_LOGGING = 1
130
138
 
131
- # Logs are saved to a file path.
139
+ # Logs are saved to the file path specified in the `logsPath` field.
132
140
  PATH = 2
133
141
  end
134
142
  end
@@ -525,7 +533,8 @@ module Google
525
533
  # Named the field as 'instance_template' instead of 'template' to avoid
526
534
  # C++ keyword conflict.
527
535
  #
528
- # Batch only supports global instance templates.
536
+ # Batch only supports global instance templates from the same project as
537
+ # the job.
529
538
  # You can specify the global instance template as a full or partial URL.
530
539
  # @!attribute [rw] install_gpu_drivers
531
540
  # @return [::Boolean]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-batch-v1
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.2
4
+ version: 0.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-04 00:00:00.000000000 Z
11
+ date: 2024-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gapic-common
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.21.1
19
+ version: 0.24.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: 2.a
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 0.21.1
29
+ version: 0.24.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: 2.a
@@ -162,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
162
162
  - !ruby/object:Gem::Version
163
163
  version: '0'
164
164
  requirements: []
165
- rubygems_version: 3.5.22
165
+ rubygems_version: 3.5.23
166
166
  signing_key:
167
167
  specification_version: 4
168
168
  summary: An API to manage the running of Batch resources on Google Cloud Platform.