google-cloud-app_engine-v1 1.0.1 → 1.1.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/app_engine/v1/applications/client.rb +30 -5
- data/lib/google/cloud/app_engine/v1/applications/operations.rb +12 -15
- data/lib/google/cloud/app_engine/v1/applications/rest/client.rb +30 -5
- data/lib/google/cloud/app_engine/v1/applications/rest/operations.rb +43 -38
- data/lib/google/cloud/app_engine/v1/applications/rest/service_stub.rb +46 -26
- data/lib/google/cloud/app_engine/v1/authorized_certificates/client.rb +28 -6
- data/lib/google/cloud/app_engine/v1/authorized_certificates/rest/client.rb +28 -6
- data/lib/google/cloud/app_engine/v1/authorized_certificates/rest/service_stub.rb +54 -32
- data/lib/google/cloud/app_engine/v1/authorized_domains/client.rb +28 -2
- data/lib/google/cloud/app_engine/v1/authorized_domains/rest/client.rb +28 -2
- data/lib/google/cloud/app_engine/v1/authorized_domains/rest/service_stub.rb +22 -8
- data/lib/google/cloud/app_engine/v1/domain_mappings/client.rb +31 -6
- data/lib/google/cloud/app_engine/v1/domain_mappings/operations.rb +12 -15
- data/lib/google/cloud/app_engine/v1/domain_mappings/rest/client.rb +31 -6
- data/lib/google/cloud/app_engine/v1/domain_mappings/rest/operations.rb +43 -38
- data/lib/google/cloud/app_engine/v1/domain_mappings/rest/service_stub.rb +54 -32
- data/lib/google/cloud/app_engine/v1/firewall/client.rb +28 -7
- data/lib/google/cloud/app_engine/v1/firewall/rest/client.rb +28 -7
- data/lib/google/cloud/app_engine/v1/firewall/rest/service_stub.rb +62 -38
- data/lib/google/cloud/app_engine/v1/instances/client.rb +30 -5
- data/lib/google/cloud/app_engine/v1/instances/operations.rb +12 -15
- data/lib/google/cloud/app_engine/v1/instances/rest/client.rb +30 -5
- data/lib/google/cloud/app_engine/v1/instances/rest/operations.rb +43 -38
- data/lib/google/cloud/app_engine/v1/instances/rest/service_stub.rb +46 -26
- data/lib/google/cloud/app_engine/v1/services/client.rb +30 -5
- data/lib/google/cloud/app_engine/v1/services/operations.rb +12 -15
- data/lib/google/cloud/app_engine/v1/services/rest/client.rb +30 -5
- data/lib/google/cloud/app_engine/v1/services/rest/operations.rb +43 -38
- data/lib/google/cloud/app_engine/v1/services/rest/service_stub.rb +46 -26
- data/lib/google/cloud/app_engine/v1/version.rb +1 -1
- data/lib/google/cloud/app_engine/v1/versions/client.rb +31 -6
- data/lib/google/cloud/app_engine/v1/versions/operations.rb +12 -15
- data/lib/google/cloud/app_engine/v1/versions/rest/client.rb +31 -6
- data/lib/google/cloud/app_engine/v1/versions/rest/operations.rb +43 -38
- data/lib/google/cloud/app_engine/v1/versions/rest/service_stub.rb +54 -32
- data/proto_docs/google/api/client.rb +39 -0
- data/proto_docs/google/longrunning/operations.rb +19 -14
- metadata +5 -5
@@ -157,8 +157,28 @@ module Google
|
|
157
157
|
endpoint: @config.endpoint,
|
158
158
|
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
159
159
|
universe_domain: @config.universe_domain,
|
160
|
-
credentials: credentials
|
160
|
+
credentials: credentials,
|
161
|
+
logger: @config.logger
|
161
162
|
)
|
163
|
+
|
164
|
+
@firewall_stub.logger(stub: true)&.info do |entry|
|
165
|
+
entry.set_system_name
|
166
|
+
entry.set_service
|
167
|
+
entry.message = "Created client for #{entry.service}"
|
168
|
+
entry.set_credentials_fields credentials
|
169
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
170
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
171
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
##
|
176
|
+
# The logger used for request/response debug logging.
|
177
|
+
#
|
178
|
+
# @return [Logger]
|
179
|
+
#
|
180
|
+
def logger
|
181
|
+
@firewall_stub.logger
|
162
182
|
end
|
163
183
|
|
164
184
|
# Service calls
|
@@ -250,7 +270,7 @@ module Google
|
|
250
270
|
@firewall_stub.list_ingress_rules request, options do |result, operation|
|
251
271
|
result = ::Gapic::Rest::PagedEnumerable.new @firewall_stub, :list_ingress_rules, "ingress_rules", request, result, options
|
252
272
|
yield result, operation if block_given?
|
253
|
-
|
273
|
+
throw :response, result
|
254
274
|
end
|
255
275
|
rescue ::Gapic::Rest::Error => e
|
256
276
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -336,7 +356,6 @@ module Google
|
|
336
356
|
|
337
357
|
@firewall_stub.batch_update_ingress_rules request, options do |result, operation|
|
338
358
|
yield result, operation if block_given?
|
339
|
-
return result
|
340
359
|
end
|
341
360
|
rescue ::Gapic::Rest::Error => e
|
342
361
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -427,7 +446,6 @@ module Google
|
|
427
446
|
|
428
447
|
@firewall_stub.create_ingress_rule request, options do |result, operation|
|
429
448
|
yield result, operation if block_given?
|
430
|
-
return result
|
431
449
|
end
|
432
450
|
rescue ::Gapic::Rest::Error => e
|
433
451
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -507,7 +525,6 @@ module Google
|
|
507
525
|
|
508
526
|
@firewall_stub.get_ingress_rule request, options do |result, operation|
|
509
527
|
yield result, operation if block_given?
|
510
|
-
return result
|
511
528
|
end
|
512
529
|
rescue ::Gapic::Rest::Error => e
|
513
530
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -591,7 +608,6 @@ module Google
|
|
591
608
|
|
592
609
|
@firewall_stub.update_ingress_rule request, options do |result, operation|
|
593
610
|
yield result, operation if block_given?
|
594
|
-
return result
|
595
611
|
end
|
596
612
|
rescue ::Gapic::Rest::Error => e
|
597
613
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -671,7 +687,6 @@ module Google
|
|
671
687
|
|
672
688
|
@firewall_stub.delete_ingress_rule request, options do |result, operation|
|
673
689
|
yield result, operation if block_given?
|
674
|
-
return result
|
675
690
|
end
|
676
691
|
rescue ::Gapic::Rest::Error => e
|
677
692
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -751,6 +766,11 @@ module Google
|
|
751
766
|
# default endpoint URL. The default value of nil uses the environment
|
752
767
|
# universe (usually the default "googleapis.com" universe).
|
753
768
|
# @return [::String,nil]
|
769
|
+
# @!attribute [rw] logger
|
770
|
+
# A custom logger to use for request/response debug logging, or the value
|
771
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
772
|
+
# explicitly disable logging.
|
773
|
+
# @return [::Logger,:default,nil]
|
754
774
|
#
|
755
775
|
class Configuration
|
756
776
|
extend ::Gapic::Config
|
@@ -772,6 +792,7 @@ module Google
|
|
772
792
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
773
793
|
config_attr :quota_project, nil, ::String, nil
|
774
794
|
config_attr :universe_domain, nil, ::String, nil
|
795
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
775
796
|
|
776
797
|
# @private
|
777
798
|
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 list_ingress_rules 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: "list_ingress_rules",
|
93
106
|
options: options
|
94
107
|
)
|
95
108
|
operation = ::Gapic::Rest::TransportOperation.new response
|
96
109
|
result = ::Google::Cloud::AppEngine::V1::ListIngressRulesResponse.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
|
##
|
@@ -125,16 +139,18 @@ module Google
|
|
125
139
|
|
126
140
|
response = @client_stub.make_http_request(
|
127
141
|
verb,
|
128
|
-
uri:
|
129
|
-
body:
|
130
|
-
params:
|
142
|
+
uri: uri,
|
143
|
+
body: body || "",
|
144
|
+
params: query_string_params,
|
145
|
+
method_name: "batch_update_ingress_rules",
|
131
146
|
options: options
|
132
147
|
)
|
133
148
|
operation = ::Gapic::Rest::TransportOperation.new response
|
134
149
|
result = ::Google::Cloud::AppEngine::V1::BatchUpdateIngressRulesResponse.decode_json response.body, ignore_unknown_fields: true
|
135
|
-
|
136
|
-
|
137
|
-
|
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:
|
167
|
-
body:
|
168
|
-
params:
|
182
|
+
uri: uri,
|
183
|
+
body: body || "",
|
184
|
+
params: query_string_params,
|
185
|
+
method_name: "create_ingress_rule",
|
169
186
|
options: options
|
170
187
|
)
|
171
188
|
operation = ::Gapic::Rest::TransportOperation.new response
|
172
189
|
result = ::Google::Cloud::AppEngine::V1::FirewallRule.decode_json response.body, ignore_unknown_fields: true
|
173
|
-
|
174
|
-
|
175
|
-
|
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:
|
205
|
-
body:
|
206
|
-
params:
|
222
|
+
uri: uri,
|
223
|
+
body: body || "",
|
224
|
+
params: query_string_params,
|
225
|
+
method_name: "get_ingress_rule",
|
207
226
|
options: options
|
208
227
|
)
|
209
228
|
operation = ::Gapic::Rest::TransportOperation.new response
|
210
229
|
result = ::Google::Cloud::AppEngine::V1::FirewallRule.decode_json response.body, ignore_unknown_fields: true
|
211
|
-
|
212
|
-
|
213
|
-
|
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:
|
243
|
-
body:
|
244
|
-
params:
|
262
|
+
uri: uri,
|
263
|
+
body: body || "",
|
264
|
+
params: query_string_params,
|
265
|
+
method_name: "update_ingress_rule",
|
245
266
|
options: options
|
246
267
|
)
|
247
268
|
operation = ::Gapic::Rest::TransportOperation.new response
|
248
269
|
result = ::Google::Cloud::AppEngine::V1::FirewallRule.decode_json response.body, ignore_unknown_fields: true
|
249
|
-
|
250
|
-
|
251
|
-
|
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:
|
281
|
-
body:
|
282
|
-
params:
|
302
|
+
uri: uri,
|
303
|
+
body: body || "",
|
304
|
+
params: query_string_params,
|
305
|
+
method_name: "delete_ingress_rule",
|
283
306
|
options: options
|
284
307
|
)
|
285
308
|
operation = ::Gapic::Rest::TransportOperation.new response
|
286
309
|
result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
|
287
|
-
|
288
|
-
|
289
|
-
|
310
|
+
catch :response do
|
311
|
+
yield result, operation if block_given?
|
312
|
+
result
|
313
|
+
end
|
290
314
|
end
|
291
315
|
|
292
316
|
##
|
@@ -162,8 +162,19 @@ module Google
|
|
162
162
|
universe_domain: @config.universe_domain,
|
163
163
|
channel_args: @config.channel_args,
|
164
164
|
interceptors: @config.interceptors,
|
165
|
-
channel_pool_config: @config.channel_pool
|
165
|
+
channel_pool_config: @config.channel_pool,
|
166
|
+
logger: @config.logger
|
166
167
|
)
|
168
|
+
|
169
|
+
@instances_stub.stub_logger&.info do |entry|
|
170
|
+
entry.set_system_name
|
171
|
+
entry.set_service
|
172
|
+
entry.message = "Created client for #{entry.service}"
|
173
|
+
entry.set_credentials_fields credentials
|
174
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
175
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
176
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
177
|
+
end
|
167
178
|
end
|
168
179
|
|
169
180
|
##
|
@@ -173,6 +184,15 @@ module Google
|
|
173
184
|
#
|
174
185
|
attr_reader :operations_client
|
175
186
|
|
187
|
+
##
|
188
|
+
# The logger used for request/response debug logging.
|
189
|
+
#
|
190
|
+
# @return [Logger]
|
191
|
+
#
|
192
|
+
def logger
|
193
|
+
@instances_stub.logger
|
194
|
+
end
|
195
|
+
|
176
196
|
# Service calls
|
177
197
|
|
178
198
|
##
|
@@ -268,7 +288,7 @@ module Google
|
|
268
288
|
@instances_stub.call_rpc :list_instances, request, options: options do |response, operation|
|
269
289
|
response = ::Gapic::PagedEnumerable.new @instances_stub, :list_instances, request, response, operation, options
|
270
290
|
yield response, operation if block_given?
|
271
|
-
|
291
|
+
throw :response, response
|
272
292
|
end
|
273
293
|
rescue ::GRPC::BadStatus => e
|
274
294
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -355,7 +375,6 @@ module Google
|
|
355
375
|
|
356
376
|
@instances_stub.call_rpc :get_instance, request, options: options do |response, operation|
|
357
377
|
yield response, operation if block_given?
|
358
|
-
return response
|
359
378
|
end
|
360
379
|
rescue ::GRPC::BadStatus => e
|
361
380
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -461,7 +480,7 @@ module Google
|
|
461
480
|
@instances_stub.call_rpc :delete_instance, request, options: options do |response, operation|
|
462
481
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
463
482
|
yield response, operation if block_given?
|
464
|
-
|
483
|
+
throw :response, response
|
465
484
|
end
|
466
485
|
rescue ::GRPC::BadStatus => e
|
467
486
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -571,7 +590,7 @@ module Google
|
|
571
590
|
@instances_stub.call_rpc :debug_instance, request, options: options do |response, operation|
|
572
591
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
573
592
|
yield response, operation if block_given?
|
574
|
-
|
593
|
+
throw :response, response
|
575
594
|
end
|
576
595
|
rescue ::GRPC::BadStatus => e
|
577
596
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -660,6 +679,11 @@ module Google
|
|
660
679
|
# default endpoint URL. The default value of nil uses the environment
|
661
680
|
# universe (usually the default "googleapis.com" universe).
|
662
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]
|
663
687
|
#
|
664
688
|
class Configuration
|
665
689
|
extend ::Gapic::Config
|
@@ -684,6 +708,7 @@ module Google
|
|
684
708
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
685
709
|
config_attr :quota_project, nil, ::String, nil
|
686
710
|
config_attr :universe_domain, nil, ::String, nil
|
711
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
687
712
|
|
688
713
|
# @private
|
689
714
|
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)
|
@@ -599,7 +590,7 @@ module Google
|
|
599
590
|
@operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
|
600
591
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
601
592
|
yield response, operation if block_given?
|
602
|
-
|
593
|
+
throw :response, response
|
603
594
|
end
|
604
595
|
rescue ::GRPC::BadStatus => e
|
605
596
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -688,6 +679,11 @@ module Google
|
|
688
679
|
# default endpoint URL. The default value of nil uses the environment
|
689
680
|
# universe (usually the default "googleapis.com" universe).
|
690
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]
|
691
687
|
#
|
692
688
|
class Configuration
|
693
689
|
extend ::Gapic::Config
|
@@ -712,6 +708,7 @@ module Google
|
|
712
708
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
713
709
|
config_attr :quota_project, nil, ::String, nil
|
714
710
|
config_attr :universe_domain, nil, ::String, nil
|
711
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
715
712
|
|
716
713
|
# @private
|
717
714
|
def initialize parent_config = nil
|
@@ -155,8 +155,19 @@ module Google
|
|
155
155
|
endpoint: @config.endpoint,
|
156
156
|
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
157
157
|
universe_domain: @config.universe_domain,
|
158
|
-
credentials: credentials
|
158
|
+
credentials: credentials,
|
159
|
+
logger: @config.logger
|
159
160
|
)
|
161
|
+
|
162
|
+
@instances_stub.logger(stub: true)&.info do |entry|
|
163
|
+
entry.set_system_name
|
164
|
+
entry.set_service
|
165
|
+
entry.message = "Created client for #{entry.service}"
|
166
|
+
entry.set_credentials_fields credentials
|
167
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
168
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
169
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
170
|
+
end
|
160
171
|
end
|
161
172
|
|
162
173
|
##
|
@@ -166,6 +177,15 @@ module Google
|
|
166
177
|
#
|
167
178
|
attr_reader :operations_client
|
168
179
|
|
180
|
+
##
|
181
|
+
# The logger used for request/response debug logging.
|
182
|
+
#
|
183
|
+
# @return [Logger]
|
184
|
+
#
|
185
|
+
def logger
|
186
|
+
@instances_stub.logger
|
187
|
+
end
|
188
|
+
|
169
189
|
# Service calls
|
170
190
|
|
171
191
|
##
|
@@ -254,7 +274,7 @@ module Google
|
|
254
274
|
@instances_stub.list_instances request, options do |result, operation|
|
255
275
|
result = ::Gapic::Rest::PagedEnumerable.new @instances_stub, :list_instances, "instances", request, result, options
|
256
276
|
yield result, operation if block_given?
|
257
|
-
|
277
|
+
throw :response, result
|
258
278
|
end
|
259
279
|
rescue ::Gapic::Rest::Error => e
|
260
280
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -334,7 +354,6 @@ module Google
|
|
334
354
|
|
335
355
|
@instances_stub.get_instance request, options do |result, operation|
|
336
356
|
yield result, operation if block_given?
|
337
|
-
return result
|
338
357
|
end
|
339
358
|
rescue ::Gapic::Rest::Error => e
|
340
359
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -433,7 +452,7 @@ module Google
|
|
433
452
|
@instances_stub.delete_instance request, options do |result, operation|
|
434
453
|
result = ::Gapic::Operation.new result, @operations_client, options: options
|
435
454
|
yield result, operation if block_given?
|
436
|
-
|
455
|
+
throw :response, result
|
437
456
|
end
|
438
457
|
rescue ::Gapic::Rest::Error => e
|
439
458
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -536,7 +555,7 @@ module Google
|
|
536
555
|
@instances_stub.debug_instance request, options do |result, operation|
|
537
556
|
result = ::Gapic::Operation.new result, @operations_client, options: options
|
538
557
|
yield result, operation if block_given?
|
539
|
-
|
558
|
+
throw :response, result
|
540
559
|
end
|
541
560
|
rescue ::Gapic::Rest::Error => e
|
542
561
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -616,6 +635,11 @@ module Google
|
|
616
635
|
# default endpoint URL. The default value of nil uses the environment
|
617
636
|
# universe (usually the default "googleapis.com" universe).
|
618
637
|
# @return [::String,nil]
|
638
|
+
# @!attribute [rw] logger
|
639
|
+
# A custom logger to use for request/response debug logging, or the value
|
640
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
641
|
+
# explicitly disable logging.
|
642
|
+
# @return [::Logger,:default,nil]
|
619
643
|
#
|
620
644
|
class Configuration
|
621
645
|
extend ::Gapic::Config
|
@@ -637,6 +661,7 @@ module Google
|
|
637
661
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
638
662
|
config_attr :quota_project, nil, ::String, nil
|
639
663
|
config_attr :universe_domain, nil, ::String, nil
|
664
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
640
665
|
|
641
666
|
# @private
|
642
667
|
def initialize parent_config = nil
|