google-cloud-dialogflow-cx-v3 0.13.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/google/cloud/dialogflow/cx/v3/agents/rest/client.rb +1032 -0
  4. data/lib/google/cloud/dialogflow/cx/v3/agents/rest/operations.rb +815 -0
  5. data/lib/google/cloud/dialogflow/cx/v3/agents/rest/service_stub.rb +586 -0
  6. data/lib/google/cloud/dialogflow/cx/v3/agents/rest.rb +56 -0
  7. data/lib/google/cloud/dialogflow/cx/v3/agents.rb +6 -0
  8. data/lib/google/cloud/dialogflow/cx/v3/bindings_override.rb +104 -0
  9. data/lib/google/cloud/dialogflow/cx/v3/changelogs/rest/client.rb +472 -0
  10. data/lib/google/cloud/dialogflow/cx/v3/changelogs/rest/service_stub.rb +168 -0
  11. data/lib/google/cloud/dialogflow/cx/v3/changelogs/rest.rb +55 -0
  12. data/lib/google/cloud/dialogflow/cx/v3/changelogs.rb +6 -0
  13. data/lib/google/cloud/dialogflow/cx/v3/deployments/rest/client.rb +456 -0
  14. data/lib/google/cloud/dialogflow/cx/v3/deployments/rest/service_stub.rb +168 -0
  15. data/lib/google/cloud/dialogflow/cx/v3/deployments/rest.rb +55 -0
  16. data/lib/google/cloud/dialogflow/cx/v3/deployments.rb +6 -0
  17. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest/client.rb +740 -0
  18. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest/service_stub.rb +347 -0
  19. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest.rb +55 -0
  20. data/lib/google/cloud/dialogflow/cx/v3/entity_types.rb +6 -0
  21. data/lib/google/cloud/dialogflow/cx/v3/environments/rest/client.rb +1028 -0
  22. data/lib/google/cloud/dialogflow/cx/v3/environments/rest/operations.rb +815 -0
  23. data/lib/google/cloud/dialogflow/cx/v3/environments/rest/service_stub.rb +585 -0
  24. data/lib/google/cloud/dialogflow/cx/v3/environments/rest.rb +57 -0
  25. data/lib/google/cloud/dialogflow/cx/v3/environments.rb +6 -0
  26. data/lib/google/cloud/dialogflow/cx/v3/experiments/rest/client.rb +821 -0
  27. data/lib/google/cloud/dialogflow/cx/v3/experiments/rest/service_stub.rb +467 -0
  28. data/lib/google/cloud/dialogflow/cx/v3/experiments/rest.rb +55 -0
  29. data/lib/google/cloud/dialogflow/cx/v3/experiments.rb +6 -0
  30. data/lib/google/cloud/dialogflow/cx/v3/flows/rest/client.rb +1182 -0
  31. data/lib/google/cloud/dialogflow/cx/v3/flows/rest/operations.rb +815 -0
  32. data/lib/google/cloud/dialogflow/cx/v3/flows/rest/service_stub.rb +646 -0
  33. data/lib/google/cloud/dialogflow/cx/v3/flows/rest.rb +56 -0
  34. data/lib/google/cloud/dialogflow/cx/v3/flows.rb +6 -0
  35. data/lib/google/cloud/dialogflow/cx/v3/intents/rest/client.rb +722 -0
  36. data/lib/google/cloud/dialogflow/cx/v3/intents/rest/service_stub.rb +347 -0
  37. data/lib/google/cloud/dialogflow/cx/v3/intents/rest.rb +55 -0
  38. data/lib/google/cloud/dialogflow/cx/v3/intents.rb +6 -0
  39. data/lib/google/cloud/dialogflow/cx/v3/pages/rest/client.rb +777 -0
  40. data/lib/google/cloud/dialogflow/cx/v3/pages/rest/service_stub.rb +347 -0
  41. data/lib/google/cloud/dialogflow/cx/v3/pages/rest.rb +55 -0
  42. data/lib/google/cloud/dialogflow/cx/v3/pages.rb +6 -0
  43. data/lib/google/cloud/dialogflow/cx/v3/rest.rb +55 -0
  44. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/rest/client.rb +673 -0
  45. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/rest/service_stub.rb +347 -0
  46. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/rest.rb +55 -0
  47. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service.rb +6 -0
  48. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/rest/client.rb +688 -0
  49. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/rest/service_stub.rb +384 -0
  50. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/rest.rb +56 -0
  51. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types.rb +6 -0
  52. data/lib/google/cloud/dialogflow/cx/v3/session_pb.rb +1 -0
  53. data/lib/google/cloud/dialogflow/cx/v3/sessions/client.rb +3 -1
  54. data/lib/google/cloud/dialogflow/cx/v3/sessions/rest/client.rb +576 -0
  55. data/lib/google/cloud/dialogflow/cx/v3/sessions/rest/service_stub.rb +254 -0
  56. data/lib/google/cloud/dialogflow/cx/v3/sessions/rest.rb +58 -0
  57. data/lib/google/cloud/dialogflow/cx/v3/sessions.rb +6 -0
  58. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest/client.rb +1304 -0
  59. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest/operations.rb +815 -0
  60. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest/service_stub.rb +765 -0
  61. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest.rb +57 -0
  62. data/lib/google/cloud/dialogflow/cx/v3/test_cases.rb +6 -0
  63. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/rest/client.rb +748 -0
  64. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/rest/service_stub.rb +347 -0
  65. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/rest.rb +56 -0
  66. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups.rb +6 -0
  67. data/lib/google/cloud/dialogflow/cx/v3/version.rb +1 -1
  68. data/lib/google/cloud/dialogflow/cx/v3/versions/rest/client.rb +865 -0
  69. data/lib/google/cloud/dialogflow/cx/v3/versions/rest/operations.rb +815 -0
  70. data/lib/google/cloud/dialogflow/cx/v3/versions/rest/service_stub.rb +467 -0
  71. data/lib/google/cloud/dialogflow/cx/v3/versions/rest.rb +56 -0
  72. data/lib/google/cloud/dialogflow/cx/v3/versions.rb +6 -0
  73. data/lib/google/cloud/dialogflow/cx/v3/webhooks/rest/client.rb +677 -0
  74. data/lib/google/cloud/dialogflow/cx/v3/webhooks/rest/service_stub.rb +347 -0
  75. data/lib/google/cloud/dialogflow/cx/v3/webhooks/rest.rb +55 -0
  76. data/lib/google/cloud/dialogflow/cx/v3/webhooks.rb +6 -0
  77. data/lib/google/cloud/dialogflow/cx/v3.rb +5 -0
  78. data/proto_docs/google/cloud/dialogflow/cx/v3/session.rb +3 -0
  79. metadata +61 -5
@@ -0,0 +1,1032 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/dialogflow/cx/v3/agent_pb"
21
+ require "google/cloud/dialogflow/cx/v3/agents/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module Dialogflow
27
+ module CX
28
+ module V3
29
+ module Agents
30
+ module Rest
31
+ ##
32
+ # REST client for the Agents service.
33
+ #
34
+ # Service for managing {::Google::Cloud::Dialogflow::CX::V3::Agent Agents}.
35
+ #
36
+ class Client
37
+ include Paths
38
+
39
+ # @private
40
+ attr_reader :agents_stub
41
+
42
+ ##
43
+ # Configure the Agents Client class.
44
+ #
45
+ # See {::Google::Cloud::Dialogflow::CX::V3::Agents::Rest::Client::Configuration}
46
+ # for a description of the configuration fields.
47
+ #
48
+ # @example
49
+ #
50
+ # # Modify the configuration for all Agents clients
51
+ # ::Google::Cloud::Dialogflow::CX::V3::Agents::Rest::Client.configure do |config|
52
+ # config.timeout = 10.0
53
+ # end
54
+ #
55
+ # @yield [config] Configure the Client client.
56
+ # @yieldparam config [Client::Configuration]
57
+ #
58
+ # @return [Client::Configuration]
59
+ #
60
+ def self.configure
61
+ @configure ||= begin
62
+ namespace = ["Google", "Cloud", "Dialogflow", "CX", "V3"]
63
+ parent_config = while namespace.any?
64
+ parent_name = namespace.join "::"
65
+ parent_const = const_get parent_name
66
+ break parent_const.configure if parent_const.respond_to? :configure
67
+ namespace.pop
68
+ end
69
+ default_config = Client::Configuration.new parent_config
70
+
71
+ default_config.timeout = 60.0
72
+ default_config.retry_policy = {
73
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
74
+ }
75
+
76
+ default_config
77
+ end
78
+ yield @configure if block_given?
79
+ @configure
80
+ end
81
+
82
+ ##
83
+ # Configure the Agents Client instance.
84
+ #
85
+ # The configuration is set to the derived mode, meaning that values can be changed,
86
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
87
+ # should be made on {Client.configure}.
88
+ #
89
+ # See {::Google::Cloud::Dialogflow::CX::V3::Agents::Rest::Client::Configuration}
90
+ # for a description of the configuration fields.
91
+ #
92
+ # @yield [config] Configure the Client client.
93
+ # @yieldparam config [Client::Configuration]
94
+ #
95
+ # @return [Client::Configuration]
96
+ #
97
+ def configure
98
+ yield @config if block_given?
99
+ @config
100
+ end
101
+
102
+ ##
103
+ # Create a new Agents REST client object.
104
+ #
105
+ # @example
106
+ #
107
+ # # Create a client using the default configuration
108
+ # client = ::Google::Cloud::Dialogflow::CX::V3::Agents::Rest::Client.new
109
+ #
110
+ # # Create a client using a custom configuration
111
+ # client = ::Google::Cloud::Dialogflow::CX::V3::Agents::Rest::Client.new do |config|
112
+ # config.timeout = 10.0
113
+ # end
114
+ #
115
+ # @yield [config] Configure the Agents client.
116
+ # @yieldparam config [Client::Configuration]
117
+ #
118
+ def initialize
119
+ # Create the configuration object
120
+ @config = Configuration.new Client.configure
121
+
122
+ # Yield the configuration if needed
123
+ yield @config if block_given?
124
+
125
+ # Create credentials
126
+ credentials = @config.credentials
127
+ # Use self-signed JWT if the endpoint is unchanged from default,
128
+ # but only if the default endpoint does not have a region prefix.
129
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
130
+ !@config.endpoint.split(".").first.include?("-")
131
+ credentials ||= Credentials.default scope: @config.scope,
132
+ enable_self_signed_jwt: enable_self_signed_jwt
133
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
134
+ credentials = Credentials.new credentials, scope: @config.scope
135
+ end
136
+
137
+ @quota_project_id = @config.quota_project
138
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
139
+
140
+ @operations_client = ::Google::Cloud::Dialogflow::CX::V3::Agents::Rest::Operations.new do |config|
141
+ config.credentials = credentials
142
+ config.quota_project = @quota_project_id
143
+ config.endpoint = @config.endpoint
144
+ end
145
+
146
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
147
+ config.credentials = credentials
148
+ config.quota_project = @quota_project_id
149
+ config.endpoint = @config.endpoint
150
+ config.bindings_override = @config.bindings_override
151
+ end
152
+
153
+ @agents_stub = ::Google::Cloud::Dialogflow::CX::V3::Agents::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
154
+ end
155
+
156
+ ##
157
+ # Get the associated client for long-running operations.
158
+ #
159
+ # @return [::Google::Cloud::Dialogflow::CX::V3::Agents::Rest::Operations]
160
+ #
161
+ attr_reader :operations_client
162
+
163
+ ##
164
+ # Get the associated client for mix-in of the Locations.
165
+ #
166
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
167
+ #
168
+ attr_reader :location_client
169
+
170
+ # Service calls
171
+
172
+ ##
173
+ # Returns the list of all agents in the specified location.
174
+ #
175
+ # @overload list_agents(request, options = nil)
176
+ # Pass arguments to `list_agents` via a request object, either of type
177
+ # {::Google::Cloud::Dialogflow::CX::V3::ListAgentsRequest} or an equivalent Hash.
178
+ #
179
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::ListAgentsRequest, ::Hash]
180
+ # A request object representing the call parameters. Required. To specify no
181
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
182
+ # @param options [::Gapic::CallOptions, ::Hash]
183
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
184
+ #
185
+ # @overload list_agents(parent: nil, page_size: nil, page_token: nil)
186
+ # Pass arguments to `list_agents` via keyword arguments. Note that at
187
+ # least one keyword argument is required. To specify no parameters, or to keep all
188
+ # the default parameter values, pass an empty Hash as a request object (see above).
189
+ #
190
+ # @param parent [::String]
191
+ # Required. The location to list all agents for.
192
+ # Format: `projects/<Project ID>/locations/<Location ID>`.
193
+ # @param page_size [::Integer]
194
+ # The maximum number of items to return in a single page. By default 100 and
195
+ # at most 1000.
196
+ # @param page_token [::String]
197
+ # The next_page_token value returned from a previous list request.
198
+ # @yield [result, operation] Access the result along with the TransportOperation object
199
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::CX::V3::Agent>]
200
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
201
+ #
202
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::CX::V3::Agent>]
203
+ #
204
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
205
+ def list_agents request, options = nil
206
+ raise ::ArgumentError, "request must be provided" if request.nil?
207
+
208
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::ListAgentsRequest
209
+
210
+ # Converts hash and nil to an options object
211
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
212
+
213
+ # Customize the options with defaults
214
+ call_metadata = @config.rpcs.list_agents.metadata.to_h
215
+
216
+ # Set x-goog-api-client and x-goog-user-project headers
217
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
218
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
219
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
220
+ transports_version_send: [:rest]
221
+
222
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
223
+
224
+ options.apply_defaults timeout: @config.rpcs.list_agents.timeout,
225
+ metadata: call_metadata,
226
+ retry_policy: @config.rpcs.list_agents.retry_policy
227
+
228
+ options.apply_defaults timeout: @config.timeout,
229
+ metadata: @config.metadata,
230
+ retry_policy: @config.retry_policy
231
+
232
+ @agents_stub.list_agents request, options do |result, operation|
233
+ result = ::Gapic::Rest::PagedEnumerable.new @agents_stub, :list_agents, "agents", request, result, options
234
+ yield result, operation if block_given?
235
+ return result
236
+ end
237
+ rescue ::Gapic::Rest::Error => e
238
+ raise ::Google::Cloud::Error.from_error(e)
239
+ end
240
+
241
+ ##
242
+ # Retrieves the specified agent.
243
+ #
244
+ # @overload get_agent(request, options = nil)
245
+ # Pass arguments to `get_agent` via a request object, either of type
246
+ # {::Google::Cloud::Dialogflow::CX::V3::GetAgentRequest} or an equivalent Hash.
247
+ #
248
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::GetAgentRequest, ::Hash]
249
+ # A request object representing the call parameters. Required. To specify no
250
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
251
+ # @param options [::Gapic::CallOptions, ::Hash]
252
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
253
+ #
254
+ # @overload get_agent(name: nil)
255
+ # Pass arguments to `get_agent` via keyword arguments. Note that at
256
+ # least one keyword argument is required. To specify no parameters, or to keep all
257
+ # the default parameter values, pass an empty Hash as a request object (see above).
258
+ #
259
+ # @param name [::String]
260
+ # Required. The name of the agent.
261
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
262
+ # @yield [result, operation] Access the result along with the TransportOperation object
263
+ # @yieldparam result [::Google::Cloud::Dialogflow::CX::V3::Agent]
264
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
265
+ #
266
+ # @return [::Google::Cloud::Dialogflow::CX::V3::Agent]
267
+ #
268
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
269
+ def get_agent request, options = nil
270
+ raise ::ArgumentError, "request must be provided" if request.nil?
271
+
272
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::GetAgentRequest
273
+
274
+ # Converts hash and nil to an options object
275
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
276
+
277
+ # Customize the options with defaults
278
+ call_metadata = @config.rpcs.get_agent.metadata.to_h
279
+
280
+ # Set x-goog-api-client and x-goog-user-project headers
281
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
282
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
283
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
284
+ transports_version_send: [:rest]
285
+
286
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
287
+
288
+ options.apply_defaults timeout: @config.rpcs.get_agent.timeout,
289
+ metadata: call_metadata,
290
+ retry_policy: @config.rpcs.get_agent.retry_policy
291
+
292
+ options.apply_defaults timeout: @config.timeout,
293
+ metadata: @config.metadata,
294
+ retry_policy: @config.retry_policy
295
+
296
+ @agents_stub.get_agent request, options do |result, operation|
297
+ yield result, operation if block_given?
298
+ return result
299
+ end
300
+ rescue ::Gapic::Rest::Error => e
301
+ raise ::Google::Cloud::Error.from_error(e)
302
+ end
303
+
304
+ ##
305
+ # Creates an agent in the specified location.
306
+ #
307
+ # Note: You should always train flows prior to sending them queries. See the
308
+ # [training
309
+ # documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
310
+ #
311
+ # @overload create_agent(request, options = nil)
312
+ # Pass arguments to `create_agent` via a request object, either of type
313
+ # {::Google::Cloud::Dialogflow::CX::V3::CreateAgentRequest} or an equivalent Hash.
314
+ #
315
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::CreateAgentRequest, ::Hash]
316
+ # A request object representing the call parameters. Required. To specify no
317
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
318
+ # @param options [::Gapic::CallOptions, ::Hash]
319
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
320
+ #
321
+ # @overload create_agent(parent: nil, agent: nil)
322
+ # Pass arguments to `create_agent` via keyword arguments. Note that at
323
+ # least one keyword argument is required. To specify no parameters, or to keep all
324
+ # the default parameter values, pass an empty Hash as a request object (see above).
325
+ #
326
+ # @param parent [::String]
327
+ # Required. The location to create a agent for.
328
+ # Format: `projects/<Project ID>/locations/<Location ID>`.
329
+ # @param agent [::Google::Cloud::Dialogflow::CX::V3::Agent, ::Hash]
330
+ # Required. The agent to create.
331
+ # @yield [result, operation] Access the result along with the TransportOperation object
332
+ # @yieldparam result [::Google::Cloud::Dialogflow::CX::V3::Agent]
333
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
334
+ #
335
+ # @return [::Google::Cloud::Dialogflow::CX::V3::Agent]
336
+ #
337
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
338
+ def create_agent request, options = nil
339
+ raise ::ArgumentError, "request must be provided" if request.nil?
340
+
341
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::CreateAgentRequest
342
+
343
+ # Converts hash and nil to an options object
344
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
345
+
346
+ # Customize the options with defaults
347
+ call_metadata = @config.rpcs.create_agent.metadata.to_h
348
+
349
+ # Set x-goog-api-client and x-goog-user-project headers
350
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
351
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
352
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
353
+ transports_version_send: [:rest]
354
+
355
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
356
+
357
+ options.apply_defaults timeout: @config.rpcs.create_agent.timeout,
358
+ metadata: call_metadata,
359
+ retry_policy: @config.rpcs.create_agent.retry_policy
360
+
361
+ options.apply_defaults timeout: @config.timeout,
362
+ metadata: @config.metadata,
363
+ retry_policy: @config.retry_policy
364
+
365
+ @agents_stub.create_agent request, options do |result, operation|
366
+ yield result, operation if block_given?
367
+ return result
368
+ end
369
+ rescue ::Gapic::Rest::Error => e
370
+ raise ::Google::Cloud::Error.from_error(e)
371
+ end
372
+
373
+ ##
374
+ # Updates the specified agent.
375
+ #
376
+ # Note: You should always train flows prior to sending them queries. See the
377
+ # [training
378
+ # documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
379
+ #
380
+ # @overload update_agent(request, options = nil)
381
+ # Pass arguments to `update_agent` via a request object, either of type
382
+ # {::Google::Cloud::Dialogflow::CX::V3::UpdateAgentRequest} or an equivalent Hash.
383
+ #
384
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::UpdateAgentRequest, ::Hash]
385
+ # A request object representing the call parameters. Required. To specify no
386
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
387
+ # @param options [::Gapic::CallOptions, ::Hash]
388
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
389
+ #
390
+ # @overload update_agent(agent: nil, update_mask: nil)
391
+ # Pass arguments to `update_agent` via keyword arguments. Note that at
392
+ # least one keyword argument is required. To specify no parameters, or to keep all
393
+ # the default parameter values, pass an empty Hash as a request object (see above).
394
+ #
395
+ # @param agent [::Google::Cloud::Dialogflow::CX::V3::Agent, ::Hash]
396
+ # Required. The agent to update.
397
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
398
+ # The mask to control which fields get updated. If the mask is not present,
399
+ # all fields will be updated.
400
+ # @yield [result, operation] Access the result along with the TransportOperation object
401
+ # @yieldparam result [::Google::Cloud::Dialogflow::CX::V3::Agent]
402
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
403
+ #
404
+ # @return [::Google::Cloud::Dialogflow::CX::V3::Agent]
405
+ #
406
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
407
+ def update_agent request, options = nil
408
+ raise ::ArgumentError, "request must be provided" if request.nil?
409
+
410
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::UpdateAgentRequest
411
+
412
+ # Converts hash and nil to an options object
413
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
414
+
415
+ # Customize the options with defaults
416
+ call_metadata = @config.rpcs.update_agent.metadata.to_h
417
+
418
+ # Set x-goog-api-client and x-goog-user-project headers
419
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
420
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
421
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
422
+ transports_version_send: [:rest]
423
+
424
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
425
+
426
+ options.apply_defaults timeout: @config.rpcs.update_agent.timeout,
427
+ metadata: call_metadata,
428
+ retry_policy: @config.rpcs.update_agent.retry_policy
429
+
430
+ options.apply_defaults timeout: @config.timeout,
431
+ metadata: @config.metadata,
432
+ retry_policy: @config.retry_policy
433
+
434
+ @agents_stub.update_agent request, options do |result, operation|
435
+ yield result, operation if block_given?
436
+ return result
437
+ end
438
+ rescue ::Gapic::Rest::Error => e
439
+ raise ::Google::Cloud::Error.from_error(e)
440
+ end
441
+
442
+ ##
443
+ # Deletes the specified agent.
444
+ #
445
+ # @overload delete_agent(request, options = nil)
446
+ # Pass arguments to `delete_agent` via a request object, either of type
447
+ # {::Google::Cloud::Dialogflow::CX::V3::DeleteAgentRequest} or an equivalent Hash.
448
+ #
449
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::DeleteAgentRequest, ::Hash]
450
+ # A request object representing the call parameters. Required. To specify no
451
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
452
+ # @param options [::Gapic::CallOptions, ::Hash]
453
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
454
+ #
455
+ # @overload delete_agent(name: nil)
456
+ # Pass arguments to `delete_agent` via keyword arguments. Note that at
457
+ # least one keyword argument is required. To specify no parameters, or to keep all
458
+ # the default parameter values, pass an empty Hash as a request object (see above).
459
+ #
460
+ # @param name [::String]
461
+ # Required. The name of the agent to delete.
462
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
463
+ # @yield [result, operation] Access the result along with the TransportOperation object
464
+ # @yieldparam result [::Google::Protobuf::Empty]
465
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
466
+ #
467
+ # @return [::Google::Protobuf::Empty]
468
+ #
469
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
470
+ def delete_agent request, options = nil
471
+ raise ::ArgumentError, "request must be provided" if request.nil?
472
+
473
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::DeleteAgentRequest
474
+
475
+ # Converts hash and nil to an options object
476
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
477
+
478
+ # Customize the options with defaults
479
+ call_metadata = @config.rpcs.delete_agent.metadata.to_h
480
+
481
+ # Set x-goog-api-client and x-goog-user-project headers
482
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
483
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
484
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
485
+ transports_version_send: [:rest]
486
+
487
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
488
+
489
+ options.apply_defaults timeout: @config.rpcs.delete_agent.timeout,
490
+ metadata: call_metadata,
491
+ retry_policy: @config.rpcs.delete_agent.retry_policy
492
+
493
+ options.apply_defaults timeout: @config.timeout,
494
+ metadata: @config.metadata,
495
+ retry_policy: @config.retry_policy
496
+
497
+ @agents_stub.delete_agent request, options do |result, operation|
498
+ yield result, operation if block_given?
499
+ return result
500
+ end
501
+ rescue ::Gapic::Rest::Error => e
502
+ raise ::Google::Cloud::Error.from_error(e)
503
+ end
504
+
505
+ ##
506
+ # Exports the specified agent to a binary file.
507
+ #
508
+ # This method is a [long-running
509
+ # operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
510
+ # The returned `Operation` type has the following method-specific fields:
511
+ #
512
+ # - `metadata`: An empty [Struct
513
+ # message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
514
+ # - `response`:
515
+ # {::Google::Cloud::Dialogflow::CX::V3::ExportAgentResponse ExportAgentResponse}
516
+ #
517
+ # @overload export_agent(request, options = nil)
518
+ # Pass arguments to `export_agent` via a request object, either of type
519
+ # {::Google::Cloud::Dialogflow::CX::V3::ExportAgentRequest} or an equivalent Hash.
520
+ #
521
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::ExportAgentRequest, ::Hash]
522
+ # A request object representing the call parameters. Required. To specify no
523
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
524
+ # @param options [::Gapic::CallOptions, ::Hash]
525
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
526
+ #
527
+ # @overload export_agent(name: nil, agent_uri: nil, data_format: nil, environment: nil)
528
+ # Pass arguments to `export_agent` via keyword arguments. Note that at
529
+ # least one keyword argument is required. To specify no parameters, or to keep all
530
+ # the default parameter values, pass an empty Hash as a request object (see above).
531
+ #
532
+ # @param name [::String]
533
+ # Required. The name of the agent to export.
534
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
535
+ # @param agent_uri [::String]
536
+ # Optional. The [Google Cloud
537
+ # Storage](https://cloud.google.com/storage/docs/) URI to export the agent
538
+ # to. The format of this URI must be `gs://<bucket-name>/<object-name>`. If
539
+ # left unspecified, the serialized agent is returned inline.
540
+ #
541
+ # Dialogflow performs a write operation for the Cloud Storage object
542
+ # on the caller's behalf, so your request authentication must
543
+ # have write permissions for the object. For more information, see
544
+ # [Dialogflow access
545
+ # control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage).
546
+ # @param data_format [::Google::Cloud::Dialogflow::CX::V3::ExportAgentRequest::DataFormat]
547
+ # Optional. The data format of the exported agent. If not specified, `BLOB`
548
+ # is assumed.
549
+ # @param environment [::String]
550
+ # Optional. Environment name. If not set, draft environment is assumed.
551
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
552
+ # ID>/environments/<Environment ID>`.
553
+ # @yield [result, operation] Access the result along with the TransportOperation object
554
+ # @yieldparam result [::Gapic::Operation]
555
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
556
+ #
557
+ # @return [::Gapic::Operation]
558
+ #
559
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
560
+ def export_agent request, options = nil
561
+ raise ::ArgumentError, "request must be provided" if request.nil?
562
+
563
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::ExportAgentRequest
564
+
565
+ # Converts hash and nil to an options object
566
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
567
+
568
+ # Customize the options with defaults
569
+ call_metadata = @config.rpcs.export_agent.metadata.to_h
570
+
571
+ # Set x-goog-api-client and x-goog-user-project headers
572
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
573
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
574
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
575
+ transports_version_send: [:rest]
576
+
577
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
578
+
579
+ options.apply_defaults timeout: @config.rpcs.export_agent.timeout,
580
+ metadata: call_metadata,
581
+ retry_policy: @config.rpcs.export_agent.retry_policy
582
+
583
+ options.apply_defaults timeout: @config.timeout,
584
+ metadata: @config.metadata,
585
+ retry_policy: @config.retry_policy
586
+
587
+ @agents_stub.export_agent request, options do |result, operation|
588
+ result = ::Gapic::Operation.new result, @operations_client, options: options
589
+ yield result, operation if block_given?
590
+ return result
591
+ end
592
+ rescue ::Gapic::Rest::Error => e
593
+ raise ::Google::Cloud::Error.from_error(e)
594
+ end
595
+
596
+ ##
597
+ # Restores the specified agent from a binary file.
598
+ #
599
+ # Replaces the current agent with a new one. Note that all existing resources
600
+ # in agent (e.g. intents, entity types, flows) will be removed.
601
+ #
602
+ # This method is a [long-running
603
+ # operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
604
+ # The returned `Operation` type has the following method-specific fields:
605
+ #
606
+ # - `metadata`: An empty [Struct
607
+ # message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
608
+ # - `response`: An [Empty
609
+ # message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
610
+ #
611
+ # Note: You should always train flows prior to sending them queries. See the
612
+ # [training
613
+ # documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
614
+ #
615
+ # @overload restore_agent(request, options = nil)
616
+ # Pass arguments to `restore_agent` via a request object, either of type
617
+ # {::Google::Cloud::Dialogflow::CX::V3::RestoreAgentRequest} or an equivalent Hash.
618
+ #
619
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::RestoreAgentRequest, ::Hash]
620
+ # A request object representing the call parameters. Required. To specify no
621
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
622
+ # @param options [::Gapic::CallOptions, ::Hash]
623
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
624
+ #
625
+ # @overload restore_agent(name: nil, agent_uri: nil, agent_content: nil, restore_option: nil)
626
+ # Pass arguments to `restore_agent` via keyword arguments. Note that at
627
+ # least one keyword argument is required. To specify no parameters, or to keep all
628
+ # the default parameter values, pass an empty Hash as a request object (see above).
629
+ #
630
+ # @param name [::String]
631
+ # Required. The name of the agent to restore into.
632
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
633
+ # @param agent_uri [::String]
634
+ # The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI
635
+ # to restore agent from. The format of this URI must be
636
+ # `gs://<bucket-name>/<object-name>`.
637
+ #
638
+ # Dialogflow performs a read operation for the Cloud Storage object
639
+ # on the caller's behalf, so your request authentication must
640
+ # have read permissions for the object. For more information, see
641
+ # [Dialogflow access
642
+ # control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage).
643
+ # @param agent_content [::String]
644
+ # Uncompressed raw byte content for agent.
645
+ # @param restore_option [::Google::Cloud::Dialogflow::CX::V3::RestoreAgentRequest::RestoreOption]
646
+ # Agent restore mode. If not specified, `KEEP` is assumed.
647
+ # @yield [result, operation] Access the result along with the TransportOperation object
648
+ # @yieldparam result [::Gapic::Operation]
649
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
650
+ #
651
+ # @return [::Gapic::Operation]
652
+ #
653
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
654
+ def restore_agent request, options = nil
655
+ raise ::ArgumentError, "request must be provided" if request.nil?
656
+
657
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::RestoreAgentRequest
658
+
659
+ # Converts hash and nil to an options object
660
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
661
+
662
+ # Customize the options with defaults
663
+ call_metadata = @config.rpcs.restore_agent.metadata.to_h
664
+
665
+ # Set x-goog-api-client and x-goog-user-project headers
666
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
667
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
668
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
669
+ transports_version_send: [:rest]
670
+
671
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
672
+
673
+ options.apply_defaults timeout: @config.rpcs.restore_agent.timeout,
674
+ metadata: call_metadata,
675
+ retry_policy: @config.rpcs.restore_agent.retry_policy
676
+
677
+ options.apply_defaults timeout: @config.timeout,
678
+ metadata: @config.metadata,
679
+ retry_policy: @config.retry_policy
680
+
681
+ @agents_stub.restore_agent request, options do |result, operation|
682
+ result = ::Gapic::Operation.new result, @operations_client, options: options
683
+ yield result, operation if block_given?
684
+ return result
685
+ end
686
+ rescue ::Gapic::Rest::Error => e
687
+ raise ::Google::Cloud::Error.from_error(e)
688
+ end
689
+
690
+ ##
691
+ # Validates the specified agent and creates or updates validation results.
692
+ # The agent in draft version is validated. Please call this API after the
693
+ # training is completed to get the complete validation results.
694
+ #
695
+ # @overload validate_agent(request, options = nil)
696
+ # Pass arguments to `validate_agent` via a request object, either of type
697
+ # {::Google::Cloud::Dialogflow::CX::V3::ValidateAgentRequest} or an equivalent Hash.
698
+ #
699
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::ValidateAgentRequest, ::Hash]
700
+ # A request object representing the call parameters. Required. To specify no
701
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
702
+ # @param options [::Gapic::CallOptions, ::Hash]
703
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
704
+ #
705
+ # @overload validate_agent(name: nil, language_code: nil)
706
+ # Pass arguments to `validate_agent` via keyword arguments. Note that at
707
+ # least one keyword argument is required. To specify no parameters, or to keep all
708
+ # the default parameter values, pass an empty Hash as a request object (see above).
709
+ #
710
+ # @param name [::String]
711
+ # Required. The agent to validate.
712
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
713
+ # @param language_code [::String]
714
+ # If not specified, the agent's default language is used.
715
+ # @yield [result, operation] Access the result along with the TransportOperation object
716
+ # @yieldparam result [::Google::Cloud::Dialogflow::CX::V3::AgentValidationResult]
717
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
718
+ #
719
+ # @return [::Google::Cloud::Dialogflow::CX::V3::AgentValidationResult]
720
+ #
721
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
722
+ def validate_agent request, options = nil
723
+ raise ::ArgumentError, "request must be provided" if request.nil?
724
+
725
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::ValidateAgentRequest
726
+
727
+ # Converts hash and nil to an options object
728
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
729
+
730
+ # Customize the options with defaults
731
+ call_metadata = @config.rpcs.validate_agent.metadata.to_h
732
+
733
+ # Set x-goog-api-client and x-goog-user-project headers
734
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
735
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
736
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
737
+ transports_version_send: [:rest]
738
+
739
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
740
+
741
+ options.apply_defaults timeout: @config.rpcs.validate_agent.timeout,
742
+ metadata: call_metadata,
743
+ retry_policy: @config.rpcs.validate_agent.retry_policy
744
+
745
+ options.apply_defaults timeout: @config.timeout,
746
+ metadata: @config.metadata,
747
+ retry_policy: @config.retry_policy
748
+
749
+ @agents_stub.validate_agent request, options do |result, operation|
750
+ yield result, operation if block_given?
751
+ return result
752
+ end
753
+ rescue ::Gapic::Rest::Error => e
754
+ raise ::Google::Cloud::Error.from_error(e)
755
+ end
756
+
757
+ ##
758
+ # Gets the latest agent validation result. Agent validation is performed
759
+ # when ValidateAgent is called.
760
+ #
761
+ # @overload get_agent_validation_result(request, options = nil)
762
+ # Pass arguments to `get_agent_validation_result` via a request object, either of type
763
+ # {::Google::Cloud::Dialogflow::CX::V3::GetAgentValidationResultRequest} or an equivalent Hash.
764
+ #
765
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::GetAgentValidationResultRequest, ::Hash]
766
+ # A request object representing the call parameters. Required. To specify no
767
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
768
+ # @param options [::Gapic::CallOptions, ::Hash]
769
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
770
+ #
771
+ # @overload get_agent_validation_result(name: nil, language_code: nil)
772
+ # Pass arguments to `get_agent_validation_result` via keyword arguments. Note that at
773
+ # least one keyword argument is required. To specify no parameters, or to keep all
774
+ # the default parameter values, pass an empty Hash as a request object (see above).
775
+ #
776
+ # @param name [::String]
777
+ # Required. The agent name.
778
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
779
+ # ID>/validationResult`.
780
+ # @param language_code [::String]
781
+ # If not specified, the agent's default language is used.
782
+ # @yield [result, operation] Access the result along with the TransportOperation object
783
+ # @yieldparam result [::Google::Cloud::Dialogflow::CX::V3::AgentValidationResult]
784
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
785
+ #
786
+ # @return [::Google::Cloud::Dialogflow::CX::V3::AgentValidationResult]
787
+ #
788
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
789
+ def get_agent_validation_result request, options = nil
790
+ raise ::ArgumentError, "request must be provided" if request.nil?
791
+
792
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::GetAgentValidationResultRequest
793
+
794
+ # Converts hash and nil to an options object
795
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
796
+
797
+ # Customize the options with defaults
798
+ call_metadata = @config.rpcs.get_agent_validation_result.metadata.to_h
799
+
800
+ # Set x-goog-api-client and x-goog-user-project headers
801
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
802
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
803
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
804
+ transports_version_send: [:rest]
805
+
806
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
807
+
808
+ options.apply_defaults timeout: @config.rpcs.get_agent_validation_result.timeout,
809
+ metadata: call_metadata,
810
+ retry_policy: @config.rpcs.get_agent_validation_result.retry_policy
811
+
812
+ options.apply_defaults timeout: @config.timeout,
813
+ metadata: @config.metadata,
814
+ retry_policy: @config.retry_policy
815
+
816
+ @agents_stub.get_agent_validation_result request, options do |result, operation|
817
+ yield result, operation if block_given?
818
+ return result
819
+ end
820
+ rescue ::Gapic::Rest::Error => e
821
+ raise ::Google::Cloud::Error.from_error(e)
822
+ end
823
+
824
+ ##
825
+ # Configuration class for the Agents REST API.
826
+ #
827
+ # This class represents the configuration for Agents REST,
828
+ # providing control over timeouts, retry behavior, logging, transport
829
+ # parameters, and other low-level controls. Certain parameters can also be
830
+ # applied individually to specific RPCs. See
831
+ # {::Google::Cloud::Dialogflow::CX::V3::Agents::Rest::Client::Configuration::Rpcs}
832
+ # for a list of RPCs that can be configured independently.
833
+ #
834
+ # Configuration can be applied globally to all clients, or to a single client
835
+ # on construction.
836
+ #
837
+ # @example
838
+ #
839
+ # # Modify the global config, setting the timeout for
840
+ # # list_agents to 20 seconds,
841
+ # # and all remaining timeouts to 10 seconds.
842
+ # ::Google::Cloud::Dialogflow::CX::V3::Agents::Rest::Client.configure do |config|
843
+ # config.timeout = 10.0
844
+ # config.rpcs.list_agents.timeout = 20.0
845
+ # end
846
+ #
847
+ # # Apply the above configuration only to a new client.
848
+ # client = ::Google::Cloud::Dialogflow::CX::V3::Agents::Rest::Client.new do |config|
849
+ # config.timeout = 10.0
850
+ # config.rpcs.list_agents.timeout = 20.0
851
+ # end
852
+ #
853
+ # @!attribute [rw] endpoint
854
+ # The hostname or hostname:port of the service endpoint.
855
+ # Defaults to `"dialogflow.googleapis.com"`.
856
+ # @return [::String]
857
+ # @!attribute [rw] credentials
858
+ # Credentials to send with calls. You may provide any of the following types:
859
+ # * (`String`) The path to a service account key file in JSON format
860
+ # * (`Hash`) A service account key as a Hash
861
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
862
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
863
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
864
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
865
+ # * (`nil`) indicating no credentials
866
+ # @return [::Object]
867
+ # @!attribute [rw] scope
868
+ # The OAuth scopes
869
+ # @return [::Array<::String>]
870
+ # @!attribute [rw] lib_name
871
+ # The library name as recorded in instrumentation and logging
872
+ # @return [::String]
873
+ # @!attribute [rw] lib_version
874
+ # The library version as recorded in instrumentation and logging
875
+ # @return [::String]
876
+ # @!attribute [rw] timeout
877
+ # The call timeout in seconds.
878
+ # @return [::Numeric]
879
+ # @!attribute [rw] metadata
880
+ # Additional headers to be sent with the call.
881
+ # @return [::Hash{::Symbol=>::String}]
882
+ # @!attribute [rw] retry_policy
883
+ # The retry policy. The value is a hash with the following keys:
884
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
885
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
886
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
887
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
888
+ # trigger a retry.
889
+ # @return [::Hash]
890
+ # @!attribute [rw] quota_project
891
+ # A separate project against which to charge quota.
892
+ # @return [::String]
893
+ #
894
+ class Configuration
895
+ extend ::Gapic::Config
896
+
897
+ config_attr :endpoint, "dialogflow.googleapis.com", ::String
898
+ config_attr :credentials, nil do |value|
899
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
900
+ allowed.any? { |klass| klass === value }
901
+ end
902
+ config_attr :scope, nil, ::String, ::Array, nil
903
+ config_attr :lib_name, nil, ::String, nil
904
+ config_attr :lib_version, nil, ::String, nil
905
+ config_attr :timeout, nil, ::Numeric, nil
906
+ config_attr :metadata, nil, ::Hash, nil
907
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
908
+ config_attr :quota_project, nil, ::String, nil
909
+
910
+ # @private
911
+ # Overrides for http bindings for the RPCs of this service
912
+ # are only used when this service is used as mixin, and only
913
+ # by the host service.
914
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
915
+ config_attr :bindings_override, {}, ::Hash, nil
916
+
917
+ # @private
918
+ def initialize parent_config = nil
919
+ @parent_config = parent_config unless parent_config.nil?
920
+
921
+ yield self if block_given?
922
+ end
923
+
924
+ ##
925
+ # Configurations for individual RPCs
926
+ # @return [Rpcs]
927
+ #
928
+ def rpcs
929
+ @rpcs ||= begin
930
+ parent_rpcs = nil
931
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
932
+ Rpcs.new parent_rpcs
933
+ end
934
+ end
935
+
936
+ ##
937
+ # Configuration RPC class for the Agents API.
938
+ #
939
+ # Includes fields providing the configuration for each RPC in this service.
940
+ # Each configuration object is of type `Gapic::Config::Method` and includes
941
+ # the following configuration fields:
942
+ #
943
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
944
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
945
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
946
+ # include the following keys:
947
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
948
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
949
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
950
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
951
+ # trigger a retry.
952
+ #
953
+ class Rpcs
954
+ ##
955
+ # RPC-specific configuration for `list_agents`
956
+ # @return [::Gapic::Config::Method]
957
+ #
958
+ attr_reader :list_agents
959
+ ##
960
+ # RPC-specific configuration for `get_agent`
961
+ # @return [::Gapic::Config::Method]
962
+ #
963
+ attr_reader :get_agent
964
+ ##
965
+ # RPC-specific configuration for `create_agent`
966
+ # @return [::Gapic::Config::Method]
967
+ #
968
+ attr_reader :create_agent
969
+ ##
970
+ # RPC-specific configuration for `update_agent`
971
+ # @return [::Gapic::Config::Method]
972
+ #
973
+ attr_reader :update_agent
974
+ ##
975
+ # RPC-specific configuration for `delete_agent`
976
+ # @return [::Gapic::Config::Method]
977
+ #
978
+ attr_reader :delete_agent
979
+ ##
980
+ # RPC-specific configuration for `export_agent`
981
+ # @return [::Gapic::Config::Method]
982
+ #
983
+ attr_reader :export_agent
984
+ ##
985
+ # RPC-specific configuration for `restore_agent`
986
+ # @return [::Gapic::Config::Method]
987
+ #
988
+ attr_reader :restore_agent
989
+ ##
990
+ # RPC-specific configuration for `validate_agent`
991
+ # @return [::Gapic::Config::Method]
992
+ #
993
+ attr_reader :validate_agent
994
+ ##
995
+ # RPC-specific configuration for `get_agent_validation_result`
996
+ # @return [::Gapic::Config::Method]
997
+ #
998
+ attr_reader :get_agent_validation_result
999
+
1000
+ # @private
1001
+ def initialize parent_rpcs = nil
1002
+ list_agents_config = parent_rpcs.list_agents if parent_rpcs.respond_to? :list_agents
1003
+ @list_agents = ::Gapic::Config::Method.new list_agents_config
1004
+ get_agent_config = parent_rpcs.get_agent if parent_rpcs.respond_to? :get_agent
1005
+ @get_agent = ::Gapic::Config::Method.new get_agent_config
1006
+ create_agent_config = parent_rpcs.create_agent if parent_rpcs.respond_to? :create_agent
1007
+ @create_agent = ::Gapic::Config::Method.new create_agent_config
1008
+ update_agent_config = parent_rpcs.update_agent if parent_rpcs.respond_to? :update_agent
1009
+ @update_agent = ::Gapic::Config::Method.new update_agent_config
1010
+ delete_agent_config = parent_rpcs.delete_agent if parent_rpcs.respond_to? :delete_agent
1011
+ @delete_agent = ::Gapic::Config::Method.new delete_agent_config
1012
+ export_agent_config = parent_rpcs.export_agent if parent_rpcs.respond_to? :export_agent
1013
+ @export_agent = ::Gapic::Config::Method.new export_agent_config
1014
+ restore_agent_config = parent_rpcs.restore_agent if parent_rpcs.respond_to? :restore_agent
1015
+ @restore_agent = ::Gapic::Config::Method.new restore_agent_config
1016
+ validate_agent_config = parent_rpcs.validate_agent if parent_rpcs.respond_to? :validate_agent
1017
+ @validate_agent = ::Gapic::Config::Method.new validate_agent_config
1018
+ get_agent_validation_result_config = parent_rpcs.get_agent_validation_result if parent_rpcs.respond_to? :get_agent_validation_result
1019
+ @get_agent_validation_result = ::Gapic::Config::Method.new get_agent_validation_result_config
1020
+
1021
+ yield self if block_given?
1022
+ end
1023
+ end
1024
+ end
1025
+ end
1026
+ end
1027
+ end
1028
+ end
1029
+ end
1030
+ end
1031
+ end
1032
+ end