google-cloud-dataproc-v1 1.0.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +31 -21
  3. data/lib/google/cloud/dataproc/v1/autoscaling_policy_service/client.rb +36 -6
  4. data/lib/google/cloud/dataproc/v1/autoscaling_policy_service/rest/client.rb +36 -6
  5. data/lib/google/cloud/dataproc/v1/autoscaling_policy_service/rest/service_stub.rb +54 -32
  6. data/lib/google/cloud/dataproc/v1/batch_controller/client.rb +37 -5
  7. data/lib/google/cloud/dataproc/v1/batch_controller/operations.rb +19 -15
  8. data/lib/google/cloud/dataproc/v1/batch_controller/rest/client.rb +37 -5
  9. data/lib/google/cloud/dataproc/v1/batch_controller/rest/operations.rb +50 -38
  10. data/lib/google/cloud/dataproc/v1/batch_controller/rest/service_stub.rb +46 -26
  11. data/lib/google/cloud/dataproc/v1/batches_pb.rb +1 -1
  12. data/lib/google/cloud/dataproc/v1/cluster_controller/client.rb +53 -17
  13. data/lib/google/cloud/dataproc/v1/cluster_controller/operations.rb +19 -15
  14. data/lib/google/cloud/dataproc/v1/cluster_controller/paths.rb +21 -0
  15. data/lib/google/cloud/dataproc/v1/cluster_controller/rest/client.rb +53 -17
  16. data/lib/google/cloud/dataproc/v1/cluster_controller/rest/operations.rb +50 -38
  17. data/lib/google/cloud/dataproc/v1/cluster_controller/rest/service_stub.rb +78 -50
  18. data/lib/google/cloud/dataproc/v1/clusters_pb.rb +3 -1
  19. data/lib/google/cloud/dataproc/v1/job_controller/client.rb +37 -8
  20. data/lib/google/cloud/dataproc/v1/job_controller/operations.rb +19 -15
  21. data/lib/google/cloud/dataproc/v1/job_controller/rest/client.rb +37 -8
  22. data/lib/google/cloud/dataproc/v1/job_controller/rest/operations.rb +50 -38
  23. data/lib/google/cloud/dataproc/v1/job_controller/rest/service_stub.rb +70 -44
  24. data/lib/google/cloud/dataproc/v1/jobs_pb.rb +2 -1
  25. data/lib/google/cloud/dataproc/v1/node_group_controller/client.rb +37 -4
  26. data/lib/google/cloud/dataproc/v1/node_group_controller/operations.rb +19 -15
  27. data/lib/google/cloud/dataproc/v1/node_group_controller/rest/client.rb +37 -4
  28. data/lib/google/cloud/dataproc/v1/node_group_controller/rest/operations.rb +50 -38
  29. data/lib/google/cloud/dataproc/v1/node_group_controller/rest/service_stub.rb +38 -20
  30. data/lib/google/cloud/dataproc/v1/session_controller/client.rb +43 -9
  31. data/lib/google/cloud/dataproc/v1/session_controller/operations.rb +19 -15
  32. data/lib/google/cloud/dataproc/v1/session_controller/rest/client.rb +43 -9
  33. data/lib/google/cloud/dataproc/v1/session_controller/rest/operations.rb +50 -38
  34. data/lib/google/cloud/dataproc/v1/session_controller/rest/service_stub.rb +54 -32
  35. data/lib/google/cloud/dataproc/v1/session_template_controller/client.rb +36 -6
  36. data/lib/google/cloud/dataproc/v1/session_template_controller/rest/client.rb +36 -6
  37. data/lib/google/cloud/dataproc/v1/session_template_controller/rest/service_stub.rb +54 -32
  38. data/lib/google/cloud/dataproc/v1/session_templates_pb.rb +1 -1
  39. data/lib/google/cloud/dataproc/v1/sessions_pb.rb +2 -1
  40. data/lib/google/cloud/dataproc/v1/shared_pb.rb +1 -1
  41. data/lib/google/cloud/dataproc/v1/version.rb +1 -1
  42. data/lib/google/cloud/dataproc/v1/workflow_template_service/client.rb +38 -8
  43. data/lib/google/cloud/dataproc/v1/workflow_template_service/operations.rb +19 -15
  44. data/lib/google/cloud/dataproc/v1/workflow_template_service/paths.rb +21 -0
  45. data/lib/google/cloud/dataproc/v1/workflow_template_service/rest/client.rb +38 -8
  46. data/lib/google/cloud/dataproc/v1/workflow_template_service/rest/operations.rb +50 -38
  47. data/lib/google/cloud/dataproc/v1/workflow_template_service/rest/service_stub.rb +70 -44
  48. data/lib/google/cloud/dataproc/v1/workflow_templates_pb.rb +2 -1
  49. data/proto_docs/google/api/client.rb +47 -0
  50. data/proto_docs/google/cloud/dataproc/v1/batches.rb +17 -0
  51. data/proto_docs/google/cloud/dataproc/v1/clusters.rb +129 -23
  52. data/proto_docs/google/cloud/dataproc/v1/jobs.rb +130 -23
  53. data/proto_docs/google/cloud/dataproc/v1/session_templates.rb +7 -0
  54. data/proto_docs/google/cloud/dataproc/v1/sessions.rb +17 -3
  55. data/proto_docs/google/cloud/dataproc/v1/shared.rb +9 -4
  56. data/proto_docs/google/cloud/dataproc/v1/workflow_templates.rb +79 -0
  57. data/proto_docs/google/longrunning/operations.rb +23 -14
  58. metadata +6 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be47bab9c0b8c11c38a6eae7c9ac0ba8c5e8d553ffdf9556767a0abf66627b02
4
- data.tar.gz: ce6fdca6a06cd25e09f25cc9ae7f57085badbf2e4a5cbe98c1aae0a73c80ce5d
3
+ metadata.gz: 2f6f0caba293653ede60a956cbb126cfce56b7699b87d935b140531f87e3155a
4
+ data.tar.gz: 30296b9abe3d2dcda407121c05b105cf5673ee42d3ab9bbaf2d2ac9ddf29ecee
5
5
  SHA512:
6
- metadata.gz: 8301d73745b126176a15715d0f439cba4da2a2c8de1d37d18a2ec1859ff55dffa7973a852f5365d0cd5e7d38bb30d26812b53193ed202bc65e4c11d1f4170927
7
- data.tar.gz: d2a68058be095bf7b737c2b0420fea03a2709b9538482c58053dabf1e1278cd1321b08f081a502d7f0323c02746d8fbc0b4cf86a23775ab65f000a4b47320d87
6
+ metadata.gz: ddfa53add9dde30c782f4b62c346e9d268bd9fc5b86d20e35c860a8e6cd330eeaa04c10689d148d5e8b56b1ff597c958fc84c81aad708b447695dba2cb6859e1
7
+ data.tar.gz: f9c8474b7be2130bc491b86b2dc1b647d5ed44e9745d8bdc4a42efc3232a2b9b4dc88218d63289142db08ac5cb2f430c269c5c0ad9539ee99f0e5f56b591786b
data/README.md CHANGED
@@ -42,40 +42,50 @@ for class and method documentation.
42
42
  See also the [Product Documentation](https://cloud.google.com/dataproc)
43
43
  for general usage information.
44
44
 
45
- ## Enabling Logging
46
-
47
- To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
48
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
49
- or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
50
- 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)
51
- and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
52
-
53
- Configuring a Ruby stdlib logger:
45
+ ## Debug Logging
46
+
47
+ This library comes with opt-in Debug Logging that can help you troubleshoot
48
+ your application's integration with the API. When logging is activated, key
49
+ events such as requests and responses, along with data payloads and metadata
50
+ such as headers and client configuration, are logged to the standard error
51
+ stream.
52
+
53
+ **WARNING:** Client Library Debug Logging includes your data payloads in
54
+ plaintext, which could include sensitive data such as PII for yourself or your
55
+ customers, private keys, or other security data that could be compromising if
56
+ leaked. Always practice good data hygiene with your application logs, and follow
57
+ the principle of least access. Google also recommends that Client Library Debug
58
+ Logging be enabled only temporarily during active debugging, and not used
59
+ permanently in production.
60
+
61
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
62
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
63
+ list of client library gem names. This will select the default logging behavior,
64
+ which writes logs to the standard error stream. On a local workstation, this may
65
+ result in logs appearing on the console. When running on a Google Cloud hosting
66
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
67
+ results in logs appearing alongside your application logs in the
68
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
69
+
70
+ You can customize logging by modifying the `logger` configuration when
71
+ constructing a client object. For example:
54
72
 
55
73
  ```ruby
74
+ require "google/cloud/dataproc/v1"
56
75
  require "logger"
57
76
 
58
- module MyLogger
59
- LOGGER = Logger.new $stderr, level: Logger::WARN
60
- def logger
61
- LOGGER
62
- end
63
- end
64
-
65
- # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
66
- module GRPC
67
- extend MyLogger
77
+ client = ::Google::Cloud::Dataproc::V1::AutoscalingPolicyService::Client.new do |config|
78
+ config.logger = Logger.new "my-app.log"
68
79
  end
69
80
  ```
70
81
 
71
-
72
82
  ## Google Cloud Samples
73
83
 
74
84
  To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
75
85
 
76
86
  ## Supported Ruby Versions
77
87
 
78
- This library is supported on Ruby 2.7+.
88
+ This library is supported on Ruby 3.0+.
79
89
 
80
90
  Google provides official support for Ruby versions that are actively supported
81
91
  by Ruby Core—that is, Ruby versions that are either in normal maintenance or
@@ -178,14 +178,26 @@ module Google
178
178
  universe_domain: @config.universe_domain,
179
179
  channel_args: @config.channel_args,
180
180
  interceptors: @config.interceptors,
181
- channel_pool_config: @config.channel_pool
181
+ channel_pool_config: @config.channel_pool,
182
+ logger: @config.logger
182
183
  )
183
184
 
185
+ @autoscaling_policy_service_stub.stub_logger&.info do |entry|
186
+ entry.set_system_name
187
+ entry.set_service
188
+ entry.message = "Created client for #{entry.service}"
189
+ entry.set_credentials_fields credentials
190
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
191
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
192
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
193
+ end
194
+
184
195
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|
185
196
  config.credentials = credentials
186
197
  config.quota_project = @quota_project_id
187
198
  config.endpoint = @autoscaling_policy_service_stub.endpoint
188
199
  config.universe_domain = @autoscaling_policy_service_stub.universe_domain
200
+ config.logger = @autoscaling_policy_service_stub.logger if config.respond_to? :logger=
189
201
  end
190
202
  end
191
203
 
@@ -196,6 +208,15 @@ module Google
196
208
  #
197
209
  attr_reader :iam_policy_client
198
210
 
211
+ ##
212
+ # The logger used for request/response debug logging.
213
+ #
214
+ # @return [Logger]
215
+ #
216
+ def logger
217
+ @autoscaling_policy_service_stub.logger
218
+ end
219
+
199
220
  # Service calls
200
221
 
201
222
  ##
@@ -289,7 +310,6 @@ module Google
289
310
 
290
311
  @autoscaling_policy_service_stub.call_rpc :create_autoscaling_policy, request, options: options do |response, operation|
291
312
  yield response, operation if block_given?
292
- return response
293
313
  end
294
314
  rescue ::GRPC::BadStatus => e
295
315
  raise ::Google::Cloud::Error.from_error(e)
@@ -378,7 +398,6 @@ module Google
378
398
 
379
399
  @autoscaling_policy_service_stub.call_rpc :update_autoscaling_policy, request, options: options do |response, operation|
380
400
  yield response, operation if block_given?
381
- return response
382
401
  end
383
402
  rescue ::GRPC::BadStatus => e
384
403
  raise ::Google::Cloud::Error.from_error(e)
@@ -473,7 +492,6 @@ module Google
473
492
 
474
493
  @autoscaling_policy_service_stub.call_rpc :get_autoscaling_policy, request, options: options do |response, operation|
475
494
  yield response, operation if block_given?
476
- return response
477
495
  end
478
496
  rescue ::GRPC::BadStatus => e
479
497
  raise ::Google::Cloud::Error.from_error(e)
@@ -579,7 +597,7 @@ module Google
579
597
  @autoscaling_policy_service_stub.call_rpc :list_autoscaling_policies, request, options: options do |response, operation|
580
598
  response = ::Gapic::PagedEnumerable.new @autoscaling_policy_service_stub, :list_autoscaling_policies, request, response, operation, options
581
599
  yield response, operation if block_given?
582
- return response
600
+ throw :response, response
583
601
  end
584
602
  rescue ::GRPC::BadStatus => e
585
603
  raise ::Google::Cloud::Error.from_error(e)
@@ -675,7 +693,6 @@ module Google
675
693
 
676
694
  @autoscaling_policy_service_stub.call_rpc :delete_autoscaling_policy, request, options: options do |response, operation|
677
695
  yield response, operation if block_given?
678
- return response
679
696
  end
680
697
  rescue ::GRPC::BadStatus => e
681
698
  raise ::Google::Cloud::Error.from_error(e)
@@ -725,6 +742,13 @@ module Google
725
742
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
726
743
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
727
744
  # * (`nil`) indicating no credentials
745
+ #
746
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
747
+ # external source for authentication to Google Cloud, you must validate it before
748
+ # providing it to a Google API client library. Providing an unvalidated credential
749
+ # configuration to Google APIs can compromise the security of your systems and data.
750
+ # For more information, refer to [Validate credential configurations from external
751
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
728
752
  # @return [::Object]
729
753
  # @!attribute [rw] scope
730
754
  # The OAuth scopes
@@ -764,6 +788,11 @@ module Google
764
788
  # default endpoint URL. The default value of nil uses the environment
765
789
  # universe (usually the default "googleapis.com" universe).
766
790
  # @return [::String,nil]
791
+ # @!attribute [rw] logger
792
+ # A custom logger to use for request/response debug logging, or the value
793
+ # `:default` (the default) to construct a default logger, or `nil` to
794
+ # explicitly disable logging.
795
+ # @return [::Logger,:default,nil]
767
796
  #
768
797
  class Configuration
769
798
  extend ::Gapic::Config
@@ -788,6 +817,7 @@ module Google
788
817
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
789
818
  config_attr :quota_project, nil, ::String, nil
790
819
  config_attr :universe_domain, nil, ::String, nil
820
+ config_attr :logger, :default, ::Logger, nil, :default
791
821
 
792
822
  # @private
793
823
  def initialize parent_config = nil
@@ -171,15 +171,27 @@ module Google
171
171
  endpoint: @config.endpoint,
172
172
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
173
173
  universe_domain: @config.universe_domain,
174
- credentials: credentials
174
+ credentials: credentials,
175
+ logger: @config.logger
175
176
  )
176
177
 
178
+ @autoscaling_policy_service_stub.logger(stub: true)&.info do |entry|
179
+ entry.set_system_name
180
+ entry.set_service
181
+ entry.message = "Created client for #{entry.service}"
182
+ entry.set_credentials_fields credentials
183
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
184
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
185
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
186
+ end
187
+
177
188
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
178
189
  config.credentials = credentials
179
190
  config.quota_project = @quota_project_id
180
191
  config.endpoint = @autoscaling_policy_service_stub.endpoint
181
192
  config.universe_domain = @autoscaling_policy_service_stub.universe_domain
182
193
  config.bindings_override = @config.bindings_override
194
+ config.logger = @autoscaling_policy_service_stub.logger if config.respond_to? :logger=
183
195
  end
184
196
  end
185
197
 
@@ -190,6 +202,15 @@ module Google
190
202
  #
191
203
  attr_reader :iam_policy_client
192
204
 
205
+ ##
206
+ # The logger used for request/response debug logging.
207
+ #
208
+ # @return [Logger]
209
+ #
210
+ def logger
211
+ @autoscaling_policy_service_stub.logger
212
+ end
213
+
193
214
  # Service calls
194
215
 
195
216
  ##
@@ -276,7 +297,6 @@ module Google
276
297
 
277
298
  @autoscaling_policy_service_stub.create_autoscaling_policy request, options do |result, operation|
278
299
  yield result, operation if block_given?
279
- return result
280
300
  end
281
301
  rescue ::Gapic::Rest::Error => e
282
302
  raise ::Google::Cloud::Error.from_error(e)
@@ -358,7 +378,6 @@ module Google
358
378
 
359
379
  @autoscaling_policy_service_stub.update_autoscaling_policy request, options do |result, operation|
360
380
  yield result, operation if block_given?
361
- return result
362
381
  end
363
382
  rescue ::Gapic::Rest::Error => e
364
383
  raise ::Google::Cloud::Error.from_error(e)
@@ -446,7 +465,6 @@ module Google
446
465
 
447
466
  @autoscaling_policy_service_stub.get_autoscaling_policy request, options do |result, operation|
448
467
  yield result, operation if block_given?
449
- return result
450
468
  end
451
469
  rescue ::Gapic::Rest::Error => e
452
470
  raise ::Google::Cloud::Error.from_error(e)
@@ -545,7 +563,7 @@ module Google
545
563
  @autoscaling_policy_service_stub.list_autoscaling_policies request, options do |result, operation|
546
564
  result = ::Gapic::Rest::PagedEnumerable.new @autoscaling_policy_service_stub, :list_autoscaling_policies, "policies", request, result, options
547
565
  yield result, operation if block_given?
548
- return result
566
+ throw :response, result
549
567
  end
550
568
  rescue ::Gapic::Rest::Error => e
551
569
  raise ::Google::Cloud::Error.from_error(e)
@@ -634,7 +652,6 @@ module Google
634
652
 
635
653
  @autoscaling_policy_service_stub.delete_autoscaling_policy request, options do |result, operation|
636
654
  yield result, operation if block_given?
637
- return result
638
655
  end
639
656
  rescue ::Gapic::Rest::Error => e
640
657
  raise ::Google::Cloud::Error.from_error(e)
@@ -682,6 +699,13 @@ module Google
682
699
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
683
700
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
684
701
  # * (`nil`) indicating no credentials
702
+ #
703
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
704
+ # external source for authentication to Google Cloud, you must validate it before
705
+ # providing it to a Google API client library. Providing an unvalidated credential
706
+ # configuration to Google APIs can compromise the security of your systems and data.
707
+ # For more information, refer to [Validate credential configurations from external
708
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
685
709
  # @return [::Object]
686
710
  # @!attribute [rw] scope
687
711
  # The OAuth scopes
@@ -714,6 +738,11 @@ module Google
714
738
  # default endpoint URL. The default value of nil uses the environment
715
739
  # universe (usually the default "googleapis.com" universe).
716
740
  # @return [::String,nil]
741
+ # @!attribute [rw] logger
742
+ # A custom logger to use for request/response debug logging, or the value
743
+ # `:default` (the default) to construct a default logger, or `nil` to
744
+ # explicitly disable logging.
745
+ # @return [::Logger,:default,nil]
717
746
  #
718
747
  class Configuration
719
748
  extend ::Gapic::Config
@@ -742,6 +771,7 @@ module Google
742
771
  # by the host service.
743
772
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
744
773
  config_attr :bindings_override, {}, ::Hash, nil
774
+ config_attr :logger, :default, ::Logger, nil, :default
745
775
 
746
776
  # @private
747
777
  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_autoscaling_policy 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_autoscaling_policy",
93
106
  options: options
94
107
  )
95
108
  operation = ::Gapic::Rest::TransportOperation.new response
96
109
  result = ::Google::Cloud::Dataproc::V1::AutoscalingPolicy.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: "update_autoscaling_policy",
131
146
  options: options
132
147
  )
133
148
  operation = ::Gapic::Rest::TransportOperation.new response
134
149
  result = ::Google::Cloud::Dataproc::V1::AutoscalingPolicy.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_autoscaling_policy",
169
186
  options: options
170
187
  )
171
188
  operation = ::Gapic::Rest::TransportOperation.new response
172
189
  result = ::Google::Cloud::Dataproc::V1::AutoscalingPolicy.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_autoscaling_policies",
207
226
  options: options
208
227
  )
209
228
  operation = ::Gapic::Rest::TransportOperation.new response
210
229
  result = ::Google::Cloud::Dataproc::V1::ListAutoscalingPoliciesResponse.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: "delete_autoscaling_policy",
245
266
  options: options
246
267
  )
247
268
  operation = ::Gapic::Rest::TransportOperation.new response
248
269
  result = ::Google::Protobuf::Empty.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
  ##
@@ -165,14 +165,26 @@ module Google
165
165
  universe_domain: @config.universe_domain,
166
166
  channel_args: @config.channel_args,
167
167
  interceptors: @config.interceptors,
168
- channel_pool_config: @config.channel_pool
168
+ channel_pool_config: @config.channel_pool,
169
+ logger: @config.logger
169
170
  )
170
171
 
172
+ @batch_controller_stub.stub_logger&.info do |entry|
173
+ entry.set_system_name
174
+ entry.set_service
175
+ entry.message = "Created client for #{entry.service}"
176
+ entry.set_credentials_fields credentials
177
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
178
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
179
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
180
+ end
181
+
171
182
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|
172
183
  config.credentials = credentials
173
184
  config.quota_project = @quota_project_id
174
185
  config.endpoint = @batch_controller_stub.endpoint
175
186
  config.universe_domain = @batch_controller_stub.universe_domain
187
+ config.logger = @batch_controller_stub.logger if config.respond_to? :logger=
176
188
  end
177
189
  end
178
190
 
@@ -190,6 +202,15 @@ module Google
190
202
  #
191
203
  attr_reader :iam_policy_client
192
204
 
205
+ ##
206
+ # The logger used for request/response debug logging.
207
+ #
208
+ # @return [Logger]
209
+ #
210
+ def logger
211
+ @batch_controller_stub.logger
212
+ end
213
+
193
214
  # Service calls
194
215
 
195
216
  ##
@@ -300,7 +321,7 @@ module Google
300
321
  @batch_controller_stub.call_rpc :create_batch, request, options: options do |response, operation|
301
322
  response = ::Gapic::Operation.new response, @operations_client, options: options
302
323
  yield response, operation if block_given?
303
- return response
324
+ throw :response, response
304
325
  end
305
326
  rescue ::GRPC::BadStatus => e
306
327
  raise ::Google::Cloud::Error.from_error(e)
@@ -388,7 +409,6 @@ module Google
388
409
 
389
410
  @batch_controller_stub.call_rpc :get_batch, request, options: options do |response, operation|
390
411
  yield response, operation if block_given?
391
- return response
392
412
  end
393
413
  rescue ::GRPC::BadStatus => e
394
414
  raise ::Google::Cloud::Error.from_error(e)
@@ -506,7 +526,7 @@ module Google
506
526
  @batch_controller_stub.call_rpc :list_batches, request, options: options do |response, operation|
507
527
  response = ::Gapic::PagedEnumerable.new @batch_controller_stub, :list_batches, request, response, operation, options
508
528
  yield response, operation if block_given?
509
- return response
529
+ throw :response, response
510
530
  end
511
531
  rescue ::GRPC::BadStatus => e
512
532
  raise ::Google::Cloud::Error.from_error(e)
@@ -595,7 +615,6 @@ module Google
595
615
 
596
616
  @batch_controller_stub.call_rpc :delete_batch, request, options: options do |response, operation|
597
617
  yield response, operation if block_given?
598
- return response
599
618
  end
600
619
  rescue ::GRPC::BadStatus => e
601
620
  raise ::Google::Cloud::Error.from_error(e)
@@ -645,6 +664,13 @@ module Google
645
664
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
646
665
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
647
666
  # * (`nil`) indicating no credentials
667
+ #
668
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
669
+ # external source for authentication to Google Cloud, you must validate it before
670
+ # providing it to a Google API client library. Providing an unvalidated credential
671
+ # configuration to Google APIs can compromise the security of your systems and data.
672
+ # For more information, refer to [Validate credential configurations from external
673
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
648
674
  # @return [::Object]
649
675
  # @!attribute [rw] scope
650
676
  # The OAuth scopes
@@ -684,6 +710,11 @@ module Google
684
710
  # default endpoint URL. The default value of nil uses the environment
685
711
  # universe (usually the default "googleapis.com" universe).
686
712
  # @return [::String,nil]
713
+ # @!attribute [rw] logger
714
+ # A custom logger to use for request/response debug logging, or the value
715
+ # `:default` (the default) to construct a default logger, or `nil` to
716
+ # explicitly disable logging.
717
+ # @return [::Logger,:default,nil]
687
718
  #
688
719
  class Configuration
689
720
  extend ::Gapic::Config
@@ -708,6 +739,7 @@ module Google
708
739
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
709
740
  config_attr :quota_project, nil, ::String, nil
710
741
  config_attr :universe_domain, nil, ::String, nil
742
+ config_attr :logger, :default, ::Logger, nil, :default
711
743
 
712
744
  # @private
713
745
  def initialize parent_config = nil