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
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
#[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::signature::SignedRequest;
use serde_json::Value as SerdeJsonValue;
use serde_json::from_str;
#[doc="<p>Structure containing the estimated age range, in years, for a face.</p> <p>Rekognition estimates an age-range for faces detected in the input image. Estimated age ranges can overlap; a face of a 5 year old may have an estimated range of 4-6 whilst the face of a 6 year old may have an estimated range of 4-8.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct AgeRange {
#[doc="<p>The highest estimated age.</p>"]
#[serde(rename="High")]
#[serde(skip_serializing_if="Option::is_none")]
pub high: Option<i64>,
#[doc="<p>The lowest estimated age.</p>"]
#[serde(rename="Low")]
#[serde(skip_serializing_if="Option::is_none")]
pub low: Option<i64>,
}
#[doc="<p>Indicates whether or not the face has a beard, and the confidence level in the determination.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct Beard {
#[doc="<p>Level of confidence in the determination.</p>"]
#[serde(rename="Confidence")]
#[serde(skip_serializing_if="Option::is_none")]
pub confidence: Option<f32>,
#[doc="<p>Boolean value that indicates whether the face has beard or not.</p>"]
#[serde(rename="Value")]
#[serde(skip_serializing_if="Option::is_none")]
pub value: Option<bool>,
}
#[doc="<p>Identifies the bounding box around the object or face. The <code>left</code> (x-coordinate) and <code>top</code> (y-coordinate) are coordinates representing the top and left sides of the bounding box. Note that the upper-left corner of the image is the origin (0,0). </p> <p>The <code>top</code> and <code>left</code> values returned are ratios of the overall image size. For example, if the input image is 700x200 pixels, and the top-left coordinate of the bounding box is 350x50 pixels, the API returns a <code>left</code> value of 0.5 (350/700) and a <code>top</code> value of 0.25 (50/200).</p> <p> The <code>width</code> and <code>height</code> values represent the dimensions of the bounding box as a ratio of the overall image dimension. For example, if the input image is 700x200 pixels, and the bounding box width is 70 pixels, the width returned is 0.1. </p> <note> <p> The bounding box coordinates can have negative values. For example, if Amazon Rekognition is able to detect a face that is at the image edge and is only partially visible, the service can return coordinates that are outside the image bounds and, depending on the image edge, you might get negative values or values greater than 1 for the <code>left</code> or <code>top</code> values. </p> </note>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct BoundingBox {
#[doc="<p>Height of the bounding box as a ratio of the overall image height.</p>"]
#[serde(rename="Height")]
#[serde(skip_serializing_if="Option::is_none")]
pub height: Option<f32>,
#[doc="<p>Left coordinate of the bounding box as a ratio of overall image width.</p>"]
#[serde(rename="Left")]
#[serde(skip_serializing_if="Option::is_none")]
pub left: Option<f32>,
#[doc="<p>Top coordinate of the bounding box as a ratio of overall image height.</p>"]
#[serde(rename="Top")]
#[serde(skip_serializing_if="Option::is_none")]
pub top: Option<f32>,
#[doc="<p>Width of the bounding box as a ratio of the overall image width.</p>"]
#[serde(rename="Width")]
#[serde(skip_serializing_if="Option::is_none")]
pub width: Option<f32>,
}
#[doc="<p>Provides information about a celebrity recognized by the operation.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct Celebrity {
#[doc="<p>Provides information about the celebrity's face, such as its location on the image.</p>"]
#[serde(rename="Face")]
#[serde(skip_serializing_if="Option::is_none")]
pub face: Option<ComparedFace>,
#[doc="<p>A unique identifier for the celebrity. </p>"]
#[serde(rename="Id")]
#[serde(skip_serializing_if="Option::is_none")]
pub id: Option<String>,
#[doc="<p>The confidence, in percentage, that Rekognition has that the recognized face is the celebrity.</p>"]
#[serde(rename="MatchConfidence")]
#[serde(skip_serializing_if="Option::is_none")]
pub match_confidence: Option<f32>,
#[doc="<p>The name of the celebrity.</p>"]
#[serde(rename="Name")]
#[serde(skip_serializing_if="Option::is_none")]
pub name: Option<String>,
#[doc="<p>An array of URLs pointing to additional information about the celebrity. If there is no additional information about the celebrity, this list is empty.</p>"]
#[serde(rename="Urls")]
#[serde(skip_serializing_if="Option::is_none")]
pub urls: Option<Vec<String>>,
}
#[doc="<p>Provides information about a face in a target image that matches the source image face analysed by <code>CompareFaces</code>. The <code>Face</code> property contains the bounding box of the face in the target image. The <code>Similarity</code> property is the confidence that the source image face matches the face in the bounding box.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct CompareFacesMatch {
#[doc="<p>Provides face metadata (bounding box and confidence that the bounding box actually contains a face).</p>"]
#[serde(rename="Face")]
#[serde(skip_serializing_if="Option::is_none")]
pub face: Option<ComparedFace>,
#[doc="<p>Level of confidence that the faces match.</p>"]
#[serde(rename="Similarity")]
#[serde(skip_serializing_if="Option::is_none")]
pub similarity: Option<f32>,
}
#[derive(Default,Debug,Clone,Serialize)]
pub struct CompareFacesRequest {
#[doc="<p>The minimum level of confidence in the face matches that a match must meet to be included in the <code>FaceMatches</code> array.</p>"]
#[serde(rename="SimilarityThreshold")]
#[serde(skip_serializing_if="Option::is_none")]
pub similarity_threshold: Option<f32>,
#[doc="<p>The source image, either as bytes or as an S3 object.</p>"]
#[serde(rename="SourceImage")]
pub source_image: Image,
#[doc="<p>The target image, either as bytes or as an S3 object.</p>"]
#[serde(rename="TargetImage")]
pub target_image: Image,
}
#[derive(Default,Debug,Clone,Deserialize)]
pub struct CompareFacesResponse {
#[doc="<p>An array of faces in the target image that match the source image face. Each <code>CompareFacesMatch</code> object provides the bounding box, the confidence level that the bounding box contains a face, and the similarity score for the face in the bounding box and the face in the source image.</p>"]
#[serde(rename="FaceMatches")]
#[serde(skip_serializing_if="Option::is_none")]
pub face_matches: Option<Vec<CompareFacesMatch>>,
#[doc="<p>The face in the source image that was used for comparison.</p>"]
#[serde(rename="SourceImageFace")]
#[serde(skip_serializing_if="Option::is_none")]
pub source_image_face: Option<ComparedSourceImageFace>,
#[doc="<p> The orientation of the source image (counterclockwise direction). If your application displays the source image, you can use this value to correct image orientation. The bounding box coordinates returned in <code>SourceImageFace</code> represent the location of the face before the image orientation is corrected. </p> <note> <p>If the source image is in .jpeg format, it might contain exchangeable image (Exif) metadata that includes the image's orientation. If the Exif metadata for the source image populates the orientation field, the value of <code>OrientationCorrection</code> is null and the <code>SourceImageFace</code> bounding box coordinates represent the location of the face after Exif metadata is used to correct the orientation. Images in .png format don't contain Exif metadata.</p> </note>"]
#[serde(rename="SourceImageOrientationCorrection")]
#[serde(skip_serializing_if="Option::is_none")]
pub source_image_orientation_correction: Option<String>,
#[doc="<p> The orientation of the target image (in counterclockwise direction). If your application displays the target image, you can use this value to correct the orientation of the image. The bounding box coordinates returned in <code>FaceMatches</code> and <code>UnmatchedFaces</code> represent face locations before the image orientation is corrected. </p> <note> <p>If the target image is in .jpg format, it might contain Exif metadata that includes the orientation of the image. If the Exif metadata for the target image populates the orientation field, the value of <code>OrientationCorrection</code> is null and the bounding box coordinates in <code>FaceMatches</code> and <code>UnmatchedFaces</code> represent the location of the face after Exif metadata is used to correct the orientation. Images in .png format don't contain Exif metadata.</p> </note>"]
#[serde(rename="TargetImageOrientationCorrection")]
#[serde(skip_serializing_if="Option::is_none")]
pub target_image_orientation_correction: Option<String>,
#[doc="<p>An array of faces in the target image that did not match the source image face.</p>"]
#[serde(rename="UnmatchedFaces")]
#[serde(skip_serializing_if="Option::is_none")]
pub unmatched_faces: Option<Vec<ComparedFace>>,
}
#[doc="<p>Provides face metadata for target image faces that are analysed by <code>CompareFaces</code> and <code>RecognizeCelebrities</code>.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct ComparedFace {
#[doc="<p>Bounding box of the face.</p>"]
#[serde(rename="BoundingBox")]
#[serde(skip_serializing_if="Option::is_none")]
pub bounding_box: Option<BoundingBox>,
#[doc="<p>Level of confidence that what the bounding box contains is a face.</p>"]
#[serde(rename="Confidence")]
#[serde(skip_serializing_if="Option::is_none")]
pub confidence: Option<f32>,
#[doc="<p>An array of facial landmarks.</p>"]
#[serde(rename="Landmarks")]
#[serde(skip_serializing_if="Option::is_none")]
pub landmarks: Option<Vec<Landmark>>,
#[doc="<p>Indicates the pose of the face as determined by its pitch, roll, and yaw.</p>"]
#[serde(rename="Pose")]
#[serde(skip_serializing_if="Option::is_none")]
pub pose: Option<Pose>,
#[doc="<p>Identifies face image brightness and sharpness. </p>"]
#[serde(rename="Quality")]
#[serde(skip_serializing_if="Option::is_none")]
pub quality: Option<ImageQuality>,
}
#[doc="<p>Type that describes the face Amazon Rekognition chose to compare with the faces in the target. This contains a bounding box for the selected face and confidence level that the bounding box contains a face. Note that Amazon Rekognition selects the largest face in the source image for this comparison. </p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct ComparedSourceImageFace {
#[doc="<p>Bounding box of the face.</p>"]
#[serde(rename="BoundingBox")]
#[serde(skip_serializing_if="Option::is_none")]
pub bounding_box: Option<BoundingBox>,
#[doc="<p>Confidence level that the selected bounding box contains a face.</p>"]
#[serde(rename="Confidence")]
#[serde(skip_serializing_if="Option::is_none")]
pub confidence: Option<f32>,
}
#[derive(Default,Debug,Clone,Serialize)]
pub struct CreateCollectionRequest {
#[doc="<p>ID for the collection that you are creating.</p>"]
#[serde(rename="CollectionId")]
pub collection_id: String,
}
#[derive(Default,Debug,Clone,Deserialize)]
pub struct CreateCollectionResponse {
#[doc="<p>Amazon Resource Name (ARN) of the collection. You can use this to manage permissions on your resources. </p>"]
#[serde(rename="CollectionArn")]
#[serde(skip_serializing_if="Option::is_none")]
pub collection_arn: Option<String>,
#[doc="<p>HTTP status code indicating the result of the operation.</p>"]
#[serde(rename="StatusCode")]
#[serde(skip_serializing_if="Option::is_none")]
pub status_code: Option<i64>,
}
#[derive(Default,Debug,Clone,Serialize)]
pub struct DeleteCollectionRequest {
#[doc="<p>ID of the collection to delete.</p>"]
#[serde(rename="CollectionId")]
pub collection_id: String,
}
#[derive(Default,Debug,Clone,Deserialize)]
pub struct DeleteCollectionResponse {
#[doc="<p>HTTP status code that indicates the result of the operation.</p>"]
#[serde(rename="StatusCode")]
#[serde(skip_serializing_if="Option::is_none")]
pub status_code: Option<i64>,
}
#[derive(Default,Debug,Clone,Serialize)]
pub struct DeleteFacesRequest {
#[doc="<p>Collection from which to remove the specific faces.</p>"]
#[serde(rename="CollectionId")]
pub collection_id: String,
#[doc="<p>An array of face IDs to delete.</p>"]
#[serde(rename="FaceIds")]
pub face_ids: Vec<String>,
}
#[derive(Default,Debug,Clone,Deserialize)]
pub struct DeleteFacesResponse {
#[doc="<p>An array of strings (face IDs) of the faces that were deleted.</p>"]
#[serde(rename="DeletedFaces")]
#[serde(skip_serializing_if="Option::is_none")]
pub deleted_faces: Option<Vec<String>>,
}
#[derive(Default,Debug,Clone,Serialize)]
pub struct DetectFacesRequest {
#[doc="<p>An array of facial attributes you want to be returned. This can be the default list of attributes or all attributes. If you don't specify a value for <code>Attributes</code> or if you specify <code>[\"DEFAULT\"]</code>, the API returns the following subset of facial attributes: <code>BoundingBox</code>, <code>Confidence</code>, <code>Pose</code>, <code>Quality</code> and <code>Landmarks</code>. If you provide <code>[\"ALL\"]</code>, all facial attributes are returned but the operation will take longer to complete.</p> <p>If you provide both, <code>[\"ALL\", \"DEFAULT\"]</code>, the service uses a logical AND operator to determine which attributes to return (in this case, all attributes). </p>"]
#[serde(rename="Attributes")]
#[serde(skip_serializing_if="Option::is_none")]
pub attributes: Option<Vec<String>>,
#[doc="<p>The image in which you want to detect faces. You can specify a blob or an S3 object. </p>"]
#[serde(rename="Image")]
pub image: Image,
}
#[derive(Default,Debug,Clone,Deserialize)]
pub struct DetectFacesResponse {
#[doc="<p>Details of each face found in the image. </p>"]
#[serde(rename="FaceDetails")]
#[serde(skip_serializing_if="Option::is_none")]
pub face_details: Option<Vec<FaceDetail>>,
#[doc="<p> The orientation of the input image (counter-clockwise direction). If your application displays the image, you can use this value to correct image orientation. The bounding box coordinates returned in <code>FaceDetails</code> represent face locations before the image orientation is corrected. </p> <note> <p>If the input image is in .jpeg format, it might contain exchangeable image (Exif) metadata that includes the image's orientation. If so, and the Exif metadata for the input image populates the orientation field, the value of <code>OrientationCorrection</code> is null and the <code>FaceDetails</code> bounding box coordinates represent face locations after Exif metadata is used to correct the image orientation. Images in .png format don't contain Exif metadata.</p> </note>"]
#[serde(rename="OrientationCorrection")]
#[serde(skip_serializing_if="Option::is_none")]
pub orientation_correction: Option<String>,
}
#[derive(Default,Debug,Clone,Serialize)]
pub struct DetectLabelsRequest {
#[doc="<p>The input image. You can provide a blob of image bytes or an S3 object.</p>"]
#[serde(rename="Image")]
pub image: Image,
#[doc="<p>Maximum number of labels you want the service to return in the response. The service returns the specified number of highest confidence labels. </p>"]
#[serde(rename="MaxLabels")]
#[serde(skip_serializing_if="Option::is_none")]
pub max_labels: Option<i64>,
#[doc="<p>Specifies the minimum confidence level for the labels to return. Amazon Rekognition doesn't return any labels with confidence lower than this specified value.</p> <p>If <code>MinConfidence</code> is not specified, the operation returns labels with a confidence values greater than or equal to 50 percent.</p>"]
#[serde(rename="MinConfidence")]
#[serde(skip_serializing_if="Option::is_none")]
pub min_confidence: Option<f32>,
}
#[derive(Default,Debug,Clone,Deserialize)]
pub struct DetectLabelsResponse {
#[doc="<p>An array of labels for the real-world objects detected. </p>"]
#[serde(rename="Labels")]
#[serde(skip_serializing_if="Option::is_none")]
pub labels: Option<Vec<Label>>,
#[doc="<p> The orientation of the input image (counter-clockwise direction). If your application displays the image, you can use this value to correct the orientation. If Amazon Rekognition detects that the input image was rotated (for example, by 90 degrees), it first corrects the orientation before detecting the labels. </p> <note> <p>If the input image Exif metadata populates the orientation field, Amazon Rekognition does not perform orientation correction and the value of OrientationCorrection will be null.</p> </note>"]
#[serde(rename="OrientationCorrection")]
#[serde(skip_serializing_if="Option::is_none")]
pub orientation_correction: Option<String>,
}
#[derive(Default,Debug,Clone,Serialize)]
pub struct DetectModerationLabelsRequest {
#[doc="<p>The input image as bytes or an S3 object.</p>"]
#[serde(rename="Image")]
pub image: Image,
#[doc="<p>Specifies the minimum confidence level for the labels to return. Amazon Rekognition doesn't return any labels with a confidence level lower than this specified value.</p> <p>If you don't specify <code>MinConfidence</code>, the operation returns labels with confidence values greater than or equal to 50 percent.</p>"]
#[serde(rename="MinConfidence")]
#[serde(skip_serializing_if="Option::is_none")]
pub min_confidence: Option<f32>,
}
#[derive(Default,Debug,Clone,Deserialize)]
pub struct DetectModerationLabelsResponse {
#[doc="<p>An array of labels for explicit or suggestive adult content found in the image. The list includes the top-level label and each child label detected in the image. This is useful for filtering specific categories of content. </p>"]
#[serde(rename="ModerationLabels")]
#[serde(skip_serializing_if="Option::is_none")]
pub moderation_labels: Option<Vec<ModerationLabel>>,
}
#[doc="<p>The emotions detected on the face, and the confidence level in the determination. For example, HAPPY, SAD, and ANGRY.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct Emotion {
#[doc="<p>Level of confidence in the determination.</p>"]
#[serde(rename="Confidence")]
#[serde(skip_serializing_if="Option::is_none")]
pub confidence: Option<f32>,
#[doc="<p>Type of emotion detected.</p>"]
#[serde(rename="Type")]
#[serde(skip_serializing_if="Option::is_none")]
pub type_: Option<String>,
}
#[doc="<p>Indicates whether or not the eyes on the face are open, and the confidence level in the determination.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct EyeOpen {
#[doc="<p>Level of confidence in the determination.</p>"]
#[serde(rename="Confidence")]
#[serde(skip_serializing_if="Option::is_none")]
pub confidence: Option<f32>,
#[doc="<p>Boolean value that indicates whether the eyes on the face are open.</p>"]
#[serde(rename="Value")]
#[serde(skip_serializing_if="Option::is_none")]
pub value: Option<bool>,
}
#[doc="<p>Indicates whether or not the face is wearing eye glasses, and the confidence level in the determination.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct Eyeglasses {
#[doc="<p>Level of confidence in the determination.</p>"]
#[serde(rename="Confidence")]
#[serde(skip_serializing_if="Option::is_none")]
pub confidence: Option<f32>,
#[doc="<p>Boolean value that indicates whether the face is wearing eye glasses or not.</p>"]
#[serde(rename="Value")]
#[serde(skip_serializing_if="Option::is_none")]
pub value: Option<bool>,
}
#[doc="<p>Describes the face properties such as the bounding box, face ID, image ID of the input image, and external image ID that you assigned. </p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct Face {
#[doc="<p>Bounding box of the face.</p>"]
#[serde(rename="BoundingBox")]
#[serde(skip_serializing_if="Option::is_none")]
pub bounding_box: Option<BoundingBox>,
#[doc="<p>Confidence level that the bounding box contains a face (and not a different object such as a tree).</p>"]
#[serde(rename="Confidence")]
#[serde(skip_serializing_if="Option::is_none")]
pub confidence: Option<f32>,
#[doc="<p>Identifier that you assign to all the faces in the input image.</p>"]
#[serde(rename="ExternalImageId")]
#[serde(skip_serializing_if="Option::is_none")]
pub external_image_id: Option<String>,
#[doc="<p>Unique identifier that Amazon Rekognition assigns to the face.</p>"]
#[serde(rename="FaceId")]
#[serde(skip_serializing_if="Option::is_none")]
pub face_id: Option<String>,
#[doc="<p>Unique identifier that Amazon Rekognition assigns to the input image.</p>"]
#[serde(rename="ImageId")]
#[serde(skip_serializing_if="Option::is_none")]
pub image_id: Option<String>,
}
#[doc="<p>Structure containing attributes of the face that the algorithm detected.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct FaceDetail {
#[doc="<p>The estimated age range, in years, for the face. Low represents the lowest estimated age and High represents the highest estimated age.</p>"]
#[serde(rename="AgeRange")]
#[serde(skip_serializing_if="Option::is_none")]
pub age_range: Option<AgeRange>,
#[doc="<p>Indicates whether or not the face has a beard, and the confidence level in the determination.</p>"]
#[serde(rename="Beard")]
#[serde(skip_serializing_if="Option::is_none")]
pub beard: Option<Beard>,
#[doc="<p>Bounding box of the face.</p>"]
#[serde(rename="BoundingBox")]
#[serde(skip_serializing_if="Option::is_none")]
pub bounding_box: Option<BoundingBox>,
#[doc="<p>Confidence level that the bounding box contains a face (and not a different object such as a tree).</p>"]
#[serde(rename="Confidence")]
#[serde(skip_serializing_if="Option::is_none")]
pub confidence: Option<f32>,
#[doc="<p>The emotions detected on the face, and the confidence level in the determination. For example, HAPPY, SAD, and ANGRY. </p>"]
#[serde(rename="Emotions")]
#[serde(skip_serializing_if="Option::is_none")]
pub emotions: Option<Vec<Emotion>>,
#[doc="<p>Indicates whether or not the face is wearing eye glasses, and the confidence level in the determination.</p>"]
#[serde(rename="Eyeglasses")]
#[serde(skip_serializing_if="Option::is_none")]
pub eyeglasses: Option<Eyeglasses>,
#[doc="<p>Indicates whether or not the eyes on the face are open, and the confidence level in the determination.</p>"]
#[serde(rename="EyesOpen")]
#[serde(skip_serializing_if="Option::is_none")]
pub eyes_open: Option<EyeOpen>,
#[doc="<p>Gender of the face and the confidence level in the determination.</p>"]
#[serde(rename="Gender")]
#[serde(skip_serializing_if="Option::is_none")]
pub gender: Option<Gender>,
#[doc="<p>Indicates the location of landmarks on the face.</p>"]
#[serde(rename="Landmarks")]
#[serde(skip_serializing_if="Option::is_none")]
pub landmarks: Option<Vec<Landmark>>,
#[doc="<p>Indicates whether or not the mouth on the face is open, and the confidence level in the determination.</p>"]
#[serde(rename="MouthOpen")]
#[serde(skip_serializing_if="Option::is_none")]
pub mouth_open: Option<MouthOpen>,
#[doc="<p>Indicates whether or not the face has a mustache, and the confidence level in the determination.</p>"]
#[serde(rename="Mustache")]
#[serde(skip_serializing_if="Option::is_none")]
pub mustache: Option<Mustache>,
#[doc="<p>Indicates the pose of the face as determined by its pitch, roll, and yaw.</p>"]
#[serde(rename="Pose")]
#[serde(skip_serializing_if="Option::is_none")]
pub pose: Option<Pose>,
#[doc="<p>Identifies image brightness and sharpness.</p>"]
#[serde(rename="Quality")]
#[serde(skip_serializing_if="Option::is_none")]
pub quality: Option<ImageQuality>,
#[doc="<p>Indicates whether or not the face is smiling, and the confidence level in the determination.</p>"]
#[serde(rename="Smile")]
#[serde(skip_serializing_if="Option::is_none")]
pub smile: Option<Smile>,
#[doc="<p>Indicates whether or not the face is wearing sunglasses, and the confidence level in the determination.</p>"]
#[serde(rename="Sunglasses")]
#[serde(skip_serializing_if="Option::is_none")]
pub sunglasses: Option<Sunglasses>,
}
#[doc="<p>Provides face metadata. In addition, it also provides the confidence in the match of this face with the input face.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct FaceMatch {
#[doc="<p>Describes the face properties such as the bounding box, face ID, image ID of the source image, and external image ID that you assigned.</p>"]
#[serde(rename="Face")]
#[serde(skip_serializing_if="Option::is_none")]
pub face: Option<Face>,
#[doc="<p>Confidence in the match of this face with the input face.</p>"]
#[serde(rename="Similarity")]
#[serde(skip_serializing_if="Option::is_none")]
pub similarity: Option<f32>,
}
#[doc="<p>Object containing both the face metadata (stored in the back-end database) and facial attributes that are detected but aren't stored in the database.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct FaceRecord {
#[doc="<p>Describes the face properties such as the bounding box, face ID, image ID of the input image, and external image ID that you assigned. </p>"]
#[serde(rename="Face")]
#[serde(skip_serializing_if="Option::is_none")]
pub face: Option<Face>,
#[doc="<p>Structure containing attributes of the face that the algorithm detected.</p>"]
#[serde(rename="FaceDetail")]
#[serde(skip_serializing_if="Option::is_none")]
pub face_detail: Option<FaceDetail>,
}
#[doc="<p>Gender of the face and the confidence level in the determination.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct Gender {
#[doc="<p>Level of confidence in the determination.</p>"]
#[serde(rename="Confidence")]
#[serde(skip_serializing_if="Option::is_none")]
pub confidence: Option<f32>,
#[doc="<p>Gender of the face.</p>"]
#[serde(rename="Value")]
#[serde(skip_serializing_if="Option::is_none")]
pub value: Option<String>,
}
#[derive(Default,Debug,Clone,Serialize)]
pub struct GetCelebrityInfoRequest {
#[doc="<p>The ID for the celebrity. You get the celebrity ID from a call to the operation, which recognizes celebrities in an image. </p>"]
#[serde(rename="Id")]
pub id: String,
}
#[derive(Default,Debug,Clone,Deserialize)]
pub struct GetCelebrityInfoResponse {
#[doc="<p>The name of the celebrity.</p>"]
#[serde(rename="Name")]
#[serde(skip_serializing_if="Option::is_none")]
pub name: Option<String>,
#[doc="<p>An array of URLs pointing to additional celebrity information. </p>"]
#[serde(rename="Urls")]
#[serde(skip_serializing_if="Option::is_none")]
pub urls: Option<Vec<String>>,
}
#[doc="<p>Provides the input image either as bytes or an S3 object.</p> <p>You pass image bytes to a Rekognition API operation by using the <code>Bytes</code> property. For example, you would use the <code>Bytes</code> property to pass an image loaded from a local file system. Image bytes passed by using the <code>Bytes</code> property must be base64-encoded. Your code may not need to encode image bytes if you are using an AWS SDK to call Rekognition API operations. For more information, see <a>example4</a>.</p> <p> You pass images stored in an S3 bucket to a Rekognition API operation by using the <code>S3Object</code> property. Images stored in an S3 bucket do not need to be base64-encoded.</p> <p>The region for the S3 bucket containing the S3 object must match the region you use for Amazon Rekognition operations.</p> <p>If you use the Amazon CLI to call Amazon Rekognition operations, passing image bytes using the Bytes property is not supported. You must first upload the image to an Amazon S3 bucket and then call the operation using the S3Object property.</p> <p>For Amazon Rekognition to process an S3 object, the user must have permission to access the S3 object. For more information, see <a>manage-access-resource-policies</a>. </p>"]
#[derive(Default,Debug,Clone,Serialize)]
pub struct Image {
#[doc="<p>Blob of image bytes up to 5 MBs.</p>"]
#[serde(rename="Bytes")]
#[serde(
deserialize_with="::rusoto_core::serialization::SerdeBlob::deserialize_blob",
serialize_with="::rusoto_core::serialization::SerdeBlob::serialize_blob",
default,
)]
pub bytes: Option<Vec<u8>>,
#[doc="<p>Identifies an S3 object as the image source.</p>"]
#[serde(rename="S3Object")]
#[serde(skip_serializing_if="Option::is_none")]
pub s3_object: Option<S3Object>,
}
#[doc="<p>Identifies face image brightness and sharpness. </p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct ImageQuality {
#[doc="<p>Value representing brightness of the face. The service returns a value between 0 and 100 (inclusive). A higher value indicates a brighter face image.</p>"]
#[serde(rename="Brightness")]
#[serde(skip_serializing_if="Option::is_none")]
pub brightness: Option<f32>,
#[doc="<p>Value representing sharpness of the face. The service returns a value between 0 and 100 (inclusive). A higher value indicates a sharper face image.</p>"]
#[serde(rename="Sharpness")]
#[serde(skip_serializing_if="Option::is_none")]
pub sharpness: Option<f32>,
}
#[derive(Default,Debug,Clone,Serialize)]
pub struct IndexFacesRequest {
#[doc="<p>The ID of an existing collection to which you want to add the faces that are detected in the input images.</p>"]
#[serde(rename="CollectionId")]
pub collection_id: String,
#[doc="<p>An array of facial attributes that you want to be returned. This can be the default list of attributes or all attributes. If you don't specify a value for <code>Attributes</code> or if you specify <code>[\"DEFAULT\"]</code>, the API returns the following subset of facial attributes: <code>BoundingBox</code>, <code>Confidence</code>, <code>Pose</code>, <code>Quality</code> and <code>Landmarks</code>. If you provide <code>[\"ALL\"]</code>, all facial attributes are returned but the operation will take longer to complete.</p> <p>If you provide both, <code>[\"ALL\", \"DEFAULT\"]</code>, the service uses a logical AND operator to determine which attributes to return (in this case, all attributes). </p>"]
#[serde(rename="DetectionAttributes")]
#[serde(skip_serializing_if="Option::is_none")]
pub detection_attributes: Option<Vec<String>>,
#[doc="<p>ID you want to assign to all the faces detected in the image.</p>"]
#[serde(rename="ExternalImageId")]
#[serde(skip_serializing_if="Option::is_none")]
pub external_image_id: Option<String>,
#[doc="<p>The input image as bytes or an S3 object.</p>"]
#[serde(rename="Image")]
pub image: Image,
}
#[derive(Default,Debug,Clone,Deserialize)]
pub struct IndexFacesResponse {
#[doc="<p>An array of faces detected and added to the collection. For more information, see <a>howitworks-index-faces</a>. </p>"]
#[serde(rename="FaceRecords")]
#[serde(skip_serializing_if="Option::is_none")]
pub face_records: Option<Vec<FaceRecord>>,
#[doc="<p>The orientation of the input image (counterclockwise direction). If your application displays the image, you can use this value to correct image orientation. The bounding box coordinates returned in <code>FaceRecords</code> represent face locations before the image orientation is corrected. </p> <note> <p>If the input image is in jpeg format, it might contain exchangeable image (Exif) metadata. If so, and the Exif metadata populates the orientation field, the value of <code>OrientationCorrection</code> is null and the bounding box coordinates in <code>FaceRecords</code> represent face locations after Exif metadata is used to correct the image orientation. Images in .png format don't contain Exif metadata.</p> </note>"]
#[serde(rename="OrientationCorrection")]
#[serde(skip_serializing_if="Option::is_none")]
pub orientation_correction: Option<String>,
}
#[doc="<p>Structure containing details about the detected label, including name, and level of confidence.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct Label {
#[doc="<p>Level of confidence.</p>"]
#[serde(rename="Confidence")]
#[serde(skip_serializing_if="Option::is_none")]
pub confidence: Option<f32>,
#[doc="<p>The name (label) of the object.</p>"]
#[serde(rename="Name")]
#[serde(skip_serializing_if="Option::is_none")]
pub name: Option<String>,
}
#[doc="<p>Indicates the location of the landmark on the face.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct Landmark {
#[doc="<p>Type of the landmark.</p>"]
#[serde(rename="Type")]
#[serde(skip_serializing_if="Option::is_none")]
pub type_: Option<String>,
#[doc="<p>x-coordinate from the top left of the landmark expressed as the ratio of the width of the image. For example, if the images is 700x200 and the x-coordinate of the landmark is at 350 pixels, this value is 0.5. </p>"]
#[serde(rename="X")]
#[serde(skip_serializing_if="Option::is_none")]
pub x: Option<f32>,
#[doc="<p>y-coordinate from the top left of the landmark expressed as the ratio of the height of the image. For example, if the images is 700x200 and the y-coordinate of the landmark is at 100 pixels, this value is 0.5.</p>"]
#[serde(rename="Y")]
#[serde(skip_serializing_if="Option::is_none")]
pub y: Option<f32>,
}
#[derive(Default,Debug,Clone,Serialize)]
pub struct ListCollectionsRequest {
#[doc="<p>Maximum number of collection IDs to return.</p>"]
#[serde(rename="MaxResults")]
#[serde(skip_serializing_if="Option::is_none")]
pub max_results: Option<i64>,
#[doc="<p>Pagination token from the previous response.</p>"]
#[serde(rename="NextToken")]
#[serde(skip_serializing_if="Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default,Debug,Clone,Deserialize)]
pub struct ListCollectionsResponse {
#[doc="<p>An array of collection IDs.</p>"]
#[serde(rename="CollectionIds")]
#[serde(skip_serializing_if="Option::is_none")]
pub collection_ids: Option<Vec<String>>,
#[doc="<p>If the result is truncated, the response provides a <code>NextToken</code> that you can use in the subsequent request to fetch the next set of collection IDs.</p>"]
#[serde(rename="NextToken")]
#[serde(skip_serializing_if="Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default,Debug,Clone,Serialize)]
pub struct ListFacesRequest {
#[doc="<p>ID of the collection from which to list the faces.</p>"]
#[serde(rename="CollectionId")]
pub collection_id: String,
#[doc="<p>Maximum number of faces to return.</p>"]
#[serde(rename="MaxResults")]
#[serde(skip_serializing_if="Option::is_none")]
pub max_results: Option<i64>,
#[doc="<p>If the previous response was incomplete (because there is more data to retrieve), Amazon Rekognition returns a pagination token in the response. You can use this pagination token to retrieve the next set of faces.</p>"]
#[serde(rename="NextToken")]
#[serde(skip_serializing_if="Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default,Debug,Clone,Deserialize)]
pub struct ListFacesResponse {
#[doc="<p>An array of <code>Face</code> objects. </p>"]
#[serde(rename="Faces")]
#[serde(skip_serializing_if="Option::is_none")]
pub faces: Option<Vec<Face>>,
#[doc="<p>If the response is truncated, Amazon Rekognition returns this token that you can use in the subsequent request to retrieve the next set of faces.</p>"]
#[serde(rename="NextToken")]
#[serde(skip_serializing_if="Option::is_none")]
pub next_token: Option<String>,
}
#[doc="<p>Provides information about a single type of moderated content found in an image. Each type of moderated content has a label within a hierarchical taxonomy. For more information, see <a>image-moderation</a>.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct ModerationLabel {
#[doc="<p>Specifies the confidence that Amazon Rekognition has that the label has been correctly identified.</p> <p>If you don't specify the <code>MinConfidence</code> parameter in the call to <code>DetectModerationLabels</code>, the operation returns labels with a confidence value greater than or equal to 50 percent.</p>"]
#[serde(rename="Confidence")]
#[serde(skip_serializing_if="Option::is_none")]
pub confidence: Option<f32>,
#[doc="<p>The label name for the type of content detected in the image.</p>"]
#[serde(rename="Name")]
#[serde(skip_serializing_if="Option::is_none")]
pub name: Option<String>,
#[doc="<p>The name for the parent label. Labels at the top-level of the hierarchy have the parent label <code>\"\"</code>.</p>"]
#[serde(rename="ParentName")]
#[serde(skip_serializing_if="Option::is_none")]
pub parent_name: Option<String>,
}
#[doc="<p>Indicates whether or not the mouth on the face is open, and the confidence level in the determination.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct MouthOpen {
#[doc="<p>Level of confidence in the determination.</p>"]
#[serde(rename="Confidence")]
#[serde(skip_serializing_if="Option::is_none")]
pub confidence: Option<f32>,
#[doc="<p>Boolean value that indicates whether the mouth on the face is open or not.</p>"]
#[serde(rename="Value")]
#[serde(skip_serializing_if="Option::is_none")]
pub value: Option<bool>,
}
#[doc="<p>Indicates whether or not the face has a mustache, and the confidence level in the determination.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct Mustache {
#[doc="<p>Level of confidence in the determination.</p>"]
#[serde(rename="Confidence")]
#[serde(skip_serializing_if="Option::is_none")]
pub confidence: Option<f32>,
#[doc="<p>Boolean value that indicates whether the face has mustache or not.</p>"]
#[serde(rename="Value")]
#[serde(skip_serializing_if="Option::is_none")]
pub value: Option<bool>,
}
#[doc="<p>Indicates the pose of the face as determined by its pitch, roll, and yaw.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct Pose {
#[doc="<p>Value representing the face rotation on the pitch axis.</p>"]
#[serde(rename="Pitch")]
#[serde(skip_serializing_if="Option::is_none")]
pub pitch: Option<f32>,
#[doc="<p>Value representing the face rotation on the roll axis.</p>"]
#[serde(rename="Roll")]
#[serde(skip_serializing_if="Option::is_none")]
pub roll: Option<f32>,
#[doc="<p>Value representing the face rotation on the yaw axis.</p>"]
#[serde(rename="Yaw")]
#[serde(skip_serializing_if="Option::is_none")]
pub yaw: Option<f32>,
}
#[derive(Default,Debug,Clone,Serialize)]
pub struct RecognizeCelebritiesRequest {
#[doc="<p>The input image to use for celebrity recognition.</p>"]
#[serde(rename="Image")]
pub image: Image,
}
#[derive(Default,Debug,Clone,Deserialize)]
pub struct RecognizeCelebritiesResponse {
#[doc="<p>Details about each celebrity found in the image. Amazon Rekognition can detect a maximum of 15 celebrities in an image.</p>"]
#[serde(rename="CelebrityFaces")]
#[serde(skip_serializing_if="Option::is_none")]
pub celebrity_faces: Option<Vec<Celebrity>>,
#[doc="<p>The orientation of the input image (counterclockwise direction). If your application displays the image, you can use this value to correct the orientation. The bounding box coordinates returned in <code>CelebrityFaces</code> and <code>UnrecognizedFaces</code> represent face locations before the image orientation is corrected. </p> <note> <p>If the input image is in .jpeg format, it might contain exchangeable image (Exif) metadata that includes the image's orientation. If so, and the Exif metadata for the input image populates the orientation field, the value of <code>OrientationCorrection</code> is null and the <code>CelebrityFaces</code> and <code>UnrecognizedFaces</code> bounding box coordinates represent face locations after Exif metadata is used to correct the image orientation. Images in .png format don't contain Exif metadata. </p> </note>"]
#[serde(rename="OrientationCorrection")]
#[serde(skip_serializing_if="Option::is_none")]
pub orientation_correction: Option<String>,
#[doc="<p>Details about each unrecognized face in the image.</p>"]
#[serde(rename="UnrecognizedFaces")]
#[serde(skip_serializing_if="Option::is_none")]
pub unrecognized_faces: Option<Vec<ComparedFace>>,
}
#[doc="<p>Provides the S3 bucket name and object name.</p> <p>The region for the S3 bucket containing the S3 object must match the region you use for Amazon Rekognition operations.</p> <p>For Amazon Rekognition to process an S3 object, the user must have permission to access the S3 object. For more information, see <a>manage-access-resource-policies</a>. </p>"]
#[derive(Default,Debug,Clone,Serialize)]
pub struct S3Object {
#[doc="<p>Name of the S3 bucket.</p>"]
#[serde(rename="Bucket")]
#[serde(skip_serializing_if="Option::is_none")]
pub bucket: Option<String>,
#[doc="<p>S3 object key name.</p>"]
#[serde(rename="Name")]
#[serde(skip_serializing_if="Option::is_none")]
pub name: Option<String>,
#[doc="<p>If the bucket is versioning enabled, you can specify the object version. </p>"]
#[serde(rename="Version")]
#[serde(skip_serializing_if="Option::is_none")]
pub version: Option<String>,
}
#[derive(Default,Debug,Clone,Serialize)]
pub struct SearchFacesByImageRequest {
#[doc="<p>ID of the collection to search.</p>"]
#[serde(rename="CollectionId")]
pub collection_id: String,
#[doc="<p>(Optional) Specifies the minimum confidence in the face match to return. For example, don't return any matches where confidence in matches is less than 70%.</p>"]
#[serde(rename="FaceMatchThreshold")]
#[serde(skip_serializing_if="Option::is_none")]
pub face_match_threshold: Option<f32>,
#[doc="<p>The input image as bytes or an S3 object.</p>"]
#[serde(rename="Image")]
pub image: Image,
#[doc="<p>Maximum number of faces to return. The operation returns the maximum number of faces with the highest confidence in the match.</p>"]
#[serde(rename="MaxFaces")]
#[serde(skip_serializing_if="Option::is_none")]
pub max_faces: Option<i64>,
}
#[derive(Default,Debug,Clone,Deserialize)]
pub struct SearchFacesByImageResponse {
#[doc="<p>An array of faces that match the input face, along with the confidence in the match.</p>"]
#[serde(rename="FaceMatches")]
#[serde(skip_serializing_if="Option::is_none")]
pub face_matches: Option<Vec<FaceMatch>>,
#[doc="<p>The bounding box around the face in the input image that Amazon Rekognition used for the search.</p>"]
#[serde(rename="SearchedFaceBoundingBox")]
#[serde(skip_serializing_if="Option::is_none")]
pub searched_face_bounding_box: Option<BoundingBox>,
#[doc="<p>The level of confidence that the <code>searchedFaceBoundingBox</code>, contains a face.</p>"]
#[serde(rename="SearchedFaceConfidence")]
#[serde(skip_serializing_if="Option::is_none")]
pub searched_face_confidence: Option<f32>,
}
#[derive(Default,Debug,Clone,Serialize)]
pub struct SearchFacesRequest {
#[doc="<p>ID of the collection the face belongs to.</p>"]
#[serde(rename="CollectionId")]
pub collection_id: String,
#[doc="<p>ID of a face to find matches for in the collection.</p>"]
#[serde(rename="FaceId")]
pub face_id: String,
#[doc="<p>Optional value specifying the minimum confidence in the face match to return. For example, don't return any matches where confidence in matches is less than 70%.</p>"]
#[serde(rename="FaceMatchThreshold")]
#[serde(skip_serializing_if="Option::is_none")]
pub face_match_threshold: Option<f32>,
#[doc="<p>Maximum number of faces to return. The operation returns the maximum number of faces with the highest confidence in the match.</p>"]
#[serde(rename="MaxFaces")]
#[serde(skip_serializing_if="Option::is_none")]
pub max_faces: Option<i64>,
}
#[derive(Default,Debug,Clone,Deserialize)]
pub struct SearchFacesResponse {
#[doc="<p>An array of faces that matched the input face, along with the confidence in the match.</p>"]
#[serde(rename="FaceMatches")]
#[serde(skip_serializing_if="Option::is_none")]
pub face_matches: Option<Vec<FaceMatch>>,
#[doc="<p>ID of the face that was searched for matches in a collection.</p>"]
#[serde(rename="SearchedFaceId")]
#[serde(skip_serializing_if="Option::is_none")]
pub searched_face_id: Option<String>,
}
#[doc="<p>Indicates whether or not the face is smiling, and the confidence level in the determination.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct Smile {
#[doc="<p>Level of confidence in the determination.</p>"]
#[serde(rename="Confidence")]
#[serde(skip_serializing_if="Option::is_none")]
pub confidence: Option<f32>,
#[doc="<p>Boolean value that indicates whether the face is smiling or not.</p>"]
#[serde(rename="Value")]
#[serde(skip_serializing_if="Option::is_none")]
pub value: Option<bool>,
}
#[doc="<p>Indicates whether or not the face is wearing sunglasses, and the confidence level in the determination.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct Sunglasses {
#[doc="<p>Level of confidence in the determination.</p>"]
#[serde(rename="Confidence")]
#[serde(skip_serializing_if="Option::is_none")]
pub confidence: Option<f32>,
#[doc="<p>Boolean value that indicates whether the face is wearing sunglasses or not.</p>"]
#[serde(rename="Value")]
#[serde(skip_serializing_if="Option::is_none")]
pub value: Option<bool>,
}
#[derive(Debug, PartialEq)]
pub enum CompareFacesError {
AccessDenied(String),
ImageTooLarge(String),
InternalServerError(String),
InvalidImageFormat(String),
InvalidParameter(String),
InvalidS3Object(String),
ProvisionedThroughputExceeded(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl CompareFacesError {
pub fn from_body(body: &str) -> CompareFacesError {
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 {
"AccessDeniedException" => {
CompareFacesError::AccessDenied(String::from(error_message))
}
"ImageTooLargeException" => {
CompareFacesError::ImageTooLarge(String::from(error_message))
}
"InternalServerError" => {
CompareFacesError::InternalServerError(String::from(error_message))
}
"InvalidImageFormatException" => {
CompareFacesError::InvalidImageFormat(String::from(error_message))
}
"InvalidParameterException" => {
CompareFacesError::InvalidParameter(String::from(error_message))
}
"InvalidS3ObjectException" => {
CompareFacesError::InvalidS3Object(String::from(error_message))
}
"ProvisionedThroughputExceededException" => CompareFacesError::ProvisionedThroughputExceeded(String::from(error_message)),
"ThrottlingException" => {
CompareFacesError::Throttling(String::from(error_message))
}
"ValidationException" => {
CompareFacesError::Validation(error_message.to_string())
}
_ => CompareFacesError::Unknown(String::from(body)),
}
}
Err(_) => CompareFacesError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for CompareFacesError {
fn from(err: serde_json::error::Error) -> CompareFacesError {
CompareFacesError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for CompareFacesError {
fn from(err: CredentialsError) -> CompareFacesError {
CompareFacesError::Credentials(err)
}
}
impl From<HttpDispatchError> for CompareFacesError {
fn from(err: HttpDispatchError) -> CompareFacesError {
CompareFacesError::HttpDispatch(err)
}
}
impl From<io::Error> for CompareFacesError {
fn from(err: io::Error) -> CompareFacesError {
CompareFacesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CompareFacesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CompareFacesError {
fn description(&self) -> &str {
match *self {
CompareFacesError::AccessDenied(ref cause) => cause,
CompareFacesError::ImageTooLarge(ref cause) => cause,
CompareFacesError::InternalServerError(ref cause) => cause,
CompareFacesError::InvalidImageFormat(ref cause) => cause,
CompareFacesError::InvalidParameter(ref cause) => cause,
CompareFacesError::InvalidS3Object(ref cause) => cause,
CompareFacesError::ProvisionedThroughputExceeded(ref cause) => cause,
CompareFacesError::Throttling(ref cause) => cause,
CompareFacesError::Validation(ref cause) => cause,
CompareFacesError::Credentials(ref err) => err.description(),
CompareFacesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CompareFacesError::Unknown(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateCollectionError {
AccessDenied(String),
InternalServerError(String),
InvalidParameter(String),
ProvisionedThroughputExceeded(String),
ResourceAlreadyExists(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl CreateCollectionError {
pub fn from_body(body: &str) -> CreateCollectionError {
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 {
"AccessDeniedException" => {
CreateCollectionError::AccessDenied(String::from(error_message))
}
"InternalServerError" => {
CreateCollectionError::InternalServerError(String::from(error_message))
}
"InvalidParameterException" => {
CreateCollectionError::InvalidParameter(String::from(error_message))
}
"ProvisionedThroughputExceededException" => CreateCollectionError::ProvisionedThroughputExceeded(String::from(error_message)),
"ResourceAlreadyExistsException" => {
CreateCollectionError::ResourceAlreadyExists(String::from(error_message))
}
"ThrottlingException" => {
CreateCollectionError::Throttling(String::from(error_message))
}
"ValidationException" => {
CreateCollectionError::Validation(error_message.to_string())
}
_ => CreateCollectionError::Unknown(String::from(body)),
}
}
Err(_) => CreateCollectionError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for CreateCollectionError {
fn from(err: serde_json::error::Error) -> CreateCollectionError {
CreateCollectionError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for CreateCollectionError {
fn from(err: CredentialsError) -> CreateCollectionError {
CreateCollectionError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateCollectionError {
fn from(err: HttpDispatchError) -> CreateCollectionError {
CreateCollectionError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateCollectionError {
fn from(err: io::Error) -> CreateCollectionError {
CreateCollectionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateCollectionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateCollectionError {
fn description(&self) -> &str {
match *self {
CreateCollectionError::AccessDenied(ref cause) => cause,
CreateCollectionError::InternalServerError(ref cause) => cause,
CreateCollectionError::InvalidParameter(ref cause) => cause,
CreateCollectionError::ProvisionedThroughputExceeded(ref cause) => cause,
CreateCollectionError::ResourceAlreadyExists(ref cause) => cause,
CreateCollectionError::Throttling(ref cause) => cause,
CreateCollectionError::Validation(ref cause) => cause,
CreateCollectionError::Credentials(ref err) => err.description(),
CreateCollectionError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateCollectionError::Unknown(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteCollectionError {
AccessDenied(String),
InternalServerError(String),
InvalidParameter(String),
ProvisionedThroughputExceeded(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl DeleteCollectionError {
pub fn from_body(body: &str) -> DeleteCollectionError {
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 {
"AccessDeniedException" => {
DeleteCollectionError::AccessDenied(String::from(error_message))
}
"InternalServerError" => {
DeleteCollectionError::InternalServerError(String::from(error_message))
}
"InvalidParameterException" => {
DeleteCollectionError::InvalidParameter(String::from(error_message))
}
"ProvisionedThroughputExceededException" => DeleteCollectionError::ProvisionedThroughputExceeded(String::from(error_message)),
"ResourceNotFoundException" => {
DeleteCollectionError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
DeleteCollectionError::Throttling(String::from(error_message))
}
"ValidationException" => {
DeleteCollectionError::Validation(error_message.to_string())
}
_ => DeleteCollectionError::Unknown(String::from(body)),
}
}
Err(_) => DeleteCollectionError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for DeleteCollectionError {
fn from(err: serde_json::error::Error) -> DeleteCollectionError {
DeleteCollectionError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteCollectionError {
fn from(err: CredentialsError) -> DeleteCollectionError {
DeleteCollectionError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteCollectionError {
fn from(err: HttpDispatchError) -> DeleteCollectionError {
DeleteCollectionError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteCollectionError {
fn from(err: io::Error) -> DeleteCollectionError {
DeleteCollectionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteCollectionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteCollectionError {
fn description(&self) -> &str {
match *self {
DeleteCollectionError::AccessDenied(ref cause) => cause,
DeleteCollectionError::InternalServerError(ref cause) => cause,
DeleteCollectionError::InvalidParameter(ref cause) => cause,
DeleteCollectionError::ProvisionedThroughputExceeded(ref cause) => cause,
DeleteCollectionError::ResourceNotFound(ref cause) => cause,
DeleteCollectionError::Throttling(ref cause) => cause,
DeleteCollectionError::Validation(ref cause) => cause,
DeleteCollectionError::Credentials(ref err) => err.description(),
DeleteCollectionError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteCollectionError::Unknown(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteFacesError {
AccessDenied(String),
InternalServerError(String),
InvalidParameter(String),
ProvisionedThroughputExceeded(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl DeleteFacesError {
pub fn from_body(body: &str) -> DeleteFacesError {
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 {
"AccessDeniedException" => {
DeleteFacesError::AccessDenied(String::from(error_message))
}
"InternalServerError" => {
DeleteFacesError::InternalServerError(String::from(error_message))
}
"InvalidParameterException" => {
DeleteFacesError::InvalidParameter(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
DeleteFacesError::ProvisionedThroughputExceeded(String::from(error_message))
}
"ResourceNotFoundException" => {
DeleteFacesError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
DeleteFacesError::Throttling(String::from(error_message))
}
"ValidationException" => {
DeleteFacesError::Validation(error_message.to_string())
}
_ => DeleteFacesError::Unknown(String::from(body)),
}
}
Err(_) => DeleteFacesError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for DeleteFacesError {
fn from(err: serde_json::error::Error) -> DeleteFacesError {
DeleteFacesError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteFacesError {
fn from(err: CredentialsError) -> DeleteFacesError {
DeleteFacesError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteFacesError {
fn from(err: HttpDispatchError) -> DeleteFacesError {
DeleteFacesError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteFacesError {
fn from(err: io::Error) -> DeleteFacesError {
DeleteFacesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteFacesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteFacesError {
fn description(&self) -> &str {
match *self {
DeleteFacesError::AccessDenied(ref cause) => cause,
DeleteFacesError::InternalServerError(ref cause) => cause,
DeleteFacesError::InvalidParameter(ref cause) => cause,
DeleteFacesError::ProvisionedThroughputExceeded(ref cause) => cause,
DeleteFacesError::ResourceNotFound(ref cause) => cause,
DeleteFacesError::Throttling(ref cause) => cause,
DeleteFacesError::Validation(ref cause) => cause,
DeleteFacesError::Credentials(ref err) => err.description(),
DeleteFacesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteFacesError::Unknown(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DetectFacesError {
AccessDenied(String),
ImageTooLarge(String),
InternalServerError(String),
InvalidImageFormat(String),
InvalidParameter(String),
InvalidS3Object(String),
ProvisionedThroughputExceeded(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl DetectFacesError {
pub fn from_body(body: &str) -> DetectFacesError {
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 {
"AccessDeniedException" => {
DetectFacesError::AccessDenied(String::from(error_message))
}
"ImageTooLargeException" => {
DetectFacesError::ImageTooLarge(String::from(error_message))
}
"InternalServerError" => {
DetectFacesError::InternalServerError(String::from(error_message))
}
"InvalidImageFormatException" => {
DetectFacesError::InvalidImageFormat(String::from(error_message))
}
"InvalidParameterException" => {
DetectFacesError::InvalidParameter(String::from(error_message))
}
"InvalidS3ObjectException" => {
DetectFacesError::InvalidS3Object(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
DetectFacesError::ProvisionedThroughputExceeded(String::from(error_message))
}
"ThrottlingException" => {
DetectFacesError::Throttling(String::from(error_message))
}
"ValidationException" => {
DetectFacesError::Validation(error_message.to_string())
}
_ => DetectFacesError::Unknown(String::from(body)),
}
}
Err(_) => DetectFacesError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for DetectFacesError {
fn from(err: serde_json::error::Error) -> DetectFacesError {
DetectFacesError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for DetectFacesError {
fn from(err: CredentialsError) -> DetectFacesError {
DetectFacesError::Credentials(err)
}
}
impl From<HttpDispatchError> for DetectFacesError {
fn from(err: HttpDispatchError) -> DetectFacesError {
DetectFacesError::HttpDispatch(err)
}
}
impl From<io::Error> for DetectFacesError {
fn from(err: io::Error) -> DetectFacesError {
DetectFacesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DetectFacesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DetectFacesError {
fn description(&self) -> &str {
match *self {
DetectFacesError::AccessDenied(ref cause) => cause,
DetectFacesError::ImageTooLarge(ref cause) => cause,
DetectFacesError::InternalServerError(ref cause) => cause,
DetectFacesError::InvalidImageFormat(ref cause) => cause,
DetectFacesError::InvalidParameter(ref cause) => cause,
DetectFacesError::InvalidS3Object(ref cause) => cause,
DetectFacesError::ProvisionedThroughputExceeded(ref cause) => cause,
DetectFacesError::Throttling(ref cause) => cause,
DetectFacesError::Validation(ref cause) => cause,
DetectFacesError::Credentials(ref err) => err.description(),
DetectFacesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DetectFacesError::Unknown(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DetectLabelsError {
AccessDenied(String),
ImageTooLarge(String),
InternalServerError(String),
InvalidImageFormat(String),
InvalidParameter(String),
InvalidS3Object(String),
ProvisionedThroughputExceeded(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl DetectLabelsError {
pub fn from_body(body: &str) -> DetectLabelsError {
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 {
"AccessDeniedException" => {
DetectLabelsError::AccessDenied(String::from(error_message))
}
"ImageTooLargeException" => {
DetectLabelsError::ImageTooLarge(String::from(error_message))
}
"InternalServerError" => {
DetectLabelsError::InternalServerError(String::from(error_message))
}
"InvalidImageFormatException" => {
DetectLabelsError::InvalidImageFormat(String::from(error_message))
}
"InvalidParameterException" => {
DetectLabelsError::InvalidParameter(String::from(error_message))
}
"InvalidS3ObjectException" => {
DetectLabelsError::InvalidS3Object(String::from(error_message))
}
"ProvisionedThroughputExceededException" => DetectLabelsError::ProvisionedThroughputExceeded(String::from(error_message)),
"ThrottlingException" => {
DetectLabelsError::Throttling(String::from(error_message))
}
"ValidationException" => {
DetectLabelsError::Validation(error_message.to_string())
}
_ => DetectLabelsError::Unknown(String::from(body)),
}
}
Err(_) => DetectLabelsError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for DetectLabelsError {
fn from(err: serde_json::error::Error) -> DetectLabelsError {
DetectLabelsError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for DetectLabelsError {
fn from(err: CredentialsError) -> DetectLabelsError {
DetectLabelsError::Credentials(err)
}
}
impl From<HttpDispatchError> for DetectLabelsError {
fn from(err: HttpDispatchError) -> DetectLabelsError {
DetectLabelsError::HttpDispatch(err)
}
}
impl From<io::Error> for DetectLabelsError {
fn from(err: io::Error) -> DetectLabelsError {
DetectLabelsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DetectLabelsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DetectLabelsError {
fn description(&self) -> &str {
match *self {
DetectLabelsError::AccessDenied(ref cause) => cause,
DetectLabelsError::ImageTooLarge(ref cause) => cause,
DetectLabelsError::InternalServerError(ref cause) => cause,
DetectLabelsError::InvalidImageFormat(ref cause) => cause,
DetectLabelsError::InvalidParameter(ref cause) => cause,
DetectLabelsError::InvalidS3Object(ref cause) => cause,
DetectLabelsError::ProvisionedThroughputExceeded(ref cause) => cause,
DetectLabelsError::Throttling(ref cause) => cause,
DetectLabelsError::Validation(ref cause) => cause,
DetectLabelsError::Credentials(ref err) => err.description(),
DetectLabelsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DetectLabelsError::Unknown(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DetectModerationLabelsError {
AccessDenied(String),
ImageTooLarge(String),
InternalServerError(String),
InvalidImageFormat(String),
InvalidParameter(String),
InvalidS3Object(String),
ProvisionedThroughputExceeded(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl DetectModerationLabelsError {
pub fn from_body(body: &str) -> DetectModerationLabelsError {
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 {
"AccessDeniedException" => {
DetectModerationLabelsError::AccessDenied(String::from(error_message))
}
"ImageTooLargeException" => {
DetectModerationLabelsError::ImageTooLarge(String::from(error_message))
}
"InternalServerError" => DetectModerationLabelsError::InternalServerError(String::from(error_message)),
"InvalidImageFormatException" => {
DetectModerationLabelsError::InvalidImageFormat(String::from(error_message))
}
"InvalidParameterException" => {
DetectModerationLabelsError::InvalidParameter(String::from(error_message))
}
"InvalidS3ObjectException" => {
DetectModerationLabelsError::InvalidS3Object(String::from(error_message))
}
"ProvisionedThroughputExceededException" => DetectModerationLabelsError::ProvisionedThroughputExceeded(String::from(error_message)),
"ThrottlingException" => {
DetectModerationLabelsError::Throttling(String::from(error_message))
}
"ValidationException" => {
DetectModerationLabelsError::Validation(error_message.to_string())
}
_ => DetectModerationLabelsError::Unknown(String::from(body)),
}
}
Err(_) => DetectModerationLabelsError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for DetectModerationLabelsError {
fn from(err: serde_json::error::Error) -> DetectModerationLabelsError {
DetectModerationLabelsError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for DetectModerationLabelsError {
fn from(err: CredentialsError) -> DetectModerationLabelsError {
DetectModerationLabelsError::Credentials(err)
}
}
impl From<HttpDispatchError> for DetectModerationLabelsError {
fn from(err: HttpDispatchError) -> DetectModerationLabelsError {
DetectModerationLabelsError::HttpDispatch(err)
}
}
impl From<io::Error> for DetectModerationLabelsError {
fn from(err: io::Error) -> DetectModerationLabelsError {
DetectModerationLabelsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DetectModerationLabelsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DetectModerationLabelsError {
fn description(&self) -> &str {
match *self {
DetectModerationLabelsError::AccessDenied(ref cause) => cause,
DetectModerationLabelsError::ImageTooLarge(ref cause) => cause,
DetectModerationLabelsError::InternalServerError(ref cause) => cause,
DetectModerationLabelsError::InvalidImageFormat(ref cause) => cause,
DetectModerationLabelsError::InvalidParameter(ref cause) => cause,
DetectModerationLabelsError::InvalidS3Object(ref cause) => cause,
DetectModerationLabelsError::ProvisionedThroughputExceeded(ref cause) => cause,
DetectModerationLabelsError::Throttling(ref cause) => cause,
DetectModerationLabelsError::Validation(ref cause) => cause,
DetectModerationLabelsError::Credentials(ref err) => err.description(),
DetectModerationLabelsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DetectModerationLabelsError::Unknown(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetCelebrityInfoError {
AccessDenied(String),
InternalServerError(String),
InvalidParameter(String),
ProvisionedThroughputExceeded(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl GetCelebrityInfoError {
pub fn from_body(body: &str) -> GetCelebrityInfoError {
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 {
"AccessDeniedException" => {
GetCelebrityInfoError::AccessDenied(String::from(error_message))
}
"InternalServerError" => {
GetCelebrityInfoError::InternalServerError(String::from(error_message))
}
"InvalidParameterException" => {
GetCelebrityInfoError::InvalidParameter(String::from(error_message))
}
"ProvisionedThroughputExceededException" => GetCelebrityInfoError::ProvisionedThroughputExceeded(String::from(error_message)),
"ResourceNotFoundException" => {
GetCelebrityInfoError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
GetCelebrityInfoError::Throttling(String::from(error_message))
}
"ValidationException" => {
GetCelebrityInfoError::Validation(error_message.to_string())
}
_ => GetCelebrityInfoError::Unknown(String::from(body)),
}
}
Err(_) => GetCelebrityInfoError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for GetCelebrityInfoError {
fn from(err: serde_json::error::Error) -> GetCelebrityInfoError {
GetCelebrityInfoError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for GetCelebrityInfoError {
fn from(err: CredentialsError) -> GetCelebrityInfoError {
GetCelebrityInfoError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetCelebrityInfoError {
fn from(err: HttpDispatchError) -> GetCelebrityInfoError {
GetCelebrityInfoError::HttpDispatch(err)
}
}
impl From<io::Error> for GetCelebrityInfoError {
fn from(err: io::Error) -> GetCelebrityInfoError {
GetCelebrityInfoError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetCelebrityInfoError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetCelebrityInfoError {
fn description(&self) -> &str {
match *self {
GetCelebrityInfoError::AccessDenied(ref cause) => cause,
GetCelebrityInfoError::InternalServerError(ref cause) => cause,
GetCelebrityInfoError::InvalidParameter(ref cause) => cause,
GetCelebrityInfoError::ProvisionedThroughputExceeded(ref cause) => cause,
GetCelebrityInfoError::ResourceNotFound(ref cause) => cause,
GetCelebrityInfoError::Throttling(ref cause) => cause,
GetCelebrityInfoError::Validation(ref cause) => cause,
GetCelebrityInfoError::Credentials(ref err) => err.description(),
GetCelebrityInfoError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetCelebrityInfoError::Unknown(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum IndexFacesError {
AccessDenied(String),
ImageTooLarge(String),
InternalServerError(String),
InvalidImageFormat(String),
InvalidParameter(String),
InvalidS3Object(String),
ProvisionedThroughputExceeded(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl IndexFacesError {
pub fn from_body(body: &str) -> IndexFacesError {
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 {
"AccessDeniedException" => {
IndexFacesError::AccessDenied(String::from(error_message))
}
"ImageTooLargeException" => {
IndexFacesError::ImageTooLarge(String::from(error_message))
}
"InternalServerError" => {
IndexFacesError::InternalServerError(String::from(error_message))
}
"InvalidImageFormatException" => {
IndexFacesError::InvalidImageFormat(String::from(error_message))
}
"InvalidParameterException" => {
IndexFacesError::InvalidParameter(String::from(error_message))
}
"InvalidS3ObjectException" => {
IndexFacesError::InvalidS3Object(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
IndexFacesError::ProvisionedThroughputExceeded(String::from(error_message))
}
"ResourceNotFoundException" => {
IndexFacesError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
IndexFacesError::Throttling(String::from(error_message))
}
"ValidationException" => IndexFacesError::Validation(error_message.to_string()),
_ => IndexFacesError::Unknown(String::from(body)),
}
}
Err(_) => IndexFacesError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for IndexFacesError {
fn from(err: serde_json::error::Error) -> IndexFacesError {
IndexFacesError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for IndexFacesError {
fn from(err: CredentialsError) -> IndexFacesError {
IndexFacesError::Credentials(err)
}
}
impl From<HttpDispatchError> for IndexFacesError {
fn from(err: HttpDispatchError) -> IndexFacesError {
IndexFacesError::HttpDispatch(err)
}
}
impl From<io::Error> for IndexFacesError {
fn from(err: io::Error) -> IndexFacesError {
IndexFacesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for IndexFacesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for IndexFacesError {
fn description(&self) -> &str {
match *self {
IndexFacesError::AccessDenied(ref cause) => cause,
IndexFacesError::ImageTooLarge(ref cause) => cause,
IndexFacesError::InternalServerError(ref cause) => cause,
IndexFacesError::InvalidImageFormat(ref cause) => cause,
IndexFacesError::InvalidParameter(ref cause) => cause,
IndexFacesError::InvalidS3Object(ref cause) => cause,
IndexFacesError::ProvisionedThroughputExceeded(ref cause) => cause,
IndexFacesError::ResourceNotFound(ref cause) => cause,
IndexFacesError::Throttling(ref cause) => cause,
IndexFacesError::Validation(ref cause) => cause,
IndexFacesError::Credentials(ref err) => err.description(),
IndexFacesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
IndexFacesError::Unknown(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListCollectionsError {
AccessDenied(String),
InternalServerError(String),
InvalidPaginationToken(String),
InvalidParameter(String),
ProvisionedThroughputExceeded(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl ListCollectionsError {
pub fn from_body(body: &str) -> ListCollectionsError {
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 {
"AccessDeniedException" => {
ListCollectionsError::AccessDenied(String::from(error_message))
}
"InternalServerError" => {
ListCollectionsError::InternalServerError(String::from(error_message))
}
"InvalidPaginationTokenException" => {
ListCollectionsError::InvalidPaginationToken(String::from(error_message))
}
"InvalidParameterException" => {
ListCollectionsError::InvalidParameter(String::from(error_message))
}
"ProvisionedThroughputExceededException" => ListCollectionsError::ProvisionedThroughputExceeded(String::from(error_message)),
"ResourceNotFoundException" => {
ListCollectionsError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
ListCollectionsError::Throttling(String::from(error_message))
}
"ValidationException" => {
ListCollectionsError::Validation(error_message.to_string())
}
_ => ListCollectionsError::Unknown(String::from(body)),
}
}
Err(_) => ListCollectionsError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for ListCollectionsError {
fn from(err: serde_json::error::Error) -> ListCollectionsError {
ListCollectionsError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for ListCollectionsError {
fn from(err: CredentialsError) -> ListCollectionsError {
ListCollectionsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListCollectionsError {
fn from(err: HttpDispatchError) -> ListCollectionsError {
ListCollectionsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListCollectionsError {
fn from(err: io::Error) -> ListCollectionsError {
ListCollectionsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListCollectionsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListCollectionsError {
fn description(&self) -> &str {
match *self {
ListCollectionsError::AccessDenied(ref cause) => cause,
ListCollectionsError::InternalServerError(ref cause) => cause,
ListCollectionsError::InvalidPaginationToken(ref cause) => cause,
ListCollectionsError::InvalidParameter(ref cause) => cause,
ListCollectionsError::ProvisionedThroughputExceeded(ref cause) => cause,
ListCollectionsError::ResourceNotFound(ref cause) => cause,
ListCollectionsError::Throttling(ref cause) => cause,
ListCollectionsError::Validation(ref cause) => cause,
ListCollectionsError::Credentials(ref err) => err.description(),
ListCollectionsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListCollectionsError::Unknown(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListFacesError {
AccessDenied(String),
InternalServerError(String),
InvalidPaginationToken(String),
InvalidParameter(String),
ProvisionedThroughputExceeded(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl ListFacesError {
pub fn from_body(body: &str) -> ListFacesError {
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 {
"AccessDeniedException" => {
ListFacesError::AccessDenied(String::from(error_message))
}
"InternalServerError" => {
ListFacesError::InternalServerError(String::from(error_message))
}
"InvalidPaginationTokenException" => {
ListFacesError::InvalidPaginationToken(String::from(error_message))
}
"InvalidParameterException" => {
ListFacesError::InvalidParameter(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
ListFacesError::ProvisionedThroughputExceeded(String::from(error_message))
}
"ResourceNotFoundException" => {
ListFacesError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
ListFacesError::Throttling(String::from(error_message))
}
"ValidationException" => ListFacesError::Validation(error_message.to_string()),
_ => ListFacesError::Unknown(String::from(body)),
}
}
Err(_) => ListFacesError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for ListFacesError {
fn from(err: serde_json::error::Error) -> ListFacesError {
ListFacesError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for ListFacesError {
fn from(err: CredentialsError) -> ListFacesError {
ListFacesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListFacesError {
fn from(err: HttpDispatchError) -> ListFacesError {
ListFacesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListFacesError {
fn from(err: io::Error) -> ListFacesError {
ListFacesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListFacesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListFacesError {
fn description(&self) -> &str {
match *self {
ListFacesError::AccessDenied(ref cause) => cause,
ListFacesError::InternalServerError(ref cause) => cause,
ListFacesError::InvalidPaginationToken(ref cause) => cause,
ListFacesError::InvalidParameter(ref cause) => cause,
ListFacesError::ProvisionedThroughputExceeded(ref cause) => cause,
ListFacesError::ResourceNotFound(ref cause) => cause,
ListFacesError::Throttling(ref cause) => cause,
ListFacesError::Validation(ref cause) => cause,
ListFacesError::Credentials(ref err) => err.description(),
ListFacesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListFacesError::Unknown(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum RecognizeCelebritiesError {
AccessDenied(String),
ImageTooLarge(String),
InternalServerError(String),
InvalidImageFormat(String),
InvalidParameter(String),
InvalidS3Object(String),
ProvisionedThroughputExceeded(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl RecognizeCelebritiesError {
pub fn from_body(body: &str) -> RecognizeCelebritiesError {
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 {
"AccessDeniedException" => {
RecognizeCelebritiesError::AccessDenied(String::from(error_message))
}
"ImageTooLargeException" => {
RecognizeCelebritiesError::ImageTooLarge(String::from(error_message))
}
"InternalServerError" => {
RecognizeCelebritiesError::InternalServerError(String::from(error_message))
}
"InvalidImageFormatException" => {
RecognizeCelebritiesError::InvalidImageFormat(String::from(error_message))
}
"InvalidParameterException" => {
RecognizeCelebritiesError::InvalidParameter(String::from(error_message))
}
"InvalidS3ObjectException" => {
RecognizeCelebritiesError::InvalidS3Object(String::from(error_message))
}
"ProvisionedThroughputExceededException" => RecognizeCelebritiesError::ProvisionedThroughputExceeded(String::from(error_message)),
"ThrottlingException" => {
RecognizeCelebritiesError::Throttling(String::from(error_message))
}
"ValidationException" => {
RecognizeCelebritiesError::Validation(error_message.to_string())
}
_ => RecognizeCelebritiesError::Unknown(String::from(body)),
}
}
Err(_) => RecognizeCelebritiesError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for RecognizeCelebritiesError {
fn from(err: serde_json::error::Error) -> RecognizeCelebritiesError {
RecognizeCelebritiesError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for RecognizeCelebritiesError {
fn from(err: CredentialsError) -> RecognizeCelebritiesError {
RecognizeCelebritiesError::Credentials(err)
}
}
impl From<HttpDispatchError> for RecognizeCelebritiesError {
fn from(err: HttpDispatchError) -> RecognizeCelebritiesError {
RecognizeCelebritiesError::HttpDispatch(err)
}
}
impl From<io::Error> for RecognizeCelebritiesError {
fn from(err: io::Error) -> RecognizeCelebritiesError {
RecognizeCelebritiesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for RecognizeCelebritiesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for RecognizeCelebritiesError {
fn description(&self) -> &str {
match *self {
RecognizeCelebritiesError::AccessDenied(ref cause) => cause,
RecognizeCelebritiesError::ImageTooLarge(ref cause) => cause,
RecognizeCelebritiesError::InternalServerError(ref cause) => cause,
RecognizeCelebritiesError::InvalidImageFormat(ref cause) => cause,
RecognizeCelebritiesError::InvalidParameter(ref cause) => cause,
RecognizeCelebritiesError::InvalidS3Object(ref cause) => cause,
RecognizeCelebritiesError::ProvisionedThroughputExceeded(ref cause) => cause,
RecognizeCelebritiesError::Throttling(ref cause) => cause,
RecognizeCelebritiesError::Validation(ref cause) => cause,
RecognizeCelebritiesError::Credentials(ref err) => err.description(),
RecognizeCelebritiesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
RecognizeCelebritiesError::Unknown(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum SearchFacesError {
AccessDenied(String),
InternalServerError(String),
InvalidParameter(String),
ProvisionedThroughputExceeded(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl SearchFacesError {
pub fn from_body(body: &str) -> SearchFacesError {
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 {
"AccessDeniedException" => {
SearchFacesError::AccessDenied(String::from(error_message))
}
"InternalServerError" => {
SearchFacesError::InternalServerError(String::from(error_message))
}
"InvalidParameterException" => {
SearchFacesError::InvalidParameter(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
SearchFacesError::ProvisionedThroughputExceeded(String::from(error_message))
}
"ResourceNotFoundException" => {
SearchFacesError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
SearchFacesError::Throttling(String::from(error_message))
}
"ValidationException" => {
SearchFacesError::Validation(error_message.to_string())
}
_ => SearchFacesError::Unknown(String::from(body)),
}
}
Err(_) => SearchFacesError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for SearchFacesError {
fn from(err: serde_json::error::Error) -> SearchFacesError {
SearchFacesError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for SearchFacesError {
fn from(err: CredentialsError) -> SearchFacesError {
SearchFacesError::Credentials(err)
}
}
impl From<HttpDispatchError> for SearchFacesError {
fn from(err: HttpDispatchError) -> SearchFacesError {
SearchFacesError::HttpDispatch(err)
}
}
impl From<io::Error> for SearchFacesError {
fn from(err: io::Error) -> SearchFacesError {
SearchFacesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SearchFacesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SearchFacesError {
fn description(&self) -> &str {
match *self {
SearchFacesError::AccessDenied(ref cause) => cause,
SearchFacesError::InternalServerError(ref cause) => cause,
SearchFacesError::InvalidParameter(ref cause) => cause,
SearchFacesError::ProvisionedThroughputExceeded(ref cause) => cause,
SearchFacesError::ResourceNotFound(ref cause) => cause,
SearchFacesError::Throttling(ref cause) => cause,
SearchFacesError::Validation(ref cause) => cause,
SearchFacesError::Credentials(ref err) => err.description(),
SearchFacesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
SearchFacesError::Unknown(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum SearchFacesByImageError {
AccessDenied(String),
ImageTooLarge(String),
InternalServerError(String),
InvalidImageFormat(String),
InvalidParameter(String),
InvalidS3Object(String),
ProvisionedThroughputExceeded(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl SearchFacesByImageError {
pub fn from_body(body: &str) -> SearchFacesByImageError {
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 {
"AccessDeniedException" => {
SearchFacesByImageError::AccessDenied(String::from(error_message))
}
"ImageTooLargeException" => {
SearchFacesByImageError::ImageTooLarge(String::from(error_message))
}
"InternalServerError" => {
SearchFacesByImageError::InternalServerError(String::from(error_message))
}
"InvalidImageFormatException" => {
SearchFacesByImageError::InvalidImageFormat(String::from(error_message))
}
"InvalidParameterException" => {
SearchFacesByImageError::InvalidParameter(String::from(error_message))
}
"InvalidS3ObjectException" => {
SearchFacesByImageError::InvalidS3Object(String::from(error_message))
}
"ProvisionedThroughputExceededException" => SearchFacesByImageError::ProvisionedThroughputExceeded(String::from(error_message)),
"ResourceNotFoundException" => {
SearchFacesByImageError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
SearchFacesByImageError::Throttling(String::from(error_message))
}
"ValidationException" => {
SearchFacesByImageError::Validation(error_message.to_string())
}
_ => SearchFacesByImageError::Unknown(String::from(body)),
}
}
Err(_) => SearchFacesByImageError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for SearchFacesByImageError {
fn from(err: serde_json::error::Error) -> SearchFacesByImageError {
SearchFacesByImageError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for SearchFacesByImageError {
fn from(err: CredentialsError) -> SearchFacesByImageError {
SearchFacesByImageError::Credentials(err)
}
}
impl From<HttpDispatchError> for SearchFacesByImageError {
fn from(err: HttpDispatchError) -> SearchFacesByImageError {
SearchFacesByImageError::HttpDispatch(err)
}
}
impl From<io::Error> for SearchFacesByImageError {
fn from(err: io::Error) -> SearchFacesByImageError {
SearchFacesByImageError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SearchFacesByImageError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SearchFacesByImageError {
fn description(&self) -> &str {
match *self {
SearchFacesByImageError::AccessDenied(ref cause) => cause,
SearchFacesByImageError::ImageTooLarge(ref cause) => cause,
SearchFacesByImageError::InternalServerError(ref cause) => cause,
SearchFacesByImageError::InvalidImageFormat(ref cause) => cause,
SearchFacesByImageError::InvalidParameter(ref cause) => cause,
SearchFacesByImageError::InvalidS3Object(ref cause) => cause,
SearchFacesByImageError::ProvisionedThroughputExceeded(ref cause) => cause,
SearchFacesByImageError::ResourceNotFound(ref cause) => cause,
SearchFacesByImageError::Throttling(ref cause) => cause,
SearchFacesByImageError::Validation(ref cause) => cause,
SearchFacesByImageError::Credentials(ref err) => err.description(),
SearchFacesByImageError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
SearchFacesByImageError::Unknown(ref cause) => cause,
}
}
}
pub trait Rekognition {
#[doc="<p>Compares a face in the <i>source</i> input image with each face detected in the <i>target</i> input image. </p> <note> <p> If the source image contains multiple faces, the service detects the largest face and compares it with each face detected in the target image. </p> </note> <p>In response, the operation returns an array of face matches ordered by similarity score in descending order. For each face match, the response provides a bounding box of the face, facial landmarks, pose details (pitch, role, and yaw), quality (brightness and sharpness), and confidence value (indicating the level of confidence that the bounding box contains a face). The response also provides a similarity score, which indicates how closely the faces match. </p> <note> <p>By default, only faces with a similarity score of greater than or equal to 80% are returned in the response. You can change this value by specifying the <code>SimilarityThreshold</code> parameter.</p> </note> <p> <code>CompareFaces</code> also returns an array of faces that don't match the source image. For each face, it returns a bounding box, confidence value, landmarks, pose details, and quality. The response also returns information about the face in the source image, including the bounding box of the face and confidence value.</p> <p>If the image doesn't contain Exif metadata, <code>CompareFaces</code> returns orientation information for the source and target images. Use these values to display the images with the correct image orientation.</p> <note> <p> This is a stateless API operation. That is, data returned by this operation doesn't persist.</p> </note> <p>For an example, see <a>get-started-exercise-compare-faces</a>.</p> <p>This operation requires permissions to perform the <code>rekognition:CompareFaces</code> action.</p>"]
fn compare_faces(&self,
input: &CompareFacesRequest)
-> Result<CompareFacesResponse, CompareFacesError>;
#[doc="<p>Creates a collection in an AWS Region. You can add faces to the collection using the operation. </p> <p>For example, you might create collections, one for each of your application users. A user can then index faces using the <code>IndexFaces</code> operation and persist results in a specific collection. Then, a user can search the collection for faces in the user-specific container. </p> <note> <p>Collection names are case-sensitive.</p> </note> <p>For an example, see <a>example1</a>. </p> <p>This operation requires permissions to perform the <code>rekognition:CreateCollection</code> action.</p>"]
fn create_collection(&self,
input: &CreateCollectionRequest)
-> Result<CreateCollectionResponse, CreateCollectionError>;
#[doc="<p>Deletes the specified collection. Note that this operation removes all faces in the collection. For an example, see <a>example1</a>.</p> <p>This operation requires permissions to perform the <code>rekognition:DeleteCollection</code> action.</p>"]
fn delete_collection(&self,
input: &DeleteCollectionRequest)
-> Result<DeleteCollectionResponse, DeleteCollectionError>;
#[doc="<p>Deletes faces from a collection. You specify a collection ID and an array of face IDs to remove from the collection.</p> <p>This operation requires permissions to perform the <code>rekognition:DeleteFaces</code> action.</p>"]
fn delete_faces(&self,
input: &DeleteFacesRequest)
-> Result<DeleteFacesResponse, DeleteFacesError>;
#[doc="<p>Detects faces within an image (JPEG or PNG) that is provided as input.</p> <p> For each face detected, the operation returns face details including a bounding box of the face, a confidence value (that the bounding box contains a face), and a fixed set of attributes such as facial landmarks (for example, coordinates of eye and mouth), gender, presence of beard, sunglasses, etc. </p> <p>The face-detection algorithm is most effective on frontal faces. For non-frontal or obscured faces, the algorithm may not detect the faces or might detect faces with lower confidence. </p> <note> <p>This is a stateless API operation. That is, the operation does not persist any data.</p> </note> <p>For an example, see <a>get-started-exercise-detect-faces</a>.</p> <p>This operation requires permissions to perform the <code>rekognition:DetectFaces</code> action. </p>"]
fn detect_faces(&self,
input: &DetectFacesRequest)
-> Result<DetectFacesResponse, DetectFacesError>;
#[doc="<p>Detects instances of real-world labels within an image (JPEG or PNG) provided as input. This includes objects like flower, tree, and table; events like wedding, graduation, and birthday party; and concepts like landscape, evening, and nature. For an example, see <a>get-started-exercise-detect-labels</a>.</p> <p> For each object, scene, and concept the API returns one or more labels. Each label provides the object name, and the level of confidence that the image contains the object. For example, suppose the input image has a lighthouse, the sea, and a rock. The response will include all three labels, one for each object. </p> <p> <code>{Name: lighthouse, Confidence: 98.4629}</code> </p> <p> <code>{Name: rock,Confidence: 79.2097}</code> </p> <p> <code> {Name: sea,Confidence: 75.061}</code> </p> <p> In the preceding example, the operation returns one label for each of the three objects. The operation can also return multiple labels for the same object in the image. For example, if the input image shows a flower (for example, a tulip), the operation might return the following three labels. </p> <p> <code>{Name: flower,Confidence: 99.0562}</code> </p> <p> <code>{Name: plant,Confidence: 99.0562}</code> </p> <p> <code>{Name: tulip,Confidence: 99.0562}</code> </p> <p>In this example, the detection algorithm more precisely identifies the flower as a tulip.</p> <p>You can provide the input image as an S3 object or as base64-encoded bytes. In response, the API returns an array of labels. In addition, the response also includes the orientation correction. Optionally, you can specify <code>MinConfidence</code> to control the confidence threshold for the labels returned. The default is 50%. You can also add the <code>MaxLabels</code> parameter to limit the number of labels returned. </p> <note> <p>If the object detected is a person, the operation doesn't provide the same facial details that the <a>DetectFaces</a> operation provides.</p> </note> <p>This is a stateless API operation. That is, the operation does not persist any data.</p> <p>This operation requires permissions to perform the <code>rekognition:DetectLabels</code> action. </p>"]
fn detect_labels(&self,
input: &DetectLabelsRequest)
-> Result<DetectLabelsResponse, DetectLabelsError>;
#[doc="<p>Detects explicit or suggestive adult content in a specified JPEG or PNG format image. Use <code>DetectModerationLabels</code> to moderate images depending on your requirements. For example, you might want to filter images that contain nudity, but not images containing suggestive content.</p> <p>To filter images, use the labels returned by <code>DetectModerationLabels</code> to determine which types of content are appropriate. For information about moderation labels, see <a>image-moderation</a>.</p>"]
fn detect_moderation_labels
(&self,
input: &DetectModerationLabelsRequest)
-> Result<DetectModerationLabelsResponse, DetectModerationLabelsError>;
#[doc="<p>Gets the name and additional information about a celebrity based on his or her Rekognition ID. The additional information is returned as an array of URLs. If there is no additional information about the celebrity, this list is empty. For more information, see <a>celebrity-recognition</a>.</p> <p>This operation requires permissions to perform the <code>rekognition:GetCelebrityInfo</code> action. </p>"]
fn get_celebrity_info(&self,
input: &GetCelebrityInfoRequest)
-> Result<GetCelebrityInfoResponse, GetCelebrityInfoError>;
#[doc="<p>Detects faces in the input image and adds them to the specified collection. </p> <p> Amazon Rekognition does not save the actual faces detected. Instead, the underlying detection algorithm first detects the faces in the input image, and for each face extracts facial features into a feature vector, and stores it in the back-end database. Amazon Rekognition uses feature vectors when performing face match and search operations using the and operations. </p> <p>If you provide the optional <code>externalImageID</code> for the input image you provided, Amazon Rekognition associates this ID with all faces that it detects. When you call the operation, the response returns the external ID. You can use this external image ID to create a client-side index to associate the faces with each image. You can then use the index to find all faces in an image. </p> <p>In response, the operation returns an array of metadata for all detected faces. This includes, the bounding box of the detected face, confidence value (indicating the bounding box contains a face), a face ID assigned by the service for each face that is detected and stored, and an image ID assigned by the service for the input image. If you request all facial attributes (using the <code>detectionAttributes</code> parameter, Amazon Rekognition returns detailed facial attributes such as facial landmarks (for example, location of eye and mount) and other facial attributes such gender. If you provide the same image, specify the same collection, and use the same external ID in the <code>IndexFaces</code> operation, Amazon Rekognition doesn't save duplicate face metadata. </p> <p>For an example, see <a>example2</a>.</p> <p>This operation requires permissions to perform the <code>rekognition:IndexFaces</code> action.</p>"]
fn index_faces(&self,
input: &IndexFacesRequest)
-> Result<IndexFacesResponse, IndexFacesError>;
#[doc="<p>Returns list of collection IDs in your account. If the result is truncated, the response also provides a <code>NextToken</code> that you can use in the subsequent request to fetch the next set of collection IDs.</p> <p>For an example, see <a>example1</a>.</p> <p>This operation requires permissions to perform the <code>rekognition:ListCollections</code> action.</p>"]
fn list_collections(&self,
input: &ListCollectionsRequest)
-> Result<ListCollectionsResponse, ListCollectionsError>;
#[doc="<p>Returns metadata for faces in the specified collection. This metadata includes information such as the bounding box coordinates, the confidence (that the bounding box contains a face), and face ID. For an example, see <a>example3</a>. </p> <p>This operation requires permissions to perform the <code>rekognition:ListFaces</code> action.</p>"]
fn list_faces(&self, input: &ListFacesRequest) -> Result<ListFacesResponse, ListFacesError>;
#[doc="<p>Returns an array of celebrities recognized in the input image. The image is passed either as base64-encoded image bytes or as a reference to an image in an Amazon S3 bucket. The image must be either a PNG or JPEG formatted file. For more information, see <a>celebrity-recognition</a>. </p> <p> <code>RecognizeCelebrities</code> returns the 15 largest faces in the image. It lists recognized celebrities in the <code>CelebrityFaces</code> list and unrecognized faces in the <code>UnrecognizedFaces</code> list. The operation doesn't return celebrities whose face sizes are smaller than the largest 15 faces in the image.</p> <p>For each celebrity recognized, the API returns a <code>Celebrity</code> object. The <code>Celebrity</code> object contains the celebrity name, ID, URL links to additional information, match confidence, and a <code>ComparedFace</code> object that you can use to locate the celebrity's face on the image.</p> <p>Rekognition does not retain information about which images a celebrity has been recognized in. Your application must store this information and use the <code>Celebrity</code> ID property as a unique identifier for the celebrity. If you don't store the celebrity name or additional information URLs returned by <code>RecognizeCelebrities</code>, you will need the ID to identify the celebrity in a call to the operation.</p> <p>For an example, see <a>recognize-celebrities-tutorial</a>.</p> <p>This operation requires permissions to perform the <code>rekognition:RecognizeCelebrities</code> operation.</p>"]
fn recognize_celebrities(&self,
input: &RecognizeCelebritiesRequest)
-> Result<RecognizeCelebritiesResponse, RecognizeCelebritiesError>;
#[doc="<p>For a given input face ID, searches for matching faces in the collection the face belongs to. You get a face ID when you add a face to the collection using the <a>IndexFaces</a> operation. The operation compares the features of the input face with faces in the specified collection. </p> <note> <p>You can also search faces without indexing faces by using the <code>SearchFacesByImage</code> operation.</p> </note> <p> The operation response returns an array of faces that match, ordered by similarity score with the highest similarity first. More specifically, it is an array of metadata for each face match that is found. Along with the metadata, the response also includes a <code>confidence</code> value for each face match, indicating the confidence that the specific face matches the input face. </p> <p>For an example, see <a>example3</a>.</p> <p>This operation requires permissions to perform the <code>rekognition:SearchFaces</code> action.</p>"]
fn search_faces(&self,
input: &SearchFacesRequest)
-> Result<SearchFacesResponse, SearchFacesError>;
#[doc="<p>For a given input image, first detects the largest face in the image, and then searches the specified collection for matching faces. The operation compares the features of the input face with faces in the specified collection. </p> <note> <p> To search for all faces in an input image, you might first call the operation, and then use the face IDs returned in subsequent calls to the operation. </p> <p> You can also call the <code>DetectFaces</code> operation and use the bounding boxes in the response to make face crops, which then you can pass in to the <code>SearchFacesByImage</code> operation. </p> </note> <p> The response returns an array of faces that match, ordered by similarity score with the highest similarity first. More specifically, it is an array of metadata for each face match found. Along with the metadata, the response also includes a <code>similarity</code> indicating how similar the face is to the input face. In the response, the operation also returns the bounding box (and a confidence level that the bounding box contains a face) of the face that Amazon Rekognition used for the input image. </p> <p>For an example, see <a>example3</a>.</p> <p>This operation requires permissions to perform the <code>rekognition:SearchFacesByImage</code> action.</p>"]
fn search_faces_by_image(&self,
input: &SearchFacesByImageRequest)
-> Result<SearchFacesByImageResponse, SearchFacesByImageError>;
}
pub struct RekognitionClient<P, D>
where P: ProvideAwsCredentials,
D: DispatchSignedRequest
{
credentials_provider: P,
region: region::Region,
dispatcher: D,
}
impl<P, D> RekognitionClient<P, D>
where P: ProvideAwsCredentials,
D: DispatchSignedRequest
{
pub fn new(request_dispatcher: D, credentials_provider: P, region: region::Region) -> Self {
RekognitionClient {
credentials_provider: credentials_provider,
region: region,
dispatcher: request_dispatcher,
}
}
}
impl<P, D> Rekognition for RekognitionClient<P, D>
where P: ProvideAwsCredentials,
D: DispatchSignedRequest
{
#[doc="<p>Compares a face in the <i>source</i> input image with each face detected in the <i>target</i> input image. </p> <note> <p> If the source image contains multiple faces, the service detects the largest face and compares it with each face detected in the target image. </p> </note> <p>In response, the operation returns an array of face matches ordered by similarity score in descending order. For each face match, the response provides a bounding box of the face, facial landmarks, pose details (pitch, role, and yaw), quality (brightness and sharpness), and confidence value (indicating the level of confidence that the bounding box contains a face). The response also provides a similarity score, which indicates how closely the faces match. </p> <note> <p>By default, only faces with a similarity score of greater than or equal to 80% are returned in the response. You can change this value by specifying the <code>SimilarityThreshold</code> parameter.</p> </note> <p> <code>CompareFaces</code> also returns an array of faces that don't match the source image. For each face, it returns a bounding box, confidence value, landmarks, pose details, and quality. The response also returns information about the face in the source image, including the bounding box of the face and confidence value.</p> <p>If the image doesn't contain Exif metadata, <code>CompareFaces</code> returns orientation information for the source and target images. Use these values to display the images with the correct image orientation.</p> <note> <p> This is a stateless API operation. That is, data returned by this operation doesn't persist.</p> </note> <p>For an example, see <a>get-started-exercise-compare-faces</a>.</p> <p>This operation requires permissions to perform the <code>rekognition:CompareFaces</code> action.</p>"]
fn compare_faces(&self,
input: &CompareFacesRequest)
-> Result<CompareFacesResponse, CompareFacesError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.CompareFaces");
let encoded = serde_json::to_string(input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);
let mut response = try!(self.dispatcher.dispatch(&request));
match response.status {
StatusCode::Ok => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Ok(serde_json::from_str::<CompareFacesResponse>(String::from_utf8_lossy(&body)
.as_ref())
.unwrap())
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(CompareFacesError::from_body(String::from_utf8_lossy(&body).as_ref()))
}
}
}
#[doc="<p>Creates a collection in an AWS Region. You can add faces to the collection using the operation. </p> <p>For example, you might create collections, one for each of your application users. A user can then index faces using the <code>IndexFaces</code> operation and persist results in a specific collection. Then, a user can search the collection for faces in the user-specific container. </p> <note> <p>Collection names are case-sensitive.</p> </note> <p>For an example, see <a>example1</a>. </p> <p>This operation requires permissions to perform the <code>rekognition:CreateCollection</code> action.</p>"]
fn create_collection(&self,
input: &CreateCollectionRequest)
-> Result<CreateCollectionResponse, CreateCollectionError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.CreateCollection");
let encoded = serde_json::to_string(input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);
let mut response = try!(self.dispatcher.dispatch(&request));
match response.status {
StatusCode::Ok => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Ok(serde_json::from_str::<CreateCollectionResponse>(String::from_utf8_lossy(&body)
.as_ref())
.unwrap())
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(CreateCollectionError::from_body(String::from_utf8_lossy(&body).as_ref()))
}
}
}
#[doc="<p>Deletes the specified collection. Note that this operation removes all faces in the collection. For an example, see <a>example1</a>.</p> <p>This operation requires permissions to perform the <code>rekognition:DeleteCollection</code> action.</p>"]
fn delete_collection(&self,
input: &DeleteCollectionRequest)
-> Result<DeleteCollectionResponse, DeleteCollectionError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.DeleteCollection");
let encoded = serde_json::to_string(input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);
let mut response = try!(self.dispatcher.dispatch(&request));
match response.status {
StatusCode::Ok => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Ok(serde_json::from_str::<DeleteCollectionResponse>(String::from_utf8_lossy(&body)
.as_ref())
.unwrap())
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(DeleteCollectionError::from_body(String::from_utf8_lossy(&body).as_ref()))
}
}
}
#[doc="<p>Deletes faces from a collection. You specify a collection ID and an array of face IDs to remove from the collection.</p> <p>This operation requires permissions to perform the <code>rekognition:DeleteFaces</code> action.</p>"]
fn delete_faces(&self,
input: &DeleteFacesRequest)
-> Result<DeleteFacesResponse, DeleteFacesError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.DeleteFaces");
let encoded = serde_json::to_string(input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);
let mut response = try!(self.dispatcher.dispatch(&request));
match response.status {
StatusCode::Ok => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Ok(serde_json::from_str::<DeleteFacesResponse>(String::from_utf8_lossy(&body)
.as_ref())
.unwrap())
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(DeleteFacesError::from_body(String::from_utf8_lossy(&body).as_ref()))
}
}
}
#[doc="<p>Detects faces within an image (JPEG or PNG) that is provided as input.</p> <p> For each face detected, the operation returns face details including a bounding box of the face, a confidence value (that the bounding box contains a face), and a fixed set of attributes such as facial landmarks (for example, coordinates of eye and mouth), gender, presence of beard, sunglasses, etc. </p> <p>The face-detection algorithm is most effective on frontal faces. For non-frontal or obscured faces, the algorithm may not detect the faces or might detect faces with lower confidence. </p> <note> <p>This is a stateless API operation. That is, the operation does not persist any data.</p> </note> <p>For an example, see <a>get-started-exercise-detect-faces</a>.</p> <p>This operation requires permissions to perform the <code>rekognition:DetectFaces</code> action. </p>"]
fn detect_faces(&self,
input: &DetectFacesRequest)
-> Result<DetectFacesResponse, DetectFacesError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.DetectFaces");
let encoded = serde_json::to_string(input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);
let mut response = try!(self.dispatcher.dispatch(&request));
match response.status {
StatusCode::Ok => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Ok(serde_json::from_str::<DetectFacesResponse>(String::from_utf8_lossy(&body)
.as_ref())
.unwrap())
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(DetectFacesError::from_body(String::from_utf8_lossy(&body).as_ref()))
}
}
}
#[doc="<p>Detects instances of real-world labels within an image (JPEG or PNG) provided as input. This includes objects like flower, tree, and table; events like wedding, graduation, and birthday party; and concepts like landscape, evening, and nature. For an example, see <a>get-started-exercise-detect-labels</a>.</p> <p> For each object, scene, and concept the API returns one or more labels. Each label provides the object name, and the level of confidence that the image contains the object. For example, suppose the input image has a lighthouse, the sea, and a rock. The response will include all three labels, one for each object. </p> <p> <code>{Name: lighthouse, Confidence: 98.4629}</code> </p> <p> <code>{Name: rock,Confidence: 79.2097}</code> </p> <p> <code> {Name: sea,Confidence: 75.061}</code> </p> <p> In the preceding example, the operation returns one label for each of the three objects. The operation can also return multiple labels for the same object in the image. For example, if the input image shows a flower (for example, a tulip), the operation might return the following three labels. </p> <p> <code>{Name: flower,Confidence: 99.0562}</code> </p> <p> <code>{Name: plant,Confidence: 99.0562}</code> </p> <p> <code>{Name: tulip,Confidence: 99.0562}</code> </p> <p>In this example, the detection algorithm more precisely identifies the flower as a tulip.</p> <p>You can provide the input image as an S3 object or as base64-encoded bytes. In response, the API returns an array of labels. In addition, the response also includes the orientation correction. Optionally, you can specify <code>MinConfidence</code> to control the confidence threshold for the labels returned. The default is 50%. You can also add the <code>MaxLabels</code> parameter to limit the number of labels returned. </p> <note> <p>If the object detected is a person, the operation doesn't provide the same facial details that the <a>DetectFaces</a> operation provides.</p> </note> <p>This is a stateless API operation. That is, the operation does not persist any data.</p> <p>This operation requires permissions to perform the <code>rekognition:DetectLabels</code> action. </p>"]
fn detect_labels(&self,
input: &DetectLabelsRequest)
-> Result<DetectLabelsResponse, DetectLabelsError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.DetectLabels");
let encoded = serde_json::to_string(input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);
let mut response = try!(self.dispatcher.dispatch(&request));
match response.status {
StatusCode::Ok => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Ok(serde_json::from_str::<DetectLabelsResponse>(String::from_utf8_lossy(&body)
.as_ref())
.unwrap())
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(DetectLabelsError::from_body(String::from_utf8_lossy(&body).as_ref()))
}
}
}
#[doc="<p>Detects explicit or suggestive adult content in a specified JPEG or PNG format image. Use <code>DetectModerationLabels</code> to moderate images depending on your requirements. For example, you might want to filter images that contain nudity, but not images containing suggestive content.</p> <p>To filter images, use the labels returned by <code>DetectModerationLabels</code> to determine which types of content are appropriate. For information about moderation labels, see <a>image-moderation</a>.</p>"]
fn detect_moderation_labels
(&self,
input: &DetectModerationLabelsRequest)
-> Result<DetectModerationLabelsResponse, DetectModerationLabelsError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.DetectModerationLabels");
let encoded = serde_json::to_string(input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);
let mut response = try!(self.dispatcher.dispatch(&request));
match response.status {
StatusCode::Ok => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Ok(serde_json::from_str::<DetectModerationLabelsResponse>(String::from_utf8_lossy(&body).as_ref()).unwrap())
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(DetectModerationLabelsError::from_body(String::from_utf8_lossy(&body).as_ref()))
}
}
}
#[doc="<p>Gets the name and additional information about a celebrity based on his or her Rekognition ID. The additional information is returned as an array of URLs. If there is no additional information about the celebrity, this list is empty. For more information, see <a>celebrity-recognition</a>.</p> <p>This operation requires permissions to perform the <code>rekognition:GetCelebrityInfo</code> action. </p>"]
fn get_celebrity_info(&self,
input: &GetCelebrityInfoRequest)
-> Result<GetCelebrityInfoResponse, GetCelebrityInfoError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.GetCelebrityInfo");
let encoded = serde_json::to_string(input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);
let mut response = try!(self.dispatcher.dispatch(&request));
match response.status {
StatusCode::Ok => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Ok(serde_json::from_str::<GetCelebrityInfoResponse>(String::from_utf8_lossy(&body)
.as_ref())
.unwrap())
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(GetCelebrityInfoError::from_body(String::from_utf8_lossy(&body).as_ref()))
}
}
}
#[doc="<p>Detects faces in the input image and adds them to the specified collection. </p> <p> Amazon Rekognition does not save the actual faces detected. Instead, the underlying detection algorithm first detects the faces in the input image, and for each face extracts facial features into a feature vector, and stores it in the back-end database. Amazon Rekognition uses feature vectors when performing face match and search operations using the and operations. </p> <p>If you provide the optional <code>externalImageID</code> for the input image you provided, Amazon Rekognition associates this ID with all faces that it detects. When you call the operation, the response returns the external ID. You can use this external image ID to create a client-side index to associate the faces with each image. You can then use the index to find all faces in an image. </p> <p>In response, the operation returns an array of metadata for all detected faces. This includes, the bounding box of the detected face, confidence value (indicating the bounding box contains a face), a face ID assigned by the service for each face that is detected and stored, and an image ID assigned by the service for the input image. If you request all facial attributes (using the <code>detectionAttributes</code> parameter, Amazon Rekognition returns detailed facial attributes such as facial landmarks (for example, location of eye and mount) and other facial attributes such gender. If you provide the same image, specify the same collection, and use the same external ID in the <code>IndexFaces</code> operation, Amazon Rekognition doesn't save duplicate face metadata. </p> <p>For an example, see <a>example2</a>.</p> <p>This operation requires permissions to perform the <code>rekognition:IndexFaces</code> action.</p>"]
fn index_faces(&self,
input: &IndexFacesRequest)
-> Result<IndexFacesResponse, IndexFacesError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.IndexFaces");
let encoded = serde_json::to_string(input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);
let mut response = try!(self.dispatcher.dispatch(&request));
match response.status {
StatusCode::Ok => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Ok(serde_json::from_str::<IndexFacesResponse>(String::from_utf8_lossy(&body)
.as_ref())
.unwrap())
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(IndexFacesError::from_body(String::from_utf8_lossy(&body).as_ref()))
}
}
}
#[doc="<p>Returns list of collection IDs in your account. If the result is truncated, the response also provides a <code>NextToken</code> that you can use in the subsequent request to fetch the next set of collection IDs.</p> <p>For an example, see <a>example1</a>.</p> <p>This operation requires permissions to perform the <code>rekognition:ListCollections</code> action.</p>"]
fn list_collections(&self,
input: &ListCollectionsRequest)
-> Result<ListCollectionsResponse, ListCollectionsError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.ListCollections");
let encoded = serde_json::to_string(input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);
let mut response = try!(self.dispatcher.dispatch(&request));
match response.status {
StatusCode::Ok => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Ok(serde_json::from_str::<ListCollectionsResponse>(String::from_utf8_lossy(&body)
.as_ref())
.unwrap())
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(ListCollectionsError::from_body(String::from_utf8_lossy(&body).as_ref()))
}
}
}
#[doc="<p>Returns metadata for faces in the specified collection. This metadata includes information such as the bounding box coordinates, the confidence (that the bounding box contains a face), and face ID. For an example, see <a>example3</a>. </p> <p>This operation requires permissions to perform the <code>rekognition:ListFaces</code> action.</p>"]
fn list_faces(&self, input: &ListFacesRequest) -> Result<ListFacesResponse, ListFacesError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.ListFaces");
let encoded = serde_json::to_string(input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);
let mut response = try!(self.dispatcher.dispatch(&request));
match response.status {
StatusCode::Ok => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Ok(serde_json::from_str::<ListFacesResponse>(String::from_utf8_lossy(&body)
.as_ref())
.unwrap())
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(ListFacesError::from_body(String::from_utf8_lossy(&body).as_ref()))
}
}
}
#[doc="<p>Returns an array of celebrities recognized in the input image. The image is passed either as base64-encoded image bytes or as a reference to an image in an Amazon S3 bucket. The image must be either a PNG or JPEG formatted file. For more information, see <a>celebrity-recognition</a>. </p> <p> <code>RecognizeCelebrities</code> returns the 15 largest faces in the image. It lists recognized celebrities in the <code>CelebrityFaces</code> list and unrecognized faces in the <code>UnrecognizedFaces</code> list. The operation doesn't return celebrities whose face sizes are smaller than the largest 15 faces in the image.</p> <p>For each celebrity recognized, the API returns a <code>Celebrity</code> object. The <code>Celebrity</code> object contains the celebrity name, ID, URL links to additional information, match confidence, and a <code>ComparedFace</code> object that you can use to locate the celebrity's face on the image.</p> <p>Rekognition does not retain information about which images a celebrity has been recognized in. Your application must store this information and use the <code>Celebrity</code> ID property as a unique identifier for the celebrity. If you don't store the celebrity name or additional information URLs returned by <code>RecognizeCelebrities</code>, you will need the ID to identify the celebrity in a call to the operation.</p> <p>For an example, see <a>recognize-celebrities-tutorial</a>.</p> <p>This operation requires permissions to perform the <code>rekognition:RecognizeCelebrities</code> operation.</p>"]
fn recognize_celebrities(&self,
input: &RecognizeCelebritiesRequest)
-> Result<RecognizeCelebritiesResponse, RecognizeCelebritiesError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.RecognizeCelebrities");
let encoded = serde_json::to_string(input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);
let mut response = try!(self.dispatcher.dispatch(&request));
match response.status {
StatusCode::Ok => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Ok(serde_json::from_str::<RecognizeCelebritiesResponse>(String::from_utf8_lossy(&body).as_ref()).unwrap())
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(RecognizeCelebritiesError::from_body(String::from_utf8_lossy(&body).as_ref()))
}
}
}
#[doc="<p>For a given input face ID, searches for matching faces in the collection the face belongs to. You get a face ID when you add a face to the collection using the <a>IndexFaces</a> operation. The operation compares the features of the input face with faces in the specified collection. </p> <note> <p>You can also search faces without indexing faces by using the <code>SearchFacesByImage</code> operation.</p> </note> <p> The operation response returns an array of faces that match, ordered by similarity score with the highest similarity first. More specifically, it is an array of metadata for each face match that is found. Along with the metadata, the response also includes a <code>confidence</code> value for each face match, indicating the confidence that the specific face matches the input face. </p> <p>For an example, see <a>example3</a>.</p> <p>This operation requires permissions to perform the <code>rekognition:SearchFaces</code> action.</p>"]
fn search_faces(&self,
input: &SearchFacesRequest)
-> Result<SearchFacesResponse, SearchFacesError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.SearchFaces");
let encoded = serde_json::to_string(input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);
let mut response = try!(self.dispatcher.dispatch(&request));
match response.status {
StatusCode::Ok => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Ok(serde_json::from_str::<SearchFacesResponse>(String::from_utf8_lossy(&body)
.as_ref())
.unwrap())
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(SearchFacesError::from_body(String::from_utf8_lossy(&body).as_ref()))
}
}
}
#[doc="<p>For a given input image, first detects the largest face in the image, and then searches the specified collection for matching faces. The operation compares the features of the input face with faces in the specified collection. </p> <note> <p> To search for all faces in an input image, you might first call the operation, and then use the face IDs returned in subsequent calls to the operation. </p> <p> You can also call the <code>DetectFaces</code> operation and use the bounding boxes in the response to make face crops, which then you can pass in to the <code>SearchFacesByImage</code> operation. </p> </note> <p> The response returns an array of faces that match, ordered by similarity score with the highest similarity first. More specifically, it is an array of metadata for each face match found. Along with the metadata, the response also includes a <code>similarity</code> indicating how similar the face is to the input face. In the response, the operation also returns the bounding box (and a confidence level that the bounding box contains a face) of the face that Amazon Rekognition used for the input image. </p> <p>For an example, see <a>example3</a>.</p> <p>This operation requires permissions to perform the <code>rekognition:SearchFacesByImage</code> action.</p>"]
fn search_faces_by_image(&self,
input: &SearchFacesByImageRequest)
-> Result<SearchFacesByImageResponse, SearchFacesByImageError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.SearchFacesByImage");
let encoded = serde_json::to_string(input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);
let mut response = try!(self.dispatcher.dispatch(&request));
match response.status {
StatusCode::Ok => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Ok(serde_json::from_str::<SearchFacesByImageResponse>(String::from_utf8_lossy(&body).as_ref()).unwrap())
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(SearchFacesByImageError::from_body(String::from_utf8_lossy(&body).as_ref()))
}
}
}
}
#[cfg(test)]
mod protocol_tests {}