google-cloud-run-v2 0.18.0 → 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +30 -20
- data/lib/google/cloud/run/v2/builds/client.rb +28 -2
- data/lib/google/cloud/run/v2/builds/rest/client.rb +28 -2
- data/lib/google/cloud/run/v2/builds/rest/service_stub.rb +22 -8
- data/lib/google/cloud/run/v2/executions/client.rb +31 -5
- data/lib/google/cloud/run/v2/executions/operations.rb +12 -15
- data/lib/google/cloud/run/v2/executions/rest/client.rb +31 -5
- data/lib/google/cloud/run/v2/executions/rest/operations.rb +52 -45
- data/lib/google/cloud/run/v2/executions/rest/service_stub.rb +46 -26
- data/lib/google/cloud/run/v2/jobs/client.rb +33 -10
- data/lib/google/cloud/run/v2/jobs/operations.rb +12 -15
- data/lib/google/cloud/run/v2/jobs/rest/client.rb +33 -10
- data/lib/google/cloud/run/v2/jobs/rest/operations.rb +52 -45
- data/lib/google/cloud/run/v2/jobs/rest/service_stub.rb +86 -56
- data/lib/google/cloud/run/v2/revisions/client.rb +30 -4
- data/lib/google/cloud/run/v2/revisions/operations.rb +12 -15
- data/lib/google/cloud/run/v2/revisions/rest/client.rb +30 -4
- data/lib/google/cloud/run/v2/revisions/rest/operations.rb +52 -45
- data/lib/google/cloud/run/v2/revisions/rest/service_stub.rb +38 -20
- data/lib/google/cloud/run/v2/services/client.rb +32 -9
- data/lib/google/cloud/run/v2/services/operations.rb +12 -15
- data/lib/google/cloud/run/v2/services/rest/client.rb +32 -9
- data/lib/google/cloud/run/v2/services/rest/operations.rb +52 -45
- data/lib/google/cloud/run/v2/services/rest/service_stub.rb +78 -50
- data/lib/google/cloud/run/v2/tasks/client.rb +29 -3
- data/lib/google/cloud/run/v2/tasks/rest/client.rb +29 -3
- data/lib/google/cloud/run/v2/tasks/rest/service_stub.rb +30 -14
- data/lib/google/cloud/run/v2/vendor_settings_pb.rb +1 -1
- data/lib/google/cloud/run/v2/version.rb +1 -1
- data/proto_docs/google/api/client.rb +19 -0
- data/proto_docs/google/cloud/run/v2/vendor_settings.rb +5 -0
- data/proto_docs/google/longrunning/operations.rb +19 -14
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fac32110a0a0c6a25e14755da7f15241364bfa6e6d309c830d323abd6b06dfb
|
4
|
+
data.tar.gz: 5a624ead025420acb5d8c27ae818f840a50a8e6c3e47eb56420f0ea70a289425
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5960d1cbff1d9d0a92407a5e20e3cf8487866028776676631935add4f118c5cf95863983f62250fff97e494f96e658a6f137fdb0a8f8ffc09a6d0c7b48823f9d
|
7
|
+
data.tar.gz: 8a6a8e8012374c13d080b0aafcc2a99474f7b2d92fbcb14f3a0e0456496351d5c83a712e7d30af66cabb043f3d865003d112f434d3ccb940be5f89840408a247
|
data/README.md
CHANGED
@@ -43,33 +43,43 @@ 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
|
-
##
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
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
|
-
|
60
|
-
|
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).
|
@@ -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
|
##
|
@@ -281,7 +302,6 @@ module Google
|
|
281
302
|
|
282
303
|
@builds_stub.call_rpc :submit_build, request, options: options do |response, operation|
|
283
304
|
yield response, operation if block_given?
|
284
|
-
return response
|
285
305
|
end
|
286
306
|
rescue ::GRPC::BadStatus => e
|
287
307
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -370,6 +390,11 @@ module Google
|
|
370
390
|
# default endpoint URL. The default value of nil uses the environment
|
371
391
|
# universe (usually the default "googleapis.com" universe).
|
372
392
|
# @return [::String,nil]
|
393
|
+
# @!attribute [rw] logger
|
394
|
+
# A custom logger to use for request/response debug logging, or the value
|
395
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
396
|
+
# explicitly disable logging.
|
397
|
+
# @return [::Logger,:default,nil]
|
373
398
|
#
|
374
399
|
class Configuration
|
375
400
|
extend ::Gapic::Config
|
@@ -394,6 +419,7 @@ module Google
|
|
394
419
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
395
420
|
config_attr :quota_project, nil, ::String, nil
|
396
421
|
config_attr :universe_domain, nil, ::String, nil
|
422
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
397
423
|
|
398
424
|
# @private
|
399
425
|
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
|
##
|
@@ -267,7 +288,6 @@ module Google
|
|
267
288
|
|
268
289
|
@builds_stub.submit_build request, options do |result, operation|
|
269
290
|
yield result, operation if block_given?
|
270
|
-
return result
|
271
291
|
end
|
272
292
|
rescue ::Gapic::Rest::Error => e
|
273
293
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -347,6 +367,11 @@ module Google
|
|
347
367
|
# default endpoint URL. The default value of nil uses the environment
|
348
368
|
# universe (usually the default "googleapis.com" universe).
|
349
369
|
# @return [::String,nil]
|
370
|
+
# @!attribute [rw] logger
|
371
|
+
# A custom logger to use for request/response debug logging, or the value
|
372
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
373
|
+
# explicitly disable logging.
|
374
|
+
# @return [::Logger,:default,nil]
|
350
375
|
#
|
351
376
|
class Configuration
|
352
377
|
extend ::Gapic::Config
|
@@ -368,6 +393,7 @@ module Google
|
|
368
393
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
369
394
|
config_attr :quota_project, nil, ::String, nil
|
370
395
|
config_attr :universe_domain, nil, ::String, nil
|
396
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
371
397
|
|
372
398
|
# @private
|
373
399
|
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
|
-
|
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
|
-
|
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:
|
91
|
-
body:
|
92
|
-
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
|
-
|
99
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
606
|
+
throw :response, response
|
587
607
|
end
|
588
608
|
rescue ::GRPC::BadStatus => e
|
589
609
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -672,6 +692,11 @@ module Google
|
|
672
692
|
# default endpoint URL. The default value of nil uses the environment
|
673
693
|
# universe (usually the default "googleapis.com" universe).
|
674
694
|
# @return [::String,nil]
|
695
|
+
# @!attribute [rw] logger
|
696
|
+
# A custom logger to use for request/response debug logging, or the value
|
697
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
698
|
+
# explicitly disable logging.
|
699
|
+
# @return [::Logger,:default,nil]
|
675
700
|
#
|
676
701
|
class Configuration
|
677
702
|
extend ::Gapic::Config
|
@@ -696,6 +721,7 @@ module Google
|
|
696
721
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
697
722
|
config_attr :quota_project, nil, ::String, nil
|
698
723
|
config_attr :universe_domain, nil, ::String, nil
|
724
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
699
725
|
|
700
726
|
# @private
|
701
727
|
def initialize parent_config = nil
|
@@ -124,14 +124,6 @@ module Google
|
|
124
124
|
# Lists operations that match the specified filter in the request. If the
|
125
125
|
# server doesn't support this method, it returns `UNIMPLEMENTED`.
|
126
126
|
#
|
127
|
-
# NOTE: the `name` binding allows API services to override the binding
|
128
|
-
# to use different resource name schemes, such as `users/*/operations`. To
|
129
|
-
# override the binding, API services can add a binding such as
|
130
|
-
# `"/v1/{name=users/*}/operations"` to their service configuration.
|
131
|
-
# For backwards compatibility, the default name includes the operations
|
132
|
-
# collection id, however overriding users must ensure the name binding
|
133
|
-
# is the parent resource, without the operations collection id.
|
134
|
-
#
|
135
127
|
# @overload list_operations(request, options = nil)
|
136
128
|
# Pass arguments to `list_operations` via a request object, either of type
|
137
129
|
# {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
|
@@ -221,7 +213,7 @@ module Google
|
|
221
213
|
wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
|
222
214
|
response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
|
223
215
|
yield response, operation if block_given?
|
224
|
-
|
216
|
+
throw :response, response
|
225
217
|
end
|
226
218
|
rescue ::GRPC::BadStatus => e
|
227
219
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -317,7 +309,7 @@ module Google
|
|
317
309
|
@operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
|
318
310
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
319
311
|
yield response, operation if block_given?
|
320
|
-
|
312
|
+
throw :response, response
|
321
313
|
end
|
322
314
|
rescue ::GRPC::BadStatus => e
|
323
315
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -406,7 +398,6 @@ module Google
|
|
406
398
|
|
407
399
|
@operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
|
408
400
|
yield response, operation if block_given?
|
409
|
-
return response
|
410
401
|
end
|
411
402
|
rescue ::GRPC::BadStatus => e
|
412
403
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -421,8 +412,9 @@ module Google
|
|
421
412
|
# other methods to check whether the cancellation succeeded or whether the
|
422
413
|
# operation completed despite cancellation. On successful cancellation,
|
423
414
|
# the operation is not deleted; instead, it becomes an operation with
|
424
|
-
# an {::Google::Longrunning::Operation#error Operation.error} value with a
|
425
|
-
# corresponding to
|
415
|
+
# an {::Google::Longrunning::Operation#error Operation.error} value with a
|
416
|
+
# {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
|
417
|
+
# `Code.CANCELLED`.
|
426
418
|
#
|
427
419
|
# @overload cancel_operation(request, options = nil)
|
428
420
|
# Pass arguments to `cancel_operation` via a request object, either of type
|
@@ -501,7 +493,6 @@ module Google
|
|
501
493
|
|
502
494
|
@operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
|
503
495
|
yield response, operation if block_given?
|
504
|
-
return response
|
505
496
|
end
|
506
497
|
rescue ::GRPC::BadStatus => e
|
507
498
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -607,7 +598,7 @@ module Google
|
|
607
598
|
@operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
|
608
599
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
609
600
|
yield response, operation if block_given?
|
610
|
-
|
601
|
+
throw :response, response
|
611
602
|
end
|
612
603
|
rescue ::GRPC::BadStatus => e
|
613
604
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -696,6 +687,11 @@ module Google
|
|
696
687
|
# default endpoint URL. The default value of nil uses the environment
|
697
688
|
# universe (usually the default "googleapis.com" universe).
|
698
689
|
# @return [::String,nil]
|
690
|
+
# @!attribute [rw] logger
|
691
|
+
# A custom logger to use for request/response debug logging, or the value
|
692
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
693
|
+
# explicitly disable logging.
|
694
|
+
# @return [::Logger,:default,nil]
|
699
695
|
#
|
700
696
|
class Configuration
|
701
697
|
extend ::Gapic::Config
|
@@ -720,6 +716,7 @@ module Google
|
|
720
716
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
721
717
|
config_attr :quota_project, nil, ::String, nil
|
722
718
|
config_attr :universe_domain, nil, ::String, nil
|
719
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
723
720
|
|
724
721
|
# @private
|
725
722
|
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
|
-
|
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
|
-
|
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
|
-
|
571
|
+
throw :response, result
|
552
572
|
end
|
553
573
|
rescue ::Gapic::Rest::Error => e
|
554
574
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -628,6 +648,11 @@ module Google
|
|
628
648
|
# default endpoint URL. The default value of nil uses the environment
|
629
649
|
# universe (usually the default "googleapis.com" universe).
|
630
650
|
# @return [::String,nil]
|
651
|
+
# @!attribute [rw] logger
|
652
|
+
# A custom logger to use for request/response debug logging, or the value
|
653
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
654
|
+
# explicitly disable logging.
|
655
|
+
# @return [::Logger,:default,nil]
|
631
656
|
#
|
632
657
|
class Configuration
|
633
658
|
extend ::Gapic::Config
|
@@ -649,6 +674,7 @@ module Google
|
|
649
674
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
650
675
|
config_attr :quota_project, nil, ::String, nil
|
651
676
|
config_attr :universe_domain, nil, ::String, nil
|
677
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
652
678
|
|
653
679
|
# @private
|
654
680
|
def initialize parent_config = nil
|