google-cloud-run-v2 0.19.0 → 0.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +31 -21
  3. data/lib/google/cloud/run/v2/builds/client.rb +39 -2
  4. data/lib/google/cloud/run/v2/builds/rest/client.rb +39 -2
  5. data/lib/google/cloud/run/v2/builds/rest/service_stub.rb +22 -8
  6. data/lib/google/cloud/run/v2/executions/client.rb +38 -5
  7. data/lib/google/cloud/run/v2/executions/operations.rb +16 -5
  8. data/lib/google/cloud/run/v2/executions/rest/client.rb +38 -5
  9. data/lib/google/cloud/run/v2/executions/rest/operations.rb +56 -35
  10. data/lib/google/cloud/run/v2/executions/rest/service_stub.rb +46 -26
  11. data/lib/google/cloud/run/v2/jobs/client.rb +40 -10
  12. data/lib/google/cloud/run/v2/jobs/operations.rb +16 -5
  13. data/lib/google/cloud/run/v2/jobs/rest/client.rb +40 -10
  14. data/lib/google/cloud/run/v2/jobs/rest/operations.rb +56 -35
  15. data/lib/google/cloud/run/v2/jobs/rest/service_stub.rb +86 -56
  16. data/lib/google/cloud/run/v2/revisions/client.rb +37 -4
  17. data/lib/google/cloud/run/v2/revisions/operations.rb +16 -5
  18. data/lib/google/cloud/run/v2/revisions/rest/client.rb +37 -4
  19. data/lib/google/cloud/run/v2/revisions/rest/operations.rb +56 -35
  20. data/lib/google/cloud/run/v2/revisions/rest/service_stub.rb +38 -20
  21. data/lib/google/cloud/run/v2/services/client.rb +39 -9
  22. data/lib/google/cloud/run/v2/services/operations.rb +16 -5
  23. data/lib/google/cloud/run/v2/services/rest/client.rb +39 -9
  24. data/lib/google/cloud/run/v2/services/rest/operations.rb +56 -35
  25. data/lib/google/cloud/run/v2/services/rest/service_stub.rb +78 -50
  26. data/lib/google/cloud/run/v2/tasks/client.rb +36 -3
  27. data/lib/google/cloud/run/v2/tasks/rest/client.rb +36 -3
  28. data/lib/google/cloud/run/v2/tasks/rest/service_stub.rb +30 -14
  29. data/lib/google/cloud/run/v2/version.rb +1 -1
  30. data/proto_docs/google/api/client.rb +19 -0
  31. data/proto_docs/google/cloud/run/v2/build.rb +4 -0
  32. data/proto_docs/google/cloud/run/v2/condition.rb +6 -0
  33. data/proto_docs/google/cloud/run/v2/job.rb +4 -0
  34. data/proto_docs/google/cloud/run/v2/k8s.min.rb +20 -0
  35. data/proto_docs/google/cloud/run/v2/vendor_settings.rb +4 -0
  36. data/proto_docs/google/longrunning/operations.rb +4 -0
  37. metadata +6 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3c6af858c63b3a63fbea6bb3837c6e75a4bac406b910fc31f1f27df7f8b7561f
4
- data.tar.gz: f9feb7dab1b2eb43831ec55bdbf53180f0969b451d8fc3a4c048b5991a74ec4f
3
+ metadata.gz: c5cb61d0eae0513846ea6422c8e9db54ff51d2e5ebd7957733d69d0fb681d8bc
4
+ data.tar.gz: 561a17eb0bcbb5299d08620590331e75ced1a61d06fe1a12b02a4ec31499b482
5
5
  SHA512:
6
- metadata.gz: ad39b59087e299ebdeaa858d3377c8d3ed5a114776456b25974344e28f611fca274115c284a93f11fae167e8679371b104af693486cfa95bc86b2149c1fd8540
7
- data.tar.gz: a57ec68e806466cd5388e895116818633242b11002129b53922a1466da79b46c729736887336aa44ed7ee9836fdb61083d429e88800ac972122ae7b7bafb9be8
6
+ metadata.gz: 87afc1e79a2edab8f1aee11fb83668442f0179d513062f545b429bc20c2663baeabc0e554dec8dd8960e3cf1abc795736326d2dfb1b86d4134254b8b77c74a7e
7
+ data.tar.gz: 0e609fc681505eff58e6b7fa9bba3a92d032f18116ef49e0c45aa3fa6014bcc7bf116a29c5cf5e2a1f08e4c849e89aa2501fae60bd55a5cadf73dae087920578
data/README.md CHANGED
@@ -43,40 +43,50 @@ for class and method documentation.
43
43
  See also the [Product Documentation](https://cloud.google.com/run/)
44
44
  for general usage information.
45
45
 
46
- ## Enabling Logging
47
-
48
- To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
49
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
50
- or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
51
- that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
52
- and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
53
-
54
- Configuring a Ruby stdlib logger:
46
+ ## Debug Logging
47
+
48
+ This library comes with opt-in Debug Logging that can help you troubleshoot
49
+ your application's integration with the API. When logging is activated, key
50
+ events such as requests and responses, along with data payloads and metadata
51
+ such as headers and client configuration, are logged to the standard error
52
+ stream.
53
+
54
+ **WARNING:** Client Library Debug Logging includes your data payloads in
55
+ plaintext, which could include sensitive data such as PII for yourself or your
56
+ customers, private keys, or other security data that could be compromising if
57
+ leaked. Always practice good data hygiene with your application logs, and follow
58
+ the principle of least access. Google also recommends that Client Library Debug
59
+ Logging be enabled only temporarily during active debugging, and not used
60
+ permanently in production.
61
+
62
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
63
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
64
+ list of client library gem names. This will select the default logging behavior,
65
+ which writes logs to the standard error stream. On a local workstation, this may
66
+ result in logs appearing on the console. When running on a Google Cloud hosting
67
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
68
+ results in logs appearing alongside your application logs in the
69
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
70
+
71
+ You can customize logging by modifying the `logger` configuration when
72
+ constructing a client object. For example:
55
73
 
56
74
  ```ruby
75
+ require "google/cloud/run/v2"
57
76
  require "logger"
58
77
 
59
- module MyLogger
60
- LOGGER = Logger.new $stderr, level: Logger::WARN
61
- def logger
62
- LOGGER
63
- end
64
- end
65
-
66
- # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
67
- module GRPC
68
- extend MyLogger
78
+ client = ::Google::Cloud::Run::V2::Builds::Client.new do |config|
79
+ config.logger = Logger.new "my-app.log"
69
80
  end
70
81
  ```
71
82
 
72
-
73
83
  ## Google Cloud Samples
74
84
 
75
85
  To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
76
86
 
77
87
  ## Supported Ruby Versions
78
88
 
79
- This library is supported on Ruby 2.7+.
89
+ This library is supported on Ruby 3.0+.
80
90
 
81
91
  Google provides official support for Ruby versions that are actively supported
82
92
  by Ruby Core—that is, Ruby versions that are either in normal maintenance or
@@ -158,14 +158,26 @@ module Google
158
158
  universe_domain: @config.universe_domain,
159
159
  channel_args: @config.channel_args,
160
160
  interceptors: @config.interceptors,
161
- channel_pool_config: @config.channel_pool
161
+ channel_pool_config: @config.channel_pool,
162
+ logger: @config.logger
162
163
  )
163
164
 
165
+ @builds_stub.stub_logger&.info do |entry|
166
+ entry.set_system_name
167
+ entry.set_service
168
+ entry.message = "Created client for #{entry.service}"
169
+ entry.set_credentials_fields credentials
170
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
171
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
172
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
173
+ end
174
+
164
175
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
165
176
  config.credentials = credentials
166
177
  config.quota_project = @quota_project_id
167
178
  config.endpoint = @builds_stub.endpoint
168
179
  config.universe_domain = @builds_stub.universe_domain
180
+ config.logger = @builds_stub.logger if config.respond_to? :logger=
169
181
  end
170
182
  end
171
183
 
@@ -176,6 +188,15 @@ module Google
176
188
  #
177
189
  attr_reader :location_client
178
190
 
191
+ ##
192
+ # The logger used for request/response debug logging.
193
+ #
194
+ # @return [Logger]
195
+ #
196
+ def logger
197
+ @builds_stub.logger
198
+ end
199
+
179
200
  # Service calls
180
201
 
181
202
  ##
@@ -207,8 +228,12 @@ module Google
207
228
  # Required. Artifact Registry URI to store the built image.
208
229
  # @param buildpack_build [::Google::Cloud::Run::V2::SubmitBuildRequest::BuildpacksBuild, ::Hash]
209
230
  # Build the source using Buildpacks.
231
+ #
232
+ # Note: The following fields are mutually exclusive: `buildpack_build`, `docker_build`. If a field in that set is populated, all other fields in the set will automatically be cleared.
210
233
  # @param docker_build [::Google::Cloud::Run::V2::SubmitBuildRequest::DockerBuild, ::Hash]
211
234
  # Build the source using Docker. This means the source has a Dockerfile.
235
+ #
236
+ # Note: The following fields are mutually exclusive: `docker_build`, `buildpack_build`. If a field in that set is populated, all other fields in the set will automatically be cleared.
212
237
  # @param service_account [::String]
213
238
  # Optional. The service account to use for the build. If not set, the default
214
239
  # Cloud Build service account for the project will be used.
@@ -281,7 +306,6 @@ module Google
281
306
 
282
307
  @builds_stub.call_rpc :submit_build, request, options: options do |response, operation|
283
308
  yield response, operation if block_given?
284
- return response
285
309
  end
286
310
  rescue ::GRPC::BadStatus => e
287
311
  raise ::Google::Cloud::Error.from_error(e)
@@ -331,6 +355,13 @@ module Google
331
355
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
332
356
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
333
357
  # * (`nil`) indicating no credentials
358
+ #
359
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
360
+ # external source for authentication to Google Cloud, you must validate it before
361
+ # providing it to a Google API client library. Providing an unvalidated credential
362
+ # configuration to Google APIs can compromise the security of your systems and data.
363
+ # For more information, refer to [Validate credential configurations from external
364
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
334
365
  # @return [::Object]
335
366
  # @!attribute [rw] scope
336
367
  # The OAuth scopes
@@ -370,6 +401,11 @@ module Google
370
401
  # default endpoint URL. The default value of nil uses the environment
371
402
  # universe (usually the default "googleapis.com" universe).
372
403
  # @return [::String,nil]
404
+ # @!attribute [rw] logger
405
+ # A custom logger to use for request/response debug logging, or the value
406
+ # `:default` (the default) to construct a default logger, or `nil` to
407
+ # explicitly disable logging.
408
+ # @return [::Logger,:default,nil]
373
409
  #
374
410
  class Configuration
375
411
  extend ::Gapic::Config
@@ -394,6 +430,7 @@ module Google
394
430
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
395
431
  config_attr :quota_project, nil, ::String, nil
396
432
  config_attr :universe_domain, nil, ::String, nil
433
+ config_attr :logger, :default, ::Logger, nil, :default
397
434
 
398
435
  # @private
399
436
  def initialize parent_config = nil
@@ -151,14 +151,26 @@ module Google
151
151
  endpoint: @config.endpoint,
152
152
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
153
153
  universe_domain: @config.universe_domain,
154
- credentials: credentials
154
+ credentials: credentials,
155
+ logger: @config.logger
155
156
  )
156
157
 
158
+ @builds_stub.logger(stub: true)&.info do |entry|
159
+ entry.set_system_name
160
+ entry.set_service
161
+ entry.message = "Created client for #{entry.service}"
162
+ entry.set_credentials_fields credentials
163
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
164
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
165
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
166
+ end
167
+
157
168
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
158
169
  config.credentials = credentials
159
170
  config.quota_project = @quota_project_id
160
171
  config.endpoint = @builds_stub.endpoint
161
172
  config.universe_domain = @builds_stub.universe_domain
173
+ config.logger = @builds_stub.logger if config.respond_to? :logger=
162
174
  end
163
175
  end
164
176
 
@@ -169,6 +181,15 @@ module Google
169
181
  #
170
182
  attr_reader :location_client
171
183
 
184
+ ##
185
+ # The logger used for request/response debug logging.
186
+ #
187
+ # @return [Logger]
188
+ #
189
+ def logger
190
+ @builds_stub.logger
191
+ end
192
+
172
193
  # Service calls
173
194
 
174
195
  ##
@@ -200,8 +221,12 @@ module Google
200
221
  # Required. Artifact Registry URI to store the built image.
201
222
  # @param buildpack_build [::Google::Cloud::Run::V2::SubmitBuildRequest::BuildpacksBuild, ::Hash]
202
223
  # Build the source using Buildpacks.
224
+ #
225
+ # Note: The following fields are mutually exclusive: `buildpack_build`, `docker_build`. If a field in that set is populated, all other fields in the set will automatically be cleared.
203
226
  # @param docker_build [::Google::Cloud::Run::V2::SubmitBuildRequest::DockerBuild, ::Hash]
204
227
  # Build the source using Docker. This means the source has a Dockerfile.
228
+ #
229
+ # Note: The following fields are mutually exclusive: `docker_build`, `buildpack_build`. If a field in that set is populated, all other fields in the set will automatically be cleared.
205
230
  # @param service_account [::String]
206
231
  # Optional. The service account to use for the build. If not set, the default
207
232
  # Cloud Build service account for the project will be used.
@@ -267,7 +292,6 @@ module Google
267
292
 
268
293
  @builds_stub.submit_build request, options do |result, operation|
269
294
  yield result, operation if block_given?
270
- return result
271
295
  end
272
296
  rescue ::Gapic::Rest::Error => e
273
297
  raise ::Google::Cloud::Error.from_error(e)
@@ -315,6 +339,13 @@ module Google
315
339
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
316
340
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
317
341
  # * (`nil`) indicating no credentials
342
+ #
343
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
344
+ # external source for authentication to Google Cloud, you must validate it before
345
+ # providing it to a Google API client library. Providing an unvalidated credential
346
+ # configuration to Google APIs can compromise the security of your systems and data.
347
+ # For more information, refer to [Validate credential configurations from external
348
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
318
349
  # @return [::Object]
319
350
  # @!attribute [rw] scope
320
351
  # The OAuth scopes
@@ -347,6 +378,11 @@ module Google
347
378
  # default endpoint URL. The default value of nil uses the environment
348
379
  # universe (usually the default "googleapis.com" universe).
349
380
  # @return [::String,nil]
381
+ # @!attribute [rw] logger
382
+ # A custom logger to use for request/response debug logging, or the value
383
+ # `:default` (the default) to construct a default logger, or `nil` to
384
+ # explicitly disable logging.
385
+ # @return [::Logger,:default,nil]
350
386
  #
351
387
  class Configuration
352
388
  extend ::Gapic::Config
@@ -368,6 +404,7 @@ module Google
368
404
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
369
405
  config_attr :quota_project, nil, ::String, nil
370
406
  config_attr :universe_domain, nil, ::String, nil
407
+ config_attr :logger, :default, ::Logger, nil, :default
371
408
 
372
409
  # @private
373
410
  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 submit_build 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: "submit_build",
93
106
  options: options
94
107
  )
95
108
  operation = ::Gapic::Rest::TransportOperation.new response
96
109
  result = ::Google::Cloud::Run::V2::SubmitBuildResponse.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
  ##
@@ -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
+ @executions_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
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
172
183
  config.credentials = credentials
173
184
  config.quota_project = @quota_project_id
174
185
  config.endpoint = @executions_stub.endpoint
175
186
  config.universe_domain = @executions_stub.universe_domain
187
+ config.logger = @executions_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 :location_client
192
204
 
205
+ ##
206
+ # The logger used for request/response debug logging.
207
+ #
208
+ # @return [Logger]
209
+ #
210
+ def logger
211
+ @executions_stub.logger
212
+ end
213
+
193
214
  # Service calls
194
215
 
195
216
  ##
@@ -275,7 +296,6 @@ module Google
275
296
 
276
297
  @executions_stub.call_rpc :get_execution, request, options: options do |response, operation|
277
298
  yield response, operation if block_given?
278
- return response
279
299
  end
280
300
  rescue ::GRPC::BadStatus => e
281
301
  raise ::Google::Cloud::Error.from_error(e)
@@ -377,7 +397,7 @@ module Google
377
397
  @executions_stub.call_rpc :list_executions, request, options: options do |response, operation|
378
398
  response = ::Gapic::PagedEnumerable.new @executions_stub, :list_executions, request, response, operation, options
379
399
  yield response, operation if block_given?
380
- return response
400
+ throw :response, response
381
401
  end
382
402
  rescue ::GRPC::BadStatus => e
383
403
  raise ::Google::Cloud::Error.from_error(e)
@@ -480,7 +500,7 @@ module Google
480
500
  @executions_stub.call_rpc :delete_execution, request, options: options do |response, operation|
481
501
  response = ::Gapic::Operation.new response, @operations_client, options: options
482
502
  yield response, operation if block_given?
483
- return response
503
+ throw :response, response
484
504
  end
485
505
  rescue ::GRPC::BadStatus => e
486
506
  raise ::Google::Cloud::Error.from_error(e)
@@ -583,7 +603,7 @@ module Google
583
603
  @executions_stub.call_rpc :cancel_execution, request, options: options do |response, operation|
584
604
  response = ::Gapic::Operation.new response, @operations_client, options: options
585
605
  yield response, operation if block_given?
586
- return response
606
+ throw :response, response
587
607
  end
588
608
  rescue ::GRPC::BadStatus => e
589
609
  raise ::Google::Cloud::Error.from_error(e)
@@ -633,6 +653,13 @@ module Google
633
653
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
634
654
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
635
655
  # * (`nil`) indicating no credentials
656
+ #
657
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
658
+ # external source for authentication to Google Cloud, you must validate it before
659
+ # providing it to a Google API client library. Providing an unvalidated credential
660
+ # configuration to Google APIs can compromise the security of your systems and data.
661
+ # For more information, refer to [Validate credential configurations from external
662
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
636
663
  # @return [::Object]
637
664
  # @!attribute [rw] scope
638
665
  # The OAuth scopes
@@ -672,6 +699,11 @@ module Google
672
699
  # default endpoint URL. The default value of nil uses the environment
673
700
  # universe (usually the default "googleapis.com" universe).
674
701
  # @return [::String,nil]
702
+ # @!attribute [rw] logger
703
+ # A custom logger to use for request/response debug logging, or the value
704
+ # `:default` (the default) to construct a default logger, or `nil` to
705
+ # explicitly disable logging.
706
+ # @return [::Logger,:default,nil]
675
707
  #
676
708
  class Configuration
677
709
  extend ::Gapic::Config
@@ -696,6 +728,7 @@ module Google
696
728
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
697
729
  config_attr :quota_project, nil, ::String, nil
698
730
  config_attr :universe_domain, nil, ::String, nil
731
+ config_attr :logger, :default, ::Logger, nil, :default
699
732
 
700
733
  # @private
701
734
  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)
@@ -600,7 +598,7 @@ module Google
600
598
  @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
601
599
  response = ::Gapic::Operation.new response, @operations_client, options: options
602
600
  yield response, operation if block_given?
603
- return response
601
+ throw :response, response
604
602
  end
605
603
  rescue ::GRPC::BadStatus => e
606
604
  raise ::Google::Cloud::Error.from_error(e)
@@ -650,6 +648,13 @@ module Google
650
648
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
651
649
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
652
650
  # * (`nil`) indicating no credentials
651
+ #
652
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
653
+ # external source for authentication to Google Cloud, you must validate it before
654
+ # providing it to a Google API client library. Providing an unvalidated credential
655
+ # configuration to Google APIs can compromise the security of your systems and data.
656
+ # For more information, refer to [Validate credential configurations from external
657
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
653
658
  # @return [::Object]
654
659
  # @!attribute [rw] scope
655
660
  # The OAuth scopes
@@ -689,6 +694,11 @@ module Google
689
694
  # default endpoint URL. The default value of nil uses the environment
690
695
  # universe (usually the default "googleapis.com" universe).
691
696
  # @return [::String,nil]
697
+ # @!attribute [rw] logger
698
+ # A custom logger to use for request/response debug logging, or the value
699
+ # `:default` (the default) to construct a default logger, or `nil` to
700
+ # explicitly disable logging.
701
+ # @return [::Logger,:default,nil]
692
702
  #
693
703
  class Configuration
694
704
  extend ::Gapic::Config
@@ -713,6 +723,7 @@ module Google
713
723
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
714
724
  config_attr :quota_project, nil, ::String, nil
715
725
  config_attr :universe_domain, nil, ::String, nil
726
+ config_attr :logger, :default, ::Logger, nil, :default
716
727
 
717
728
  # @private
718
729
  def initialize parent_config = nil
@@ -158,14 +158,26 @@ module Google
158
158
  endpoint: @config.endpoint,
159
159
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
160
160
  universe_domain: @config.universe_domain,
161
- credentials: credentials
161
+ credentials: credentials,
162
+ logger: @config.logger
162
163
  )
163
164
 
165
+ @executions_stub.logger(stub: true)&.info do |entry|
166
+ entry.set_system_name
167
+ entry.set_service
168
+ entry.message = "Created client for #{entry.service}"
169
+ entry.set_credentials_fields credentials
170
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
171
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
172
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
173
+ end
174
+
164
175
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
165
176
  config.credentials = credentials
166
177
  config.quota_project = @quota_project_id
167
178
  config.endpoint = @executions_stub.endpoint
168
179
  config.universe_domain = @executions_stub.universe_domain
180
+ config.logger = @executions_stub.logger if config.respond_to? :logger=
169
181
  end
170
182
  end
171
183
 
@@ -183,6 +195,15 @@ module Google
183
195
  #
184
196
  attr_reader :location_client
185
197
 
198
+ ##
199
+ # The logger used for request/response debug logging.
200
+ #
201
+ # @return [Logger]
202
+ #
203
+ def logger
204
+ @executions_stub.logger
205
+ end
206
+
186
207
  # Service calls
187
208
 
188
209
  ##
@@ -261,7 +282,6 @@ module Google
261
282
 
262
283
  @executions_stub.get_execution request, options do |result, operation|
263
284
  yield result, operation if block_given?
264
- return result
265
285
  end
266
286
  rescue ::Gapic::Rest::Error => e
267
287
  raise ::Google::Cloud::Error.from_error(e)
@@ -356,7 +376,7 @@ module Google
356
376
  @executions_stub.list_executions request, options do |result, operation|
357
377
  result = ::Gapic::Rest::PagedEnumerable.new @executions_stub, :list_executions, "executions", request, result, options
358
378
  yield result, operation if block_given?
359
- return result
379
+ throw :response, result
360
380
  end
361
381
  rescue ::Gapic::Rest::Error => e
362
382
  raise ::Google::Cloud::Error.from_error(e)
@@ -452,7 +472,7 @@ module Google
452
472
  @executions_stub.delete_execution request, options do |result, operation|
453
473
  result = ::Gapic::Operation.new result, @operations_client, options: options
454
474
  yield result, operation if block_given?
455
- return result
475
+ throw :response, result
456
476
  end
457
477
  rescue ::Gapic::Rest::Error => e
458
478
  raise ::Google::Cloud::Error.from_error(e)
@@ -548,7 +568,7 @@ module Google
548
568
  @executions_stub.cancel_execution request, options do |result, operation|
549
569
  result = ::Gapic::Operation.new result, @operations_client, options: options
550
570
  yield result, operation if block_given?
551
- return result
571
+ throw :response, result
552
572
  end
553
573
  rescue ::Gapic::Rest::Error => e
554
574
  raise ::Google::Cloud::Error.from_error(e)
@@ -596,6 +616,13 @@ module Google
596
616
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
597
617
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
598
618
  # * (`nil`) indicating no credentials
619
+ #
620
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
621
+ # external source for authentication to Google Cloud, you must validate it before
622
+ # providing it to a Google API client library. Providing an unvalidated credential
623
+ # configuration to Google APIs can compromise the security of your systems and data.
624
+ # For more information, refer to [Validate credential configurations from external
625
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
599
626
  # @return [::Object]
600
627
  # @!attribute [rw] scope
601
628
  # The OAuth scopes
@@ -628,6 +655,11 @@ module Google
628
655
  # default endpoint URL. The default value of nil uses the environment
629
656
  # universe (usually the default "googleapis.com" universe).
630
657
  # @return [::String,nil]
658
+ # @!attribute [rw] logger
659
+ # A custom logger to use for request/response debug logging, or the value
660
+ # `:default` (the default) to construct a default logger, or `nil` to
661
+ # explicitly disable logging.
662
+ # @return [::Logger,:default,nil]
631
663
  #
632
664
  class Configuration
633
665
  extend ::Gapic::Config
@@ -649,6 +681,7 @@ module Google
649
681
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
650
682
  config_attr :quota_project, nil, ::String, nil
651
683
  config_attr :universe_domain, nil, ::String, nil
684
+ config_attr :logger, :default, ::Logger, nil, :default
652
685
 
653
686
  # @private
654
687
  def initialize parent_config = nil