google-cloud-dialogflow-v2 0.22.0 → 0.23.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/google/cloud/dialogflow/v2/agents/rest/client.rb +1078 -0
  4. data/lib/google/cloud/dialogflow/v2/agents/rest/operations.rb +813 -0
  5. data/lib/google/cloud/dialogflow/v2/agents/rest/service_stub.rb +652 -0
  6. data/lib/google/cloud/dialogflow/v2/agents/rest.rb +54 -0
  7. data/lib/google/cloud/dialogflow/v2/agents.rb +6 -0
  8. data/lib/google/cloud/dialogflow/v2/answer_records/rest/client.rb +463 -0
  9. data/lib/google/cloud/dialogflow/v2/answer_records/rest/service_stub.rb +182 -0
  10. data/lib/google/cloud/dialogflow/v2/answer_records/rest.rb +54 -0
  11. data/lib/google/cloud/dialogflow/v2/answer_records.rb +6 -0
  12. data/lib/google/cloud/dialogflow/v2/bindings_override.rb +102 -0
  13. data/lib/google/cloud/dialogflow/v2/contexts/rest/client.rb +753 -0
  14. data/lib/google/cloud/dialogflow/v2/contexts/rest/service_stub.rb +536 -0
  15. data/lib/google/cloud/dialogflow/v2/contexts/rest.rb +53 -0
  16. data/lib/google/cloud/dialogflow/v2/contexts.rb +6 -0
  17. data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest/client.rb +714 -0
  18. data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest/operations.rb +813 -0
  19. data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest/service_stub.rb +367 -0
  20. data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest.rb +57 -0
  21. data/lib/google/cloud/dialogflow/v2/conversation_datasets.rb +6 -0
  22. data/lib/google/cloud/dialogflow/v2/conversation_models/rest/client.rb +1010 -0
  23. data/lib/google/cloud/dialogflow/v2/conversation_models/rest/operations.rb +813 -0
  24. data/lib/google/cloud/dialogflow/v2/conversation_models/rest/service_stub.rb +642 -0
  25. data/lib/google/cloud/dialogflow/v2/conversation_models/rest.rb +54 -0
  26. data/lib/google/cloud/dialogflow/v2/conversation_models.rb +6 -0
  27. data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/client.rb +868 -0
  28. data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/operations.rb +813 -0
  29. data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/service_stub.rb +518 -0
  30. data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest.rb +55 -0
  31. data/lib/google/cloud/dialogflow/v2/conversation_profiles.rb +6 -0
  32. data/lib/google/cloud/dialogflow/v2/conversations/rest/client.rb +819 -0
  33. data/lib/google/cloud/dialogflow/v2/conversations/rest/service_stub.rb +450 -0
  34. data/lib/google/cloud/dialogflow/v2/conversations/rest.rb +54 -0
  35. data/lib/google/cloud/dialogflow/v2/conversations.rb +6 -0
  36. data/lib/google/cloud/dialogflow/v2/documents/rest/client.rb +1013 -0
  37. data/lib/google/cloud/dialogflow/v2/documents/rest/operations.rb +813 -0
  38. data/lib/google/cloud/dialogflow/v2/documents/rest/service_stub.rb +631 -0
  39. data/lib/google/cloud/dialogflow/v2/documents/rest.rb +55 -0
  40. data/lib/google/cloud/dialogflow/v2/documents.rb +6 -0
  41. data/lib/google/cloud/dialogflow/v2/entity_types/rest/client.rb +1178 -0
  42. data/lib/google/cloud/dialogflow/v2/entity_types/rest/operations.rb +813 -0
  43. data/lib/google/cloud/dialogflow/v2/entity_types/rest/service_stub.rb +722 -0
  44. data/lib/google/cloud/dialogflow/v2/entity_types/rest.rb +54 -0
  45. data/lib/google/cloud/dialogflow/v2/entity_types.rb +6 -0
  46. data/lib/google/cloud/dialogflow/v2/environments/rest/client.rb +779 -0
  47. data/lib/google/cloud/dialogflow/v2/environments/rest/service_stub.rb +448 -0
  48. data/lib/google/cloud/dialogflow/v2/environments/rest.rb +53 -0
  49. data/lib/google/cloud/dialogflow/v2/environments.rb +6 -0
  50. data/lib/google/cloud/dialogflow/v2/fulfillments/rest/client.rb +444 -0
  51. data/lib/google/cloud/dialogflow/v2/fulfillments/rest/service_stub.rb +182 -0
  52. data/lib/google/cloud/dialogflow/v2/fulfillments/rest.rb +53 -0
  53. data/lib/google/cloud/dialogflow/v2/fulfillments.rb +6 -0
  54. data/lib/google/cloud/dialogflow/v2/intents/rest/client.rb +914 -0
  55. data/lib/google/cloud/dialogflow/v2/intents/rest/operations.rb +813 -0
  56. data/lib/google/cloud/dialogflow/v2/intents/rest/service_stub.rb +532 -0
  57. data/lib/google/cloud/dialogflow/v2/intents/rest.rb +54 -0
  58. data/lib/google/cloud/dialogflow/v2/intents.rb +6 -0
  59. data/lib/google/cloud/dialogflow/v2/knowledge_bases/rest/client.rb +696 -0
  60. data/lib/google/cloud/dialogflow/v2/knowledge_bases/rest/service_stub.rb +419 -0
  61. data/lib/google/cloud/dialogflow/v2/knowledge_bases/rest.rb +54 -0
  62. data/lib/google/cloud/dialogflow/v2/knowledge_bases.rb +6 -0
  63. data/lib/google/cloud/dialogflow/v2/participants/rest/client.rb +955 -0
  64. data/lib/google/cloud/dialogflow/v2/participants/rest/service_stub.rb +588 -0
  65. data/lib/google/cloud/dialogflow/v2/participants/rest.rb +53 -0
  66. data/lib/google/cloud/dialogflow/v2/participants.rb +6 -0
  67. data/lib/google/cloud/dialogflow/v2/rest.rb +54 -0
  68. data/lib/google/cloud/dialogflow/v2/session_entity_types/rest/client.rb +703 -0
  69. data/lib/google/cloud/dialogflow/v2/session_entity_types/rest/service_stub.rb +456 -0
  70. data/lib/google/cloud/dialogflow/v2/session_entity_types/rest.rb +54 -0
  71. data/lib/google/cloud/dialogflow/v2/session_entity_types.rb +6 -0
  72. data/lib/google/cloud/dialogflow/v2/sessions/rest/client.rb +437 -0
  73. data/lib/google/cloud/dialogflow/v2/sessions/rest/service_stub.rb +132 -0
  74. data/lib/google/cloud/dialogflow/v2/sessions/rest.rb +56 -0
  75. data/lib/google/cloud/dialogflow/v2/sessions.rb +6 -0
  76. data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
  77. data/lib/google/cloud/dialogflow/v2/versions/rest/client.rb +686 -0
  78. data/lib/google/cloud/dialogflow/v2/versions/rest/service_stub.rb +382 -0
  79. data/lib/google/cloud/dialogflow/v2/versions/rest.rb +53 -0
  80. data/lib/google/cloud/dialogflow/v2/versions.rb +6 -0
  81. data/lib/google/cloud/dialogflow/v2.rb +5 -0
  82. metadata +66 -5
@@ -0,0 +1,779 @@
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/v2/environment_pb"
21
+ require "google/cloud/dialogflow/v2/environments/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module Dialogflow
27
+ module V2
28
+ module Environments
29
+ module Rest
30
+ ##
31
+ # REST client for the Environments service.
32
+ #
33
+ # Service for managing {::Google::Cloud::Dialogflow::V2::Environment Environments}.
34
+ #
35
+ class Client
36
+ include Paths
37
+
38
+ # @private
39
+ attr_reader :environments_stub
40
+
41
+ ##
42
+ # Configure the Environments Client class.
43
+ #
44
+ # See {::Google::Cloud::Dialogflow::V2::Environments::Rest::Client::Configuration}
45
+ # for a description of the configuration fields.
46
+ #
47
+ # @example
48
+ #
49
+ # # Modify the configuration for all Environments clients
50
+ # ::Google::Cloud::Dialogflow::V2::Environments::Rest::Client.configure do |config|
51
+ # config.timeout = 10.0
52
+ # end
53
+ #
54
+ # @yield [config] Configure the Client client.
55
+ # @yieldparam config [Client::Configuration]
56
+ #
57
+ # @return [Client::Configuration]
58
+ #
59
+ def self.configure
60
+ @configure ||= begin
61
+ namespace = ["Google", "Cloud", "Dialogflow", "V2"]
62
+ parent_config = while namespace.any?
63
+ parent_name = namespace.join "::"
64
+ parent_const = const_get parent_name
65
+ break parent_const.configure if parent_const.respond_to? :configure
66
+ namespace.pop
67
+ end
68
+ default_config = Client::Configuration.new parent_config
69
+
70
+ default_config.timeout = 60.0
71
+ default_config.retry_policy = {
72
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
73
+ }
74
+
75
+ default_config
76
+ end
77
+ yield @configure if block_given?
78
+ @configure
79
+ end
80
+
81
+ ##
82
+ # Configure the Environments Client instance.
83
+ #
84
+ # The configuration is set to the derived mode, meaning that values can be changed,
85
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
86
+ # should be made on {Client.configure}.
87
+ #
88
+ # See {::Google::Cloud::Dialogflow::V2::Environments::Rest::Client::Configuration}
89
+ # for a description of the configuration fields.
90
+ #
91
+ # @yield [config] Configure the Client client.
92
+ # @yieldparam config [Client::Configuration]
93
+ #
94
+ # @return [Client::Configuration]
95
+ #
96
+ def configure
97
+ yield @config if block_given?
98
+ @config
99
+ end
100
+
101
+ ##
102
+ # Create a new Environments REST client object.
103
+ #
104
+ # @example
105
+ #
106
+ # # Create a client using the default configuration
107
+ # client = ::Google::Cloud::Dialogflow::V2::Environments::Rest::Client.new
108
+ #
109
+ # # Create a client using a custom configuration
110
+ # client = ::Google::Cloud::Dialogflow::V2::Environments::Rest::Client.new do |config|
111
+ # config.timeout = 10.0
112
+ # end
113
+ #
114
+ # @yield [config] Configure the Environments client.
115
+ # @yieldparam config [Client::Configuration]
116
+ #
117
+ def initialize
118
+ # Create the configuration object
119
+ @config = Configuration.new Client.configure
120
+
121
+ # Yield the configuration if needed
122
+ yield @config if block_given?
123
+
124
+ # Create credentials
125
+ credentials = @config.credentials
126
+ # Use self-signed JWT if the endpoint is unchanged from default,
127
+ # but only if the default endpoint does not have a region prefix.
128
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
129
+ !@config.endpoint.split(".").first.include?("-")
130
+ credentials ||= Credentials.default scope: @config.scope,
131
+ enable_self_signed_jwt: enable_self_signed_jwt
132
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
133
+ credentials = Credentials.new credentials, scope: @config.scope
134
+ end
135
+
136
+ @quota_project_id = @config.quota_project
137
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
138
+
139
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
140
+ config.credentials = credentials
141
+ config.quota_project = @quota_project_id
142
+ config.endpoint = @config.endpoint
143
+ config.bindings_override = @config.bindings_override
144
+ end
145
+
146
+ @environments_stub = ::Google::Cloud::Dialogflow::V2::Environments::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
147
+ end
148
+
149
+ ##
150
+ # Get the associated client for mix-in of the Locations.
151
+ #
152
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
153
+ #
154
+ attr_reader :location_client
155
+
156
+ # Service calls
157
+
158
+ ##
159
+ # Returns the list of all non-default environments of the specified agent.
160
+ #
161
+ # @overload list_environments(request, options = nil)
162
+ # Pass arguments to `list_environments` via a request object, either of type
163
+ # {::Google::Cloud::Dialogflow::V2::ListEnvironmentsRequest} or an equivalent Hash.
164
+ #
165
+ # @param request [::Google::Cloud::Dialogflow::V2::ListEnvironmentsRequest, ::Hash]
166
+ # A request object representing the call parameters. Required. To specify no
167
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
168
+ # @param options [::Gapic::CallOptions, ::Hash]
169
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
170
+ #
171
+ # @overload list_environments(parent: nil, page_size: nil, page_token: nil)
172
+ # Pass arguments to `list_environments` via keyword arguments. Note that at
173
+ # least one keyword argument is required. To specify no parameters, or to keep all
174
+ # the default parameter values, pass an empty Hash as a request object (see above).
175
+ #
176
+ # @param parent [::String]
177
+ # Required. The agent to list all environments from.
178
+ # Format:
179
+ #
180
+ # - `projects/<Project ID>/agent`
181
+ # - `projects/<Project ID>/locations/<Location ID>/agent`
182
+ # @param page_size [::Integer]
183
+ # Optional. The maximum number of items to return in a single page. By
184
+ # default 100 and at most 1000.
185
+ # @param page_token [::String]
186
+ # Optional. The next_page_token value returned from a previous list request.
187
+ # @yield [result, operation] Access the result along with the TransportOperation object
188
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Environment>]
189
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
190
+ #
191
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Environment>]
192
+ #
193
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
194
+ def list_environments request, options = nil
195
+ raise ::ArgumentError, "request must be provided" if request.nil?
196
+
197
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::ListEnvironmentsRequest
198
+
199
+ # Converts hash and nil to an options object
200
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
201
+
202
+ # Customize the options with defaults
203
+ call_metadata = @config.rpcs.list_environments.metadata.to_h
204
+
205
+ # Set x-goog-api-client and x-goog-user-project headers
206
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
207
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
208
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
209
+ transports_version_send: [:rest]
210
+
211
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
212
+
213
+ options.apply_defaults timeout: @config.rpcs.list_environments.timeout,
214
+ metadata: call_metadata,
215
+ retry_policy: @config.rpcs.list_environments.retry_policy
216
+
217
+ options.apply_defaults timeout: @config.timeout,
218
+ metadata: @config.metadata,
219
+ retry_policy: @config.retry_policy
220
+
221
+ @environments_stub.list_environments request, options do |result, operation|
222
+ result = ::Gapic::Rest::PagedEnumerable.new @environments_stub, :list_environments, "environments", request, result, options
223
+ yield result, operation if block_given?
224
+ return result
225
+ end
226
+ rescue ::Gapic::Rest::Error => e
227
+ raise ::Google::Cloud::Error.from_error(e)
228
+ end
229
+
230
+ ##
231
+ # Retrieves the specified agent environment.
232
+ #
233
+ # @overload get_environment(request, options = nil)
234
+ # Pass arguments to `get_environment` via a request object, either of type
235
+ # {::Google::Cloud::Dialogflow::V2::GetEnvironmentRequest} or an equivalent Hash.
236
+ #
237
+ # @param request [::Google::Cloud::Dialogflow::V2::GetEnvironmentRequest, ::Hash]
238
+ # A request object representing the call parameters. Required. To specify no
239
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
240
+ # @param options [::Gapic::CallOptions, ::Hash]
241
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
242
+ #
243
+ # @overload get_environment(name: nil)
244
+ # Pass arguments to `get_environment` via keyword arguments. Note that at
245
+ # least one keyword argument is required. To specify no parameters, or to keep all
246
+ # the default parameter values, pass an empty Hash as a request object (see above).
247
+ #
248
+ # @param name [::String]
249
+ # Required. The name of the environment.
250
+ # Supported formats:
251
+ #
252
+ # - `projects/<Project ID>/agent/environments/<Environment ID>`
253
+ # - `projects/<Project ID>/locations/<Location
254
+ # ID>/agent/environments/<Environment ID>`
255
+ #
256
+ # The environment ID for the default environment is `-`.
257
+ # @yield [result, operation] Access the result along with the TransportOperation object
258
+ # @yieldparam result [::Google::Cloud::Dialogflow::V2::Environment]
259
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
260
+ #
261
+ # @return [::Google::Cloud::Dialogflow::V2::Environment]
262
+ #
263
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
264
+ def get_environment request, options = nil
265
+ raise ::ArgumentError, "request must be provided" if request.nil?
266
+
267
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::GetEnvironmentRequest
268
+
269
+ # Converts hash and nil to an options object
270
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
271
+
272
+ # Customize the options with defaults
273
+ call_metadata = @config.rpcs.get_environment.metadata.to_h
274
+
275
+ # Set x-goog-api-client and x-goog-user-project headers
276
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
277
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
278
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
279
+ transports_version_send: [:rest]
280
+
281
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
282
+
283
+ options.apply_defaults timeout: @config.rpcs.get_environment.timeout,
284
+ metadata: call_metadata,
285
+ retry_policy: @config.rpcs.get_environment.retry_policy
286
+
287
+ options.apply_defaults timeout: @config.timeout,
288
+ metadata: @config.metadata,
289
+ retry_policy: @config.retry_policy
290
+
291
+ @environments_stub.get_environment request, options do |result, operation|
292
+ yield result, operation if block_given?
293
+ return result
294
+ end
295
+ rescue ::Gapic::Rest::Error => e
296
+ raise ::Google::Cloud::Error.from_error(e)
297
+ end
298
+
299
+ ##
300
+ # Creates an agent environment.
301
+ #
302
+ # @overload create_environment(request, options = nil)
303
+ # Pass arguments to `create_environment` via a request object, either of type
304
+ # {::Google::Cloud::Dialogflow::V2::CreateEnvironmentRequest} or an equivalent Hash.
305
+ #
306
+ # @param request [::Google::Cloud::Dialogflow::V2::CreateEnvironmentRequest, ::Hash]
307
+ # A request object representing the call parameters. Required. To specify no
308
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
309
+ # @param options [::Gapic::CallOptions, ::Hash]
310
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
311
+ #
312
+ # @overload create_environment(parent: nil, environment: nil, environment_id: nil)
313
+ # Pass arguments to `create_environment` via keyword arguments. Note that at
314
+ # least one keyword argument is required. To specify no parameters, or to keep all
315
+ # the default parameter values, pass an empty Hash as a request object (see above).
316
+ #
317
+ # @param parent [::String]
318
+ # Required. The agent to create an environment for.
319
+ # Supported formats:
320
+ #
321
+ # - `projects/<Project ID>/agent`
322
+ # - `projects/<Project ID>/locations/<Location ID>/agent`
323
+ # @param environment [::Google::Cloud::Dialogflow::V2::Environment, ::Hash]
324
+ # Required. The environment to create.
325
+ # @param environment_id [::String]
326
+ # Required. The unique id of the new environment.
327
+ # @yield [result, operation] Access the result along with the TransportOperation object
328
+ # @yieldparam result [::Google::Cloud::Dialogflow::V2::Environment]
329
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
330
+ #
331
+ # @return [::Google::Cloud::Dialogflow::V2::Environment]
332
+ #
333
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
334
+ def create_environment request, options = nil
335
+ raise ::ArgumentError, "request must be provided" if request.nil?
336
+
337
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::CreateEnvironmentRequest
338
+
339
+ # Converts hash and nil to an options object
340
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
341
+
342
+ # Customize the options with defaults
343
+ call_metadata = @config.rpcs.create_environment.metadata.to_h
344
+
345
+ # Set x-goog-api-client and x-goog-user-project headers
346
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
347
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
348
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
349
+ transports_version_send: [:rest]
350
+
351
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
352
+
353
+ options.apply_defaults timeout: @config.rpcs.create_environment.timeout,
354
+ metadata: call_metadata,
355
+ retry_policy: @config.rpcs.create_environment.retry_policy
356
+
357
+ options.apply_defaults timeout: @config.timeout,
358
+ metadata: @config.metadata,
359
+ retry_policy: @config.retry_policy
360
+
361
+ @environments_stub.create_environment request, options do |result, operation|
362
+ yield result, operation if block_given?
363
+ return result
364
+ end
365
+ rescue ::Gapic::Rest::Error => e
366
+ raise ::Google::Cloud::Error.from_error(e)
367
+ end
368
+
369
+ ##
370
+ # Updates the specified agent environment.
371
+ #
372
+ # This method allows you to deploy new agent versions into the environment.
373
+ # When an environment is pointed to a new agent version by setting
374
+ # `environment.agent_version`, the environment is temporarily set to the
375
+ # `LOADING` state. During that time, the environment continues serving the
376
+ # previous version of the agent. After the new agent version is done loading,
377
+ # the environment is set back to the `RUNNING` state.
378
+ # You can use "-" as Environment ID in environment name to update an agent
379
+ # version in the default environment. WARNING: this will negate all recent
380
+ # changes to the draft agent and can't be undone. You may want to save the
381
+ # draft agent to a version before calling this method.
382
+ #
383
+ # @overload update_environment(request, options = nil)
384
+ # Pass arguments to `update_environment` via a request object, either of type
385
+ # {::Google::Cloud::Dialogflow::V2::UpdateEnvironmentRequest} or an equivalent Hash.
386
+ #
387
+ # @param request [::Google::Cloud::Dialogflow::V2::UpdateEnvironmentRequest, ::Hash]
388
+ # A request object representing the call parameters. Required. To specify no
389
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
390
+ # @param options [::Gapic::CallOptions, ::Hash]
391
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
392
+ #
393
+ # @overload update_environment(environment: nil, update_mask: nil, allow_load_to_draft_and_discard_changes: nil)
394
+ # Pass arguments to `update_environment` via keyword arguments. Note that at
395
+ # least one keyword argument is required. To specify no parameters, or to keep all
396
+ # the default parameter values, pass an empty Hash as a request object (see above).
397
+ #
398
+ # @param environment [::Google::Cloud::Dialogflow::V2::Environment, ::Hash]
399
+ # Required. The environment to update.
400
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
401
+ # Required. The mask to control which fields get updated.
402
+ # @param allow_load_to_draft_and_discard_changes [::Boolean]
403
+ # Optional. This field is used to prevent accidental overwrite of the default
404
+ # environment, which is an operation that cannot be undone. To confirm that
405
+ # the caller desires this overwrite, this field must be explicitly set to
406
+ # true when updating the default environment (environment ID = `-`).
407
+ # @yield [result, operation] Access the result along with the TransportOperation object
408
+ # @yieldparam result [::Google::Cloud::Dialogflow::V2::Environment]
409
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
410
+ #
411
+ # @return [::Google::Cloud::Dialogflow::V2::Environment]
412
+ #
413
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
414
+ def update_environment request, options = nil
415
+ raise ::ArgumentError, "request must be provided" if request.nil?
416
+
417
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::UpdateEnvironmentRequest
418
+
419
+ # Converts hash and nil to an options object
420
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
421
+
422
+ # Customize the options with defaults
423
+ call_metadata = @config.rpcs.update_environment.metadata.to_h
424
+
425
+ # Set x-goog-api-client and x-goog-user-project headers
426
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
427
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
428
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
429
+ transports_version_send: [:rest]
430
+
431
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
432
+
433
+ options.apply_defaults timeout: @config.rpcs.update_environment.timeout,
434
+ metadata: call_metadata,
435
+ retry_policy: @config.rpcs.update_environment.retry_policy
436
+
437
+ options.apply_defaults timeout: @config.timeout,
438
+ metadata: @config.metadata,
439
+ retry_policy: @config.retry_policy
440
+
441
+ @environments_stub.update_environment request, options do |result, operation|
442
+ yield result, operation if block_given?
443
+ return result
444
+ end
445
+ rescue ::Gapic::Rest::Error => e
446
+ raise ::Google::Cloud::Error.from_error(e)
447
+ end
448
+
449
+ ##
450
+ # Deletes the specified agent environment.
451
+ #
452
+ # @overload delete_environment(request, options = nil)
453
+ # Pass arguments to `delete_environment` via a request object, either of type
454
+ # {::Google::Cloud::Dialogflow::V2::DeleteEnvironmentRequest} or an equivalent Hash.
455
+ #
456
+ # @param request [::Google::Cloud::Dialogflow::V2::DeleteEnvironmentRequest, ::Hash]
457
+ # A request object representing the call parameters. Required. To specify no
458
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
459
+ # @param options [::Gapic::CallOptions, ::Hash]
460
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
461
+ #
462
+ # @overload delete_environment(name: nil)
463
+ # Pass arguments to `delete_environment` via keyword arguments. Note that at
464
+ # least one keyword argument is required. To specify no parameters, or to keep all
465
+ # the default parameter values, pass an empty Hash as a request object (see above).
466
+ #
467
+ # @param name [::String]
468
+ # Required. The name of the environment to delete.
469
+ # / Format:
470
+ #
471
+ # - `projects/<Project ID>/agent/environments/<Environment ID>`
472
+ # - `projects/<Project ID>/locations/<Location
473
+ # ID>/agent/environments/<Environment ID>`
474
+ #
475
+ # The environment ID for the default environment is `-`.
476
+ # @yield [result, operation] Access the result along with the TransportOperation object
477
+ # @yieldparam result [::Google::Protobuf::Empty]
478
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
479
+ #
480
+ # @return [::Google::Protobuf::Empty]
481
+ #
482
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
483
+ def delete_environment request, options = nil
484
+ raise ::ArgumentError, "request must be provided" if request.nil?
485
+
486
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::DeleteEnvironmentRequest
487
+
488
+ # Converts hash and nil to an options object
489
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
490
+
491
+ # Customize the options with defaults
492
+ call_metadata = @config.rpcs.delete_environment.metadata.to_h
493
+
494
+ # Set x-goog-api-client and x-goog-user-project headers
495
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
496
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
497
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
498
+ transports_version_send: [:rest]
499
+
500
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
501
+
502
+ options.apply_defaults timeout: @config.rpcs.delete_environment.timeout,
503
+ metadata: call_metadata,
504
+ retry_policy: @config.rpcs.delete_environment.retry_policy
505
+
506
+ options.apply_defaults timeout: @config.timeout,
507
+ metadata: @config.metadata,
508
+ retry_policy: @config.retry_policy
509
+
510
+ @environments_stub.delete_environment request, options do |result, operation|
511
+ yield result, operation if block_given?
512
+ return result
513
+ end
514
+ rescue ::Gapic::Rest::Error => e
515
+ raise ::Google::Cloud::Error.from_error(e)
516
+ end
517
+
518
+ ##
519
+ # Gets the history of the specified environment.
520
+ #
521
+ # @overload get_environment_history(request, options = nil)
522
+ # Pass arguments to `get_environment_history` via a request object, either of type
523
+ # {::Google::Cloud::Dialogflow::V2::GetEnvironmentHistoryRequest} or an equivalent Hash.
524
+ #
525
+ # @param request [::Google::Cloud::Dialogflow::V2::GetEnvironmentHistoryRequest, ::Hash]
526
+ # A request object representing the call parameters. Required. To specify no
527
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
528
+ # @param options [::Gapic::CallOptions, ::Hash]
529
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
530
+ #
531
+ # @overload get_environment_history(parent: nil, page_size: nil, page_token: nil)
532
+ # Pass arguments to `get_environment_history` via keyword arguments. Note that at
533
+ # least one keyword argument is required. To specify no parameters, or to keep all
534
+ # the default parameter values, pass an empty Hash as a request object (see above).
535
+ #
536
+ # @param parent [::String]
537
+ # Required. The name of the environment to retrieve history for.
538
+ # Supported formats:
539
+ #
540
+ # - `projects/<Project ID>/agent/environments/<Environment ID>`
541
+ # - `projects/<Project ID>/locations/<Location
542
+ # ID>/agent/environments/<Environment ID>`
543
+ #
544
+ # The environment ID for the default environment is `-`.
545
+ # @param page_size [::Integer]
546
+ # Optional. The maximum number of items to return in a single page. By
547
+ # default 100 and at most 1000.
548
+ # @param page_token [::String]
549
+ # Optional. The next_page_token value returned from a previous list request.
550
+ # @yield [result, operation] Access the result along with the TransportOperation object
551
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::EnvironmentHistory::Entry>]
552
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
553
+ #
554
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::EnvironmentHistory::Entry>]
555
+ #
556
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
557
+ def get_environment_history request, options = nil
558
+ raise ::ArgumentError, "request must be provided" if request.nil?
559
+
560
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::GetEnvironmentHistoryRequest
561
+
562
+ # Converts hash and nil to an options object
563
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
564
+
565
+ # Customize the options with defaults
566
+ call_metadata = @config.rpcs.get_environment_history.metadata.to_h
567
+
568
+ # Set x-goog-api-client and x-goog-user-project headers
569
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
570
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
571
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
572
+ transports_version_send: [:rest]
573
+
574
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
575
+
576
+ options.apply_defaults timeout: @config.rpcs.get_environment_history.timeout,
577
+ metadata: call_metadata,
578
+ retry_policy: @config.rpcs.get_environment_history.retry_policy
579
+
580
+ options.apply_defaults timeout: @config.timeout,
581
+ metadata: @config.metadata,
582
+ retry_policy: @config.retry_policy
583
+
584
+ @environments_stub.get_environment_history request, options do |result, operation|
585
+ result = ::Gapic::Rest::PagedEnumerable.new @environments_stub, :get_environment_history, "entries", request, result, options
586
+ yield result, operation if block_given?
587
+ return result
588
+ end
589
+ rescue ::Gapic::Rest::Error => e
590
+ raise ::Google::Cloud::Error.from_error(e)
591
+ end
592
+
593
+ ##
594
+ # Configuration class for the Environments REST API.
595
+ #
596
+ # This class represents the configuration for Environments REST,
597
+ # providing control over timeouts, retry behavior, logging, transport
598
+ # parameters, and other low-level controls. Certain parameters can also be
599
+ # applied individually to specific RPCs. See
600
+ # {::Google::Cloud::Dialogflow::V2::Environments::Rest::Client::Configuration::Rpcs}
601
+ # for a list of RPCs that can be configured independently.
602
+ #
603
+ # Configuration can be applied globally to all clients, or to a single client
604
+ # on construction.
605
+ #
606
+ # @example
607
+ #
608
+ # # Modify the global config, setting the timeout for
609
+ # # list_environments to 20 seconds,
610
+ # # and all remaining timeouts to 10 seconds.
611
+ # ::Google::Cloud::Dialogflow::V2::Environments::Rest::Client.configure do |config|
612
+ # config.timeout = 10.0
613
+ # config.rpcs.list_environments.timeout = 20.0
614
+ # end
615
+ #
616
+ # # Apply the above configuration only to a new client.
617
+ # client = ::Google::Cloud::Dialogflow::V2::Environments::Rest::Client.new do |config|
618
+ # config.timeout = 10.0
619
+ # config.rpcs.list_environments.timeout = 20.0
620
+ # end
621
+ #
622
+ # @!attribute [rw] endpoint
623
+ # The hostname or hostname:port of the service endpoint.
624
+ # Defaults to `"dialogflow.googleapis.com"`.
625
+ # @return [::String]
626
+ # @!attribute [rw] credentials
627
+ # Credentials to send with calls. You may provide any of the following types:
628
+ # * (`String`) The path to a service account key file in JSON format
629
+ # * (`Hash`) A service account key as a Hash
630
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
631
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
632
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
633
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
634
+ # * (`nil`) indicating no credentials
635
+ # @return [::Object]
636
+ # @!attribute [rw] scope
637
+ # The OAuth scopes
638
+ # @return [::Array<::String>]
639
+ # @!attribute [rw] lib_name
640
+ # The library name as recorded in instrumentation and logging
641
+ # @return [::String]
642
+ # @!attribute [rw] lib_version
643
+ # The library version as recorded in instrumentation and logging
644
+ # @return [::String]
645
+ # @!attribute [rw] timeout
646
+ # The call timeout in seconds.
647
+ # @return [::Numeric]
648
+ # @!attribute [rw] metadata
649
+ # Additional headers to be sent with the call.
650
+ # @return [::Hash{::Symbol=>::String}]
651
+ # @!attribute [rw] retry_policy
652
+ # The retry policy. The value is a hash with the following keys:
653
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
654
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
655
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
656
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
657
+ # trigger a retry.
658
+ # @return [::Hash]
659
+ # @!attribute [rw] quota_project
660
+ # A separate project against which to charge quota.
661
+ # @return [::String]
662
+ #
663
+ class Configuration
664
+ extend ::Gapic::Config
665
+
666
+ config_attr :endpoint, "dialogflow.googleapis.com", ::String
667
+ config_attr :credentials, nil do |value|
668
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
669
+ allowed.any? { |klass| klass === value }
670
+ end
671
+ config_attr :scope, nil, ::String, ::Array, nil
672
+ config_attr :lib_name, nil, ::String, nil
673
+ config_attr :lib_version, nil, ::String, nil
674
+ config_attr :timeout, nil, ::Numeric, nil
675
+ config_attr :metadata, nil, ::Hash, nil
676
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
677
+ config_attr :quota_project, nil, ::String, nil
678
+
679
+ # @private
680
+ # Overrides for http bindings for the RPCs of this service
681
+ # are only used when this service is used as mixin, and only
682
+ # by the host service.
683
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
684
+ config_attr :bindings_override, {}, ::Hash, nil
685
+
686
+ # @private
687
+ def initialize parent_config = nil
688
+ @parent_config = parent_config unless parent_config.nil?
689
+
690
+ yield self if block_given?
691
+ end
692
+
693
+ ##
694
+ # Configurations for individual RPCs
695
+ # @return [Rpcs]
696
+ #
697
+ def rpcs
698
+ @rpcs ||= begin
699
+ parent_rpcs = nil
700
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
701
+ Rpcs.new parent_rpcs
702
+ end
703
+ end
704
+
705
+ ##
706
+ # Configuration RPC class for the Environments API.
707
+ #
708
+ # Includes fields providing the configuration for each RPC in this service.
709
+ # Each configuration object is of type `Gapic::Config::Method` and includes
710
+ # the following configuration fields:
711
+ #
712
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
713
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
714
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
715
+ # include the following keys:
716
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
717
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
718
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
719
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
720
+ # trigger a retry.
721
+ #
722
+ class Rpcs
723
+ ##
724
+ # RPC-specific configuration for `list_environments`
725
+ # @return [::Gapic::Config::Method]
726
+ #
727
+ attr_reader :list_environments
728
+ ##
729
+ # RPC-specific configuration for `get_environment`
730
+ # @return [::Gapic::Config::Method]
731
+ #
732
+ attr_reader :get_environment
733
+ ##
734
+ # RPC-specific configuration for `create_environment`
735
+ # @return [::Gapic::Config::Method]
736
+ #
737
+ attr_reader :create_environment
738
+ ##
739
+ # RPC-specific configuration for `update_environment`
740
+ # @return [::Gapic::Config::Method]
741
+ #
742
+ attr_reader :update_environment
743
+ ##
744
+ # RPC-specific configuration for `delete_environment`
745
+ # @return [::Gapic::Config::Method]
746
+ #
747
+ attr_reader :delete_environment
748
+ ##
749
+ # RPC-specific configuration for `get_environment_history`
750
+ # @return [::Gapic::Config::Method]
751
+ #
752
+ attr_reader :get_environment_history
753
+
754
+ # @private
755
+ def initialize parent_rpcs = nil
756
+ list_environments_config = parent_rpcs.list_environments if parent_rpcs.respond_to? :list_environments
757
+ @list_environments = ::Gapic::Config::Method.new list_environments_config
758
+ get_environment_config = parent_rpcs.get_environment if parent_rpcs.respond_to? :get_environment
759
+ @get_environment = ::Gapic::Config::Method.new get_environment_config
760
+ create_environment_config = parent_rpcs.create_environment if parent_rpcs.respond_to? :create_environment
761
+ @create_environment = ::Gapic::Config::Method.new create_environment_config
762
+ update_environment_config = parent_rpcs.update_environment if parent_rpcs.respond_to? :update_environment
763
+ @update_environment = ::Gapic::Config::Method.new update_environment_config
764
+ delete_environment_config = parent_rpcs.delete_environment if parent_rpcs.respond_to? :delete_environment
765
+ @delete_environment = ::Gapic::Config::Method.new delete_environment_config
766
+ get_environment_history_config = parent_rpcs.get_environment_history if parent_rpcs.respond_to? :get_environment_history
767
+ @get_environment_history = ::Gapic::Config::Method.new get_environment_history_config
768
+
769
+ yield self if block_given?
770
+ end
771
+ end
772
+ end
773
+ end
774
+ end
775
+ end
776
+ end
777
+ end
778
+ end
779
+ end