1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
#[allow(warnings)]
use hyper::Client;
use hyper::status::StatusCode;
use rusoto_core::request::DispatchSignedRequest;
use rusoto_core::region;
use std::fmt;
use std::error::Error;
use std::io;
use std::io::Read;
use rusoto_core::request::HttpDispatchError;
use rusoto_core::credential::{CredentialsError, ProvideAwsCredentials};
use serde_json;
use rusoto_core::param::{Params, ServiceParams};
use rusoto_core::signature::SignedRequest;
use serde_json::from_str;
use serde_json::Value as SerdeJsonValue;
#[derive(Default,Debug,Clone,Serialize)]
pub struct DeleteLexiconInput {
#[doc="<p>The name of the lexicon to delete. Must be an existing lexicon in the region.</p>"]
#[serde(rename="Name")]
pub name: String,
}
#[derive(Default,Debug,Clone,Deserialize)]
pub struct DeleteLexiconOutput;
#[derive(Default,Debug,Clone,Serialize)]
pub struct DescribeVoicesInput {
#[doc="<p> The language identification tag (ISO 639 code for the language name-ISO 3166 country code) for filtering the list of voices returned. If you don't specify this optional parameter, all available voices are returned. </p>"]
#[serde(rename="LanguageCode")]
#[serde(skip_serializing_if="Option::is_none")]
pub language_code: Option<String>,
#[doc="<p>An opaque pagination token returned from the previous <code>DescribeVoices</code> operation. If present, this indicates where to continue the listing.</p>"]
#[serde(rename="NextToken")]
#[serde(skip_serializing_if="Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default,Debug,Clone,Deserialize)]
pub struct DescribeVoicesOutput {
#[doc="<p>The pagination token to use in the next request to continue the listing of voices. <code>NextToken</code> is returned only if the response is truncated.</p>"]
#[serde(rename="NextToken")]
#[serde(skip_serializing_if="Option::is_none")]
pub next_token: Option<String>,
#[doc="<p>A list of voices with their properties.</p>"]
#[serde(rename="Voices")]
#[serde(skip_serializing_if="Option::is_none")]
pub voices: Option<Vec<Voice>>,
}
#[derive(Default,Debug,Clone,Serialize)]
pub struct GetLexiconInput {
#[doc="<p>Name of the lexicon.</p>"]
#[serde(rename="Name")]
pub name: String,
}
#[derive(Default,Debug,Clone,Deserialize)]
pub struct GetLexiconOutput {
#[doc="<p>Lexicon object that provides name and the string content of the lexicon. </p>"]
#[serde(rename="Lexicon")]
#[serde(skip_serializing_if="Option::is_none")]
pub lexicon: Option<Lexicon>,
#[doc="<p>Metadata of the lexicon, including phonetic alphabetic used, language code, lexicon ARN, number of lexemes defined in the lexicon, and size of lexicon in bytes.</p>"]
#[serde(rename="LexiconAttributes")]
#[serde(skip_serializing_if="Option::is_none")]
pub lexicon_attributes: Option<LexiconAttributes>,
}
#[doc="<p>Provides lexicon name and lexicon content in string format. For more information, see <a href=\"https://www.w3.org/TR/pronunciation-lexicon/\">Pronunciation Lexicon Specification (PLS) Version 1.0</a>.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct Lexicon {
#[doc="<p>Lexicon content in string format. The content of a lexicon must be in PLS format.</p>"]
#[serde(rename="Content")]
#[serde(skip_serializing_if="Option::is_none")]
pub content: Option<String>,
#[doc="<p>Name of the lexicon.</p>"]
#[serde(rename="Name")]
#[serde(skip_serializing_if="Option::is_none")]
pub name: Option<String>,
}
#[doc="<p>Contains metadata describing the lexicon such as the number of lexemes, language code, and so on. For more information, see <a href=\"http://docs.aws.amazon.com/polly/latest/dg/managing-lexicons.html\">Managing Lexicons</a>.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct LexiconAttributes {
#[doc="<p>Phonetic alphabet used in the lexicon. Valid values are <code>ipa</code> and <code>x-sampa</code>.</p>"]
#[serde(rename="Alphabet")]
#[serde(skip_serializing_if="Option::is_none")]
pub alphabet: Option<String>,
#[doc="<p>Language code that the lexicon applies to. A lexicon with a language code such as \"en\" would be applied to all English languages (en-GB, en-US, en-AUS, en-WLS, and so on.</p>"]
#[serde(rename="LanguageCode")]
#[serde(skip_serializing_if="Option::is_none")]
pub language_code: Option<String>,
#[doc="<p>Date lexicon was last modified (a timestamp value).</p>"]
#[serde(rename="LastModified")]
#[serde(skip_serializing_if="Option::is_none")]
pub last_modified: Option<f64>,
#[doc="<p>Number of lexemes in the lexicon.</p>"]
#[serde(rename="LexemesCount")]
#[serde(skip_serializing_if="Option::is_none")]
pub lexemes_count: Option<i64>,
#[doc="<p>Amazon Resource Name (ARN) of the lexicon.</p>"]
#[serde(rename="LexiconArn")]
#[serde(skip_serializing_if="Option::is_none")]
pub lexicon_arn: Option<String>,
#[doc="<p>Total size of the lexicon, in characters.</p>"]
#[serde(rename="Size")]
#[serde(skip_serializing_if="Option::is_none")]
pub size: Option<i64>,
}
#[doc="<p>Describes the content of the lexicon.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct LexiconDescription {
#[doc="<p>Provides lexicon metadata.</p>"]
#[serde(rename="Attributes")]
#[serde(skip_serializing_if="Option::is_none")]
pub attributes: Option<LexiconAttributes>,
#[doc="<p>Name of the lexicon.</p>"]
#[serde(rename="Name")]
#[serde(skip_serializing_if="Option::is_none")]
pub name: Option<String>,
}
#[derive(Default,Debug,Clone,Serialize)]
pub struct ListLexiconsInput {
#[doc="<p>An opaque pagination token returned from previous <code>ListLexicons</code> operation. If present, indicates where to continue the list of lexicons.</p>"]
#[serde(rename="NextToken")]
#[serde(skip_serializing_if="Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default,Debug,Clone,Deserialize)]
pub struct ListLexiconsOutput {
#[doc="<p>A list of lexicon names and attributes.</p>"]
#[serde(rename="Lexicons")]
#[serde(skip_serializing_if="Option::is_none")]
pub lexicons: Option<Vec<LexiconDescription>>,
#[doc="<p>The pagination token to use in the next request to continue the listing of lexicons. <code>NextToken</code> is returned only if the response is truncated.</p>"]
#[serde(rename="NextToken")]
#[serde(skip_serializing_if="Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default,Debug,Clone,Serialize)]
pub struct PutLexiconInput {
#[doc="<p>Content of the PLS lexicon as string data.</p>"]
#[serde(rename="Content")]
pub content: String,
#[doc="<p>Name of the lexicon. The name must follow the regular express format [0-9A-Za-z]{1,20}. That is, the name is a case-sensitive alphanumeric string up to 20 characters long. </p>"]
#[serde(rename="Name")]
pub name: String,
}
#[derive(Default,Debug,Clone,Deserialize)]
pub struct PutLexiconOutput;
#[derive(Default,Debug,Clone,Serialize)]
pub struct SynthesizeSpeechInput {
#[doc="<p>List of one or more pronunciation lexicon names you want the service to apply during synthesis. Lexicons are applied only if the language of the lexicon is the same as the language of the voice. For information about storing lexicons, see <a href=\"http://docs.aws.amazon.com/polly/latest/dg/API_PutLexicon.html\">PutLexicon</a>.</p>"]
#[serde(rename="LexiconNames")]
#[serde(skip_serializing_if="Option::is_none")]
pub lexicon_names: Option<Vec<String>>,
#[doc="<p> The format in which the returned output will be encoded. For audio stream, this will be mp3, ogg_vorbis, or pcm. For speech marks, this will be json. </p>"]
#[serde(rename="OutputFormat")]
pub output_format: String,
#[doc="<p> The audio frequency specified in Hz. </p> <p>The valid values for <code>mp3</code> and <code>ogg_vorbis</code> are \"8000\", \"16000\", and \"22050\". The default value is \"22050\". </p> <p> Valid values for <code>pcm</code> are \"8000\" and \"16000\" The default value is \"16000\". </p>"]
#[serde(rename="SampleRate")]
#[serde(skip_serializing_if="Option::is_none")]
pub sample_rate: Option<String>,
#[doc="<p>The type of speech marks returned for the input text.</p>"]
#[serde(rename="SpeechMarkTypes")]
#[serde(skip_serializing_if="Option::is_none")]
pub speech_mark_types: Option<Vec<String>>,
#[doc="<p> Input text to synthesize. If you specify <code>ssml</code> as the <code>TextType</code>, follow the SSML format for the input text. </p>"]
#[serde(rename="Text")]
pub text: String,
#[doc="<p> Specifies whether the input text is plain text or SSML. The default value is plain text. For more information, see <a href=\"http://docs.aws.amazon.com/polly/latest/dg/ssml.html\">Using SSML</a>.</p>"]
#[serde(rename="TextType")]
#[serde(skip_serializing_if="Option::is_none")]
pub text_type: Option<String>,
#[doc="<p> Voice ID to use for the synthesis. You can get a list of available voice IDs by calling the <a href=\"http://docs.aws.amazon.com/polly/latest/dg/API_DescribeVoices.html\">DescribeVoices</a> operation. </p>"]
#[serde(rename="VoiceId")]
pub voice_id: String,
}
#[derive(Default,Debug,Clone)]
pub struct SynthesizeSpeechOutput {
#[doc="<p> Stream containing the synthesized speech. </p>"]
pub audio_stream: Option<Vec<u8>>,
#[doc="<p> Specifies the type audio stream. This should reflect the <code>OutputFormat</code> parameter in your request. </p> <ul> <li> <p> If you request <code>mp3</code> as the <code>OutputFormat</code>, the <code>ContentType</code> returned is audio/mpeg. </p> </li> <li> <p> If you request <code>ogg_vorbis</code> as the <code>OutputFormat</code>, the <code>ContentType</code> returned is audio/ogg. </p> </li> <li> <p> If you request <code>pcm</code> as the <code>OutputFormat</code>, the <code>ContentType</code> returned is audio/pcm in a signed 16-bit, 1 channel (mono), little-endian format. </p> </li> <li> <p>If you request <code>json</code> as the <code>OutputFormat</code>, the <code>ContentType</code> returned is audio/json.</p> </li> </ul> <p> </p>"]
pub content_type: Option<String>,
#[doc="<p>Number of characters synthesized.</p>"]
pub request_characters: Option<i64>,
}
#[doc="<p>Description of the voice.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct Voice {
#[doc="<p>Gender of the voice.</p>"]
#[serde(rename="Gender")]
#[serde(skip_serializing_if="Option::is_none")]
pub gender: Option<String>,
#[doc="<p>Amazon Polly assigned voice ID. This is the ID that you specify when calling the <code>SynthesizeSpeech</code> operation.</p>"]
#[serde(rename="Id")]
#[serde(skip_serializing_if="Option::is_none")]
pub id: Option<String>,
#[doc="<p>Language code of the voice.</p>"]
#[serde(rename="LanguageCode")]
#[serde(skip_serializing_if="Option::is_none")]
pub language_code: Option<String>,
#[doc="<p>Human readable name of the language in English.</p>"]
#[serde(rename="LanguageName")]
#[serde(skip_serializing_if="Option::is_none")]
pub language_name: Option<String>,
#[doc="<p>Name of the voice (for example, Salli, Kendra, etc.). This provides a human readable voice name that you might display in your application.</p>"]
#[serde(rename="Name")]
#[serde(skip_serializing_if="Option::is_none")]
pub name: Option<String>,
}
#[derive(Debug, PartialEq)]
pub enum DeleteLexiconError {
LexiconNotFound(String),
ServiceFailure(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl DeleteLexiconError {
pub fn from_body(body: &str) -> DeleteLexiconError {
match from_str::<SerdeJsonValue>(body) {
Ok(json) => {
let raw_error_type = json.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or(body);
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"LexiconNotFoundException" => {
DeleteLexiconError::LexiconNotFound(String::from(error_message))
}
"ServiceFailureException" => {
DeleteLexiconError::ServiceFailure(String::from(error_message))
}
"ValidationException" => {
DeleteLexiconError::Validation(error_message.to_string())
}
_ => DeleteLexiconError::Unknown(String::from(body)),
}
}
Err(_) => DeleteLexiconError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for DeleteLexiconError {
fn from(err: serde_json::error::Error) -> DeleteLexiconError {
DeleteLexiconError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteLexiconError {
fn from(err: CredentialsError) -> DeleteLexiconError {
DeleteLexiconError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteLexiconError {
fn from(err: HttpDispatchError) -> DeleteLexiconError {
DeleteLexiconError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteLexiconError {
fn from(err: io::Error) -> DeleteLexiconError {
DeleteLexiconError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteLexiconError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteLexiconError {
fn description(&self) -> &str {
match *self {
DeleteLexiconError::LexiconNotFound(ref cause) => cause,
DeleteLexiconError::ServiceFailure(ref cause) => cause,
DeleteLexiconError::Validation(ref cause) => cause,
DeleteLexiconError::Credentials(ref err) => err.description(),
DeleteLexiconError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteLexiconError::Unknown(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeVoicesError {
InvalidNextToken(String),
ServiceFailure(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl DescribeVoicesError {
pub fn from_body(body: &str) -> DescribeVoicesError {
match from_str::<SerdeJsonValue>(body) {
Ok(json) => {
let raw_error_type = json.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or(body);
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"InvalidNextTokenException" => {
DescribeVoicesError::InvalidNextToken(String::from(error_message))
}
"ServiceFailureException" => {
DescribeVoicesError::ServiceFailure(String::from(error_message))
}
"ValidationException" => {
DescribeVoicesError::Validation(error_message.to_string())
}
_ => DescribeVoicesError::Unknown(String::from(body)),
}
}
Err(_) => DescribeVoicesError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for DescribeVoicesError {
fn from(err: serde_json::error::Error) -> DescribeVoicesError {
DescribeVoicesError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeVoicesError {
fn from(err: CredentialsError) -> DescribeVoicesError {
DescribeVoicesError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeVoicesError {
fn from(err: HttpDispatchError) -> DescribeVoicesError {
DescribeVoicesError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeVoicesError {
fn from(err: io::Error) -> DescribeVoicesError {
DescribeVoicesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeVoicesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeVoicesError {
fn description(&self) -> &str {
match *self {
DescribeVoicesError::InvalidNextToken(ref cause) => cause,
DescribeVoicesError::ServiceFailure(ref cause) => cause,
DescribeVoicesError::Validation(ref cause) => cause,
DescribeVoicesError::Credentials(ref err) => err.description(),
DescribeVoicesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DescribeVoicesError::Unknown(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetLexiconError {
LexiconNotFound(String),
ServiceFailure(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl GetLexiconError {
pub fn from_body(body: &str) -> GetLexiconError {
match from_str::<SerdeJsonValue>(body) {
Ok(json) => {
let raw_error_type = json.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or(body);
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"LexiconNotFoundException" => {
GetLexiconError::LexiconNotFound(String::from(error_message))
}
"ServiceFailureException" => {
GetLexiconError::ServiceFailure(String::from(error_message))
}
"ValidationException" => GetLexiconError::Validation(error_message.to_string()),
_ => GetLexiconError::Unknown(String::from(body)),
}
}
Err(_) => GetLexiconError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for GetLexiconError {
fn from(err: serde_json::error::Error) -> GetLexiconError {
GetLexiconError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for GetLexiconError {
fn from(err: CredentialsError) -> GetLexiconError {
GetLexiconError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetLexiconError {
fn from(err: HttpDispatchError) -> GetLexiconError {
GetLexiconError::HttpDispatch(err)
}
}
impl From<io::Error> for GetLexiconError {
fn from(err: io::Error) -> GetLexiconError {
GetLexiconError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetLexiconError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetLexiconError {
fn description(&self) -> &str {
match *self {
GetLexiconError::LexiconNotFound(ref cause) => cause,
GetLexiconError::ServiceFailure(ref cause) => cause,
GetLexiconError::Validation(ref cause) => cause,
GetLexiconError::Credentials(ref err) => err.description(),
GetLexiconError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetLexiconError::Unknown(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListLexiconsError {
InvalidNextToken(String),
ServiceFailure(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl ListLexiconsError {
pub fn from_body(body: &str) -> ListLexiconsError {
match from_str::<SerdeJsonValue>(body) {
Ok(json) => {
let raw_error_type = json.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or(body);
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"InvalidNextTokenException" => {
ListLexiconsError::InvalidNextToken(String::from(error_message))
}
"ServiceFailureException" => {
ListLexiconsError::ServiceFailure(String::from(error_message))
}
"ValidationException" => {
ListLexiconsError::Validation(error_message.to_string())
}
_ => ListLexiconsError::Unknown(String::from(body)),
}
}
Err(_) => ListLexiconsError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for ListLexiconsError {
fn from(err: serde_json::error::Error) -> ListLexiconsError {
ListLexiconsError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for ListLexiconsError {
fn from(err: CredentialsError) -> ListLexiconsError {
ListLexiconsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListLexiconsError {
fn from(err: HttpDispatchError) -> ListLexiconsError {
ListLexiconsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListLexiconsError {
fn from(err: io::Error) -> ListLexiconsError {
ListLexiconsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListLexiconsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListLexiconsError {
fn description(&self) -> &str {
match *self {
ListLexiconsError::InvalidNextToken(ref cause) => cause,
ListLexiconsError::ServiceFailure(ref cause) => cause,
ListLexiconsError::Validation(ref cause) => cause,
ListLexiconsError::Credentials(ref err) => err.description(),
ListLexiconsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListLexiconsError::Unknown(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum PutLexiconError {
InvalidLexicon(String),
LexiconSizeExceeded(String),
MaxLexemeLengthExceeded(String),
MaxLexiconsNumberExceeded(String),
ServiceFailure(String),
UnsupportedPlsAlphabet(String),
UnsupportedPlsLanguage(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl PutLexiconError {
pub fn from_body(body: &str) -> PutLexiconError {
match from_str::<SerdeJsonValue>(body) {
Ok(json) => {
let raw_error_type = json.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or(body);
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"InvalidLexiconException" => {
PutLexiconError::InvalidLexicon(String::from(error_message))
}
"LexiconSizeExceededException" => {
PutLexiconError::LexiconSizeExceeded(String::from(error_message))
}
"MaxLexemeLengthExceededException" => {
PutLexiconError::MaxLexemeLengthExceeded(String::from(error_message))
}
"MaxLexiconsNumberExceededException" => {
PutLexiconError::MaxLexiconsNumberExceeded(String::from(error_message))
}
"ServiceFailureException" => {
PutLexiconError::ServiceFailure(String::from(error_message))
}
"UnsupportedPlsAlphabetException" => {
PutLexiconError::UnsupportedPlsAlphabet(String::from(error_message))
}
"UnsupportedPlsLanguageException" => {
PutLexiconError::UnsupportedPlsLanguage(String::from(error_message))
}
"ValidationException" => PutLexiconError::Validation(error_message.to_string()),
_ => PutLexiconError::Unknown(String::from(body)),
}
}
Err(_) => PutLexiconError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for PutLexiconError {
fn from(err: serde_json::error::Error) -> PutLexiconError {
PutLexiconError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for PutLexiconError {
fn from(err: CredentialsError) -> PutLexiconError {
PutLexiconError::Credentials(err)
}
}
impl From<HttpDispatchError> for PutLexiconError {
fn from(err: HttpDispatchError) -> PutLexiconError {
PutLexiconError::HttpDispatch(err)
}
}
impl From<io::Error> for PutLexiconError {
fn from(err: io::Error) -> PutLexiconError {
PutLexiconError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for PutLexiconError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PutLexiconError {
fn description(&self) -> &str {
match *self {
PutLexiconError::InvalidLexicon(ref cause) => cause,
PutLexiconError::LexiconSizeExceeded(ref cause) => cause,
PutLexiconError::MaxLexemeLengthExceeded(ref cause) => cause,
PutLexiconError::MaxLexiconsNumberExceeded(ref cause) => cause,
PutLexiconError::ServiceFailure(ref cause) => cause,
PutLexiconError::UnsupportedPlsAlphabet(ref cause) => cause,
PutLexiconError::UnsupportedPlsLanguage(ref cause) => cause,
PutLexiconError::Validation(ref cause) => cause,
PutLexiconError::Credentials(ref err) => err.description(),
PutLexiconError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
PutLexiconError::Unknown(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum SynthesizeSpeechError {
InvalidSampleRate(String),
InvalidSsml(String),
LexiconNotFound(String),
MarksNotSupportedForFormat(String),
ServiceFailure(String),
SsmlMarksNotSupportedForTextType(String),
TextLengthExceeded(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl SynthesizeSpeechError {
pub fn from_body(body: &str) -> SynthesizeSpeechError {
match from_str::<SerdeJsonValue>(body) {
Ok(json) => {
let raw_error_type = json.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or(body);
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"InvalidSampleRateException" => {
SynthesizeSpeechError::InvalidSampleRate(String::from(error_message))
}
"InvalidSsmlException" => {
SynthesizeSpeechError::InvalidSsml(String::from(error_message))
}
"LexiconNotFoundException" => {
SynthesizeSpeechError::LexiconNotFound(String::from(error_message))
}
"MarksNotSupportedForFormatException" => SynthesizeSpeechError::MarksNotSupportedForFormat(String::from(error_message)),
"ServiceFailureException" => {
SynthesizeSpeechError::ServiceFailure(String::from(error_message))
}
"SsmlMarksNotSupportedForTextTypeException" => SynthesizeSpeechError::SsmlMarksNotSupportedForTextType(String::from(error_message)),
"TextLengthExceededException" => {
SynthesizeSpeechError::TextLengthExceeded(String::from(error_message))
}
"ValidationException" => {
SynthesizeSpeechError::Validation(error_message.to_string())
}
_ => SynthesizeSpeechError::Unknown(String::from(body)),
}
}
Err(_) => SynthesizeSpeechError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for SynthesizeSpeechError {
fn from(err: serde_json::error::Error) -> SynthesizeSpeechError {
SynthesizeSpeechError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for SynthesizeSpeechError {
fn from(err: CredentialsError) -> SynthesizeSpeechError {
SynthesizeSpeechError::Credentials(err)
}
}
impl From<HttpDispatchError> for SynthesizeSpeechError {
fn from(err: HttpDispatchError) -> SynthesizeSpeechError {
SynthesizeSpeechError::HttpDispatch(err)
}
}
impl From<io::Error> for SynthesizeSpeechError {
fn from(err: io::Error) -> SynthesizeSpeechError {
SynthesizeSpeechError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SynthesizeSpeechError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SynthesizeSpeechError {
fn description(&self) -> &str {
match *self {
SynthesizeSpeechError::InvalidSampleRate(ref cause) => cause,
SynthesizeSpeechError::InvalidSsml(ref cause) => cause,
SynthesizeSpeechError::LexiconNotFound(ref cause) => cause,
SynthesizeSpeechError::MarksNotSupportedForFormat(ref cause) => cause,
SynthesizeSpeechError::ServiceFailure(ref cause) => cause,
SynthesizeSpeechError::SsmlMarksNotSupportedForTextType(ref cause) => cause,
SynthesizeSpeechError::TextLengthExceeded(ref cause) => cause,
SynthesizeSpeechError::Validation(ref cause) => cause,
SynthesizeSpeechError::Credentials(ref err) => err.description(),
SynthesizeSpeechError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
SynthesizeSpeechError::Unknown(ref cause) => cause,
}
}
}
pub trait Polly {
#[doc="<p>Deletes the specified pronunciation lexicon stored in an AWS Region. A lexicon which has been deleted is not available for speech synthesis, nor is it possible to retrieve it using either the <code>GetLexicon</code> or <code>ListLexicon</code> APIs.</p> <p>For more information, see <a href=\"http://docs.aws.amazon.com/polly/latest/dg/managing-lexicons.html\">Managing Lexicons</a>.</p>"]
fn delete_lexicon(&self,
input: &DeleteLexiconInput)
-> Result<DeleteLexiconOutput, DeleteLexiconError>;
#[doc="<p>Returns the list of voices that are available for use when requesting speech synthesis. Each voice speaks a specified language, is either male or female, and is identified by an ID, which is the ASCII version of the voice name. </p> <p>When synthesizing speech ( <code>SynthesizeSpeech</code> ), you provide the voice ID for the voice you want from the list of voices returned by <code>DescribeVoices</code>.</p> <p>For example, you want your news reader application to read news in a specific language, but giving a user the option to choose the voice. Using the <code>DescribeVoices</code> operation you can provide the user with a list of available voices to select from.</p> <p> You can optionally specify a language code to filter the available voices. For example, if you specify <code>en-US</code>, the operation returns a list of all available US English voices. </p> <p>This operation requires permissions to perform the <code>polly:DescribeVoices</code> action.</p>"]
fn describe_voices(&self,
input: &DescribeVoicesInput)
-> Result<DescribeVoicesOutput, DescribeVoicesError>;
#[doc="<p>Returns the content of the specified pronunciation lexicon stored in an AWS Region. For more information, see <a href=\"http://docs.aws.amazon.com/polly/latest/dg/managing-lexicons.html\">Managing Lexicons</a>.</p>"]
fn get_lexicon(&self, input: &GetLexiconInput) -> Result<GetLexiconOutput, GetLexiconError>;
#[doc="<p>Returns a list of pronunciation lexicons stored in an AWS Region. For more information, see <a href=\"http://docs.aws.amazon.com/polly/latest/dg/managing-lexicons.html\">Managing Lexicons</a>.</p>"]
fn list_lexicons(&self,
input: &ListLexiconsInput)
-> Result<ListLexiconsOutput, ListLexiconsError>;
#[doc="<p>Stores a pronunciation lexicon in an AWS Region. If a lexicon with the same name already exists in the region, it is overwritten by the new lexicon. Lexicon operations have eventual consistency, therefore, it might take some time before the lexicon is available to the SynthesizeSpeech operation.</p> <p>For more information, see <a href=\"http://docs.aws.amazon.com/polly/latest/dg/managing-lexicons.html\">Managing Lexicons</a>.</p>"]
fn put_lexicon(&self, input: &PutLexiconInput) -> Result<PutLexiconOutput, PutLexiconError>;
#[doc="<p>Synthesizes UTF-8 input, plain text or SSML, to a stream of bytes. SSML input must be valid, well-formed SSML. Some alphabets might not be available with all the voices (for example, Cyrillic might not be read at all by English voices) unless phoneme mapping is used. For more information, see <a href=\"http://docs.aws.amazon.com/polly/latest/dg/how-text-to-speech-works.html\">How it Works</a>.</p>"]
fn synthesize_speech(&self,
input: &SynthesizeSpeechInput)
-> Result<SynthesizeSpeechOutput, SynthesizeSpeechError>;
}
pub struct PollyClient<P, D>
where P: ProvideAwsCredentials,
D: DispatchSignedRequest
{
credentials_provider: P,
region: region::Region,
dispatcher: D,
}
impl<P, D> PollyClient<P, D>
where P: ProvideAwsCredentials,
D: DispatchSignedRequest
{
pub fn new(request_dispatcher: D, credentials_provider: P, region: region::Region) -> Self {
PollyClient {
credentials_provider: credentials_provider,
region: region,
dispatcher: request_dispatcher,
}
}
}
impl<P, D> Polly for PollyClient<P, D>
where P: ProvideAwsCredentials,
D: DispatchSignedRequest
{
#[doc="<p>Deletes the specified pronunciation lexicon stored in an AWS Region. A lexicon which has been deleted is not available for speech synthesis, nor is it possible to retrieve it using either the <code>GetLexicon</code> or <code>ListLexicon</code> APIs.</p> <p>For more information, see <a href=\"http://docs.aws.amazon.com/polly/latest/dg/managing-lexicons.html\">Managing Lexicons</a>.</p>"]
fn delete_lexicon(&self,
input: &DeleteLexiconInput)
-> Result<DeleteLexiconOutput, DeleteLexiconError> {
let request_uri = format!("/v1/lexicons/{lexicon_name}", lexicon_name = input.name);
let mut request = SignedRequest::new("DELETE", "polly", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.sign_with_plus(&self.credentials_provider.credentials()?, true);
let mut response = self.dispatcher.dispatch(&request)?;
match response.status {
StatusCode::Ok => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
if body == b"{}" {
body = b"null".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<DeleteLexiconOutput>(&body).unwrap();
Ok(result)
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(DeleteLexiconError::from_body(String::from_utf8_lossy(&body).as_ref()))
}
}
}
#[doc="<p>Returns the list of voices that are available for use when requesting speech synthesis. Each voice speaks a specified language, is either male or female, and is identified by an ID, which is the ASCII version of the voice name. </p> <p>When synthesizing speech ( <code>SynthesizeSpeech</code> ), you provide the voice ID for the voice you want from the list of voices returned by <code>DescribeVoices</code>.</p> <p>For example, you want your news reader application to read news in a specific language, but giving a user the option to choose the voice. Using the <code>DescribeVoices</code> operation you can provide the user with a list of available voices to select from.</p> <p> You can optionally specify a language code to filter the available voices. For example, if you specify <code>en-US</code>, the operation returns a list of all available US English voices. </p> <p>This operation requires permissions to perform the <code>polly:DescribeVoices</code> action.</p>"]
fn describe_voices(&self,
input: &DescribeVoicesInput)
-> Result<DescribeVoicesOutput, DescribeVoicesError> {
let request_uri = "/v1/voices";
let mut request = SignedRequest::new("GET", "polly", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut params = Params::new();
if let Some(ref x) = input.language_code {
params.put("LanguageCode", x);
}
if let Some(ref x) = input.next_token {
params.put("NextToken", x);
}
request.set_params(params);
request.sign_with_plus(&self.credentials_provider.credentials()?, true);
let mut response = self.dispatcher.dispatch(&request)?;
match response.status {
StatusCode::Ok => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
if body == b"{}" {
body = b"null".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<DescribeVoicesOutput>(&body).unwrap();
Ok(result)
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(DescribeVoicesError::from_body(String::from_utf8_lossy(&body).as_ref()))
}
}
}
#[doc="<p>Returns the content of the specified pronunciation lexicon stored in an AWS Region. For more information, see <a href=\"http://docs.aws.amazon.com/polly/latest/dg/managing-lexicons.html\">Managing Lexicons</a>.</p>"]
fn get_lexicon(&self, input: &GetLexiconInput) -> Result<GetLexiconOutput, GetLexiconError> {
let request_uri = format!("/v1/lexicons/{lexicon_name}", lexicon_name = input.name);
let mut request = SignedRequest::new("GET", "polly", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.sign_with_plus(&self.credentials_provider.credentials()?, true);
let mut response = self.dispatcher.dispatch(&request)?;
match response.status {
StatusCode::Ok => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
if body == b"{}" {
body = b"null".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<GetLexiconOutput>(&body).unwrap();
Ok(result)
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(GetLexiconError::from_body(String::from_utf8_lossy(&body).as_ref()))
}
}
}
#[doc="<p>Returns a list of pronunciation lexicons stored in an AWS Region. For more information, see <a href=\"http://docs.aws.amazon.com/polly/latest/dg/managing-lexicons.html\">Managing Lexicons</a>.</p>"]
fn list_lexicons(&self,
input: &ListLexiconsInput)
-> Result<ListLexiconsOutput, ListLexiconsError> {
let request_uri = "/v1/lexicons";
let mut request = SignedRequest::new("GET", "polly", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut params = Params::new();
if let Some(ref x) = input.next_token {
params.put("NextToken", x);
}
request.set_params(params);
request.sign_with_plus(&self.credentials_provider.credentials()?, true);
let mut response = self.dispatcher.dispatch(&request)?;
match response.status {
StatusCode::Ok => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
if body == b"{}" {
body = b"null".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<ListLexiconsOutput>(&body).unwrap();
Ok(result)
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(ListLexiconsError::from_body(String::from_utf8_lossy(&body).as_ref()))
}
}
}
#[doc="<p>Stores a pronunciation lexicon in an AWS Region. If a lexicon with the same name already exists in the region, it is overwritten by the new lexicon. Lexicon operations have eventual consistency, therefore, it might take some time before the lexicon is available to the SynthesizeSpeech operation.</p> <p>For more information, see <a href=\"http://docs.aws.amazon.com/polly/latest/dg/managing-lexicons.html\">Managing Lexicons</a>.</p>"]
fn put_lexicon(&self, input: &PutLexiconInput) -> Result<PutLexiconOutput, PutLexiconError> {
let request_uri = format!("/v1/lexicons/{lexicon_name}", lexicon_name = input.name);
let mut request = SignedRequest::new("PUT", "polly", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(input).unwrap());
request.set_payload(encoded);
request.sign_with_plus(&self.credentials_provider.credentials()?, true);
let mut response = self.dispatcher.dispatch(&request)?;
match response.status {
StatusCode::Ok => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
if body == b"{}" {
body = b"null".to_vec();
}
debug!("Response body: {:?}", body);
debug!("Response status: {}", response.status);
let result = serde_json::from_slice::<PutLexiconOutput>(&body).unwrap();
Ok(result)
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(PutLexiconError::from_body(String::from_utf8_lossy(&body).as_ref()))
}
}
}
#[doc="<p>Synthesizes UTF-8 input, plain text or SSML, to a stream of bytes. SSML input must be valid, well-formed SSML. Some alphabets might not be available with all the voices (for example, Cyrillic might not be read at all by English voices) unless phoneme mapping is used. For more information, see <a href=\"http://docs.aws.amazon.com/polly/latest/dg/how-text-to-speech-works.html\">How it Works</a>.</p>"]
fn synthesize_speech(&self,
input: &SynthesizeSpeechInput)
-> Result<SynthesizeSpeechOutput, SynthesizeSpeechError> {
let request_uri = "/v1/speech";
let mut request = SignedRequest::new("POST", "polly", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(input).unwrap());
request.set_payload(encoded);
request.sign_with_plus(&self.credentials_provider.credentials()?, true);
let mut response = self.dispatcher.dispatch(&request)?;
match response.status {
StatusCode::Ok => {
let mut result = SynthesizeSpeechOutput::default();
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
result.audio_stream = Some(body);
if let Some(content_type) = response.headers.get("Content-Type") {
let value = content_type.to_owned();
result.content_type = Some(value)
};
if let Some(request_characters) =
response.headers.get("x-amzn-RequestCharacters") {
let value = request_characters.to_owned();
result.request_characters = Some(value.parse::<i64>().unwrap())
};
Ok(result)
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(SynthesizeSpeechError::from_body(String::from_utf8_lossy(&body).as_ref()))
}
}
}
}
#[cfg(test)]
mod protocol_tests {}