aws-sdk-lexmodelsv2 1.3.0 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,532 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WARNING ABOUT GENERATED CODE
4
+ #
5
+ # This file is generated. See the contributing guide for more information:
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+ require 'aws-sdk-core/waiters'
11
+
12
+ module Aws::LexModelsV2
13
+ # Waiters are utility methods that poll for a particular state to occur
14
+ # on a client. Waiters can fail after a number of attempts at a polling
15
+ # interval defined for the service client.
16
+ #
17
+ # For a list of operations that can be waited for and the
18
+ # client methods called for each operation, see the table below or the
19
+ # {Client#wait_until} field documentation for the {Client}.
20
+ #
21
+ # # Invoking a Waiter
22
+ # To invoke a waiter, call #wait_until on a {Client}. The first parameter
23
+ # is the waiter name, which is specific to the service client and indicates
24
+ # which operation is being waited for. The second parameter is a hash of
25
+ # parameters that are passed to the client method called by the waiter,
26
+ # which varies according to the waiter name.
27
+ #
28
+ # # Wait Failures
29
+ # To catch errors in a waiter, use WaiterFailed,
30
+ # as shown in the following example.
31
+ #
32
+ # rescue rescue Aws::Waiters::Errors::WaiterFailed => error
33
+ # puts "failed waiting for instance running: #{error.message}
34
+ # end
35
+ #
36
+ # # Configuring a Waiter
37
+ # Each waiter has a default polling interval and a maximum number of
38
+ # attempts it will make before returning control to your program.
39
+ # To set these values, use the `max_attempts` and `delay` parameters
40
+ # in your `#wait_until` call.
41
+ # The following example waits for up to 25 seconds, polling every five seconds.
42
+ #
43
+ # client.wait_until(...) do |w|
44
+ # w.max_attempts = 5
45
+ # w.delay = 5
46
+ # end
47
+ #
48
+ # To disable wait failures, set the value of either of these parameters
49
+ # to `nil`.
50
+ #
51
+ # # Extending a Waiter
52
+ # To modify the behavior of waiters, you can register callbacks that are
53
+ # triggered before each polling attempt and before waiting.
54
+ #
55
+ # The following example implements an exponential backoff in a waiter
56
+ # by doubling the amount of time to wait on every attempt.
57
+ #
58
+ # client.wait_until(...) do |w|
59
+ # w.interval = 0 # disable normal sleep
60
+ # w.before_wait do |n, resp|
61
+ # sleep(n ** 2)
62
+ # end
63
+ # end
64
+ #
65
+ # # Available Waiters
66
+ #
67
+ # The following table lists the valid waiter names, the operations they call,
68
+ # and the default `:delay` and `:max_attempts` values.
69
+ #
70
+ # | waiter_name | params | :delay | :max_attempts |
71
+ # | ------------------------------------ | ----------------------------- | -------- | ------------- |
72
+ # | bot_alias_available | {Client#describe_bot_alias} | 10 | 35 |
73
+ # | bot_available | {Client#describe_bot} | 10 | 35 |
74
+ # | bot_export_completed | {Client#describe_export} | 10 | 35 |
75
+ # | bot_import_completed | {Client#describe_import} | 10 | 35 |
76
+ # | bot_locale_built | {Client#describe_bot_locale} | 10 | 35 |
77
+ # | bot_locale_created | {Client#describe_bot_locale} | 10 | 35 |
78
+ # | bot_locale_express_testing_available | {Client#describe_bot_locale} | 10 | 35 |
79
+ # | bot_version_available | {Client#describe_bot_version} | 10 | 35 |
80
+ #
81
+ module Waiters
82
+
83
+ # Wait until a bot alias is available
84
+ class BotAliasAvailable
85
+
86
+ # @param [Hash] options
87
+ # @option options [required, Client] :client
88
+ # @option options [Integer] :max_attempts (35)
89
+ # @option options [Integer] :delay (10)
90
+ # @option options [Proc] :before_attempt
91
+ # @option options [Proc] :before_wait
92
+ def initialize(options)
93
+ @client = options.fetch(:client)
94
+ @waiter = Aws::Waiters::Waiter.new({
95
+ max_attempts: 35,
96
+ delay: 10,
97
+ poller: Aws::Waiters::Poller.new(
98
+ operation_name: :describe_bot_alias,
99
+ acceptors: [
100
+ {
101
+ "expected" => "Available",
102
+ "matcher" => "path",
103
+ "state" => "success",
104
+ "argument" => "bot_alias_status"
105
+ },
106
+ {
107
+ "expected" => "Failed",
108
+ "matcher" => "path",
109
+ "state" => "failure",
110
+ "argument" => "bot_alias_status"
111
+ },
112
+ {
113
+ "expected" => "Deleting",
114
+ "matcher" => "path",
115
+ "state" => "failure",
116
+ "argument" => "bot_alias_status"
117
+ }
118
+ ]
119
+ )
120
+ }.merge(options))
121
+ end
122
+
123
+ # @option (see Client#describe_bot_alias)
124
+ # @return (see Client#describe_bot_alias)
125
+ def wait(params = {})
126
+ @waiter.wait(client: @client, params: params)
127
+ end
128
+
129
+ # @api private
130
+ attr_reader :waiter
131
+
132
+ end
133
+
134
+ # Wait until a bot is available
135
+ class BotAvailable
136
+
137
+ # @param [Hash] options
138
+ # @option options [required, Client] :client
139
+ # @option options [Integer] :max_attempts (35)
140
+ # @option options [Integer] :delay (10)
141
+ # @option options [Proc] :before_attempt
142
+ # @option options [Proc] :before_wait
143
+ def initialize(options)
144
+ @client = options.fetch(:client)
145
+ @waiter = Aws::Waiters::Waiter.new({
146
+ max_attempts: 35,
147
+ delay: 10,
148
+ poller: Aws::Waiters::Poller.new(
149
+ operation_name: :describe_bot,
150
+ acceptors: [
151
+ {
152
+ "expected" => "Available",
153
+ "matcher" => "path",
154
+ "state" => "success",
155
+ "argument" => "bot_status"
156
+ },
157
+ {
158
+ "expected" => "Deleting",
159
+ "matcher" => "path",
160
+ "state" => "failure",
161
+ "argument" => "bot_status"
162
+ },
163
+ {
164
+ "expected" => "Failed",
165
+ "matcher" => "path",
166
+ "state" => "failure",
167
+ "argument" => "bot_status"
168
+ },
169
+ {
170
+ "expected" => "Inactive",
171
+ "matcher" => "path",
172
+ "state" => "failure",
173
+ "argument" => "bot_status"
174
+ }
175
+ ]
176
+ )
177
+ }.merge(options))
178
+ end
179
+
180
+ # @option (see Client#describe_bot)
181
+ # @return (see Client#describe_bot)
182
+ def wait(params = {})
183
+ @waiter.wait(client: @client, params: params)
184
+ end
185
+
186
+ # @api private
187
+ attr_reader :waiter
188
+
189
+ end
190
+
191
+ # Wait until a bot has been exported
192
+ class BotExportCompleted
193
+
194
+ # @param [Hash] options
195
+ # @option options [required, Client] :client
196
+ # @option options [Integer] :max_attempts (35)
197
+ # @option options [Integer] :delay (10)
198
+ # @option options [Proc] :before_attempt
199
+ # @option options [Proc] :before_wait
200
+ def initialize(options)
201
+ @client = options.fetch(:client)
202
+ @waiter = Aws::Waiters::Waiter.new({
203
+ max_attempts: 35,
204
+ delay: 10,
205
+ poller: Aws::Waiters::Poller.new(
206
+ operation_name: :describe_export,
207
+ acceptors: [
208
+ {
209
+ "expected" => "Completed",
210
+ "matcher" => "path",
211
+ "state" => "success",
212
+ "argument" => "export_status"
213
+ },
214
+ {
215
+ "expected" => "Deleting",
216
+ "matcher" => "path",
217
+ "state" => "failure",
218
+ "argument" => "export_status"
219
+ },
220
+ {
221
+ "expected" => "Failed",
222
+ "matcher" => "path",
223
+ "state" => "failure",
224
+ "argument" => "export_status"
225
+ }
226
+ ]
227
+ )
228
+ }.merge(options))
229
+ end
230
+
231
+ # @option (see Client#describe_export)
232
+ # @return (see Client#describe_export)
233
+ def wait(params = {})
234
+ @waiter.wait(client: @client, params: params)
235
+ end
236
+
237
+ # @api private
238
+ attr_reader :waiter
239
+
240
+ end
241
+
242
+ # Wait until a bot has been imported
243
+ class BotImportCompleted
244
+
245
+ # @param [Hash] options
246
+ # @option options [required, Client] :client
247
+ # @option options [Integer] :max_attempts (35)
248
+ # @option options [Integer] :delay (10)
249
+ # @option options [Proc] :before_attempt
250
+ # @option options [Proc] :before_wait
251
+ def initialize(options)
252
+ @client = options.fetch(:client)
253
+ @waiter = Aws::Waiters::Waiter.new({
254
+ max_attempts: 35,
255
+ delay: 10,
256
+ poller: Aws::Waiters::Poller.new(
257
+ operation_name: :describe_import,
258
+ acceptors: [
259
+ {
260
+ "expected" => "Completed",
261
+ "matcher" => "path",
262
+ "state" => "success",
263
+ "argument" => "import_status"
264
+ },
265
+ {
266
+ "expected" => "Deleting",
267
+ "matcher" => "path",
268
+ "state" => "failure",
269
+ "argument" => "import_status"
270
+ },
271
+ {
272
+ "expected" => "Failed",
273
+ "matcher" => "path",
274
+ "state" => "failure",
275
+ "argument" => "import_status"
276
+ }
277
+ ]
278
+ )
279
+ }.merge(options))
280
+ end
281
+
282
+ # @option (see Client#describe_import)
283
+ # @return (see Client#describe_import)
284
+ def wait(params = {})
285
+ @waiter.wait(client: @client, params: params)
286
+ end
287
+
288
+ # @api private
289
+ attr_reader :waiter
290
+
291
+ end
292
+
293
+ # Wait until a bot locale is built
294
+ class BotLocaleBuilt
295
+
296
+ # @param [Hash] options
297
+ # @option options [required, Client] :client
298
+ # @option options [Integer] :max_attempts (35)
299
+ # @option options [Integer] :delay (10)
300
+ # @option options [Proc] :before_attempt
301
+ # @option options [Proc] :before_wait
302
+ def initialize(options)
303
+ @client = options.fetch(:client)
304
+ @waiter = Aws::Waiters::Waiter.new({
305
+ max_attempts: 35,
306
+ delay: 10,
307
+ poller: Aws::Waiters::Poller.new(
308
+ operation_name: :describe_bot_locale,
309
+ acceptors: [
310
+ {
311
+ "expected" => "Built",
312
+ "matcher" => "path",
313
+ "state" => "success",
314
+ "argument" => "bot_locale_status"
315
+ },
316
+ {
317
+ "expected" => "Deleting",
318
+ "matcher" => "path",
319
+ "state" => "failure",
320
+ "argument" => "bot_locale_status"
321
+ },
322
+ {
323
+ "expected" => "Failed",
324
+ "matcher" => "path",
325
+ "state" => "failure",
326
+ "argument" => "bot_locale_status"
327
+ },
328
+ {
329
+ "expected" => "NotBuilt",
330
+ "matcher" => "path",
331
+ "state" => "failure",
332
+ "argument" => "bot_locale_status"
333
+ }
334
+ ]
335
+ )
336
+ }.merge(options))
337
+ end
338
+
339
+ # @option (see Client#describe_bot_locale)
340
+ # @return (see Client#describe_bot_locale)
341
+ def wait(params = {})
342
+ @waiter.wait(client: @client, params: params)
343
+ end
344
+
345
+ # @api private
346
+ attr_reader :waiter
347
+
348
+ end
349
+
350
+ # Wait unit a bot locale is created
351
+ class BotLocaleCreated
352
+
353
+ # @param [Hash] options
354
+ # @option options [required, Client] :client
355
+ # @option options [Integer] :max_attempts (35)
356
+ # @option options [Integer] :delay (10)
357
+ # @option options [Proc] :before_attempt
358
+ # @option options [Proc] :before_wait
359
+ def initialize(options)
360
+ @client = options.fetch(:client)
361
+ @waiter = Aws::Waiters::Waiter.new({
362
+ max_attempts: 35,
363
+ delay: 10,
364
+ poller: Aws::Waiters::Poller.new(
365
+ operation_name: :describe_bot_locale,
366
+ acceptors: [
367
+ {
368
+ "expected" => "Built",
369
+ "matcher" => "path",
370
+ "state" => "success",
371
+ "argument" => "bot_locale_status"
372
+ },
373
+ {
374
+ "expected" => "ReadyExpressTesting",
375
+ "matcher" => "path",
376
+ "state" => "success",
377
+ "argument" => "bot_locale_status"
378
+ },
379
+ {
380
+ "expected" => "NotBuilt",
381
+ "matcher" => "path",
382
+ "state" => "success",
383
+ "argument" => "bot_locale_status"
384
+ },
385
+ {
386
+ "expected" => "Deleting",
387
+ "matcher" => "path",
388
+ "state" => "failure",
389
+ "argument" => "bot_locale_status"
390
+ },
391
+ {
392
+ "expected" => "Failed",
393
+ "matcher" => "path",
394
+ "state" => "failure",
395
+ "argument" => "bot_locale_status"
396
+ }
397
+ ]
398
+ )
399
+ }.merge(options))
400
+ end
401
+
402
+ # @option (see Client#describe_bot_locale)
403
+ # @return (see Client#describe_bot_locale)
404
+ def wait(params = {})
405
+ @waiter.wait(client: @client, params: params)
406
+ end
407
+
408
+ # @api private
409
+ attr_reader :waiter
410
+
411
+ end
412
+
413
+ # Wait until a bot locale build is ready for express testing
414
+ class BotLocaleExpressTestingAvailable
415
+
416
+ # @param [Hash] options
417
+ # @option options [required, Client] :client
418
+ # @option options [Integer] :max_attempts (35)
419
+ # @option options [Integer] :delay (10)
420
+ # @option options [Proc] :before_attempt
421
+ # @option options [Proc] :before_wait
422
+ def initialize(options)
423
+ @client = options.fetch(:client)
424
+ @waiter = Aws::Waiters::Waiter.new({
425
+ max_attempts: 35,
426
+ delay: 10,
427
+ poller: Aws::Waiters::Poller.new(
428
+ operation_name: :describe_bot_locale,
429
+ acceptors: [
430
+ {
431
+ "expected" => "Built",
432
+ "matcher" => "path",
433
+ "state" => "success",
434
+ "argument" => "bot_locale_status"
435
+ },
436
+ {
437
+ "expected" => "ReadyExpressTesting",
438
+ "matcher" => "path",
439
+ "state" => "success",
440
+ "argument" => "bot_locale_status"
441
+ },
442
+ {
443
+ "expected" => "Deleting",
444
+ "matcher" => "path",
445
+ "state" => "failure",
446
+ "argument" => "bot_locale_status"
447
+ },
448
+ {
449
+ "expected" => "Failed",
450
+ "matcher" => "path",
451
+ "state" => "failure",
452
+ "argument" => "bot_locale_status"
453
+ },
454
+ {
455
+ "expected" => "NotBuilt",
456
+ "matcher" => "path",
457
+ "state" => "failure",
458
+ "argument" => "bot_locale_status"
459
+ }
460
+ ]
461
+ )
462
+ }.merge(options))
463
+ end
464
+
465
+ # @option (see Client#describe_bot_locale)
466
+ # @return (see Client#describe_bot_locale)
467
+ def wait(params = {})
468
+ @waiter.wait(client: @client, params: params)
469
+ end
470
+
471
+ # @api private
472
+ attr_reader :waiter
473
+
474
+ end
475
+
476
+ # Wait until a bot version is available
477
+ class BotVersionAvailable
478
+
479
+ # @param [Hash] options
480
+ # @option options [required, Client] :client
481
+ # @option options [Integer] :max_attempts (35)
482
+ # @option options [Integer] :delay (10)
483
+ # @option options [Proc] :before_attempt
484
+ # @option options [Proc] :before_wait
485
+ def initialize(options)
486
+ @client = options.fetch(:client)
487
+ @waiter = Aws::Waiters::Waiter.new({
488
+ max_attempts: 35,
489
+ delay: 10,
490
+ poller: Aws::Waiters::Poller.new(
491
+ operation_name: :describe_bot_version,
492
+ acceptors: [
493
+ {
494
+ "expected" => "Available",
495
+ "matcher" => "path",
496
+ "state" => "success",
497
+ "argument" => "bot_status"
498
+ },
499
+ {
500
+ "expected" => "Deleting",
501
+ "matcher" => "path",
502
+ "state" => "failure",
503
+ "argument" => "bot_status"
504
+ },
505
+ {
506
+ "expected" => "Failed",
507
+ "matcher" => "path",
508
+ "state" => "failure",
509
+ "argument" => "bot_status"
510
+ },
511
+ {
512
+ "state" => "retry",
513
+ "matcher" => "status",
514
+ "expected" => 404
515
+ }
516
+ ]
517
+ )
518
+ }.merge(options))
519
+ end
520
+
521
+ # @option (see Client#describe_bot_version)
522
+ # @return (see Client#describe_bot_version)
523
+ def wait(params = {})
524
+ @waiter.wait(client: @client, params: params)
525
+ end
526
+
527
+ # @api private
528
+ attr_reader :waiter
529
+
530
+ end
531
+ end
532
+ end