google-cloud-dialogflow-cx-v3 1.2.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +31 -21
  3. data/lib/google/cloud/dialogflow/cx/v3/agents/client.rb +44 -12
  4. data/lib/google/cloud/dialogflow/cx/v3/agents/operations.rb +19 -15
  5. data/lib/google/cloud/dialogflow/cx/v3/agents/rest/client.rb +44 -12
  6. data/lib/google/cloud/dialogflow/cx/v3/agents/rest/operations.rb +50 -38
  7. data/lib/google/cloud/dialogflow/cx/v3/agents/rest/service_stub.rb +102 -68
  8. data/lib/google/cloud/dialogflow/cx/v3/changelogs/client.rb +36 -3
  9. data/lib/google/cloud/dialogflow/cx/v3/changelogs/rest/client.rb +36 -3
  10. data/lib/google/cloud/dialogflow/cx/v3/changelogs/rest/service_stub.rb +30 -14
  11. data/lib/google/cloud/dialogflow/cx/v3/deployments/client.rb +36 -3
  12. data/lib/google/cloud/dialogflow/cx/v3/deployments/rest/client.rb +36 -3
  13. data/lib/google/cloud/dialogflow/cx/v3/deployments/rest/service_stub.rb +30 -14
  14. data/lib/google/cloud/dialogflow/cx/v3/entity_types/client.rb +46 -8
  15. data/lib/google/cloud/dialogflow/cx/v3/entity_types/operations.rb +19 -15
  16. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest/client.rb +46 -8
  17. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest/operations.rb +50 -38
  18. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest/service_stub.rb +70 -44
  19. data/lib/google/cloud/dialogflow/cx/v3/environments/client.rb +42 -10
  20. data/lib/google/cloud/dialogflow/cx/v3/environments/operations.rb +19 -15
  21. data/lib/google/cloud/dialogflow/cx/v3/environments/rest/client.rb +42 -10
  22. data/lib/google/cloud/dialogflow/cx/v3/environments/rest/operations.rb +50 -38
  23. data/lib/google/cloud/dialogflow/cx/v3/environments/rest/service_stub.rb +86 -56
  24. data/lib/google/cloud/dialogflow/cx/v3/experiments/client.rb +36 -8
  25. data/lib/google/cloud/dialogflow/cx/v3/experiments/rest/client.rb +36 -8
  26. data/lib/google/cloud/dialogflow/cx/v3/experiments/rest/service_stub.rb +70 -44
  27. data/lib/google/cloud/dialogflow/cx/v3/flows/client.rb +43 -11
  28. data/lib/google/cloud/dialogflow/cx/v3/flows/operations.rb +19 -15
  29. data/lib/google/cloud/dialogflow/cx/v3/flows/rest/client.rb +43 -11
  30. data/lib/google/cloud/dialogflow/cx/v3/flows/rest/operations.rb +50 -38
  31. data/lib/google/cloud/dialogflow/cx/v3/flows/rest/service_stub.rb +94 -62
  32. data/lib/google/cloud/dialogflow/cx/v3/generators/client.rb +36 -6
  33. data/lib/google/cloud/dialogflow/cx/v3/generators/rest/client.rb +36 -6
  34. data/lib/google/cloud/dialogflow/cx/v3/generators/rest/service_stub.rb +54 -32
  35. data/lib/google/cloud/dialogflow/cx/v3/intents/client.rb +46 -8
  36. data/lib/google/cloud/dialogflow/cx/v3/intents/operations.rb +19 -15
  37. data/lib/google/cloud/dialogflow/cx/v3/intents/rest/client.rb +46 -8
  38. data/lib/google/cloud/dialogflow/cx/v3/intents/rest/operations.rb +50 -38
  39. data/lib/google/cloud/dialogflow/cx/v3/intents/rest/service_stub.rb +70 -44
  40. data/lib/google/cloud/dialogflow/cx/v3/pages/client.rb +36 -6
  41. data/lib/google/cloud/dialogflow/cx/v3/pages/rest/client.rb +36 -6
  42. data/lib/google/cloud/dialogflow/cx/v3/pages/rest/service_stub.rb +54 -32
  43. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/client.rb +36 -6
  44. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/rest/client.rb +36 -6
  45. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/rest/service_stub.rb +54 -32
  46. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/client.rb +36 -6
  47. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/rest/client.rb +36 -6
  48. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/rest/service_stub.rb +54 -32
  49. data/lib/google/cloud/dialogflow/cx/v3/sessions/client.rb +35 -7
  50. data/lib/google/cloud/dialogflow/cx/v3/sessions/rest/client.rb +35 -5
  51. data/lib/google/cloud/dialogflow/cx/v3/sessions/rest/service_stub.rb +47 -26
  52. data/lib/google/cloud/dialogflow/cx/v3/test_cases/client.rb +45 -13
  53. data/lib/google/cloud/dialogflow/cx/v3/test_cases/operations.rb +19 -15
  54. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest/client.rb +45 -13
  55. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest/operations.rb +50 -38
  56. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest/service_stub.rb +110 -74
  57. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/client.rb +36 -6
  58. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/rest/client.rb +36 -6
  59. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/rest/service_stub.rb +54 -32
  60. data/lib/google/cloud/dialogflow/cx/v3/version.rb +1 -1
  61. data/lib/google/cloud/dialogflow/cx/v3/versions/client.rb +38 -8
  62. data/lib/google/cloud/dialogflow/cx/v3/versions/operations.rb +19 -15
  63. data/lib/google/cloud/dialogflow/cx/v3/versions/rest/client.rb +38 -8
  64. data/lib/google/cloud/dialogflow/cx/v3/versions/rest/operations.rb +50 -38
  65. data/lib/google/cloud/dialogflow/cx/v3/versions/rest/service_stub.rb +70 -44
  66. data/lib/google/cloud/dialogflow/cx/v3/webhooks/client.rb +36 -6
  67. data/lib/google/cloud/dialogflow/cx/v3/webhooks/rest/client.rb +36 -6
  68. data/lib/google/cloud/dialogflow/cx/v3/webhooks/rest/service_stub.rb +54 -32
  69. data/proto_docs/google/api/client.rb +19 -0
  70. data/proto_docs/google/cloud/dialogflow/cx/v3/agent.rb +12 -0
  71. data/proto_docs/google/cloud/dialogflow/cx/v3/entity_type.rb +12 -0
  72. data/proto_docs/google/cloud/dialogflow/cx/v3/experiment.rb +4 -0
  73. data/proto_docs/google/cloud/dialogflow/cx/v3/flow.rb +8 -0
  74. data/proto_docs/google/cloud/dialogflow/cx/v3/fulfillment.rb +4 -0
  75. data/proto_docs/google/cloud/dialogflow/cx/v3/intent.rb +12 -0
  76. data/proto_docs/google/cloud/dialogflow/cx/v3/page.rb +12 -0
  77. data/proto_docs/google/cloud/dialogflow/cx/v3/response_message.rb +28 -0
  78. data/proto_docs/google/cloud/dialogflow/cx/v3/security_settings.rb +4 -0
  79. data/proto_docs/google/cloud/dialogflow/cx/v3/session.rb +32 -0
  80. data/proto_docs/google/cloud/dialogflow/cx/v3/test_case.rb +22 -0
  81. data/proto_docs/google/cloud/dialogflow/cx/v3/webhook.rb +18 -0
  82. data/proto_docs/google/longrunning/operations.rb +23 -14
  83. data/proto_docs/google/protobuf/struct.rb +12 -0
  84. metadata +6 -9
@@ -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
- def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
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
- raise_faraday_errors: false
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_experiments 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: uri,
92
- body: body || "",
93
- params: query_string_params,
103
+ uri: uri,
104
+ body: body || "",
105
+ params: query_string_params,
106
+ method_name: "list_experiments",
94
107
  options: options
95
108
  )
96
109
  operation = ::Gapic::Rest::TransportOperation.new response
97
110
  result = ::Google::Cloud::Dialogflow::CX::V3::ListExperimentsResponse.decode_json response.body, ignore_unknown_fields: true
98
-
99
- yield result, operation if block_given?
100
- result
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: uri,
130
- body: body || "",
131
- params: query_string_params,
143
+ uri: uri,
144
+ body: body || "",
145
+ params: query_string_params,
146
+ method_name: "get_experiment",
132
147
  options: options
133
148
  )
134
149
  operation = ::Gapic::Rest::TransportOperation.new response
135
150
  result = ::Google::Cloud::Dialogflow::CX::V3::Experiment.decode_json response.body, ignore_unknown_fields: true
136
-
137
- yield result, operation if block_given?
138
- result
151
+ catch :response do
152
+ yield result, operation if block_given?
153
+ result
154
+ end
139
155
  end
140
156
 
141
157
  ##
@@ -164,16 +180,18 @@ module Google
164
180
 
165
181
  response = @client_stub.make_http_request(
166
182
  verb,
167
- uri: uri,
168
- body: body || "",
169
- params: query_string_params,
183
+ uri: uri,
184
+ body: body || "",
185
+ params: query_string_params,
186
+ method_name: "create_experiment",
170
187
  options: options
171
188
  )
172
189
  operation = ::Gapic::Rest::TransportOperation.new response
173
190
  result = ::Google::Cloud::Dialogflow::CX::V3::Experiment.decode_json response.body, ignore_unknown_fields: true
174
-
175
- yield result, operation if block_given?
176
- result
191
+ catch :response do
192
+ yield result, operation if block_given?
193
+ result
194
+ end
177
195
  end
178
196
 
179
197
  ##
@@ -202,16 +220,18 @@ module Google
202
220
 
203
221
  response = @client_stub.make_http_request(
204
222
  verb,
205
- uri: uri,
206
- body: body || "",
207
- params: query_string_params,
223
+ uri: uri,
224
+ body: body || "",
225
+ params: query_string_params,
226
+ method_name: "update_experiment",
208
227
  options: options
209
228
  )
210
229
  operation = ::Gapic::Rest::TransportOperation.new response
211
230
  result = ::Google::Cloud::Dialogflow::CX::V3::Experiment.decode_json response.body, ignore_unknown_fields: true
212
-
213
- yield result, operation if block_given?
214
- result
231
+ catch :response do
232
+ yield result, operation if block_given?
233
+ result
234
+ end
215
235
  end
216
236
 
217
237
  ##
@@ -240,16 +260,18 @@ module Google
240
260
 
241
261
  response = @client_stub.make_http_request(
242
262
  verb,
243
- uri: uri,
244
- body: body || "",
245
- params: query_string_params,
263
+ uri: uri,
264
+ body: body || "",
265
+ params: query_string_params,
266
+ method_name: "delete_experiment",
246
267
  options: options
247
268
  )
248
269
  operation = ::Gapic::Rest::TransportOperation.new response
249
270
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
250
-
251
- yield result, operation if block_given?
252
- result
271
+ catch :response do
272
+ yield result, operation if block_given?
273
+ result
274
+ end
253
275
  end
254
276
 
255
277
  ##
@@ -278,16 +300,18 @@ module Google
278
300
 
279
301
  response = @client_stub.make_http_request(
280
302
  verb,
281
- uri: uri,
282
- body: body || "",
283
- params: query_string_params,
303
+ uri: uri,
304
+ body: body || "",
305
+ params: query_string_params,
306
+ method_name: "start_experiment",
284
307
  options: options
285
308
  )
286
309
  operation = ::Gapic::Rest::TransportOperation.new response
287
310
  result = ::Google::Cloud::Dialogflow::CX::V3::Experiment.decode_json response.body, ignore_unknown_fields: true
288
-
289
- yield result, operation if block_given?
290
- result
311
+ catch :response do
312
+ yield result, operation if block_given?
313
+ result
314
+ end
291
315
  end
292
316
 
293
317
  ##
@@ -316,16 +340,18 @@ module Google
316
340
 
317
341
  response = @client_stub.make_http_request(
318
342
  verb,
319
- uri: uri,
320
- body: body || "",
321
- params: query_string_params,
343
+ uri: uri,
344
+ body: body || "",
345
+ params: query_string_params,
346
+ method_name: "stop_experiment",
322
347
  options: options
323
348
  )
324
349
  operation = ::Gapic::Rest::TransportOperation.new response
325
350
  result = ::Google::Cloud::Dialogflow::CX::V3::Experiment.decode_json response.body, ignore_unknown_fields: true
326
-
327
- yield result, operation if block_given?
328
- result
351
+ catch :response do
352
+ yield result, operation if block_given?
353
+ result
354
+ end
329
355
  end
330
356
 
331
357
  ##
@@ -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
+ @flows_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 = @flows_stub.endpoint
181
192
  config.universe_domain = @flows_stub.universe_domain
193
+ config.logger = @flows_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
+ @flows_stub.logger
218
+ end
219
+
199
220
  # Service calls
200
221
 
201
222
  ##
@@ -298,7 +319,6 @@ module Google
298
319
 
299
320
  @flows_stub.call_rpc :create_flow, request, options: options do |response, operation|
300
321
  yield response, operation if block_given?
301
- return response
302
322
  end
303
323
  rescue ::GRPC::BadStatus => e
304
324
  raise ::Google::Cloud::Error.from_error(e)
@@ -397,7 +417,6 @@ module Google
397
417
 
398
418
  @flows_stub.call_rpc :delete_flow, request, options: options do |response, operation|
399
419
  yield response, operation if block_given?
400
- return response
401
420
  end
402
421
  rescue ::GRPC::BadStatus => e
403
422
  raise ::Google::Cloud::Error.from_error(e)
@@ -508,7 +527,7 @@ module Google
508
527
  @flows_stub.call_rpc :list_flows, request, options: options do |response, operation|
509
528
  response = ::Gapic::PagedEnumerable.new @flows_stub, :list_flows, request, response, operation, options
510
529
  yield response, operation if block_given?
511
- return response
530
+ throw :response, response
512
531
  end
513
532
  rescue ::GRPC::BadStatus => e
514
533
  raise ::Google::Cloud::Error.from_error(e)
@@ -610,7 +629,6 @@ module Google
610
629
 
611
630
  @flows_stub.call_rpc :get_flow, request, options: options do |response, operation|
612
631
  yield response, operation if block_given?
613
- return response
614
632
  end
615
633
  rescue ::GRPC::BadStatus => e
616
634
  raise ::Google::Cloud::Error.from_error(e)
@@ -716,7 +734,6 @@ module Google
716
734
 
717
735
  @flows_stub.call_rpc :update_flow, request, options: options do |response, operation|
718
736
  yield response, operation if block_given?
719
- return response
720
737
  end
721
738
  rescue ::GRPC::BadStatus => e
722
739
  raise ::Google::Cloud::Error.from_error(e)
@@ -826,7 +843,7 @@ module Google
826
843
  @flows_stub.call_rpc :train_flow, request, options: options do |response, operation|
827
844
  response = ::Gapic::Operation.new response, @operations_client, options: options
828
845
  yield response, operation if block_given?
829
- return response
846
+ throw :response, response
830
847
  end
831
848
  rescue ::GRPC::BadStatus => e
832
849
  raise ::Google::Cloud::Error.from_error(e)
@@ -918,7 +935,6 @@ module Google
918
935
 
919
936
  @flows_stub.call_rpc :validate_flow, request, options: options do |response, operation|
920
937
  yield response, operation if block_given?
921
- return response
922
938
  end
923
939
  rescue ::GRPC::BadStatus => e
924
940
  raise ::Google::Cloud::Error.from_error(e)
@@ -1009,7 +1025,6 @@ module Google
1009
1025
 
1010
1026
  @flows_stub.call_rpc :get_flow_validation_result, request, options: options do |response, operation|
1011
1027
  yield response, operation if block_given?
1012
- return response
1013
1028
  end
1014
1029
  rescue ::GRPC::BadStatus => e
1015
1030
  raise ::Google::Cloud::Error.from_error(e)
@@ -1059,8 +1074,12 @@ module Google
1059
1074
  # have read permissions for the object. For more information, see
1060
1075
  # [Dialogflow access
1061
1076
  # control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage).
1077
+ #
1078
+ # Note: The following fields are mutually exclusive: `flow_uri`, `flow_content`. If a field in that set is populated, all other fields in the set will automatically be cleared.
1062
1079
  # @param flow_content [::String]
1063
1080
  # Uncompressed raw byte content for flow.
1081
+ #
1082
+ # Note: The following fields are mutually exclusive: `flow_content`, `flow_uri`. If a field in that set is populated, all other fields in the set will automatically be cleared.
1064
1083
  # @param import_option [::Google::Cloud::Dialogflow::CX::V3::ImportFlowRequest::ImportOption]
1065
1084
  # Flow import mode. If not specified, `KEEP` is assumed.
1066
1085
  # @param flow_import_strategy [::Google::Cloud::Dialogflow::CX::V3::FlowImportStrategy, ::Hash]
@@ -1134,7 +1153,7 @@ module Google
1134
1153
  @flows_stub.call_rpc :import_flow, request, options: options do |response, operation|
1135
1154
  response = ::Gapic::Operation.new response, @operations_client, options: options
1136
1155
  yield response, operation if block_given?
1137
- return response
1156
+ throw :response, response
1138
1157
  end
1139
1158
  rescue ::GRPC::BadStatus => e
1140
1159
  raise ::Google::Cloud::Error.from_error(e)
@@ -1255,7 +1274,7 @@ module Google
1255
1274
  @flows_stub.call_rpc :export_flow, request, options: options do |response, operation|
1256
1275
  response = ::Gapic::Operation.new response, @operations_client, options: options
1257
1276
  yield response, operation if block_given?
1258
- return response
1277
+ throw :response, response
1259
1278
  end
1260
1279
  rescue ::GRPC::BadStatus => e
1261
1280
  raise ::Google::Cloud::Error.from_error(e)
@@ -1305,6 +1324,13 @@ module Google
1305
1324
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
1306
1325
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
1307
1326
  # * (`nil`) indicating no credentials
1327
+ #
1328
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
1329
+ # external source for authentication to Google Cloud, you must validate it before
1330
+ # providing it to a Google API client library. Providing an unvalidated credential
1331
+ # configuration to Google APIs can compromise the security of your systems and data.
1332
+ # For more information, refer to [Validate credential configurations from external
1333
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
1308
1334
  # @return [::Object]
1309
1335
  # @!attribute [rw] scope
1310
1336
  # The OAuth scopes
@@ -1344,6 +1370,11 @@ module Google
1344
1370
  # default endpoint URL. The default value of nil uses the environment
1345
1371
  # universe (usually the default "googleapis.com" universe).
1346
1372
  # @return [::String,nil]
1373
+ # @!attribute [rw] logger
1374
+ # A custom logger to use for request/response debug logging, or the value
1375
+ # `:default` (the default) to construct a default logger, or `nil` to
1376
+ # explicitly disable logging.
1377
+ # @return [::Logger,:default,nil]
1347
1378
  #
1348
1379
  class Configuration
1349
1380
  extend ::Gapic::Config
@@ -1368,6 +1399,7 @@ module Google
1368
1399
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1369
1400
  config_attr :quota_project, nil, ::String, nil
1370
1401
  config_attr :universe_domain, nil, ::String, nil
1402
+ config_attr :logger, :default, ::Logger, nil, :default
1371
1403
 
1372
1404
  # @private
1373
1405
  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
- return response
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
- return response
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 {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
426
- # corresponding to `Code.CANCELLED`.
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
- return response
594
+ throw :response, response
604
595
  end
605
596
  rescue ::GRPC::BadStatus => e
606
597
  raise ::Google::Cloud::Error.from_error(e)
@@ -650,6 +641,13 @@ module Google
650
641
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
651
642
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
652
643
  # * (`nil`) indicating no credentials
644
+ #
645
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
646
+ # external source for authentication to Google Cloud, you must validate it before
647
+ # providing it to a Google API client library. Providing an unvalidated credential
648
+ # configuration to Google APIs can compromise the security of your systems and data.
649
+ # For more information, refer to [Validate credential configurations from external
650
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
653
651
  # @return [::Object]
654
652
  # @!attribute [rw] scope
655
653
  # The OAuth scopes
@@ -689,6 +687,11 @@ module Google
689
687
  # default endpoint URL. The default value of nil uses the environment
690
688
  # universe (usually the default "googleapis.com" universe).
691
689
  # @return [::String,nil]
690
+ # @!attribute [rw] logger
691
+ # A custom logger to use for request/response debug logging, or the value
692
+ # `:default` (the default) to construct a default logger, or `nil` to
693
+ # explicitly disable logging.
694
+ # @return [::Logger,:default,nil]
692
695
  #
693
696
  class Configuration
694
697
  extend ::Gapic::Config
@@ -713,6 +716,7 @@ module Google
713
716
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
714
717
  config_attr :quota_project, nil, ::String, nil
715
718
  config_attr :universe_domain, nil, ::String, nil
719
+ config_attr :logger, :default, ::Logger, nil, :default
716
720
 
717
721
  # @private
718
722
  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
+ @flows_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 = @flows_stub.endpoint
174
185
  config.universe_domain = @flows_stub.universe_domain
175
186
  config.bindings_override = @config.bindings_override
187
+ config.logger = @flows_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
+ @flows_stub.logger
212
+ end
213
+
193
214
  # Service calls
194
215
 
195
216
  ##
@@ -285,7 +306,6 @@ module Google
285
306
 
286
307
  @flows_stub.create_flow 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)
@@ -377,7 +397,6 @@ module Google
377
397
 
378
398
  @flows_stub.delete_flow request, options do |result, operation|
379
399
  yield result, operation if block_given?
380
- return result
381
400
  end
382
401
  rescue ::Gapic::Rest::Error => e
383
402
  raise ::Google::Cloud::Error.from_error(e)
@@ -481,7 +500,7 @@ module Google
481
500
  @flows_stub.list_flows request, options do |result, operation|
482
501
  result = ::Gapic::Rest::PagedEnumerable.new @flows_stub, :list_flows, "flows", request, result, options
483
502
  yield result, operation if block_given?
484
- return result
503
+ throw :response, result
485
504
  end
486
505
  rescue ::Gapic::Rest::Error => e
487
506
  raise ::Google::Cloud::Error.from_error(e)
@@ -576,7 +595,6 @@ module Google
576
595
 
577
596
  @flows_stub.get_flow request, options do |result, operation|
578
597
  yield result, operation if block_given?
579
- return result
580
598
  end
581
599
  rescue ::Gapic::Rest::Error => e
582
600
  raise ::Google::Cloud::Error.from_error(e)
@@ -675,7 +693,6 @@ module Google
675
693
 
676
694
  @flows_stub.update_flow request, options do |result, operation|
677
695
  yield result, operation if block_given?
678
- return result
679
696
  end
680
697
  rescue ::Gapic::Rest::Error => e
681
698
  raise ::Google::Cloud::Error.from_error(e)
@@ -778,7 +795,7 @@ module Google
778
795
  @flows_stub.train_flow request, options do |result, operation|
779
796
  result = ::Gapic::Operation.new result, @operations_client, options: options
780
797
  yield result, operation if block_given?
781
- return result
798
+ throw :response, result
782
799
  end
783
800
  rescue ::Gapic::Rest::Error => e
784
801
  raise ::Google::Cloud::Error.from_error(e)
@@ -863,7 +880,6 @@ module Google
863
880
 
864
881
  @flows_stub.validate_flow request, options do |result, operation|
865
882
  yield result, operation if block_given?
866
- return result
867
883
  end
868
884
  rescue ::Gapic::Rest::Error => e
869
885
  raise ::Google::Cloud::Error.from_error(e)
@@ -947,7 +963,6 @@ module Google
947
963
 
948
964
  @flows_stub.get_flow_validation_result request, options do |result, operation|
949
965
  yield result, operation if block_given?
950
- return result
951
966
  end
952
967
  rescue ::Gapic::Rest::Error => e
953
968
  raise ::Google::Cloud::Error.from_error(e)
@@ -997,8 +1012,12 @@ module Google
997
1012
  # have read permissions for the object. For more information, see
998
1013
  # [Dialogflow access
999
1014
  # control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage).
1015
+ #
1016
+ # Note: The following fields are mutually exclusive: `flow_uri`, `flow_content`. If a field in that set is populated, all other fields in the set will automatically be cleared.
1000
1017
  # @param flow_content [::String]
1001
1018
  # Uncompressed raw byte content for flow.
1019
+ #
1020
+ # Note: The following fields are mutually exclusive: `flow_content`, `flow_uri`. If a field in that set is populated, all other fields in the set will automatically be cleared.
1002
1021
  # @param import_option [::Google::Cloud::Dialogflow::CX::V3::ImportFlowRequest::ImportOption]
1003
1022
  # Flow import mode. If not specified, `KEEP` is assumed.
1004
1023
  # @param flow_import_strategy [::Google::Cloud::Dialogflow::CX::V3::FlowImportStrategy, ::Hash]
@@ -1065,7 +1084,7 @@ module Google
1065
1084
  @flows_stub.import_flow request, options do |result, operation|
1066
1085
  result = ::Gapic::Operation.new result, @operations_client, options: options
1067
1086
  yield result, operation if block_given?
1068
- return result
1087
+ throw :response, result
1069
1088
  end
1070
1089
  rescue ::Gapic::Rest::Error => e
1071
1090
  raise ::Google::Cloud::Error.from_error(e)
@@ -1179,7 +1198,7 @@ module Google
1179
1198
  @flows_stub.export_flow request, options do |result, operation|
1180
1199
  result = ::Gapic::Operation.new result, @operations_client, options: options
1181
1200
  yield result, operation if block_given?
1182
- return result
1201
+ throw :response, result
1183
1202
  end
1184
1203
  rescue ::Gapic::Rest::Error => e
1185
1204
  raise ::Google::Cloud::Error.from_error(e)
@@ -1227,6 +1246,13 @@ module Google
1227
1246
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1228
1247
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
1229
1248
  # * (`nil`) indicating no credentials
1249
+ #
1250
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
1251
+ # external source for authentication to Google Cloud, you must validate it before
1252
+ # providing it to a Google API client library. Providing an unvalidated credential
1253
+ # configuration to Google APIs can compromise the security of your systems and data.
1254
+ # For more information, refer to [Validate credential configurations from external
1255
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
1230
1256
  # @return [::Object]
1231
1257
  # @!attribute [rw] scope
1232
1258
  # The OAuth scopes
@@ -1259,6 +1285,11 @@ module Google
1259
1285
  # default endpoint URL. The default value of nil uses the environment
1260
1286
  # universe (usually the default "googleapis.com" universe).
1261
1287
  # @return [::String,nil]
1288
+ # @!attribute [rw] logger
1289
+ # A custom logger to use for request/response debug logging, or the value
1290
+ # `:default` (the default) to construct a default logger, or `nil` to
1291
+ # explicitly disable logging.
1292
+ # @return [::Logger,:default,nil]
1262
1293
  #
1263
1294
  class Configuration
1264
1295
  extend ::Gapic::Config
@@ -1287,6 +1318,7 @@ module Google
1287
1318
  # by the host service.
1288
1319
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
1289
1320
  config_attr :bindings_override, {}, ::Hash, nil
1321
+ config_attr :logger, :default, ::Logger, nil, :default
1290
1322
 
1291
1323
  # @private
1292
1324
  def initialize parent_config = nil