google-cloud-dialogflow-v2 1.4.1 → 1.5.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/dialogflow/v2/agents/client.rb +33 -10
- data/lib/google/cloud/dialogflow/v2/agents/operations.rb +9 -5
- data/lib/google/cloud/dialogflow/v2/agents/rest/client.rb +33 -10
- data/lib/google/cloud/dialogflow/v2/agents/rest/operations.rb +40 -28
- data/lib/google/cloud/dialogflow/v2/agents/rest/service_stub.rb +86 -56
- data/lib/google/cloud/dialogflow/v2/answer_records/client.rb +29 -3
- data/lib/google/cloud/dialogflow/v2/answer_records/rest/client.rb +29 -3
- data/lib/google/cloud/dialogflow/v2/answer_records/rest/service_stub.rb +30 -14
- data/lib/google/cloud/dialogflow/v2/contexts/client.rb +29 -7
- data/lib/google/cloud/dialogflow/v2/contexts/rest/client.rb +29 -7
- data/lib/google/cloud/dialogflow/v2/contexts/rest/service_stub.rb +62 -38
- data/lib/google/cloud/dialogflow/v2/conversation_datasets/client.rb +32 -6
- data/lib/google/cloud/dialogflow/v2/conversation_datasets/operations.rb +9 -5
- data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest/client.rb +32 -6
- data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest/operations.rb +40 -28
- data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest/service_stub.rb +54 -32
- data/lib/google/cloud/dialogflow/v2/conversation_models/client.rb +35 -10
- data/lib/google/cloud/dialogflow/v2/conversation_models/operations.rb +9 -5
- data/lib/google/cloud/dialogflow/v2/conversation_models/rest/client.rb +35 -10
- data/lib/google/cloud/dialogflow/v2/conversation_models/rest/operations.rb +40 -28
- data/lib/google/cloud/dialogflow/v2/conversation_models/rest/service_stub.rb +86 -56
- data/lib/google/cloud/dialogflow/v2/conversation_profiles/client.rb +31 -8
- data/lib/google/cloud/dialogflow/v2/conversation_profiles/operations.rb +9 -5
- data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/client.rb +31 -8
- data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/operations.rb +40 -28
- data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/service_stub.rb +70 -44
- data/lib/google/cloud/dialogflow/v2/conversations/client.rb +30 -10
- data/lib/google/cloud/dialogflow/v2/conversations/rest/client.rb +30 -10
- data/lib/google/cloud/dialogflow/v2/conversations/rest/service_stub.rb +86 -56
- data/lib/google/cloud/dialogflow/v2/documents/client.rb +35 -9
- data/lib/google/cloud/dialogflow/v2/documents/operations.rb +9 -5
- data/lib/google/cloud/dialogflow/v2/documents/rest/client.rb +35 -9
- data/lib/google/cloud/dialogflow/v2/documents/rest/operations.rb +40 -28
- data/lib/google/cloud/dialogflow/v2/documents/rest/service_stub.rb +78 -50
- data/lib/google/cloud/dialogflow/v2/encryption_spec_service/client.rb +29 -3
- data/lib/google/cloud/dialogflow/v2/encryption_spec_service/operations.rb +9 -5
- data/lib/google/cloud/dialogflow/v2/encryption_spec_service/rest/client.rb +29 -3
- data/lib/google/cloud/dialogflow/v2/encryption_spec_service/rest/operations.rb +40 -28
- data/lib/google/cloud/dialogflow/v2/encryption_spec_service/rest/service_stub.rb +30 -14
- data/lib/google/cloud/dialogflow/v2/entity_types/client.rb +34 -11
- data/lib/google/cloud/dialogflow/v2/entity_types/operations.rb +9 -5
- data/lib/google/cloud/dialogflow/v2/entity_types/rest/client.rb +34 -11
- data/lib/google/cloud/dialogflow/v2/entity_types/rest/operations.rb +40 -28
- data/lib/google/cloud/dialogflow/v2/entity_types/rest/service_stub.rb +94 -62
- data/lib/google/cloud/dialogflow/v2/environments/client.rb +30 -7
- data/lib/google/cloud/dialogflow/v2/environments/rest/client.rb +30 -7
- data/lib/google/cloud/dialogflow/v2/environments/rest/service_stub.rb +62 -38
- data/lib/google/cloud/dialogflow/v2/fulfillments/client.rb +28 -3
- data/lib/google/cloud/dialogflow/v2/fulfillments/rest/client.rb +28 -3
- data/lib/google/cloud/dialogflow/v2/fulfillments/rest/service_stub.rb +30 -14
- data/lib/google/cloud/dialogflow/v2/generators/client.rb +29 -6
- data/lib/google/cloud/dialogflow/v2/generators/rest/client.rb +29 -6
- data/lib/google/cloud/dialogflow/v2/generators/rest/service_stub.rb +54 -32
- data/lib/google/cloud/dialogflow/v2/intents/client.rb +31 -8
- data/lib/google/cloud/dialogflow/v2/intents/operations.rb +9 -5
- data/lib/google/cloud/dialogflow/v2/intents/rest/client.rb +31 -8
- data/lib/google/cloud/dialogflow/v2/intents/rest/operations.rb +40 -28
- data/lib/google/cloud/dialogflow/v2/intents/rest/service_stub.rb +70 -44
- data/lib/google/cloud/dialogflow/v2/knowledge_bases/client.rb +29 -6
- data/lib/google/cloud/dialogflow/v2/knowledge_bases/rest/client.rb +29 -6
- data/lib/google/cloud/dialogflow/v2/knowledge_bases/rest/service_stub.rb +54 -32
- data/lib/google/cloud/dialogflow/v2/participants/client.rb +29 -11
- data/lib/google/cloud/dialogflow/v2/participants/rest/client.rb +29 -10
- data/lib/google/cloud/dialogflow/v2/participants/rest/service_stub.rb +86 -56
- data/lib/google/cloud/dialogflow/v2/session_entity_types/client.rb +29 -6
- data/lib/google/cloud/dialogflow/v2/session_entity_types/rest/client.rb +29 -6
- data/lib/google/cloud/dialogflow/v2/session_entity_types/rest/service_stub.rb +54 -32
- data/lib/google/cloud/dialogflow/v2/sessions/client.rb +28 -3
- data/lib/google/cloud/dialogflow/v2/sessions/rest/client.rb +28 -2
- data/lib/google/cloud/dialogflow/v2/sessions/rest/service_stub.rb +22 -8
- data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
- data/lib/google/cloud/dialogflow/v2/versions/client.rb +29 -6
- data/lib/google/cloud/dialogflow/v2/versions/rest/client.rb +29 -6
- data/lib/google/cloud/dialogflow/v2/versions/rest/service_stub.rb +54 -32
- metadata +4 -4
@@ -157,15 +157,27 @@ 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
|
)
|
162
163
|
|
164
|
+
@conversations_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
|
+
|
163
174
|
@location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
|
164
175
|
config.credentials = credentials
|
165
176
|
config.quota_project = @quota_project_id
|
166
177
|
config.endpoint = @conversations_stub.endpoint
|
167
178
|
config.universe_domain = @conversations_stub.universe_domain
|
168
179
|
config.bindings_override = @config.bindings_override
|
180
|
+
config.logger = @conversations_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
|
+
@conversations_stub.logger
|
198
|
+
end
|
199
|
+
|
179
200
|
# Service calls
|
180
201
|
|
181
202
|
##
|
@@ -285,7 +306,6 @@ module Google
|
|
285
306
|
|
286
307
|
@conversations_stub.create_conversation request, options do |result, operation|
|
287
308
|
yield result, operation if block_given?
|
288
|
-
return result
|
289
309
|
end
|
290
310
|
rescue ::Gapic::Rest::Error => e
|
291
311
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -384,7 +404,7 @@ module Google
|
|
384
404
|
@conversations_stub.list_conversations request, options do |result, operation|
|
385
405
|
result = ::Gapic::Rest::PagedEnumerable.new @conversations_stub, :list_conversations, "conversations", request, result, options
|
386
406
|
yield result, operation if block_given?
|
387
|
-
|
407
|
+
throw :response, result
|
388
408
|
end
|
389
409
|
rescue ::Gapic::Rest::Error => e
|
390
410
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -465,7 +485,6 @@ module Google
|
|
465
485
|
|
466
486
|
@conversations_stub.get_conversation request, options do |result, operation|
|
467
487
|
yield result, operation if block_given?
|
468
|
-
return result
|
469
488
|
end
|
470
489
|
rescue ::Gapic::Rest::Error => e
|
471
490
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -547,7 +566,6 @@ module Google
|
|
547
566
|
|
548
567
|
@conversations_stub.complete_conversation request, options do |result, operation|
|
549
568
|
yield result, operation if block_given?
|
550
|
-
return result
|
551
569
|
end
|
552
570
|
rescue ::Gapic::Rest::Error => e
|
553
571
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -651,7 +669,7 @@ module Google
|
|
651
669
|
@conversations_stub.list_messages request, options do |result, operation|
|
652
670
|
result = ::Gapic::Rest::PagedEnumerable.new @conversations_stub, :list_messages, "messages", request, result, options
|
653
671
|
yield result, operation if block_given?
|
654
|
-
|
672
|
+
throw :response, result
|
655
673
|
end
|
656
674
|
rescue ::Gapic::Rest::Error => e
|
657
675
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -748,7 +766,6 @@ module Google
|
|
748
766
|
|
749
767
|
@conversations_stub.suggest_conversation_summary request, options do |result, operation|
|
750
768
|
yield result, operation if block_given?
|
751
|
-
return result
|
752
769
|
end
|
753
770
|
rescue ::Gapic::Rest::Error => e
|
754
771
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -842,7 +859,6 @@ module Google
|
|
842
859
|
|
843
860
|
@conversations_stub.generate_stateless_summary request, options do |result, operation|
|
844
861
|
yield result, operation if block_given?
|
845
|
-
return result
|
846
862
|
end
|
847
863
|
rescue ::Gapic::Rest::Error => e
|
848
864
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -934,7 +950,6 @@ module Google
|
|
934
950
|
|
935
951
|
@conversations_stub.generate_stateless_suggestion request, options do |result, operation|
|
936
952
|
yield result, operation if block_given?
|
937
|
-
return result
|
938
953
|
end
|
939
954
|
rescue ::Gapic::Rest::Error => e
|
940
955
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1062,7 +1077,6 @@ module Google
|
|
1062
1077
|
|
1063
1078
|
@conversations_stub.search_knowledge request, options do |result, operation|
|
1064
1079
|
yield result, operation if block_given?
|
1065
|
-
return result
|
1066
1080
|
end
|
1067
1081
|
rescue ::Gapic::Rest::Error => e
|
1068
1082
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1142,6 +1156,11 @@ module Google
|
|
1142
1156
|
# default endpoint URL. The default value of nil uses the environment
|
1143
1157
|
# universe (usually the default "googleapis.com" universe).
|
1144
1158
|
# @return [::String,nil]
|
1159
|
+
# @!attribute [rw] logger
|
1160
|
+
# A custom logger to use for request/response debug logging, or the value
|
1161
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
1162
|
+
# explicitly disable logging.
|
1163
|
+
# @return [::Logger,:default,nil]
|
1145
1164
|
#
|
1146
1165
|
class Configuration
|
1147
1166
|
extend ::Gapic::Config
|
@@ -1170,6 +1189,7 @@ module Google
|
|
1170
1189
|
# by the host service.
|
1171
1190
|
# @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
|
1172
1191
|
config_attr :bindings_override, {}, ::Hash, nil
|
1192
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
1173
1193
|
|
1174
1194
|
# @private
|
1175
1195
|
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 create_conversation 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: "create_conversation",
|
93
106
|
options: options
|
94
107
|
)
|
95
108
|
operation = ::Gapic::Rest::TransportOperation.new response
|
96
109
|
result = ::Google::Cloud::Dialogflow::V2::Conversation.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: "list_conversations",
|
131
146
|
options: options
|
132
147
|
)
|
133
148
|
operation = ::Gapic::Rest::TransportOperation.new response
|
134
149
|
result = ::Google::Cloud::Dialogflow::V2::ListConversationsResponse.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: "get_conversation",
|
169
186
|
options: options
|
170
187
|
)
|
171
188
|
operation = ::Gapic::Rest::TransportOperation.new response
|
172
189
|
result = ::Google::Cloud::Dialogflow::V2::Conversation.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: "complete_conversation",
|
207
226
|
options: options
|
208
227
|
)
|
209
228
|
operation = ::Gapic::Rest::TransportOperation.new response
|
210
229
|
result = ::Google::Cloud::Dialogflow::V2::Conversation.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: "list_messages",
|
245
266
|
options: options
|
246
267
|
)
|
247
268
|
operation = ::Gapic::Rest::TransportOperation.new response
|
248
269
|
result = ::Google::Cloud::Dialogflow::V2::ListMessagesResponse.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: "suggest_conversation_summary",
|
283
306
|
options: options
|
284
307
|
)
|
285
308
|
operation = ::Gapic::Rest::TransportOperation.new response
|
286
309
|
result = ::Google::Cloud::Dialogflow::V2::SuggestConversationSummaryResponse.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
|
##
|
@@ -315,16 +339,18 @@ module Google
|
|
315
339
|
|
316
340
|
response = @client_stub.make_http_request(
|
317
341
|
verb,
|
318
|
-
uri:
|
319
|
-
body:
|
320
|
-
params:
|
342
|
+
uri: uri,
|
343
|
+
body: body || "",
|
344
|
+
params: query_string_params,
|
345
|
+
method_name: "generate_stateless_summary",
|
321
346
|
options: options
|
322
347
|
)
|
323
348
|
operation = ::Gapic::Rest::TransportOperation.new response
|
324
349
|
result = ::Google::Cloud::Dialogflow::V2::GenerateStatelessSummaryResponse.decode_json response.body, ignore_unknown_fields: true
|
325
|
-
|
326
|
-
|
327
|
-
|
350
|
+
catch :response do
|
351
|
+
yield result, operation if block_given?
|
352
|
+
result
|
353
|
+
end
|
328
354
|
end
|
329
355
|
|
330
356
|
##
|
@@ -353,16 +379,18 @@ module Google
|
|
353
379
|
|
354
380
|
response = @client_stub.make_http_request(
|
355
381
|
verb,
|
356
|
-
uri:
|
357
|
-
body:
|
358
|
-
params:
|
382
|
+
uri: uri,
|
383
|
+
body: body || "",
|
384
|
+
params: query_string_params,
|
385
|
+
method_name: "generate_stateless_suggestion",
|
359
386
|
options: options
|
360
387
|
)
|
361
388
|
operation = ::Gapic::Rest::TransportOperation.new response
|
362
389
|
result = ::Google::Cloud::Dialogflow::V2::GenerateStatelessSuggestionResponse.decode_json response.body, ignore_unknown_fields: true
|
363
|
-
|
364
|
-
|
365
|
-
|
390
|
+
catch :response do
|
391
|
+
yield result, operation if block_given?
|
392
|
+
result
|
393
|
+
end
|
366
394
|
end
|
367
395
|
|
368
396
|
##
|
@@ -391,16 +419,18 @@ module Google
|
|
391
419
|
|
392
420
|
response = @client_stub.make_http_request(
|
393
421
|
verb,
|
394
|
-
uri:
|
395
|
-
body:
|
396
|
-
params:
|
422
|
+
uri: uri,
|
423
|
+
body: body || "",
|
424
|
+
params: query_string_params,
|
425
|
+
method_name: "search_knowledge",
|
397
426
|
options: options
|
398
427
|
)
|
399
428
|
operation = ::Gapic::Rest::TransportOperation.new response
|
400
429
|
result = ::Google::Cloud::Dialogflow::V2::SearchKnowledgeResponse.decode_json response.body, ignore_unknown_fields: true
|
401
|
-
|
402
|
-
|
403
|
-
|
430
|
+
catch :response do
|
431
|
+
yield result, operation if block_given?
|
432
|
+
result
|
433
|
+
end
|
404
434
|
end
|
405
435
|
|
406
436
|
##
|
@@ -171,14 +171,26 @@ module Google
|
|
171
171
|
universe_domain: @config.universe_domain,
|
172
172
|
channel_args: @config.channel_args,
|
173
173
|
interceptors: @config.interceptors,
|
174
|
-
channel_pool_config: @config.channel_pool
|
174
|
+
channel_pool_config: @config.channel_pool,
|
175
|
+
logger: @config.logger
|
175
176
|
)
|
176
177
|
|
178
|
+
@documents_stub.stub_logger&.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
|
@location_client = Google::Cloud::Location::Locations::Client.new do |config|
|
178
189
|
config.credentials = credentials
|
179
190
|
config.quota_project = @quota_project_id
|
180
191
|
config.endpoint = @documents_stub.endpoint
|
181
192
|
config.universe_domain = @documents_stub.universe_domain
|
193
|
+
config.logger = @documents_stub.logger if config.respond_to? :logger=
|
182
194
|
end
|
183
195
|
end
|
184
196
|
|
@@ -196,6 +208,15 @@ module Google
|
|
196
208
|
#
|
197
209
|
attr_reader :location_client
|
198
210
|
|
211
|
+
##
|
212
|
+
# The logger used for request/response debug logging.
|
213
|
+
#
|
214
|
+
# @return [Logger]
|
215
|
+
#
|
216
|
+
def logger
|
217
|
+
@documents_stub.logger
|
218
|
+
end
|
219
|
+
|
199
220
|
# Service calls
|
200
221
|
|
201
222
|
##
|
@@ -312,7 +333,7 @@ module Google
|
|
312
333
|
@documents_stub.call_rpc :list_documents, request, options: options do |response, operation|
|
313
334
|
response = ::Gapic::PagedEnumerable.new @documents_stub, :list_documents, request, response, operation, options
|
314
335
|
yield response, operation if block_given?
|
315
|
-
|
336
|
+
throw :response, response
|
316
337
|
end
|
317
338
|
rescue ::GRPC::BadStatus => e
|
318
339
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -400,7 +421,6 @@ module Google
|
|
400
421
|
|
401
422
|
@documents_stub.call_rpc :get_document, request, options: options do |response, operation|
|
402
423
|
yield response, operation if block_given?
|
403
|
-
return response
|
404
424
|
end
|
405
425
|
rescue ::GRPC::BadStatus => e
|
406
426
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -506,7 +526,7 @@ module Google
|
|
506
526
|
@documents_stub.call_rpc :create_document, request, options: options do |response, operation|
|
507
527
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
508
528
|
yield response, operation if block_given?
|
509
|
-
|
529
|
+
throw :response, response
|
510
530
|
end
|
511
531
|
rescue ::GRPC::BadStatus => e
|
512
532
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -625,7 +645,7 @@ module Google
|
|
625
645
|
@documents_stub.call_rpc :import_documents, request, options: options do |response, operation|
|
626
646
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
627
647
|
yield response, operation if block_given?
|
628
|
-
|
648
|
+
throw :response, response
|
629
649
|
end
|
630
650
|
rescue ::GRPC::BadStatus => e
|
631
651
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -730,7 +750,7 @@ module Google
|
|
730
750
|
@documents_stub.call_rpc :delete_document, request, options: options do |response, operation|
|
731
751
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
732
752
|
yield response, operation if block_given?
|
733
|
-
|
753
|
+
throw :response, response
|
734
754
|
end
|
735
755
|
rescue ::GRPC::BadStatus => e
|
736
756
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -836,7 +856,7 @@ module Google
|
|
836
856
|
@documents_stub.call_rpc :update_document, request, options: options do |response, operation|
|
837
857
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
838
858
|
yield response, operation if block_given?
|
839
|
-
|
859
|
+
throw :response, response
|
840
860
|
end
|
841
861
|
rescue ::GRPC::BadStatus => e
|
842
862
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -958,7 +978,7 @@ module Google
|
|
958
978
|
@documents_stub.call_rpc :reload_document, request, options: options do |response, operation|
|
959
979
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
960
980
|
yield response, operation if block_given?
|
961
|
-
|
981
|
+
throw :response, response
|
962
982
|
end
|
963
983
|
rescue ::GRPC::BadStatus => e
|
964
984
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1071,7 +1091,7 @@ module Google
|
|
1071
1091
|
@documents_stub.call_rpc :export_document, request, options: options do |response, operation|
|
1072
1092
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
1073
1093
|
yield response, operation if block_given?
|
1074
|
-
|
1094
|
+
throw :response, response
|
1075
1095
|
end
|
1076
1096
|
rescue ::GRPC::BadStatus => e
|
1077
1097
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1160,6 +1180,11 @@ module Google
|
|
1160
1180
|
# default endpoint URL. The default value of nil uses the environment
|
1161
1181
|
# universe (usually the default "googleapis.com" universe).
|
1162
1182
|
# @return [::String,nil]
|
1183
|
+
# @!attribute [rw] logger
|
1184
|
+
# A custom logger to use for request/response debug logging, or the value
|
1185
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
1186
|
+
# explicitly disable logging.
|
1187
|
+
# @return [::Logger,:default,nil]
|
1163
1188
|
#
|
1164
1189
|
class Configuration
|
1165
1190
|
extend ::Gapic::Config
|
@@ -1184,6 +1209,7 @@ module Google
|
|
1184
1209
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
1185
1210
|
config_attr :quota_project, nil, ::String, nil
|
1186
1211
|
config_attr :universe_domain, nil, ::String, nil
|
1212
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
1187
1213
|
|
1188
1214
|
# @private
|
1189
1215
|
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
|
-
|
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
|
-
|
312
|
+
throw :response, response
|
313
313
|
end
|
314
314
|
rescue ::GRPC::BadStatus => e
|
315
315
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -398,7 +398,6 @@ module Google
|
|
398
398
|
|
399
399
|
@operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
|
400
400
|
yield response, operation if block_given?
|
401
|
-
return response
|
402
401
|
end
|
403
402
|
rescue ::GRPC::BadStatus => e
|
404
403
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -494,7 +493,6 @@ module Google
|
|
494
493
|
|
495
494
|
@operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
|
496
495
|
yield response, operation if block_given?
|
497
|
-
return response
|
498
496
|
end
|
499
497
|
rescue ::GRPC::BadStatus => e
|
500
498
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -592,7 +590,7 @@ module Google
|
|
592
590
|
@operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
|
593
591
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
594
592
|
yield response, operation if block_given?
|
595
|
-
|
593
|
+
throw :response, response
|
596
594
|
end
|
597
595
|
rescue ::GRPC::BadStatus => e
|
598
596
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -681,6 +679,11 @@ module Google
|
|
681
679
|
# default endpoint URL. The default value of nil uses the environment
|
682
680
|
# universe (usually the default "googleapis.com" universe).
|
683
681
|
# @return [::String,nil]
|
682
|
+
# @!attribute [rw] logger
|
683
|
+
# A custom logger to use for request/response debug logging, or the value
|
684
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
685
|
+
# explicitly disable logging.
|
686
|
+
# @return [::Logger,:default,nil]
|
684
687
|
#
|
685
688
|
class Configuration
|
686
689
|
extend ::Gapic::Config
|
@@ -705,6 +708,7 @@ module Google
|
|
705
708
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
706
709
|
config_attr :quota_project, nil, ::String, nil
|
707
710
|
config_attr :universe_domain, nil, ::String, nil
|
711
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
708
712
|
|
709
713
|
# @private
|
710
714
|
def initialize parent_config = nil
|