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
@@ -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
+ @changelogs_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 = @changelogs_stub.endpoint
167
178
  config.universe_domain = @changelogs_stub.universe_domain
168
179
  config.bindings_override = @config.bindings_override
180
+ config.logger = @changelogs_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
+ @changelogs_stub.logger
198
+ end
199
+
179
200
  # Service calls
180
201
 
181
202
  ##
@@ -283,7 +304,7 @@ module Google
283
304
  @changelogs_stub.list_changelogs request, options do |result, operation|
284
305
  result = ::Gapic::Rest::PagedEnumerable.new @changelogs_stub, :list_changelogs, "changelogs", request, result, options
285
306
  yield result, operation if block_given?
286
- return result
307
+ throw :response, result
287
308
  end
288
309
  rescue ::Gapic::Rest::Error => e
289
310
  raise ::Google::Cloud::Error.from_error(e)
@@ -364,7 +385,6 @@ module Google
364
385
 
365
386
  @changelogs_stub.get_changelog request, options do |result, operation|
366
387
  yield result, operation if block_given?
367
- return result
368
388
  end
369
389
  rescue ::Gapic::Rest::Error => e
370
390
  raise ::Google::Cloud::Error.from_error(e)
@@ -412,6 +432,13 @@ module Google
412
432
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
413
433
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
414
434
  # * (`nil`) indicating no credentials
435
+ #
436
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
437
+ # external source for authentication to Google Cloud, you must validate it before
438
+ # providing it to a Google API client library. Providing an unvalidated credential
439
+ # configuration to Google APIs can compromise the security of your systems and data.
440
+ # For more information, refer to [Validate credential configurations from external
441
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
415
442
  # @return [::Object]
416
443
  # @!attribute [rw] scope
417
444
  # The OAuth scopes
@@ -444,6 +471,11 @@ module Google
444
471
  # default endpoint URL. The default value of nil uses the environment
445
472
  # universe (usually the default "googleapis.com" universe).
446
473
  # @return [::String,nil]
474
+ # @!attribute [rw] logger
475
+ # A custom logger to use for request/response debug logging, or the value
476
+ # `:default` (the default) to construct a default logger, or `nil` to
477
+ # explicitly disable logging.
478
+ # @return [::Logger,:default,nil]
447
479
  #
448
480
  class Configuration
449
481
  extend ::Gapic::Config
@@ -472,6 +504,7 @@ module Google
472
504
  # by the host service.
473
505
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
474
506
  config_attr :bindings_override, {}, ::Hash, nil
507
+ config_attr :logger, :default, ::Logger, nil, :default
475
508
 
476
509
  # @private
477
510
  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
- 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_changelogs 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_changelogs",
94
107
  options: options
95
108
  )
96
109
  operation = ::Gapic::Rest::TransportOperation.new response
97
110
  result = ::Google::Cloud::Dialogflow::CX::V3::ListChangelogsResponse.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_changelog",
132
147
  options: options
133
148
  )
134
149
  operation = ::Gapic::Rest::TransportOperation.new response
135
150
  result = ::Google::Cloud::Dialogflow::CX::V3::Changelog.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,14 +164,26 @@ module Google
164
164
  universe_domain: @config.universe_domain,
165
165
  channel_args: @config.channel_args,
166
166
  interceptors: @config.interceptors,
167
- channel_pool_config: @config.channel_pool
167
+ channel_pool_config: @config.channel_pool,
168
+ logger: @config.logger
168
169
  )
169
170
 
171
+ @deployments_stub.stub_logger&.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::Client.new do |config|
171
182
  config.credentials = credentials
172
183
  config.quota_project = @quota_project_id
173
184
  config.endpoint = @deployments_stub.endpoint
174
185
  config.universe_domain = @deployments_stub.universe_domain
186
+ config.logger = @deployments_stub.logger if config.respond_to? :logger=
175
187
  end
176
188
  end
177
189
 
@@ -182,6 +194,15 @@ module Google
182
194
  #
183
195
  attr_reader :location_client
184
196
 
197
+ ##
198
+ # The logger used for request/response debug logging.
199
+ #
200
+ # @return [Logger]
201
+ #
202
+ def logger
203
+ @deployments_stub.logger
204
+ end
205
+
185
206
  # Service calls
186
207
 
187
208
  ##
@@ -277,7 +298,7 @@ module Google
277
298
  @deployments_stub.call_rpc :list_deployments, request, options: options do |response, operation|
278
299
  response = ::Gapic::PagedEnumerable.new @deployments_stub, :list_deployments, request, response, operation, options
279
300
  yield response, operation if block_given?
280
- return response
301
+ throw :response, response
281
302
  end
282
303
  rescue ::GRPC::BadStatus => e
283
304
  raise ::Google::Cloud::Error.from_error(e)
@@ -366,7 +387,6 @@ module Google
366
387
 
367
388
  @deployments_stub.call_rpc :get_deployment, request, options: options do |response, operation|
368
389
  yield response, operation if block_given?
369
- return response
370
390
  end
371
391
  rescue ::GRPC::BadStatus => e
372
392
  raise ::Google::Cloud::Error.from_error(e)
@@ -416,6 +436,13 @@ module Google
416
436
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
417
437
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
418
438
  # * (`nil`) indicating no credentials
439
+ #
440
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
441
+ # external source for authentication to Google Cloud, you must validate it before
442
+ # providing it to a Google API client library. Providing an unvalidated credential
443
+ # configuration to Google APIs can compromise the security of your systems and data.
444
+ # For more information, refer to [Validate credential configurations from external
445
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
419
446
  # @return [::Object]
420
447
  # @!attribute [rw] scope
421
448
  # The OAuth scopes
@@ -455,6 +482,11 @@ module Google
455
482
  # default endpoint URL. The default value of nil uses the environment
456
483
  # universe (usually the default "googleapis.com" universe).
457
484
  # @return [::String,nil]
485
+ # @!attribute [rw] logger
486
+ # A custom logger to use for request/response debug logging, or the value
487
+ # `:default` (the default) to construct a default logger, or `nil` to
488
+ # explicitly disable logging.
489
+ # @return [::Logger,:default,nil]
458
490
  #
459
491
  class Configuration
460
492
  extend ::Gapic::Config
@@ -479,6 +511,7 @@ module Google
479
511
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
480
512
  config_attr :quota_project, nil, ::String, nil
481
513
  config_attr :universe_domain, nil, ::String, nil
514
+ config_attr :logger, :default, ::Logger, nil, :default
482
515
 
483
516
  # @private
484
517
  def initialize parent_config = nil
@@ -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
- return result
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)
@@ -394,6 +414,13 @@ module Google
394
414
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
395
415
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
396
416
  # * (`nil`) indicating no credentials
417
+ #
418
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
419
+ # external source for authentication to Google Cloud, you must validate it before
420
+ # providing it to a Google API client library. Providing an unvalidated credential
421
+ # configuration to Google APIs can compromise the security of your systems and data.
422
+ # For more information, refer to [Validate credential configurations from external
423
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
397
424
  # @return [::Object]
398
425
  # @!attribute [rw] scope
399
426
  # The OAuth scopes
@@ -426,6 +453,11 @@ module Google
426
453
  # default endpoint URL. The default value of nil uses the environment
427
454
  # universe (usually the default "googleapis.com" universe).
428
455
  # @return [::String,nil]
456
+ # @!attribute [rw] logger
457
+ # A custom logger to use for request/response debug logging, or the value
458
+ # `:default` (the default) to construct a default logger, or `nil` to
459
+ # explicitly disable logging.
460
+ # @return [::Logger,:default,nil]
429
461
  #
430
462
  class Configuration
431
463
  extend ::Gapic::Config
@@ -454,6 +486,7 @@ module Google
454
486
  # by the host service.
455
487
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
456
488
  config_attr :bindings_override, {}, ::Hash, nil
489
+ config_attr :logger, :default, ::Logger, nil, :default
457
490
 
458
491
  # @private
459
492
  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
- 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_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: uri,
92
- body: body || "",
93
- params: query_string_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
- 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_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
- 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
  ##
@@ -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
- return response
737
+ throw :response, response
721
738
  end
722
739
  rescue ::GRPC::BadStatus => e
723
740
  raise ::Google::Cloud::Error.from_error(e)
@@ -759,8 +776,12 @@ module Google
759
776
  # have write permissions for the object. For more information, see
760
777
  # [Dialogflow access
761
778
  # control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage).
779
+ #
780
+ # Note: The following fields are mutually exclusive: `entity_types_uri`, `entity_types_content_inline`. If a field in that set is populated, all other fields in the set will automatically be cleared.
762
781
  # @param entity_types_content_inline [::Boolean]
763
782
  # Optional. The option to return the serialized entity types inline.
783
+ #
784
+ # Note: The following fields are mutually exclusive: `entity_types_content_inline`, `entity_types_uri`. If a field in that set is populated, all other fields in the set will automatically be cleared.
764
785
  # @param data_format [::Google::Cloud::Dialogflow::CX::V3::ExportEntityTypesRequest::DataFormat]
765
786
  # Optional. The data format of the exported entity types. If not specified,
766
787
  # `BLOB` is assumed.
@@ -845,7 +866,7 @@ module Google
845
866
  @entity_types_stub.call_rpc :export_entity_types, request, options: options do |response, operation|
846
867
  response = ::Gapic::Operation.new response, @operations_client, options: options
847
868
  yield response, operation if block_given?
848
- return response
869
+ throw :response, response
849
870
  end
850
871
  rescue ::GRPC::BadStatus => e
851
872
  raise ::Google::Cloud::Error.from_error(e)
@@ -882,8 +903,12 @@ module Google
882
903
  # have read permissions for the object. For more information, see
883
904
  # [Dialogflow access
884
905
  # control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage).
906
+ #
907
+ # Note: The following fields are mutually exclusive: `entity_types_uri`, `entity_types_content`. If a field in that set is populated, all other fields in the set will automatically be cleared.
885
908
  # @param entity_types_content [::Google::Cloud::Dialogflow::CX::V3::InlineSource, ::Hash]
886
909
  # Uncompressed byte content of entity types.
910
+ #
911
+ # Note: The following fields are mutually exclusive: `entity_types_content`, `entity_types_uri`. If a field in that set is populated, all other fields in the set will automatically be cleared.
887
912
  # @param merge_option [::Google::Cloud::Dialogflow::CX::V3::ImportEntityTypesRequest::MergeOption]
888
913
  # Required. Merge option for importing entity types.
889
914
  # @param target_entity_type [::String]
@@ -963,7 +988,7 @@ module Google
963
988
  @entity_types_stub.call_rpc :import_entity_types, request, options: options do |response, operation|
964
989
  response = ::Gapic::Operation.new response, @operations_client, options: options
965
990
  yield response, operation if block_given?
966
- return response
991
+ throw :response, response
967
992
  end
968
993
  rescue ::GRPC::BadStatus => e
969
994
  raise ::Google::Cloud::Error.from_error(e)
@@ -1013,6 +1038,13 @@ module Google
1013
1038
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
1014
1039
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
1015
1040
  # * (`nil`) indicating no credentials
1041
+ #
1042
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
1043
+ # external source for authentication to Google Cloud, you must validate it before
1044
+ # providing it to a Google API client library. Providing an unvalidated credential
1045
+ # configuration to Google APIs can compromise the security of your systems and data.
1046
+ # For more information, refer to [Validate credential configurations from external
1047
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
1016
1048
  # @return [::Object]
1017
1049
  # @!attribute [rw] scope
1018
1050
  # The OAuth scopes
@@ -1052,6 +1084,11 @@ module Google
1052
1084
  # default endpoint URL. The default value of nil uses the environment
1053
1085
  # universe (usually the default "googleapis.com" universe).
1054
1086
  # @return [::String,nil]
1087
+ # @!attribute [rw] logger
1088
+ # A custom logger to use for request/response debug logging, or the value
1089
+ # `:default` (the default) to construct a default logger, or `nil` to
1090
+ # explicitly disable logging.
1091
+ # @return [::Logger,:default,nil]
1055
1092
  #
1056
1093
  class Configuration
1057
1094
  extend ::Gapic::Config
@@ -1076,6 +1113,7 @@ module Google
1076
1113
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1077
1114
  config_attr :quota_project, nil, ::String, nil
1078
1115
  config_attr :universe_domain, nil, ::String, nil
1116
+ config_attr :logger, :default, ::Logger, nil, :default
1079
1117
 
1080
1118
  # @private
1081
1119
  def initialize parent_config = nil