google-cloud-dialogflow-v2 1.4.0 → 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 +12 -15
- data/lib/google/cloud/dialogflow/v2/agents/rest/client.rb +33 -10
- data/lib/google/cloud/dialogflow/v2/agents/rest/operations.rb +43 -38
- 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 +12 -15
- data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest/client.rb +32 -6
- data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest/operations.rb +43 -38
- 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 +12 -15
- data/lib/google/cloud/dialogflow/v2/conversation_models/rest/client.rb +35 -10
- data/lib/google/cloud/dialogflow/v2/conversation_models/rest/operations.rb +43 -38
- data/lib/google/cloud/dialogflow/v2/conversation_models/rest/service_stub.rb +86 -56
- data/lib/google/cloud/dialogflow/v2/conversation_profile_services_pb.rb +6 -2
- data/lib/google/cloud/dialogflow/v2/conversation_profiles/client.rb +37 -10
- data/lib/google/cloud/dialogflow/v2/conversation_profiles/operations.rb +12 -15
- data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/client.rb +37 -10
- data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/operations.rb +43 -38
- 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 +12 -15
- data/lib/google/cloud/dialogflow/v2/documents/rest/client.rb +35 -9
- data/lib/google/cloud/dialogflow/v2/documents/rest/operations.rb +43 -38
- 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 +12 -15
- 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 +43 -38
- 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 +12 -15
- data/lib/google/cloud/dialogflow/v2/entity_types/rest/client.rb +34 -11
- data/lib/google/cloud/dialogflow/v2/entity_types/rest/operations.rb +43 -38
- 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/intent_pb.rb +1 -1
- data/lib/google/cloud/dialogflow/v2/intents/client.rb +31 -8
- data/lib/google/cloud/dialogflow/v2/intents/operations.rb +12 -15
- data/lib/google/cloud/dialogflow/v2/intents/rest/client.rb +31 -8
- data/lib/google/cloud/dialogflow/v2/intents/rest/operations.rb +43 -38
- 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
- data/proto_docs/google/api/client.rb +19 -0
- data/proto_docs/google/cloud/dialogflow/v2/answer_record.rb +3 -2
- data/proto_docs/google/cloud/dialogflow/v2/audio_config.rb +2 -2
- data/proto_docs/google/cloud/dialogflow/v2/conversation.rb +10 -6
- data/proto_docs/google/cloud/dialogflow/v2/conversation_dataset.rb +2 -2
- data/proto_docs/google/cloud/dialogflow/v2/conversation_profile.rb +7 -4
- data/proto_docs/google/cloud/dialogflow/v2/intent.rb +1 -1
- data/proto_docs/google/cloud/dialogflow/v2/participant.rb +10 -8
- data/proto_docs/google/cloud/dialogflow/v2/session.rb +12 -10
- data/proto_docs/google/longrunning/operations.rb +19 -14
- metadata +5 -5
@@ -156,15 +156,27 @@ module Google
|
|
156
156
|
endpoint: @config.endpoint,
|
157
157
|
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
158
158
|
universe_domain: @config.universe_domain,
|
159
|
-
credentials: credentials
|
159
|
+
credentials: credentials,
|
160
|
+
logger: @config.logger
|
160
161
|
)
|
161
162
|
|
163
|
+
@environments_stub.logger(stub: true)&.info do |entry|
|
164
|
+
entry.set_system_name
|
165
|
+
entry.set_service
|
166
|
+
entry.message = "Created client for #{entry.service}"
|
167
|
+
entry.set_credentials_fields credentials
|
168
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
169
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
170
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
171
|
+
end
|
172
|
+
|
162
173
|
@location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
|
163
174
|
config.credentials = credentials
|
164
175
|
config.quota_project = @quota_project_id
|
165
176
|
config.endpoint = @environments_stub.endpoint
|
166
177
|
config.universe_domain = @environments_stub.universe_domain
|
167
178
|
config.bindings_override = @config.bindings_override
|
179
|
+
config.logger = @environments_stub.logger if config.respond_to? :logger=
|
168
180
|
end
|
169
181
|
end
|
170
182
|
|
@@ -175,6 +187,15 @@ module Google
|
|
175
187
|
#
|
176
188
|
attr_reader :location_client
|
177
189
|
|
190
|
+
##
|
191
|
+
# The logger used for request/response debug logging.
|
192
|
+
#
|
193
|
+
# @return [Logger]
|
194
|
+
#
|
195
|
+
def logger
|
196
|
+
@environments_stub.logger
|
197
|
+
end
|
198
|
+
|
178
199
|
# Service calls
|
179
200
|
|
180
201
|
##
|
@@ -264,7 +285,7 @@ module Google
|
|
264
285
|
@environments_stub.list_environments request, options do |result, operation|
|
265
286
|
result = ::Gapic::Rest::PagedEnumerable.new @environments_stub, :list_environments, "environments", request, result, options
|
266
287
|
yield result, operation if block_given?
|
267
|
-
|
288
|
+
throw :response, result
|
268
289
|
end
|
269
290
|
rescue ::Gapic::Rest::Error => e
|
270
291
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -350,7 +371,6 @@ module Google
|
|
350
371
|
|
351
372
|
@environments_stub.get_environment request, options do |result, operation|
|
352
373
|
yield result, operation if block_given?
|
353
|
-
return result
|
354
374
|
end
|
355
375
|
rescue ::Gapic::Rest::Error => e
|
356
376
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -437,7 +457,6 @@ module Google
|
|
437
457
|
|
438
458
|
@environments_stub.create_environment request, options do |result, operation|
|
439
459
|
yield result, operation if block_given?
|
440
|
-
return result
|
441
460
|
end
|
442
461
|
rescue ::Gapic::Rest::Error => e
|
443
462
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -534,7 +553,6 @@ module Google
|
|
534
553
|
|
535
554
|
@environments_stub.update_environment request, options do |result, operation|
|
536
555
|
yield result, operation if block_given?
|
537
|
-
return result
|
538
556
|
end
|
539
557
|
rescue ::Gapic::Rest::Error => e
|
540
558
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -620,7 +638,6 @@ module Google
|
|
620
638
|
|
621
639
|
@environments_stub.delete_environment request, options do |result, operation|
|
622
640
|
yield result, operation if block_given?
|
623
|
-
return result
|
624
641
|
end
|
625
642
|
rescue ::Gapic::Rest::Error => e
|
626
643
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -716,7 +733,7 @@ module Google
|
|
716
733
|
@environments_stub.get_environment_history request, options do |result, operation|
|
717
734
|
result = ::Gapic::Rest::PagedEnumerable.new @environments_stub, :get_environment_history, "entries", request, result, options
|
718
735
|
yield result, operation if block_given?
|
719
|
-
|
736
|
+
throw :response, result
|
720
737
|
end
|
721
738
|
rescue ::Gapic::Rest::Error => e
|
722
739
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -796,6 +813,11 @@ module Google
|
|
796
813
|
# default endpoint URL. The default value of nil uses the environment
|
797
814
|
# universe (usually the default "googleapis.com" universe).
|
798
815
|
# @return [::String,nil]
|
816
|
+
# @!attribute [rw] logger
|
817
|
+
# A custom logger to use for request/response debug logging, or the value
|
818
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
819
|
+
# explicitly disable logging.
|
820
|
+
# @return [::Logger,:default,nil]
|
799
821
|
#
|
800
822
|
class Configuration
|
801
823
|
extend ::Gapic::Config
|
@@ -824,6 +846,7 @@ module Google
|
|
824
846
|
# by the host service.
|
825
847
|
# @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
|
826
848
|
config_attr :bindings_override, {}, ::Hash, nil
|
849
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
827
850
|
|
828
851
|
# @private
|
829
852
|
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_environments 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_environments",
|
93
106
|
options: options
|
94
107
|
)
|
95
108
|
operation = ::Gapic::Rest::TransportOperation.new response
|
96
109
|
result = ::Google::Cloud::Dialogflow::V2::ListEnvironmentsResponse.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: "get_environment",
|
131
146
|
options: options
|
132
147
|
)
|
133
148
|
operation = ::Gapic::Rest::TransportOperation.new response
|
134
149
|
result = ::Google::Cloud::Dialogflow::V2::Environment.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_environment",
|
169
186
|
options: options
|
170
187
|
)
|
171
188
|
operation = ::Gapic::Rest::TransportOperation.new response
|
172
189
|
result = ::Google::Cloud::Dialogflow::V2::Environment.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: "update_environment",
|
207
226
|
options: options
|
208
227
|
)
|
209
228
|
operation = ::Gapic::Rest::TransportOperation.new response
|
210
229
|
result = ::Google::Cloud::Dialogflow::V2::Environment.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: "delete_environment",
|
245
266
|
options: options
|
246
267
|
)
|
247
268
|
operation = ::Gapic::Rest::TransportOperation.new response
|
248
269
|
result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
|
249
|
-
|
250
|
-
|
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: "get_environment_history",
|
283
306
|
options: options
|
284
307
|
)
|
285
308
|
operation = ::Gapic::Rest::TransportOperation.new response
|
286
309
|
result = ::Google::Cloud::Dialogflow::V2::EnvironmentHistory.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
|
##
|
@@ -163,14 +163,26 @@ module Google
|
|
163
163
|
universe_domain: @config.universe_domain,
|
164
164
|
channel_args: @config.channel_args,
|
165
165
|
interceptors: @config.interceptors,
|
166
|
-
channel_pool_config: @config.channel_pool
|
166
|
+
channel_pool_config: @config.channel_pool,
|
167
|
+
logger: @config.logger
|
167
168
|
)
|
168
169
|
|
170
|
+
@fulfillments_stub.stub_logger&.info do |entry|
|
171
|
+
entry.set_system_name
|
172
|
+
entry.set_service
|
173
|
+
entry.message = "Created client for #{entry.service}"
|
174
|
+
entry.set_credentials_fields credentials
|
175
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
176
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
177
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
178
|
+
end
|
179
|
+
|
169
180
|
@location_client = Google::Cloud::Location::Locations::Client.new do |config|
|
170
181
|
config.credentials = credentials
|
171
182
|
config.quota_project = @quota_project_id
|
172
183
|
config.endpoint = @fulfillments_stub.endpoint
|
173
184
|
config.universe_domain = @fulfillments_stub.universe_domain
|
185
|
+
config.logger = @fulfillments_stub.logger if config.respond_to? :logger=
|
174
186
|
end
|
175
187
|
end
|
176
188
|
|
@@ -181,6 +193,15 @@ module Google
|
|
181
193
|
#
|
182
194
|
attr_reader :location_client
|
183
195
|
|
196
|
+
##
|
197
|
+
# The logger used for request/response debug logging.
|
198
|
+
#
|
199
|
+
# @return [Logger]
|
200
|
+
#
|
201
|
+
def logger
|
202
|
+
@fulfillments_stub.logger
|
203
|
+
end
|
204
|
+
|
184
205
|
# Service calls
|
185
206
|
|
186
207
|
##
|
@@ -264,7 +285,6 @@ module Google
|
|
264
285
|
|
265
286
|
@fulfillments_stub.call_rpc :get_fulfillment, request, options: options do |response, operation|
|
266
287
|
yield response, operation if block_given?
|
267
|
-
return response
|
268
288
|
end
|
269
289
|
rescue ::GRPC::BadStatus => e
|
270
290
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -353,7 +373,6 @@ module Google
|
|
353
373
|
|
354
374
|
@fulfillments_stub.call_rpc :update_fulfillment, request, options: options do |response, operation|
|
355
375
|
yield response, operation if block_given?
|
356
|
-
return response
|
357
376
|
end
|
358
377
|
rescue ::GRPC::BadStatus => e
|
359
378
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -442,6 +461,11 @@ module Google
|
|
442
461
|
# default endpoint URL. The default value of nil uses the environment
|
443
462
|
# universe (usually the default "googleapis.com" universe).
|
444
463
|
# @return [::String,nil]
|
464
|
+
# @!attribute [rw] logger
|
465
|
+
# A custom logger to use for request/response debug logging, or the value
|
466
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
467
|
+
# explicitly disable logging.
|
468
|
+
# @return [::Logger,:default,nil]
|
445
469
|
#
|
446
470
|
class Configuration
|
447
471
|
extend ::Gapic::Config
|
@@ -466,6 +490,7 @@ module Google
|
|
466
490
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
467
491
|
config_attr :quota_project, nil, ::String, nil
|
468
492
|
config_attr :universe_domain, nil, ::String, nil
|
493
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
469
494
|
|
470
495
|
# @private
|
471
496
|
def initialize parent_config = nil
|
@@ -156,15 +156,27 @@ module Google
|
|
156
156
|
endpoint: @config.endpoint,
|
157
157
|
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
158
158
|
universe_domain: @config.universe_domain,
|
159
|
-
credentials: credentials
|
159
|
+
credentials: credentials,
|
160
|
+
logger: @config.logger
|
160
161
|
)
|
161
162
|
|
163
|
+
@fulfillments_stub.logger(stub: true)&.info do |entry|
|
164
|
+
entry.set_system_name
|
165
|
+
entry.set_service
|
166
|
+
entry.message = "Created client for #{entry.service}"
|
167
|
+
entry.set_credentials_fields credentials
|
168
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
169
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
170
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
171
|
+
end
|
172
|
+
|
162
173
|
@location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
|
163
174
|
config.credentials = credentials
|
164
175
|
config.quota_project = @quota_project_id
|
165
176
|
config.endpoint = @fulfillments_stub.endpoint
|
166
177
|
config.universe_domain = @fulfillments_stub.universe_domain
|
167
178
|
config.bindings_override = @config.bindings_override
|
179
|
+
config.logger = @fulfillments_stub.logger if config.respond_to? :logger=
|
168
180
|
end
|
169
181
|
end
|
170
182
|
|
@@ -175,6 +187,15 @@ module Google
|
|
175
187
|
#
|
176
188
|
attr_reader :location_client
|
177
189
|
|
190
|
+
##
|
191
|
+
# The logger used for request/response debug logging.
|
192
|
+
#
|
193
|
+
# @return [Logger]
|
194
|
+
#
|
195
|
+
def logger
|
196
|
+
@fulfillments_stub.logger
|
197
|
+
end
|
198
|
+
|
178
199
|
# Service calls
|
179
200
|
|
180
201
|
##
|
@@ -251,7 +272,6 @@ module Google
|
|
251
272
|
|
252
273
|
@fulfillments_stub.get_fulfillment request, options do |result, operation|
|
253
274
|
yield result, operation if block_given?
|
254
|
-
return result
|
255
275
|
end
|
256
276
|
rescue ::Gapic::Rest::Error => e
|
257
277
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -333,7 +353,6 @@ module Google
|
|
333
353
|
|
334
354
|
@fulfillments_stub.update_fulfillment request, options do |result, operation|
|
335
355
|
yield result, operation if block_given?
|
336
|
-
return result
|
337
356
|
end
|
338
357
|
rescue ::Gapic::Rest::Error => e
|
339
358
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -413,6 +432,11 @@ module Google
|
|
413
432
|
# default endpoint URL. The default value of nil uses the environment
|
414
433
|
# universe (usually the default "googleapis.com" universe).
|
415
434
|
# @return [::String,nil]
|
435
|
+
# @!attribute [rw] logger
|
436
|
+
# A custom logger to use for request/response debug logging, or the value
|
437
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
438
|
+
# explicitly disable logging.
|
439
|
+
# @return [::Logger,:default,nil]
|
416
440
|
#
|
417
441
|
class Configuration
|
418
442
|
extend ::Gapic::Config
|
@@ -441,6 +465,7 @@ module Google
|
|
441
465
|
# by the host service.
|
442
466
|
# @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
|
443
467
|
config_attr :bindings_override, {}, ::Hash, nil
|
468
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
444
469
|
|
445
470
|
# @private
|
446
471
|
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 get_fulfillment 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: "get_fulfillment",
|
93
106
|
options: options
|
94
107
|
)
|
95
108
|
operation = ::Gapic::Rest::TransportOperation.new response
|
96
109
|
result = ::Google::Cloud::Dialogflow::V2::Fulfillment.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: "update_fulfillment",
|
131
146
|
options: options
|
132
147
|
)
|
133
148
|
operation = ::Gapic::Rest::TransportOperation.new response
|
134
149
|
result = ::Google::Cloud::Dialogflow::V2::Fulfillment.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
|
##
|
@@ -167,14 +167,26 @@ module Google
|
|
167
167
|
universe_domain: @config.universe_domain,
|
168
168
|
channel_args: @config.channel_args,
|
169
169
|
interceptors: @config.interceptors,
|
170
|
-
channel_pool_config: @config.channel_pool
|
170
|
+
channel_pool_config: @config.channel_pool,
|
171
|
+
logger: @config.logger
|
171
172
|
)
|
172
173
|
|
174
|
+
@generators_stub.stub_logger&.info do |entry|
|
175
|
+
entry.set_system_name
|
176
|
+
entry.set_service
|
177
|
+
entry.message = "Created client for #{entry.service}"
|
178
|
+
entry.set_credentials_fields credentials
|
179
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
180
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
181
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
182
|
+
end
|
183
|
+
|
173
184
|
@location_client = Google::Cloud::Location::Locations::Client.new do |config|
|
174
185
|
config.credentials = credentials
|
175
186
|
config.quota_project = @quota_project_id
|
176
187
|
config.endpoint = @generators_stub.endpoint
|
177
188
|
config.universe_domain = @generators_stub.universe_domain
|
189
|
+
config.logger = @generators_stub.logger if config.respond_to? :logger=
|
178
190
|
end
|
179
191
|
end
|
180
192
|
|
@@ -185,6 +197,15 @@ module Google
|
|
185
197
|
#
|
186
198
|
attr_reader :location_client
|
187
199
|
|
200
|
+
##
|
201
|
+
# The logger used for request/response debug logging.
|
202
|
+
#
|
203
|
+
# @return [Logger]
|
204
|
+
#
|
205
|
+
def logger
|
206
|
+
@generators_stub.logger
|
207
|
+
end
|
208
|
+
|
188
209
|
# Service calls
|
189
210
|
|
190
211
|
##
|
@@ -281,7 +302,6 @@ module Google
|
|
281
302
|
|
282
303
|
@generators_stub.call_rpc :create_generator, 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)
|
@@ -368,7 +388,6 @@ module Google
|
|
368
388
|
|
369
389
|
@generators_stub.call_rpc :get_generator, request, options: options do |response, operation|
|
370
390
|
yield response, operation if block_given?
|
371
|
-
return response
|
372
391
|
end
|
373
392
|
rescue ::GRPC::BadStatus => e
|
374
393
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -465,7 +484,7 @@ module Google
|
|
465
484
|
@generators_stub.call_rpc :list_generators, request, options: options do |response, operation|
|
466
485
|
response = ::Gapic::PagedEnumerable.new @generators_stub, :list_generators, request, response, operation, options
|
467
486
|
yield response, operation if block_given?
|
468
|
-
|
487
|
+
throw :response, response
|
469
488
|
end
|
470
489
|
rescue ::GRPC::BadStatus => e
|
471
490
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -552,7 +571,6 @@ module Google
|
|
552
571
|
|
553
572
|
@generators_stub.call_rpc :delete_generator, request, options: options do |response, operation|
|
554
573
|
yield response, operation if block_given?
|
555
|
-
return response
|
556
574
|
end
|
557
575
|
rescue ::GRPC::BadStatus => e
|
558
576
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -641,7 +659,6 @@ module Google
|
|
641
659
|
|
642
660
|
@generators_stub.call_rpc :update_generator, request, options: options do |response, operation|
|
643
661
|
yield response, operation if block_given?
|
644
|
-
return response
|
645
662
|
end
|
646
663
|
rescue ::GRPC::BadStatus => e
|
647
664
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -730,6 +747,11 @@ module Google
|
|
730
747
|
# default endpoint URL. The default value of nil uses the environment
|
731
748
|
# universe (usually the default "googleapis.com" universe).
|
732
749
|
# @return [::String,nil]
|
750
|
+
# @!attribute [rw] logger
|
751
|
+
# A custom logger to use for request/response debug logging, or the value
|
752
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
753
|
+
# explicitly disable logging.
|
754
|
+
# @return [::Logger,:default,nil]
|
733
755
|
#
|
734
756
|
class Configuration
|
735
757
|
extend ::Gapic::Config
|
@@ -754,6 +776,7 @@ module Google
|
|
754
776
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
755
777
|
config_attr :quota_project, nil, ::String, nil
|
756
778
|
config_attr :universe_domain, nil, ::String, nil
|
779
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
757
780
|
|
758
781
|
# @private
|
759
782
|
def initialize parent_config = nil
|