google-cloud-dialogflow-cx-v3 1.2.0 → 1.3.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/cx/v3/agents/client.rb +31 -12
- data/lib/google/cloud/dialogflow/cx/v3/agents/operations.rb +12 -15
- data/lib/google/cloud/dialogflow/cx/v3/agents/rest/client.rb +31 -12
- data/lib/google/cloud/dialogflow/cx/v3/agents/rest/operations.rb +43 -38
- data/lib/google/cloud/dialogflow/cx/v3/agents/rest/service_stub.rb +102 -68
- data/lib/google/cloud/dialogflow/cx/v3/changelogs/client.rb +29 -3
- data/lib/google/cloud/dialogflow/cx/v3/changelogs/rest/client.rb +29 -3
- data/lib/google/cloud/dialogflow/cx/v3/changelogs/rest/service_stub.rb +30 -14
- data/lib/google/cloud/dialogflow/cx/v3/deployments/client.rb +29 -3
- data/lib/google/cloud/dialogflow/cx/v3/deployments/rest/client.rb +29 -3
- data/lib/google/cloud/dialogflow/cx/v3/deployments/rest/service_stub.rb +30 -14
- data/lib/google/cloud/dialogflow/cx/v3/entity_types/client.rb +31 -8
- data/lib/google/cloud/dialogflow/cx/v3/entity_types/operations.rb +12 -15
- data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest/client.rb +31 -8
- data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest/operations.rb +43 -38
- data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest/service_stub.rb +70 -44
- data/lib/google/cloud/dialogflow/cx/v3/environments/client.rb +35 -10
- data/lib/google/cloud/dialogflow/cx/v3/environments/operations.rb +12 -15
- data/lib/google/cloud/dialogflow/cx/v3/environments/rest/client.rb +35 -10
- data/lib/google/cloud/dialogflow/cx/v3/environments/rest/operations.rb +43 -38
- data/lib/google/cloud/dialogflow/cx/v3/environments/rest/service_stub.rb +86 -56
- data/lib/google/cloud/dialogflow/cx/v3/experiments/client.rb +29 -8
- data/lib/google/cloud/dialogflow/cx/v3/experiments/rest/client.rb +29 -8
- data/lib/google/cloud/dialogflow/cx/v3/experiments/rest/service_stub.rb +70 -44
- data/lib/google/cloud/dialogflow/cx/v3/flows/client.rb +32 -11
- data/lib/google/cloud/dialogflow/cx/v3/flows/operations.rb +12 -15
- data/lib/google/cloud/dialogflow/cx/v3/flows/rest/client.rb +32 -11
- data/lib/google/cloud/dialogflow/cx/v3/flows/rest/operations.rb +43 -38
- data/lib/google/cloud/dialogflow/cx/v3/flows/rest/service_stub.rb +94 -62
- data/lib/google/cloud/dialogflow/cx/v3/generators/client.rb +29 -6
- data/lib/google/cloud/dialogflow/cx/v3/generators/rest/client.rb +29 -6
- data/lib/google/cloud/dialogflow/cx/v3/generators/rest/service_stub.rb +54 -32
- data/lib/google/cloud/dialogflow/cx/v3/intents/client.rb +31 -8
- data/lib/google/cloud/dialogflow/cx/v3/intents/operations.rb +12 -15
- data/lib/google/cloud/dialogflow/cx/v3/intents/rest/client.rb +31 -8
- data/lib/google/cloud/dialogflow/cx/v3/intents/rest/operations.rb +43 -38
- data/lib/google/cloud/dialogflow/cx/v3/intents/rest/service_stub.rb +70 -44
- data/lib/google/cloud/dialogflow/cx/v3/pages/client.rb +29 -6
- data/lib/google/cloud/dialogflow/cx/v3/pages/rest/client.rb +29 -6
- data/lib/google/cloud/dialogflow/cx/v3/pages/rest/service_stub.rb +54 -32
- data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/client.rb +29 -6
- data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/rest/client.rb +29 -6
- data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/rest/service_stub.rb +54 -32
- data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/client.rb +29 -6
- data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/rest/client.rb +29 -6
- data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/rest/service_stub.rb +54 -32
- data/lib/google/cloud/dialogflow/cx/v3/sessions/client.rb +28 -7
- data/lib/google/cloud/dialogflow/cx/v3/sessions/rest/client.rb +28 -5
- data/lib/google/cloud/dialogflow/cx/v3/sessions/rest/service_stub.rb +47 -26
- data/lib/google/cloud/dialogflow/cx/v3/test_cases/client.rb +34 -13
- data/lib/google/cloud/dialogflow/cx/v3/test_cases/operations.rb +12 -15
- data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest/client.rb +34 -13
- data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest/operations.rb +43 -38
- data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest/service_stub.rb +110 -74
- data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/client.rb +29 -6
- data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/rest/client.rb +29 -6
- data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/rest/service_stub.rb +54 -32
- data/lib/google/cloud/dialogflow/cx/v3/version.rb +1 -1
- data/lib/google/cloud/dialogflow/cx/v3/versions/client.rb +31 -8
- data/lib/google/cloud/dialogflow/cx/v3/versions/operations.rb +12 -15
- data/lib/google/cloud/dialogflow/cx/v3/versions/rest/client.rb +31 -8
- data/lib/google/cloud/dialogflow/cx/v3/versions/rest/operations.rb +43 -38
- data/lib/google/cloud/dialogflow/cx/v3/versions/rest/service_stub.rb +70 -44
- data/lib/google/cloud/dialogflow/cx/v3/webhooks/client.rb +29 -6
- data/lib/google/cloud/dialogflow/cx/v3/webhooks/rest/client.rb +29 -6
- data/lib/google/cloud/dialogflow/cx/v3/webhooks/rest/service_stub.rb +54 -32
- data/proto_docs/google/api/client.rb +19 -0
- data/proto_docs/google/longrunning/operations.rb +19 -14
- metadata +5 -5
@@ -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
|
+
@deployments_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 = @deployments_stub.endpoint
|
167
178
|
config.universe_domain = @deployments_stub.universe_domain
|
168
179
|
config.bindings_override = @config.bindings_override
|
180
|
+
config.logger = @deployments_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
|
+
@deployments_stub.logger
|
198
|
+
end
|
199
|
+
|
179
200
|
# Service calls
|
180
201
|
|
181
202
|
##
|
@@ -264,7 +285,7 @@ module Google
|
|
264
285
|
@deployments_stub.list_deployments request, options do |result, operation|
|
265
286
|
result = ::Gapic::Rest::PagedEnumerable.new @deployments_stub, :list_deployments, "deployments", 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)
|
@@ -346,7 +367,6 @@ module Google
|
|
346
367
|
|
347
368
|
@deployments_stub.get_deployment request, options do |result, operation|
|
348
369
|
yield result, operation if block_given?
|
349
|
-
return result
|
350
370
|
end
|
351
371
|
rescue ::Gapic::Rest::Error => e
|
352
372
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -426,6 +446,11 @@ module Google
|
|
426
446
|
# default endpoint URL. The default value of nil uses the environment
|
427
447
|
# universe (usually the default "googleapis.com" universe).
|
428
448
|
# @return [::String,nil]
|
449
|
+
# @!attribute [rw] logger
|
450
|
+
# A custom logger to use for request/response debug logging, or the value
|
451
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
452
|
+
# explicitly disable logging.
|
453
|
+
# @return [::Logger,:default,nil]
|
429
454
|
#
|
430
455
|
class Configuration
|
431
456
|
extend ::Gapic::Config
|
@@ -454,6 +479,7 @@ module Google
|
|
454
479
|
# by the host service.
|
455
480
|
# @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
|
456
481
|
config_attr :bindings_override, {}, ::Hash, nil
|
482
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
457
483
|
|
458
484
|
# @private
|
459
485
|
def initialize parent_config = nil
|
@@ -31,7 +31,8 @@ module Google
|
|
31
31
|
# including transcoding, making the REST call, and deserialing the response.
|
32
32
|
#
|
33
33
|
class ServiceStub
|
34
|
-
|
34
|
+
# @private
|
35
|
+
def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
|
35
36
|
# These require statements are intentionally placed here to initialize
|
36
37
|
# the REST modules only when it's required.
|
37
38
|
require "gapic/rest"
|
@@ -41,7 +42,9 @@ module Google
|
|
41
42
|
universe_domain: universe_domain,
|
42
43
|
credentials: credentials,
|
43
44
|
numeric_enums: true,
|
44
|
-
|
45
|
+
service_name: self.class,
|
46
|
+
raise_faraday_errors: false,
|
47
|
+
logger: logger
|
45
48
|
end
|
46
49
|
|
47
50
|
##
|
@@ -62,6 +65,15 @@ module Google
|
|
62
65
|
@client_stub.endpoint
|
63
66
|
end
|
64
67
|
|
68
|
+
##
|
69
|
+
# The logger used for request/response debug logging.
|
70
|
+
#
|
71
|
+
# @return [Logger]
|
72
|
+
#
|
73
|
+
def logger stub: false
|
74
|
+
stub ? @client_stub.stub_logger : @client_stub.logger
|
75
|
+
end
|
76
|
+
|
65
77
|
##
|
66
78
|
# Baseline implementation for the list_deployments REST call
|
67
79
|
#
|
@@ -88,16 +100,18 @@ module Google
|
|
88
100
|
|
89
101
|
response = @client_stub.make_http_request(
|
90
102
|
verb,
|
91
|
-
uri:
|
92
|
-
body:
|
93
|
-
params:
|
103
|
+
uri: uri,
|
104
|
+
body: body || "",
|
105
|
+
params: query_string_params,
|
106
|
+
method_name: "list_deployments",
|
94
107
|
options: options
|
95
108
|
)
|
96
109
|
operation = ::Gapic::Rest::TransportOperation.new response
|
97
110
|
result = ::Google::Cloud::Dialogflow::CX::V3::ListDeploymentsResponse.decode_json response.body, ignore_unknown_fields: true
|
98
|
-
|
99
|
-
|
100
|
-
|
111
|
+
catch :response do
|
112
|
+
yield result, operation if block_given?
|
113
|
+
result
|
114
|
+
end
|
101
115
|
end
|
102
116
|
|
103
117
|
##
|
@@ -126,16 +140,18 @@ module Google
|
|
126
140
|
|
127
141
|
response = @client_stub.make_http_request(
|
128
142
|
verb,
|
129
|
-
uri:
|
130
|
-
body:
|
131
|
-
params:
|
143
|
+
uri: uri,
|
144
|
+
body: body || "",
|
145
|
+
params: query_string_params,
|
146
|
+
method_name: "get_deployment",
|
132
147
|
options: options
|
133
148
|
)
|
134
149
|
operation = ::Gapic::Rest::TransportOperation.new response
|
135
150
|
result = ::Google::Cloud::Dialogflow::CX::V3::Deployment.decode_json response.body, ignore_unknown_fields: true
|
136
|
-
|
137
|
-
|
138
|
-
|
151
|
+
catch :response do
|
152
|
+
yield result, operation if block_given?
|
153
|
+
result
|
154
|
+
end
|
139
155
|
end
|
140
156
|
|
141
157
|
##
|
@@ -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
|
+
@entity_types_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 = @entity_types_stub.endpoint
|
181
192
|
config.universe_domain = @entity_types_stub.universe_domain
|
193
|
+
config.logger = @entity_types_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
|
+
@entity_types_stub.logger
|
218
|
+
end
|
219
|
+
|
199
220
|
# Service calls
|
200
221
|
|
201
222
|
##
|
@@ -293,7 +314,6 @@ module Google
|
|
293
314
|
|
294
315
|
@entity_types_stub.call_rpc :get_entity_type, request, options: options do |response, operation|
|
295
316
|
yield response, operation if block_given?
|
296
|
-
return response
|
297
317
|
end
|
298
318
|
rescue ::GRPC::BadStatus => e
|
299
319
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -398,7 +418,6 @@ module Google
|
|
398
418
|
|
399
419
|
@entity_types_stub.call_rpc :create_entity_type, request, options: options do |response, operation|
|
400
420
|
yield response, operation if block_given?
|
401
|
-
return response
|
402
421
|
end
|
403
422
|
rescue ::GRPC::BadStatus => e
|
404
423
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -502,7 +521,6 @@ module Google
|
|
502
521
|
|
503
522
|
@entity_types_stub.call_rpc :update_entity_type, request, options: options do |response, operation|
|
504
523
|
yield response, operation if block_given?
|
505
|
-
return response
|
506
524
|
end
|
507
525
|
rescue ::GRPC::BadStatus => e
|
508
526
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -607,7 +625,6 @@ module Google
|
|
607
625
|
|
608
626
|
@entity_types_stub.call_rpc :delete_entity_type, request, options: options do |response, operation|
|
609
627
|
yield response, operation if block_given?
|
610
|
-
return response
|
611
628
|
end
|
612
629
|
rescue ::GRPC::BadStatus => e
|
613
630
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -717,7 +734,7 @@ module Google
|
|
717
734
|
@entity_types_stub.call_rpc :list_entity_types, request, options: options do |response, operation|
|
718
735
|
response = ::Gapic::PagedEnumerable.new @entity_types_stub, :list_entity_types, request, response, operation, options
|
719
736
|
yield response, operation if block_given?
|
720
|
-
|
737
|
+
throw :response, response
|
721
738
|
end
|
722
739
|
rescue ::GRPC::BadStatus => e
|
723
740
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -845,7 +862,7 @@ module Google
|
|
845
862
|
@entity_types_stub.call_rpc :export_entity_types, request, options: options do |response, operation|
|
846
863
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
847
864
|
yield response, operation if block_given?
|
848
|
-
|
865
|
+
throw :response, response
|
849
866
|
end
|
850
867
|
rescue ::GRPC::BadStatus => e
|
851
868
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -963,7 +980,7 @@ module Google
|
|
963
980
|
@entity_types_stub.call_rpc :import_entity_types, request, options: options do |response, operation|
|
964
981
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
965
982
|
yield response, operation if block_given?
|
966
|
-
|
983
|
+
throw :response, response
|
967
984
|
end
|
968
985
|
rescue ::GRPC::BadStatus => e
|
969
986
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1052,6 +1069,11 @@ module Google
|
|
1052
1069
|
# default endpoint URL. The default value of nil uses the environment
|
1053
1070
|
# universe (usually the default "googleapis.com" universe).
|
1054
1071
|
# @return [::String,nil]
|
1072
|
+
# @!attribute [rw] logger
|
1073
|
+
# A custom logger to use for request/response debug logging, or the value
|
1074
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
1075
|
+
# explicitly disable logging.
|
1076
|
+
# @return [::Logger,:default,nil]
|
1055
1077
|
#
|
1056
1078
|
class Configuration
|
1057
1079
|
extend ::Gapic::Config
|
@@ -1076,6 +1098,7 @@ module Google
|
|
1076
1098
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
1077
1099
|
config_attr :quota_project, nil, ::String, nil
|
1078
1100
|
config_attr :universe_domain, nil, ::String, nil
|
1101
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
1079
1102
|
|
1080
1103
|
# @private
|
1081
1104
|
def initialize parent_config = nil
|
@@ -125,14 +125,6 @@ module Google
|
|
125
125
|
# Lists operations that match the specified filter in the request. If the
|
126
126
|
# server doesn't support this method, it returns `UNIMPLEMENTED`.
|
127
127
|
#
|
128
|
-
# NOTE: the `name` binding allows API services to override the binding
|
129
|
-
# to use different resource name schemes, such as `users/*/operations`. To
|
130
|
-
# override the binding, API services can add a binding such as
|
131
|
-
# `"/v1/{name=users/*}/operations"` to their service configuration.
|
132
|
-
# For backwards compatibility, the default name includes the operations
|
133
|
-
# collection id, however overriding users must ensure the name binding
|
134
|
-
# is the parent resource, without the operations collection id.
|
135
|
-
#
|
136
128
|
# @overload list_operations(request, options = nil)
|
137
129
|
# Pass arguments to `list_operations` via a request object, either of type
|
138
130
|
# {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
|
@@ -222,7 +214,7 @@ module Google
|
|
222
214
|
wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
|
223
215
|
response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
|
224
216
|
yield response, operation if block_given?
|
225
|
-
|
217
|
+
throw :response, response
|
226
218
|
end
|
227
219
|
rescue ::GRPC::BadStatus => e
|
228
220
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -318,7 +310,7 @@ module Google
|
|
318
310
|
@operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
|
319
311
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
320
312
|
yield response, operation if block_given?
|
321
|
-
|
313
|
+
throw :response, response
|
322
314
|
end
|
323
315
|
rescue ::GRPC::BadStatus => e
|
324
316
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -407,7 +399,6 @@ module Google
|
|
407
399
|
|
408
400
|
@operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
|
409
401
|
yield response, operation if block_given?
|
410
|
-
return response
|
411
402
|
end
|
412
403
|
rescue ::GRPC::BadStatus => e
|
413
404
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -422,8 +413,9 @@ module Google
|
|
422
413
|
# other methods to check whether the cancellation succeeded or whether the
|
423
414
|
# operation completed despite cancellation. On successful cancellation,
|
424
415
|
# the operation is not deleted; instead, it becomes an operation with
|
425
|
-
# an {::Google::Longrunning::Operation#error Operation.error} value with a
|
426
|
-
# corresponding to
|
416
|
+
# an {::Google::Longrunning::Operation#error Operation.error} value with a
|
417
|
+
# {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
|
418
|
+
# `Code.CANCELLED`.
|
427
419
|
#
|
428
420
|
# @overload cancel_operation(request, options = nil)
|
429
421
|
# Pass arguments to `cancel_operation` via a request object, either of type
|
@@ -502,7 +494,6 @@ module Google
|
|
502
494
|
|
503
495
|
@operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
|
504
496
|
yield response, operation if block_given?
|
505
|
-
return response
|
506
497
|
end
|
507
498
|
rescue ::GRPC::BadStatus => e
|
508
499
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -600,7 +591,7 @@ module Google
|
|
600
591
|
@operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
|
601
592
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
602
593
|
yield response, operation if block_given?
|
603
|
-
|
594
|
+
throw :response, response
|
604
595
|
end
|
605
596
|
rescue ::GRPC::BadStatus => e
|
606
597
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -689,6 +680,11 @@ module Google
|
|
689
680
|
# default endpoint URL. The default value of nil uses the environment
|
690
681
|
# universe (usually the default "googleapis.com" universe).
|
691
682
|
# @return [::String,nil]
|
683
|
+
# @!attribute [rw] logger
|
684
|
+
# A custom logger to use for request/response debug logging, or the value
|
685
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
686
|
+
# explicitly disable logging.
|
687
|
+
# @return [::Logger,:default,nil]
|
692
688
|
#
|
693
689
|
class Configuration
|
694
690
|
extend ::Gapic::Config
|
@@ -713,6 +709,7 @@ module Google
|
|
713
709
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
714
710
|
config_attr :quota_project, nil, ::String, nil
|
715
711
|
config_attr :universe_domain, nil, ::String, nil
|
712
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
716
713
|
|
717
714
|
# @private
|
718
715
|
def initialize parent_config = nil
|
@@ -164,15 +164,27 @@ module Google
|
|
164
164
|
endpoint: @config.endpoint,
|
165
165
|
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
166
166
|
universe_domain: @config.universe_domain,
|
167
|
-
credentials: credentials
|
167
|
+
credentials: credentials,
|
168
|
+
logger: @config.logger
|
168
169
|
)
|
169
170
|
|
171
|
+
@entity_types_stub.logger(stub: true)&.info do |entry|
|
172
|
+
entry.set_system_name
|
173
|
+
entry.set_service
|
174
|
+
entry.message = "Created client for #{entry.service}"
|
175
|
+
entry.set_credentials_fields credentials
|
176
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
177
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
178
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
179
|
+
end
|
180
|
+
|
170
181
|
@location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
|
171
182
|
config.credentials = credentials
|
172
183
|
config.quota_project = @quota_project_id
|
173
184
|
config.endpoint = @entity_types_stub.endpoint
|
174
185
|
config.universe_domain = @entity_types_stub.universe_domain
|
175
186
|
config.bindings_override = @config.bindings_override
|
187
|
+
config.logger = @entity_types_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
|
+
@entity_types_stub.logger
|
212
|
+
end
|
213
|
+
|
193
214
|
# Service calls
|
194
215
|
|
195
216
|
##
|
@@ -280,7 +301,6 @@ module Google
|
|
280
301
|
|
281
302
|
@entity_types_stub.get_entity_type request, options do |result, operation|
|
282
303
|
yield result, operation if block_given?
|
283
|
-
return result
|
284
304
|
end
|
285
305
|
rescue ::Gapic::Rest::Error => e
|
286
306
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -378,7 +398,6 @@ module Google
|
|
378
398
|
|
379
399
|
@entity_types_stub.create_entity_type request, options do |result, operation|
|
380
400
|
yield result, operation if block_given?
|
381
|
-
return result
|
382
401
|
end
|
383
402
|
rescue ::Gapic::Rest::Error => e
|
384
403
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -475,7 +494,6 @@ module Google
|
|
475
494
|
|
476
495
|
@entity_types_stub.update_entity_type request, options do |result, operation|
|
477
496
|
yield result, operation if block_given?
|
478
|
-
return result
|
479
497
|
end
|
480
498
|
rescue ::Gapic::Rest::Error => e
|
481
499
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -573,7 +591,6 @@ module Google
|
|
573
591
|
|
574
592
|
@entity_types_stub.delete_entity_type request, options do |result, operation|
|
575
593
|
yield result, operation if block_given?
|
576
|
-
return result
|
577
594
|
end
|
578
595
|
rescue ::Gapic::Rest::Error => e
|
579
596
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -676,7 +693,7 @@ module Google
|
|
676
693
|
@entity_types_stub.list_entity_types request, options do |result, operation|
|
677
694
|
result = ::Gapic::Rest::PagedEnumerable.new @entity_types_stub, :list_entity_types, "entity_types", request, result, options
|
678
695
|
yield result, operation if block_given?
|
679
|
-
|
696
|
+
throw :response, result
|
680
697
|
end
|
681
698
|
rescue ::Gapic::Rest::Error => e
|
682
699
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -797,7 +814,7 @@ module Google
|
|
797
814
|
@entity_types_stub.export_entity_types request, options do |result, operation|
|
798
815
|
result = ::Gapic::Operation.new result, @operations_client, options: options
|
799
816
|
yield result, operation if block_given?
|
800
|
-
|
817
|
+
throw :response, result
|
801
818
|
end
|
802
819
|
rescue ::Gapic::Rest::Error => e
|
803
820
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -908,7 +925,7 @@ module Google
|
|
908
925
|
@entity_types_stub.import_entity_types request, options do |result, operation|
|
909
926
|
result = ::Gapic::Operation.new result, @operations_client, options: options
|
910
927
|
yield result, operation if block_given?
|
911
|
-
|
928
|
+
throw :response, result
|
912
929
|
end
|
913
930
|
rescue ::Gapic::Rest::Error => e
|
914
931
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -988,6 +1005,11 @@ module Google
|
|
988
1005
|
# default endpoint URL. The default value of nil uses the environment
|
989
1006
|
# universe (usually the default "googleapis.com" universe).
|
990
1007
|
# @return [::String,nil]
|
1008
|
+
# @!attribute [rw] logger
|
1009
|
+
# A custom logger to use for request/response debug logging, or the value
|
1010
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
1011
|
+
# explicitly disable logging.
|
1012
|
+
# @return [::Logger,:default,nil]
|
991
1013
|
#
|
992
1014
|
class Configuration
|
993
1015
|
extend ::Gapic::Config
|
@@ -1016,6 +1038,7 @@ module Google
|
|
1016
1038
|
# by the host service.
|
1017
1039
|
# @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
|
1018
1040
|
config_attr :bindings_override, {}, ::Hash, nil
|
1041
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
1019
1042
|
|
1020
1043
|
# @private
|
1021
1044
|
def initialize parent_config = nil
|