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
// =================================================================
//
//                           * WARNING *
//
//                    This file is generated!
//
//  Changes made to this file will be overwritten. If changes are
//  required to the generated code, the service_crategen project
//  must be updated to generate the changes.
//
// =================================================================

use std::error::Error;
use std::fmt;
use std::io;

#[allow(warnings)]
use futures::future;
use futures::Future;
use rusoto_core::reactor::{CredentialsProvider, RequestDispatcher};
use rusoto_core::request::DispatchSignedRequest;
use rusoto_core::region;
use rusoto_core::{ClientInner, RusotoFuture};

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;
use hyper::StatusCode;
#[derive(Default, Debug, Clone, Serialize)]
pub struct BatchGetNamedQueryInput {
    /// <p>An array of query IDs.</p>
    #[serde(rename = "NamedQueryIds")]
    pub named_query_ids: Vec<String>,
}

#[derive(Default, Debug, Clone, Deserialize)]
pub struct BatchGetNamedQueryOutput {
    /// <p>Information about the named query IDs submitted.</p>
    #[serde(rename = "NamedQueries")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub named_queries: Option<Vec<NamedQuery>>,
    /// <p>Information about provided query IDs.</p>
    #[serde(rename = "UnprocessedNamedQueryIds")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub unprocessed_named_query_ids: Option<Vec<UnprocessedNamedQueryId>>,
}

#[derive(Default, Debug, Clone, Serialize)]
pub struct BatchGetQueryExecutionInput {
    /// <p>An array of query execution IDs.</p>
    #[serde(rename = "QueryExecutionIds")]
    pub query_execution_ids: Vec<String>,
}

#[derive(Default, Debug, Clone, Deserialize)]
pub struct BatchGetQueryExecutionOutput {
    /// <p>Information about a query execution.</p>
    #[serde(rename = "QueryExecutions")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub query_executions: Option<Vec<QueryExecution>>,
    /// <p>Information about the query executions that failed to run.</p>
    #[serde(rename = "UnprocessedQueryExecutionIds")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub unprocessed_query_execution_ids: Option<Vec<UnprocessedQueryExecutionId>>,
}

/// <p>Information about the columns in a query execution result.</p>
#[derive(Default, Debug, Clone, Deserialize)]
pub struct ColumnInfo {
    /// <p>Indicates whether values in the column are case-sensitive.</p>
    #[serde(rename = "CaseSensitive")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub case_sensitive: Option<bool>,
    /// <p>The catalog to which the query results belong.</p>
    #[serde(rename = "CatalogName")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub catalog_name: Option<String>,
    /// <p>A column label.</p>
    #[serde(rename = "Label")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub label: Option<String>,
    /// <p>The name of the column.</p>
    #[serde(rename = "Name")]
    pub name: String,
    /// <p>Indicates the column's nullable status.</p>
    #[serde(rename = "Nullable")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub nullable: Option<String>,
    /// <p>For <code>DECIMAL</code> data types, specifies the total number of digits, up to 38. For performance reasons, we recommend up to 18 digits.</p>
    #[serde(rename = "Precision")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub precision: Option<i64>,
    /// <p>For <code>DECIMAL</code> data types, specifies the total number of digits in the fractional part of the value. Defaults to 0.</p>
    #[serde(rename = "Scale")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub scale: Option<i64>,
    /// <p>The schema name (database name) to which the query results belong.</p>
    #[serde(rename = "SchemaName")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub schema_name: Option<String>,
    /// <p>The table name for the query results.</p>
    #[serde(rename = "TableName")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub table_name: Option<String>,
    /// <p>The data type of the column.</p>
    #[serde(rename = "Type")]
    pub type_: String,
}

#[derive(Default, Debug, Clone, Serialize)]
pub struct CreateNamedQueryInput {
    /// <p><p>A unique case-sensitive string used to ensure the request to create the query is idempotent (executes only once). If another <code>CreateNamedQuery</code> request is received, the same response is returned and another query is not created. If a parameter has changed, for example, the <code>QueryString</code>, an error is returned.</p> <important> <p>This token is listed as not required because AWS SDKs (for example the AWS SDK for Java) auto-generate the token for users. If you are not using the AWS SDK or the AWS CLI, you must provide this token or the action will fail.</p> </important></p>
    #[serde(rename = "ClientRequestToken")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub client_request_token: Option<String>,
    /// <p>The database to which the query belongs.</p>
    #[serde(rename = "Database")]
    pub database: String,
    /// <p>A brief explanation of the query.</p>
    #[serde(rename = "Description")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// <p>The plain language name for the query.</p>
    #[serde(rename = "Name")]
    pub name: String,
    /// <p>The text of the query itself. In other words, all query statements.</p>
    #[serde(rename = "QueryString")]
    pub query_string: String,
}

#[derive(Default, Debug, Clone, Deserialize)]
pub struct CreateNamedQueryOutput {
    /// <p>The unique ID of the query.</p>
    #[serde(rename = "NamedQueryId")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub named_query_id: Option<String>,
}

/// <p>A piece of data (a field in the table).</p>
#[derive(Default, Debug, Clone, Deserialize)]
pub struct Datum {
    /// <p>The value of the datum.</p>
    #[serde(rename = "VarCharValue")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub var_char_value: Option<String>,
}

#[derive(Default, Debug, Clone, Serialize)]
pub struct DeleteNamedQueryInput {
    /// <p>The unique ID of the query to delete.</p>
    #[serde(rename = "NamedQueryId")]
    pub named_query_id: String,
}

#[derive(Default, Debug, Clone, Deserialize)]
pub struct DeleteNamedQueryOutput;

/// <p>If query results are encrypted in Amazon S3, indicates the Amazon S3 encryption option used.</p>
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
pub struct EncryptionConfiguration {
    /// <p>Indicates whether Amazon S3 server-side encryption with Amazon S3-managed keys (<code>SSE-S3</code>), server-side encryption with KMS-managed keys (<code>SSE-KMS</code>), or client-side encryption with KMS-managed keys (CSE-KMS) is used.</p>
    #[serde(rename = "EncryptionOption")]
    pub encryption_option: String,
    /// <p>For <code>SSE-KMS</code> and <code>CSE-KMS</code>, this is the KMS key ARN or ID.</p>
    #[serde(rename = "KmsKey")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub kms_key: Option<String>,
}

#[derive(Default, Debug, Clone, Serialize)]
pub struct GetNamedQueryInput {
    /// <p>The unique ID of the query. Use <a>ListNamedQueries</a> to get query IDs.</p>
    #[serde(rename = "NamedQueryId")]
    pub named_query_id: String,
}

#[derive(Default, Debug, Clone, Deserialize)]
pub struct GetNamedQueryOutput {
    /// <p>Information about the query.</p>
    #[serde(rename = "NamedQuery")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub named_query: Option<NamedQuery>,
}

#[derive(Default, Debug, Clone, Serialize)]
pub struct GetQueryExecutionInput {
    /// <p>The unique ID of the query execution.</p>
    #[serde(rename = "QueryExecutionId")]
    pub query_execution_id: String,
}

#[derive(Default, Debug, Clone, Deserialize)]
pub struct GetQueryExecutionOutput {
    /// <p>Information about the query execution.</p>
    #[serde(rename = "QueryExecution")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub query_execution: Option<QueryExecution>,
}

#[derive(Default, Debug, Clone, Serialize)]
pub struct GetQueryResultsInput {
    /// <p>The maximum number of results (rows) to return in this request.</p>
    #[serde(rename = "MaxResults")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub max_results: Option<i64>,
    /// <p>The token that specifies where to start pagination if a previous request was truncated.</p>
    #[serde(rename = "NextToken")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub next_token: Option<String>,
    /// <p>The unique ID of the query execution.</p>
    #[serde(rename = "QueryExecutionId")]
    pub query_execution_id: String,
}

#[derive(Default, Debug, Clone, Deserialize)]
pub struct GetQueryResultsOutput {
    /// <p>A token to be used by the next request if this request is truncated.</p>
    #[serde(rename = "NextToken")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub next_token: Option<String>,
    /// <p>The results of the query execution.</p>
    #[serde(rename = "ResultSet")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub result_set: Option<ResultSet>,
}

#[derive(Default, Debug, Clone, Serialize)]
pub struct ListNamedQueriesInput {
    /// <p>The maximum number of queries to return in this request.</p>
    #[serde(rename = "MaxResults")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub max_results: Option<i64>,
    /// <p>The token that specifies where to start pagination if a previous request was truncated.</p>
    #[serde(rename = "NextToken")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub next_token: Option<String>,
}

#[derive(Default, Debug, Clone, Deserialize)]
pub struct ListNamedQueriesOutput {
    /// <p>The list of unique query IDs.</p>
    #[serde(rename = "NamedQueryIds")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub named_query_ids: Option<Vec<String>>,
    /// <p>A token to be used by the next request if this request is truncated.</p>
    #[serde(rename = "NextToken")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub next_token: Option<String>,
}

#[derive(Default, Debug, Clone, Serialize)]
pub struct ListQueryExecutionsInput {
    /// <p>The maximum number of query executions to return in this request.</p>
    #[serde(rename = "MaxResults")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub max_results: Option<i64>,
    /// <p>The token that specifies where to start pagination if a previous request was truncated.</p>
    #[serde(rename = "NextToken")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub next_token: Option<String>,
}

#[derive(Default, Debug, Clone, Deserialize)]
pub struct ListQueryExecutionsOutput {
    /// <p>A token to be used by the next request if this request is truncated.</p>
    #[serde(rename = "NextToken")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub next_token: Option<String>,
    /// <p>The unique IDs of each query execution as an array of strings.</p>
    #[serde(rename = "QueryExecutionIds")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub query_execution_ids: Option<Vec<String>>,
}

/// <p>A query, where <code>QueryString</code> is the SQL query statements that comprise the query.</p>
#[derive(Default, Debug, Clone, Deserialize)]
pub struct NamedQuery {
    /// <p>The database to which the query belongs.</p>
    #[serde(rename = "Database")]
    pub database: String,
    /// <p>A brief description of the query.</p>
    #[serde(rename = "Description")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// <p>The plain-language name of the query.</p>
    #[serde(rename = "Name")]
    pub name: String,
    /// <p>The unique identifier of the query.</p>
    #[serde(rename = "NamedQueryId")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub named_query_id: Option<String>,
    /// <p>The SQL query statements that comprise the query.</p>
    #[serde(rename = "QueryString")]
    pub query_string: String,
}

/// <p>Information about a single instance of a query execution.</p>
#[derive(Default, Debug, Clone, Deserialize)]
pub struct QueryExecution {
    /// <p>The SQL query statements which the query execution ran.</p>
    #[serde(rename = "Query")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub query: Option<String>,
    /// <p>The database in which the query execution occurred.</p>
    #[serde(rename = "QueryExecutionContext")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub query_execution_context: Option<QueryExecutionContext>,
    /// <p>The unique identifier for each query execution.</p>
    #[serde(rename = "QueryExecutionId")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub query_execution_id: Option<String>,
    /// <p>The location in Amazon S3 where query results were stored and the encryption option, if any, used for query results.</p>
    #[serde(rename = "ResultConfiguration")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub result_configuration: Option<ResultConfiguration>,
    /// <p>The amount of data scanned during the query execution and the amount of time that it took to execute.</p>
    #[serde(rename = "Statistics")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub statistics: Option<QueryExecutionStatistics>,
    /// <p>The completion date, current state, submission time, and state change reason (if applicable) for the query execution.</p>
    #[serde(rename = "Status")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub status: Option<QueryExecutionStatus>,
}

/// <p>The database in which the query execution occurs.</p>
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
pub struct QueryExecutionContext {
    /// <p>The name of the database.</p>
    #[serde(rename = "Database")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub database: Option<String>,
}

/// <p>The amount of data scanned during the query execution and the amount of time that it took to execute.</p>
#[derive(Default, Debug, Clone, Deserialize)]
pub struct QueryExecutionStatistics {
    /// <p>The number of bytes in the data that was queried.</p>
    #[serde(rename = "DataScannedInBytes")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub data_scanned_in_bytes: Option<i64>,
    /// <p>The number of milliseconds that the query took to execute.</p>
    #[serde(rename = "EngineExecutionTimeInMillis")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub engine_execution_time_in_millis: Option<i64>,
}

/// <p>The completion date, current state, submission time, and state change reason (if applicable) for the query execution.</p>
#[derive(Default, Debug, Clone, Deserialize)]
pub struct QueryExecutionStatus {
    /// <p>The date and time that the query completed.</p>
    #[serde(rename = "CompletionDateTime")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub completion_date_time: Option<f64>,
    /// <p>The state of query execution. <code>SUBMITTED</code> indicates that the query is queued for execution. <code>RUNNING</code> indicates that the query is scanning data and returning results. <code>SUCCEEDED</code> indicates that the query completed without error. <code>FAILED</code> indicates that the query experienced an error and did not complete processing. <code>CANCELLED</code> indicates that user input interrupted query execution.</p>
    #[serde(rename = "State")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub state: Option<String>,
    /// <p>Further detail about the status of the query.</p>
    #[serde(rename = "StateChangeReason")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub state_change_reason: Option<String>,
    /// <p>The date and time that the query was submitted.</p>
    #[serde(rename = "SubmissionDateTime")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub submission_date_time: Option<f64>,
}

/// <p>The location in Amazon S3 where query results are stored and the encryption option, if any, used for query results.</p>
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
pub struct ResultConfiguration {
    /// <p>If query results are encrypted in S3, indicates the S3 encryption option used (for example, <code>SSE-KMS</code> or <code>CSE-KMS</code> and key information.</p>
    #[serde(rename = "EncryptionConfiguration")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub encryption_configuration: Option<EncryptionConfiguration>,
    /// <p>The location in S3 where query results are stored.</p>
    #[serde(rename = "OutputLocation")]
    pub output_location: String,
}

/// <p>The metadata and rows that comprise a query result set. The metadata describes the column structure and data types.</p>
#[derive(Default, Debug, Clone, Deserialize)]
pub struct ResultSet {
    /// <p>The metadata that describes the column structure and data types of a table of query results.</p>
    #[serde(rename = "ResultSetMetadata")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub result_set_metadata: Option<ResultSetMetadata>,
    /// <p>The rows in the table.</p>
    #[serde(rename = "Rows")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub rows: Option<Vec<Row>>,
}

/// <p>The metadata that describes the column structure and data types of a table of query results.</p>
#[derive(Default, Debug, Clone, Deserialize)]
pub struct ResultSetMetadata {
    /// <p>Information about the columns in a query execution result.</p>
    #[serde(rename = "ColumnInfo")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub column_info: Option<Vec<ColumnInfo>>,
}

/// <p>The rows that comprise a query result table.</p>
#[derive(Default, Debug, Clone, Deserialize)]
pub struct Row {
    /// <p>The data that populates a row in a query result table.</p>
    #[serde(rename = "Data")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub data: Option<Vec<Datum>>,
}

#[derive(Default, Debug, Clone, Serialize)]
pub struct StartQueryExecutionInput {
    /// <p><p>A unique case-sensitive string used to ensure the request to create the query is idempotent (executes only once). If another <code>StartQueryExecution</code> request is received, the same response is returned and another query is not created. If a parameter has changed, for example, the <code>QueryString</code>, an error is returned.</p> <important> <p>This token is listed as not required because AWS SDKs (for example the AWS SDK for Java) auto-generate the token for users. If you are not using the AWS SDK or the AWS CLI, you must provide this token or the action will fail.</p> </important></p>
    #[serde(rename = "ClientRequestToken")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub client_request_token: Option<String>,
    /// <p>The database within which the query executes.</p>
    #[serde(rename = "QueryExecutionContext")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub query_execution_context: Option<QueryExecutionContext>,
    /// <p>The SQL query statements to be executed.</p>
    #[serde(rename = "QueryString")]
    pub query_string: String,
    /// <p>Specifies information about where and how to save the results of the query execution.</p>
    #[serde(rename = "ResultConfiguration")]
    pub result_configuration: ResultConfiguration,
}

#[derive(Default, Debug, Clone, Deserialize)]
pub struct StartQueryExecutionOutput {
    /// <p>The unique ID of the query that ran as a result of this request.</p>
    #[serde(rename = "QueryExecutionId")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub query_execution_id: Option<String>,
}

#[derive(Default, Debug, Clone, Serialize)]
pub struct StopQueryExecutionInput {
    /// <p>The unique ID of the query execution to stop.</p>
    #[serde(rename = "QueryExecutionId")]
    pub query_execution_id: String,
}

#[derive(Default, Debug, Clone, Deserialize)]
pub struct StopQueryExecutionOutput;

/// <p>Information about a named query ID that could not be processed.</p>
#[derive(Default, Debug, Clone, Deserialize)]
pub struct UnprocessedNamedQueryId {
    /// <p>The error code returned when the processing request for the named query failed, if applicable.</p>
    #[serde(rename = "ErrorCode")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub error_code: Option<String>,
    /// <p>The error message returned when the processing request for the named query failed, if applicable.</p>
    #[serde(rename = "ErrorMessage")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub error_message: Option<String>,
    /// <p>The unique identifier of the named query.</p>
    #[serde(rename = "NamedQueryId")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub named_query_id: Option<String>,
}

/// <p>Describes a query execution that failed to process.</p>
#[derive(Default, Debug, Clone, Deserialize)]
pub struct UnprocessedQueryExecutionId {
    /// <p>The error code returned when the query execution failed to process, if applicable.</p>
    #[serde(rename = "ErrorCode")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub error_code: Option<String>,
    /// <p>The error message returned when the query execution failed to process, if applicable.</p>
    #[serde(rename = "ErrorMessage")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub error_message: Option<String>,
    /// <p>The unique identifier of the query execution.</p>
    #[serde(rename = "QueryExecutionId")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub query_execution_id: Option<String>,
}

/// Errors returned by BatchGetNamedQuery
#[derive(Debug, PartialEq)]
pub enum BatchGetNamedQueryError {
    /// <p>Indicates a platform issue, which may be due to a transient condition or outage.</p>
    InternalServer(String),
    /// <p>Indicates that something is wrong with the input to the request. For example, a required parameter may be missing or out of range.</p>
    InvalidRequest(String),
    /// An error occurred dispatching the HTTP request
    HttpDispatch(HttpDispatchError),
    /// An error was encountered with AWS credentials.
    Credentials(CredentialsError),
    /// A validation error occurred.  Details from AWS are provided.
    Validation(String),
    /// An unknown error occurred.  The raw HTTP response is provided.
    Unknown(String),
}

impl BatchGetNamedQueryError {
    pub fn from_body(body: &str) -> BatchGetNamedQueryError {
        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 {
                    "InternalServerException" => {
                        BatchGetNamedQueryError::InternalServer(String::from(error_message))
                    }
                    "InvalidRequestException" => {
                        BatchGetNamedQueryError::InvalidRequest(String::from(error_message))
                    }
                    "ValidationException" => {
                        BatchGetNamedQueryError::Validation(error_message.to_string())
                    }
                    _ => BatchGetNamedQueryError::Unknown(String::from(body)),
                }
            }
            Err(_) => BatchGetNamedQueryError::Unknown(String::from(body)),
        }
    }
}

impl From<serde_json::error::Error> for BatchGetNamedQueryError {
    fn from(err: serde_json::error::Error) -> BatchGetNamedQueryError {
        BatchGetNamedQueryError::Unknown(err.description().to_string())
    }
}
impl From<CredentialsError> for BatchGetNamedQueryError {
    fn from(err: CredentialsError) -> BatchGetNamedQueryError {
        BatchGetNamedQueryError::Credentials(err)
    }
}
impl From<HttpDispatchError> for BatchGetNamedQueryError {
    fn from(err: HttpDispatchError) -> BatchGetNamedQueryError {
        BatchGetNamedQueryError::HttpDispatch(err)
    }
}
impl From<io::Error> for BatchGetNamedQueryError {
    fn from(err: io::Error) -> BatchGetNamedQueryError {
        BatchGetNamedQueryError::HttpDispatch(HttpDispatchError::from(err))
    }
}
impl fmt::Display for BatchGetNamedQueryError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.description())
    }
}
impl Error for BatchGetNamedQueryError {
    fn description(&self) -> &str {
        match *self {
            BatchGetNamedQueryError::InternalServer(ref cause) => cause,
            BatchGetNamedQueryError::InvalidRequest(ref cause) => cause,
            BatchGetNamedQueryError::Validation(ref cause) => cause,
            BatchGetNamedQueryError::Credentials(ref err) => err.description(),
            BatchGetNamedQueryError::HttpDispatch(ref dispatch_error) => {
                dispatch_error.description()
            }
            BatchGetNamedQueryError::Unknown(ref cause) => cause,
        }
    }
}
/// Errors returned by BatchGetQueryExecution
#[derive(Debug, PartialEq)]
pub enum BatchGetQueryExecutionError {
    /// <p>Indicates a platform issue, which may be due to a transient condition or outage.</p>
    InternalServer(String),
    /// <p>Indicates that something is wrong with the input to the request. For example, a required parameter may be missing or out of range.</p>
    InvalidRequest(String),
    /// An error occurred dispatching the HTTP request
    HttpDispatch(HttpDispatchError),
    /// An error was encountered with AWS credentials.
    Credentials(CredentialsError),
    /// A validation error occurred.  Details from AWS are provided.
    Validation(String),
    /// An unknown error occurred.  The raw HTTP response is provided.
    Unknown(String),
}

impl BatchGetQueryExecutionError {
    pub fn from_body(body: &str) -> BatchGetQueryExecutionError {
        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 {
                    "InternalServerException" => {
                        BatchGetQueryExecutionError::InternalServer(String::from(error_message))
                    }
                    "InvalidRequestException" => {
                        BatchGetQueryExecutionError::InvalidRequest(String::from(error_message))
                    }
                    "ValidationException" => {
                        BatchGetQueryExecutionError::Validation(error_message.to_string())
                    }
                    _ => BatchGetQueryExecutionError::Unknown(String::from(body)),
                }
            }
            Err(_) => BatchGetQueryExecutionError::Unknown(String::from(body)),
        }
    }
}

impl From<serde_json::error::Error> for BatchGetQueryExecutionError {
    fn from(err: serde_json::error::Error) -> BatchGetQueryExecutionError {
        BatchGetQueryExecutionError::Unknown(err.description().to_string())
    }
}
impl From<CredentialsError> for BatchGetQueryExecutionError {
    fn from(err: CredentialsError) -> BatchGetQueryExecutionError {
        BatchGetQueryExecutionError::Credentials(err)
    }
}
impl From<HttpDispatchError> for BatchGetQueryExecutionError {
    fn from(err: HttpDispatchError) -> BatchGetQueryExecutionError {
        BatchGetQueryExecutionError::HttpDispatch(err)
    }
}
impl From<io::Error> for BatchGetQueryExecutionError {
    fn from(err: io::Error) -> BatchGetQueryExecutionError {
        BatchGetQueryExecutionError::HttpDispatch(HttpDispatchError::from(err))
    }
}
impl fmt::Display for BatchGetQueryExecutionError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.description())
    }
}
impl Error for BatchGetQueryExecutionError {
    fn description(&self) -> &str {
        match *self {
            BatchGetQueryExecutionError::InternalServer(ref cause) => cause,
            BatchGetQueryExecutionError::InvalidRequest(ref cause) => cause,
            BatchGetQueryExecutionError::Validation(ref cause) => cause,
            BatchGetQueryExecutionError::Credentials(ref err) => err.description(),
            BatchGetQueryExecutionError::HttpDispatch(ref dispatch_error) => {
                dispatch_error.description()
            }
            BatchGetQueryExecutionError::Unknown(ref cause) => cause,
        }
    }
}
/// Errors returned by CreateNamedQuery
#[derive(Debug, PartialEq)]
pub enum CreateNamedQueryError {
    /// <p>Indicates a platform issue, which may be due to a transient condition or outage.</p>
    InternalServer(String),
    /// <p>Indicates that something is wrong with the input to the request. For example, a required parameter may be missing or out of range.</p>
    InvalidRequest(String),
    /// An error occurred dispatching the HTTP request
    HttpDispatch(HttpDispatchError),
    /// An error was encountered with AWS credentials.
    Credentials(CredentialsError),
    /// A validation error occurred.  Details from AWS are provided.
    Validation(String),
    /// An unknown error occurred.  The raw HTTP response is provided.
    Unknown(String),
}

impl CreateNamedQueryError {
    pub fn from_body(body: &str) -> CreateNamedQueryError {
        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 {
                    "InternalServerException" => {
                        CreateNamedQueryError::InternalServer(String::from(error_message))
                    }
                    "InvalidRequestException" => {
                        CreateNamedQueryError::InvalidRequest(String::from(error_message))
                    }
                    "ValidationException" => {
                        CreateNamedQueryError::Validation(error_message.to_string())
                    }
                    _ => CreateNamedQueryError::Unknown(String::from(body)),
                }
            }
            Err(_) => CreateNamedQueryError::Unknown(String::from(body)),
        }
    }
}

impl From<serde_json::error::Error> for CreateNamedQueryError {
    fn from(err: serde_json::error::Error) -> CreateNamedQueryError {
        CreateNamedQueryError::Unknown(err.description().to_string())
    }
}
impl From<CredentialsError> for CreateNamedQueryError {
    fn from(err: CredentialsError) -> CreateNamedQueryError {
        CreateNamedQueryError::Credentials(err)
    }
}
impl From<HttpDispatchError> for CreateNamedQueryError {
    fn from(err: HttpDispatchError) -> CreateNamedQueryError {
        CreateNamedQueryError::HttpDispatch(err)
    }
}
impl From<io::Error> for CreateNamedQueryError {
    fn from(err: io::Error) -> CreateNamedQueryError {
        CreateNamedQueryError::HttpDispatch(HttpDispatchError::from(err))
    }
}
impl fmt::Display for CreateNamedQueryError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.description())
    }
}
impl Error for CreateNamedQueryError {
    fn description(&self) -> &str {
        match *self {
            CreateNamedQueryError::InternalServer(ref cause) => cause,
            CreateNamedQueryError::InvalidRequest(ref cause) => cause,
            CreateNamedQueryError::Validation(ref cause) => cause,
            CreateNamedQueryError::Credentials(ref err) => err.description(),
            CreateNamedQueryError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
            CreateNamedQueryError::Unknown(ref cause) => cause,
        }
    }
}
/// Errors returned by DeleteNamedQuery
#[derive(Debug, PartialEq)]
pub enum DeleteNamedQueryError {
    /// <p>Indicates a platform issue, which may be due to a transient condition or outage.</p>
    InternalServer(String),
    /// <p>Indicates that something is wrong with the input to the request. For example, a required parameter may be missing or out of range.</p>
    InvalidRequest(String),
    /// An error occurred dispatching the HTTP request
    HttpDispatch(HttpDispatchError),
    /// An error was encountered with AWS credentials.
    Credentials(CredentialsError),
    /// A validation error occurred.  Details from AWS are provided.
    Validation(String),
    /// An unknown error occurred.  The raw HTTP response is provided.
    Unknown(String),
}

impl DeleteNamedQueryError {
    pub fn from_body(body: &str) -> DeleteNamedQueryError {
        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 {
                    "InternalServerException" => {
                        DeleteNamedQueryError::InternalServer(String::from(error_message))
                    }
                    "InvalidRequestException" => {
                        DeleteNamedQueryError::InvalidRequest(String::from(error_message))
                    }
                    "ValidationException" => {
                        DeleteNamedQueryError::Validation(error_message.to_string())
                    }
                    _ => DeleteNamedQueryError::Unknown(String::from(body)),
                }
            }
            Err(_) => DeleteNamedQueryError::Unknown(String::from(body)),
        }
    }
}

impl From<serde_json::error::Error> for DeleteNamedQueryError {
    fn from(err: serde_json::error::Error) -> DeleteNamedQueryError {
        DeleteNamedQueryError::Unknown(err.description().to_string())
    }
}
impl From<CredentialsError> for DeleteNamedQueryError {
    fn from(err: CredentialsError) -> DeleteNamedQueryError {
        DeleteNamedQueryError::Credentials(err)
    }
}
impl From<HttpDispatchError> for DeleteNamedQueryError {
    fn from(err: HttpDispatchError) -> DeleteNamedQueryError {
        DeleteNamedQueryError::HttpDispatch(err)
    }
}
impl From<io::Error> for DeleteNamedQueryError {
    fn from(err: io::Error) -> DeleteNamedQueryError {
        DeleteNamedQueryError::HttpDispatch(HttpDispatchError::from(err))
    }
}
impl fmt::Display for DeleteNamedQueryError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.description())
    }
}
impl Error for DeleteNamedQueryError {
    fn description(&self) -> &str {
        match *self {
            DeleteNamedQueryError::InternalServer(ref cause) => cause,
            DeleteNamedQueryError::InvalidRequest(ref cause) => cause,
            DeleteNamedQueryError::Validation(ref cause) => cause,
            DeleteNamedQueryError::Credentials(ref err) => err.description(),
            DeleteNamedQueryError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
            DeleteNamedQueryError::Unknown(ref cause) => cause,
        }
    }
}
/// Errors returned by GetNamedQuery
#[derive(Debug, PartialEq)]
pub enum GetNamedQueryError {
    /// <p>Indicates a platform issue, which may be due to a transient condition or outage.</p>
    InternalServer(String),
    /// <p>Indicates that something is wrong with the input to the request. For example, a required parameter may be missing or out of range.</p>
    InvalidRequest(String),
    /// An error occurred dispatching the HTTP request
    HttpDispatch(HttpDispatchError),
    /// An error was encountered with AWS credentials.
    Credentials(CredentialsError),
    /// A validation error occurred.  Details from AWS are provided.
    Validation(String),
    /// An unknown error occurred.  The raw HTTP response is provided.
    Unknown(String),
}

impl GetNamedQueryError {
    pub fn from_body(body: &str) -> GetNamedQueryError {
        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 {
                    "InternalServerException" => {
                        GetNamedQueryError::InternalServer(String::from(error_message))
                    }
                    "InvalidRequestException" => {
                        GetNamedQueryError::InvalidRequest(String::from(error_message))
                    }
                    "ValidationException" => {
                        GetNamedQueryError::Validation(error_message.to_string())
                    }
                    _ => GetNamedQueryError::Unknown(String::from(body)),
                }
            }
            Err(_) => GetNamedQueryError::Unknown(String::from(body)),
        }
    }
}

impl From<serde_json::error::Error> for GetNamedQueryError {
    fn from(err: serde_json::error::Error) -> GetNamedQueryError {
        GetNamedQueryError::Unknown(err.description().to_string())
    }
}
impl From<CredentialsError> for GetNamedQueryError {
    fn from(err: CredentialsError) -> GetNamedQueryError {
        GetNamedQueryError::Credentials(err)
    }
}
impl From<HttpDispatchError> for GetNamedQueryError {
    fn from(err: HttpDispatchError) -> GetNamedQueryError {
        GetNamedQueryError::HttpDispatch(err)
    }
}
impl From<io::Error> for GetNamedQueryError {
    fn from(err: io::Error) -> GetNamedQueryError {
        GetNamedQueryError::HttpDispatch(HttpDispatchError::from(err))
    }
}
impl fmt::Display for GetNamedQueryError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.description())
    }
}
impl Error for GetNamedQueryError {
    fn description(&self) -> &str {
        match *self {
            GetNamedQueryError::InternalServer(ref cause) => cause,
            GetNamedQueryError::InvalidRequest(ref cause) => cause,
            GetNamedQueryError::Validation(ref cause) => cause,
            GetNamedQueryError::Credentials(ref err) => err.description(),
            GetNamedQueryError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
            GetNamedQueryError::Unknown(ref cause) => cause,
        }
    }
}
/// Errors returned by GetQueryExecution
#[derive(Debug, PartialEq)]
pub enum GetQueryExecutionError {
    /// <p>Indicates a platform issue, which may be due to a transient condition or outage.</p>
    InternalServer(String),
    /// <p>Indicates that something is wrong with the input to the request. For example, a required parameter may be missing or out of range.</p>
    InvalidRequest(String),
    /// An error occurred dispatching the HTTP request
    HttpDispatch(HttpDispatchError),
    /// An error was encountered with AWS credentials.
    Credentials(CredentialsError),
    /// A validation error occurred.  Details from AWS are provided.
    Validation(String),
    /// An unknown error occurred.  The raw HTTP response is provided.
    Unknown(String),
}

impl GetQueryExecutionError {
    pub fn from_body(body: &str) -> GetQueryExecutionError {
        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 {
                    "InternalServerException" => {
                        GetQueryExecutionError::InternalServer(String::from(error_message))
                    }
                    "InvalidRequestException" => {
                        GetQueryExecutionError::InvalidRequest(String::from(error_message))
                    }
                    "ValidationException" => {
                        GetQueryExecutionError::Validation(error_message.to_string())
                    }
                    _ => GetQueryExecutionError::Unknown(String::from(body)),
                }
            }
            Err(_) => GetQueryExecutionError::Unknown(String::from(body)),
        }
    }
}

impl From<serde_json::error::Error> for GetQueryExecutionError {
    fn from(err: serde_json::error::Error) -> GetQueryExecutionError {
        GetQueryExecutionError::Unknown(err.description().to_string())
    }
}
impl From<CredentialsError> for GetQueryExecutionError {
    fn from(err: CredentialsError) -> GetQueryExecutionError {
        GetQueryExecutionError::Credentials(err)
    }
}
impl From<HttpDispatchError> for GetQueryExecutionError {
    fn from(err: HttpDispatchError) -> GetQueryExecutionError {
        GetQueryExecutionError::HttpDispatch(err)
    }
}
impl From<io::Error> for GetQueryExecutionError {
    fn from(err: io::Error) -> GetQueryExecutionError {
        GetQueryExecutionError::HttpDispatch(HttpDispatchError::from(err))
    }
}
impl fmt::Display for GetQueryExecutionError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.description())
    }
}
impl Error for GetQueryExecutionError {
    fn description(&self) -> &str {
        match *self {
            GetQueryExecutionError::InternalServer(ref cause) => cause,
            GetQueryExecutionError::InvalidRequest(ref cause) => cause,
            GetQueryExecutionError::Validation(ref cause) => cause,
            GetQueryExecutionError::Credentials(ref err) => err.description(),
            GetQueryExecutionError::HttpDispatch(ref dispatch_error) => {
                dispatch_error.description()
            }
            GetQueryExecutionError::Unknown(ref cause) => cause,
        }
    }
}
/// Errors returned by GetQueryResults
#[derive(Debug, PartialEq)]
pub enum GetQueryResultsError {
    /// <p>Indicates a platform issue, which may be due to a transient condition or outage.</p>
    InternalServer(String),
    /// <p>Indicates that something is wrong with the input to the request. For example, a required parameter may be missing or out of range.</p>
    InvalidRequest(String),
    /// An error occurred dispatching the HTTP request
    HttpDispatch(HttpDispatchError),
    /// An error was encountered with AWS credentials.
    Credentials(CredentialsError),
    /// A validation error occurred.  Details from AWS are provided.
    Validation(String),
    /// An unknown error occurred.  The raw HTTP response is provided.
    Unknown(String),
}

impl GetQueryResultsError {
    pub fn from_body(body: &str) -> GetQueryResultsError {
        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 {
                    "InternalServerException" => {
                        GetQueryResultsError::InternalServer(String::from(error_message))
                    }
                    "InvalidRequestException" => {
                        GetQueryResultsError::InvalidRequest(String::from(error_message))
                    }
                    "ValidationException" => {
                        GetQueryResultsError::Validation(error_message.to_string())
                    }
                    _ => GetQueryResultsError::Unknown(String::from(body)),
                }
            }
            Err(_) => GetQueryResultsError::Unknown(String::from(body)),
        }
    }
}

impl From<serde_json::error::Error> for GetQueryResultsError {
    fn from(err: serde_json::error::Error) -> GetQueryResultsError {
        GetQueryResultsError::Unknown(err.description().to_string())
    }
}
impl From<CredentialsError> for GetQueryResultsError {
    fn from(err: CredentialsError) -> GetQueryResultsError {
        GetQueryResultsError::Credentials(err)
    }
}
impl From<HttpDispatchError> for GetQueryResultsError {
    fn from(err: HttpDispatchError) -> GetQueryResultsError {
        GetQueryResultsError::HttpDispatch(err)
    }
}
impl From<io::Error> for GetQueryResultsError {
    fn from(err: io::Error) -> GetQueryResultsError {
        GetQueryResultsError::HttpDispatch(HttpDispatchError::from(err))
    }
}
impl fmt::Display for GetQueryResultsError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.description())
    }
}
impl Error for GetQueryResultsError {
    fn description(&self) -> &str {
        match *self {
            GetQueryResultsError::InternalServer(ref cause) => cause,
            GetQueryResultsError::InvalidRequest(ref cause) => cause,
            GetQueryResultsError::Validation(ref cause) => cause,
            GetQueryResultsError::Credentials(ref err) => err.description(),
            GetQueryResultsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
            GetQueryResultsError::Unknown(ref cause) => cause,
        }
    }
}
/// Errors returned by ListNamedQueries
#[derive(Debug, PartialEq)]
pub enum ListNamedQueriesError {
    /// <p>Indicates a platform issue, which may be due to a transient condition or outage.</p>
    InternalServer(String),
    /// <p>Indicates that something is wrong with the input to the request. For example, a required parameter may be missing or out of range.</p>
    InvalidRequest(String),
    /// An error occurred dispatching the HTTP request
    HttpDispatch(HttpDispatchError),
    /// An error was encountered with AWS credentials.
    Credentials(CredentialsError),
    /// A validation error occurred.  Details from AWS are provided.
    Validation(String),
    /// An unknown error occurred.  The raw HTTP response is provided.
    Unknown(String),
}

impl ListNamedQueriesError {
    pub fn from_body(body: &str) -> ListNamedQueriesError {
        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 {
                    "InternalServerException" => {
                        ListNamedQueriesError::InternalServer(String::from(error_message))
                    }
                    "InvalidRequestException" => {
                        ListNamedQueriesError::InvalidRequest(String::from(error_message))
                    }
                    "ValidationException" => {
                        ListNamedQueriesError::Validation(error_message.to_string())
                    }
                    _ => ListNamedQueriesError::Unknown(String::from(body)),
                }
            }
            Err(_) => ListNamedQueriesError::Unknown(String::from(body)),
        }
    }
}

impl From<serde_json::error::Error> for ListNamedQueriesError {
    fn from(err: serde_json::error::Error) -> ListNamedQueriesError {
        ListNamedQueriesError::Unknown(err.description().to_string())
    }
}
impl From<CredentialsError> for ListNamedQueriesError {
    fn from(err: CredentialsError) -> ListNamedQueriesError {
        ListNamedQueriesError::Credentials(err)
    }
}
impl From<HttpDispatchError> for ListNamedQueriesError {
    fn from(err: HttpDispatchError) -> ListNamedQueriesError {
        ListNamedQueriesError::HttpDispatch(err)
    }
}
impl From<io::Error> for ListNamedQueriesError {
    fn from(err: io::Error) -> ListNamedQueriesError {
        ListNamedQueriesError::HttpDispatch(HttpDispatchError::from(err))
    }
}
impl fmt::Display for ListNamedQueriesError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.description())
    }
}
impl Error for ListNamedQueriesError {
    fn description(&self) -> &str {
        match *self {
            ListNamedQueriesError::InternalServer(ref cause) => cause,
            ListNamedQueriesError::InvalidRequest(ref cause) => cause,
            ListNamedQueriesError::Validation(ref cause) => cause,
            ListNamedQueriesError::Credentials(ref err) => err.description(),
            ListNamedQueriesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
            ListNamedQueriesError::Unknown(ref cause) => cause,
        }
    }
}
/// Errors returned by ListQueryExecutions
#[derive(Debug, PartialEq)]
pub enum ListQueryExecutionsError {
    /// <p>Indicates a platform issue, which may be due to a transient condition or outage.</p>
    InternalServer(String),
    /// <p>Indicates that something is wrong with the input to the request. For example, a required parameter may be missing or out of range.</p>
    InvalidRequest(String),
    /// An error occurred dispatching the HTTP request
    HttpDispatch(HttpDispatchError),
    /// An error was encountered with AWS credentials.
    Credentials(CredentialsError),
    /// A validation error occurred.  Details from AWS are provided.
    Validation(String),
    /// An unknown error occurred.  The raw HTTP response is provided.
    Unknown(String),
}

impl ListQueryExecutionsError {
    pub fn from_body(body: &str) -> ListQueryExecutionsError {
        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 {
                    "InternalServerException" => {
                        ListQueryExecutionsError::InternalServer(String::from(error_message))
                    }
                    "InvalidRequestException" => {
                        ListQueryExecutionsError::InvalidRequest(String::from(error_message))
                    }
                    "ValidationException" => {
                        ListQueryExecutionsError::Validation(error_message.to_string())
                    }
                    _ => ListQueryExecutionsError::Unknown(String::from(body)),
                }
            }
            Err(_) => ListQueryExecutionsError::Unknown(String::from(body)),
        }
    }
}

impl From<serde_json::error::Error> for ListQueryExecutionsError {
    fn from(err: serde_json::error::Error) -> ListQueryExecutionsError {
        ListQueryExecutionsError::Unknown(err.description().to_string())
    }
}
impl From<CredentialsError> for ListQueryExecutionsError {
    fn from(err: CredentialsError) -> ListQueryExecutionsError {
        ListQueryExecutionsError::Credentials(err)
    }
}
impl From<HttpDispatchError> for ListQueryExecutionsError {
    fn from(err: HttpDispatchError) -> ListQueryExecutionsError {
        ListQueryExecutionsError::HttpDispatch(err)
    }
}
impl From<io::Error> for ListQueryExecutionsError {
    fn from(err: io::Error) -> ListQueryExecutionsError {
        ListQueryExecutionsError::HttpDispatch(HttpDispatchError::from(err))
    }
}
impl fmt::Display for ListQueryExecutionsError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.description())
    }
}
impl Error for ListQueryExecutionsError {
    fn description(&self) -> &str {
        match *self {
            ListQueryExecutionsError::InternalServer(ref cause) => cause,
            ListQueryExecutionsError::InvalidRequest(ref cause) => cause,
            ListQueryExecutionsError::Validation(ref cause) => cause,
            ListQueryExecutionsError::Credentials(ref err) => err.description(),
            ListQueryExecutionsError::HttpDispatch(ref dispatch_error) => {
                dispatch_error.description()
            }
            ListQueryExecutionsError::Unknown(ref cause) => cause,
        }
    }
}
/// Errors returned by StartQueryExecution
#[derive(Debug, PartialEq)]
pub enum StartQueryExecutionError {
    /// <p>Indicates a platform issue, which may be due to a transient condition or outage.</p>
    InternalServer(String),
    /// <p>Indicates that something is wrong with the input to the request. For example, a required parameter may be missing or out of range.</p>
    InvalidRequest(String),
    /// <p>Indicates that the request was throttled.</p>
    TooManyRequests(String),
    /// An error occurred dispatching the HTTP request
    HttpDispatch(HttpDispatchError),
    /// An error was encountered with AWS credentials.
    Credentials(CredentialsError),
    /// A validation error occurred.  Details from AWS are provided.
    Validation(String),
    /// An unknown error occurred.  The raw HTTP response is provided.
    Unknown(String),
}

impl StartQueryExecutionError {
    pub fn from_body(body: &str) -> StartQueryExecutionError {
        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 {
                    "InternalServerException" => {
                        StartQueryExecutionError::InternalServer(String::from(error_message))
                    }
                    "InvalidRequestException" => {
                        StartQueryExecutionError::InvalidRequest(String::from(error_message))
                    }
                    "TooManyRequestsException" => {
                        StartQueryExecutionError::TooManyRequests(String::from(error_message))
                    }
                    "ValidationException" => {
                        StartQueryExecutionError::Validation(error_message.to_string())
                    }
                    _ => StartQueryExecutionError::Unknown(String::from(body)),
                }
            }
            Err(_) => StartQueryExecutionError::Unknown(String::from(body)),
        }
    }
}

impl From<serde_json::error::Error> for StartQueryExecutionError {
    fn from(err: serde_json::error::Error) -> StartQueryExecutionError {
        StartQueryExecutionError::Unknown(err.description().to_string())
    }
}
impl From<CredentialsError> for StartQueryExecutionError {
    fn from(err: CredentialsError) -> StartQueryExecutionError {
        StartQueryExecutionError::Credentials(err)
    }
}
impl From<HttpDispatchError> for StartQueryExecutionError {
    fn from(err: HttpDispatchError) -> StartQueryExecutionError {
        StartQueryExecutionError::HttpDispatch(err)
    }
}
impl From<io::Error> for StartQueryExecutionError {
    fn from(err: io::Error) -> StartQueryExecutionError {
        StartQueryExecutionError::HttpDispatch(HttpDispatchError::from(err))
    }
}
impl fmt::Display for StartQueryExecutionError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.description())
    }
}
impl Error for StartQueryExecutionError {
    fn description(&self) -> &str {
        match *self {
            StartQueryExecutionError::InternalServer(ref cause) => cause,
            StartQueryExecutionError::InvalidRequest(ref cause) => cause,
            StartQueryExecutionError::TooManyRequests(ref cause) => cause,
            StartQueryExecutionError::Validation(ref cause) => cause,
            StartQueryExecutionError::Credentials(ref err) => err.description(),
            StartQueryExecutionError::HttpDispatch(ref dispatch_error) => {
                dispatch_error.description()
            }
            StartQueryExecutionError::Unknown(ref cause) => cause,
        }
    }
}
/// Errors returned by StopQueryExecution
#[derive(Debug, PartialEq)]
pub enum StopQueryExecutionError {
    /// <p>Indicates a platform issue, which may be due to a transient condition or outage.</p>
    InternalServer(String),
    /// <p>Indicates that something is wrong with the input to the request. For example, a required parameter may be missing or out of range.</p>
    InvalidRequest(String),
    /// An error occurred dispatching the HTTP request
    HttpDispatch(HttpDispatchError),
    /// An error was encountered with AWS credentials.
    Credentials(CredentialsError),
    /// A validation error occurred.  Details from AWS are provided.
    Validation(String),
    /// An unknown error occurred.  The raw HTTP response is provided.
    Unknown(String),
}

impl StopQueryExecutionError {
    pub fn from_body(body: &str) -> StopQueryExecutionError {
        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 {
                    "InternalServerException" => {
                        StopQueryExecutionError::InternalServer(String::from(error_message))
                    }
                    "InvalidRequestException" => {
                        StopQueryExecutionError::InvalidRequest(String::from(error_message))
                    }
                    "ValidationException" => {
                        StopQueryExecutionError::Validation(error_message.to_string())
                    }
                    _ => StopQueryExecutionError::Unknown(String::from(body)),
                }
            }
            Err(_) => StopQueryExecutionError::Unknown(String::from(body)),
        }
    }
}

impl From<serde_json::error::Error> for StopQueryExecutionError {
    fn from(err: serde_json::error::Error) -> StopQueryExecutionError {
        StopQueryExecutionError::Unknown(err.description().to_string())
    }
}
impl From<CredentialsError> for StopQueryExecutionError {
    fn from(err: CredentialsError) -> StopQueryExecutionError {
        StopQueryExecutionError::Credentials(err)
    }
}
impl From<HttpDispatchError> for StopQueryExecutionError {
    fn from(err: HttpDispatchError) -> StopQueryExecutionError {
        StopQueryExecutionError::HttpDispatch(err)
    }
}
impl From<io::Error> for StopQueryExecutionError {
    fn from(err: io::Error) -> StopQueryExecutionError {
        StopQueryExecutionError::HttpDispatch(HttpDispatchError::from(err))
    }
}
impl fmt::Display for StopQueryExecutionError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.description())
    }
}
impl Error for StopQueryExecutionError {
    fn description(&self) -> &str {
        match *self {
            StopQueryExecutionError::InternalServer(ref cause) => cause,
            StopQueryExecutionError::InvalidRequest(ref cause) => cause,
            StopQueryExecutionError::Validation(ref cause) => cause,
            StopQueryExecutionError::Credentials(ref err) => err.description(),
            StopQueryExecutionError::HttpDispatch(ref dispatch_error) => {
                dispatch_error.description()
            }
            StopQueryExecutionError::Unknown(ref cause) => cause,
        }
    }
}
/// Trait representing the capabilities of the Amazon Athena API. Amazon Athena clients implement this trait.
pub trait Athena {
    /// <p>Returns the details of a single named query or a list of up to 50 queries, which you provide as an array of query ID strings. Use <a>ListNamedQueries</a> to get the list of named query IDs. If information could not be retrieved for a submitted query ID, information about the query ID submitted is listed under <a>UnprocessedNamedQueryId</a>. Named queries are different from executed queries. Use <a>BatchGetQueryExecution</a> to get details about each unique query execution, and <a>ListQueryExecutions</a> to get a list of query execution IDs.</p>
    fn batch_get_named_query(
        &self,
        input: &BatchGetNamedQueryInput,
    ) -> RusotoFuture<BatchGetNamedQueryOutput, BatchGetNamedQueryError>;

    /// <p>Returns the details of a single query execution or a list of up to 50 query executions, which you provide as an array of query execution ID strings. To get a list of query execution IDs, use <a>ListQueryExecutions</a>. Query executions are different from named (saved) queries. Use <a>BatchGetNamedQuery</a> to get details about named queries.</p>
    fn batch_get_query_execution(
        &self,
        input: &BatchGetQueryExecutionInput,
    ) -> RusotoFuture<BatchGetQueryExecutionOutput, BatchGetQueryExecutionError>;

    /// <p>Creates a named query.</p> <p>For code samples using the AWS SDK for Java, see <a href="http://docs.aws.amazon.com/athena/latest/ug/code-samples.html">Examples and Code Samples</a> in the <i>Amazon Athena User Guide</i>.</p>
    fn create_named_query(
        &self,
        input: &CreateNamedQueryInput,
    ) -> RusotoFuture<CreateNamedQueryOutput, CreateNamedQueryError>;

    /// <p>Deletes a named query.</p> <p>For code samples using the AWS SDK for Java, see <a href="http://docs.aws.amazon.com/athena/latest/ug/code-samples.html">Examples and Code Samples</a> in the <i>Amazon Athena User Guide</i>.</p>
    fn delete_named_query(
        &self,
        input: &DeleteNamedQueryInput,
    ) -> RusotoFuture<DeleteNamedQueryOutput, DeleteNamedQueryError>;

    /// <p>Returns information about a single query.</p>
    fn get_named_query(
        &self,
        input: &GetNamedQueryInput,
    ) -> RusotoFuture<GetNamedQueryOutput, GetNamedQueryError>;

    /// <p>Returns information about a single execution of a query. Each time a query executes, information about the query execution is saved with a unique ID.</p>
    fn get_query_execution(
        &self,
        input: &GetQueryExecutionInput,
    ) -> RusotoFuture<GetQueryExecutionOutput, GetQueryExecutionError>;

    /// <p>Returns the results of a single query execution specified by <code>QueryExecutionId</code>. This request does not execute the query but returns results. Use <a>StartQueryExecution</a> to run a query.</p>
    fn get_query_results(
        &self,
        input: &GetQueryResultsInput,
    ) -> RusotoFuture<GetQueryResultsOutput, GetQueryResultsError>;

    /// <p>Provides a list of all available query IDs.</p> <p>For code samples using the AWS SDK for Java, see <a href="http://docs.aws.amazon.com/athena/latest/ug/code-samples.html">Examples and Code Samples</a> in the <i>Amazon Athena User Guide</i>.</p>
    fn list_named_queries(
        &self,
        input: &ListNamedQueriesInput,
    ) -> RusotoFuture<ListNamedQueriesOutput, ListNamedQueriesError>;

    /// <p>Provides a list of all available query execution IDs.</p> <p>For code samples using the AWS SDK for Java, see <a href="http://docs.aws.amazon.com/athena/latest/ug/code-samples.html">Examples and Code Samples</a> in the <i>Amazon Athena User Guide</i>.</p>
    fn list_query_executions(
        &self,
        input: &ListQueryExecutionsInput,
    ) -> RusotoFuture<ListQueryExecutionsOutput, ListQueryExecutionsError>;

    /// <p>Runs (executes) the SQL query statements contained in the <code>Query</code> string.</p> <p>For code samples using the AWS SDK for Java, see <a href="http://docs.aws.amazon.com/athena/latest/ug/code-samples.html">Examples and Code Samples</a> in the <i>Amazon Athena User Guide</i>.</p>
    fn start_query_execution(
        &self,
        input: &StartQueryExecutionInput,
    ) -> RusotoFuture<StartQueryExecutionOutput, StartQueryExecutionError>;

    /// <p>Stops a query execution.</p> <p>For code samples using the AWS SDK for Java, see <a href="http://docs.aws.amazon.com/athena/latest/ug/code-samples.html">Examples and Code Samples</a> in the <i>Amazon Athena User Guide</i>.</p>
    fn stop_query_execution(
        &self,
        input: &StopQueryExecutionInput,
    ) -> RusotoFuture<StopQueryExecutionOutput, StopQueryExecutionError>;
}
/// A client for the Amazon Athena API.
pub struct AthenaClient<P = CredentialsProvider, D = RequestDispatcher>
where
    P: ProvideAwsCredentials,
    D: DispatchSignedRequest,
{
    inner: ClientInner<P, D>,
    region: region::Region,
}

impl AthenaClient {
    /// Creates a simple client backed by an implicit event loop.
    ///
    /// The client will use the default credentials provider and tls client.
    ///
    /// See the `rusoto_core::reactor` module for more details.
    pub fn simple(region: region::Region) -> AthenaClient {
        AthenaClient::new(
            RequestDispatcher::default(),
            CredentialsProvider::default(),
            region,
        )
    }
}

impl<P, D> AthenaClient<P, D>
where
    P: ProvideAwsCredentials,
    D: DispatchSignedRequest,
{
    pub fn new(request_dispatcher: D, credentials_provider: P, region: region::Region) -> Self {
        AthenaClient {
            inner: ClientInner::new(credentials_provider, request_dispatcher),
            region: region,
        }
    }
}

impl<P, D> Athena for AthenaClient<P, D>
where
    P: ProvideAwsCredentials + 'static,
    D: DispatchSignedRequest + 'static,
{
    /// <p>Returns the details of a single named query or a list of up to 50 queries, which you provide as an array of query ID strings. Use <a>ListNamedQueries</a> to get the list of named query IDs. If information could not be retrieved for a submitted query ID, information about the query ID submitted is listed under <a>UnprocessedNamedQueryId</a>. Named queries are different from executed queries. Use <a>BatchGetQueryExecution</a> to get details about each unique query execution, and <a>ListQueryExecutions</a> to get a list of query execution IDs.</p>
    fn batch_get_named_query(
        &self,
        input: &BatchGetNamedQueryInput,
    ) -> RusotoFuture<BatchGetNamedQueryOutput, BatchGetNamedQueryError> {
        let mut request = SignedRequest::new("POST", "athena", &self.region, "/");

        request.set_content_type("application/x-amz-json-1.1".to_owned());
        request.add_header("x-amz-target", "AmazonAthena.BatchGetNamedQuery");
        let encoded = serde_json::to_string(input).unwrap();
        request.set_payload(Some(encoded.into_bytes()));

        let future = self.inner.sign_and_dispatch(request, |response| {
            if response.status == StatusCode::Ok {
                future::Either::A(response.buffer().from_err().map(|response| {
                    serde_json::from_str::<BatchGetNamedQueryOutput>(
                        String::from_utf8_lossy(response.body.as_ref()).as_ref(),
                    ).unwrap()
                }))
            } else {
                future::Either::B(response.buffer().from_err().and_then(|response| {
                    Err(BatchGetNamedQueryError::from_body(
                        String::from_utf8_lossy(response.body.as_ref()).as_ref(),
                    ))
                }))
            }
        });

        RusotoFuture::new(future)
    }

    /// <p>Returns the details of a single query execution or a list of up to 50 query executions, which you provide as an array of query execution ID strings. To get a list of query execution IDs, use <a>ListQueryExecutions</a>. Query executions are different from named (saved) queries. Use <a>BatchGetNamedQuery</a> to get details about named queries.</p>
    fn batch_get_query_execution(
        &self,
        input: &BatchGetQueryExecutionInput,
    ) -> RusotoFuture<BatchGetQueryExecutionOutput, BatchGetQueryExecutionError> {
        let mut request = SignedRequest::new("POST", "athena", &self.region, "/");

        request.set_content_type("application/x-amz-json-1.1".to_owned());
        request.add_header("x-amz-target", "AmazonAthena.BatchGetQueryExecution");
        let encoded = serde_json::to_string(input).unwrap();
        request.set_payload(Some(encoded.into_bytes()));

        let future = self.inner.sign_and_dispatch(request, |response| {
            if response.status == StatusCode::Ok {
                future::Either::A(response.buffer().from_err().map(|response| {
                    serde_json::from_str::<BatchGetQueryExecutionOutput>(
                        String::from_utf8_lossy(response.body.as_ref()).as_ref(),
                    ).unwrap()
                }))
            } else {
                future::Either::B(response.buffer().from_err().and_then(|response| {
                    Err(BatchGetQueryExecutionError::from_body(
                        String::from_utf8_lossy(response.body.as_ref()).as_ref(),
                    ))
                }))
            }
        });

        RusotoFuture::new(future)
    }

    /// <p>Creates a named query.</p> <p>For code samples using the AWS SDK for Java, see <a href="http://docs.aws.amazon.com/athena/latest/ug/code-samples.html">Examples and Code Samples</a> in the <i>Amazon Athena User Guide</i>.</p>
    fn create_named_query(
        &self,
        input: &CreateNamedQueryInput,
    ) -> RusotoFuture<CreateNamedQueryOutput, CreateNamedQueryError> {
        let mut request = SignedRequest::new("POST", "athena", &self.region, "/");

        request.set_content_type("application/x-amz-json-1.1".to_owned());
        request.add_header("x-amz-target", "AmazonAthena.CreateNamedQuery");
        let encoded = serde_json::to_string(input).unwrap();
        request.set_payload(Some(encoded.into_bytes()));

        let future = self.inner.sign_and_dispatch(request, |response| {
            if response.status == StatusCode::Ok {
                future::Either::A(response.buffer().from_err().map(|response| {
                    serde_json::from_str::<CreateNamedQueryOutput>(
                        String::from_utf8_lossy(response.body.as_ref()).as_ref(),
                    ).unwrap()
                }))
            } else {
                future::Either::B(response.buffer().from_err().and_then(|response| {
                    Err(CreateNamedQueryError::from_body(
                        String::from_utf8_lossy(response.body.as_ref()).as_ref(),
                    ))
                }))
            }
        });

        RusotoFuture::new(future)
    }

    /// <p>Deletes a named query.</p> <p>For code samples using the AWS SDK for Java, see <a href="http://docs.aws.amazon.com/athena/latest/ug/code-samples.html">Examples and Code Samples</a> in the <i>Amazon Athena User Guide</i>.</p>
    fn delete_named_query(
        &self,
        input: &DeleteNamedQueryInput,
    ) -> RusotoFuture<DeleteNamedQueryOutput, DeleteNamedQueryError> {
        let mut request = SignedRequest::new("POST", "athena", &self.region, "/");

        request.set_content_type("application/x-amz-json-1.1".to_owned());
        request.add_header("x-amz-target", "AmazonAthena.DeleteNamedQuery");
        let encoded = serde_json::to_string(input).unwrap();
        request.set_payload(Some(encoded.into_bytes()));

        let future = self.inner.sign_and_dispatch(request, |response| {
            if response.status == StatusCode::Ok {
                future::Either::A(response.buffer().from_err().map(|response| {
                    serde_json::from_str::<DeleteNamedQueryOutput>(
                        String::from_utf8_lossy(response.body.as_ref()).as_ref(),
                    ).unwrap()
                }))
            } else {
                future::Either::B(response.buffer().from_err().and_then(|response| {
                    Err(DeleteNamedQueryError::from_body(
                        String::from_utf8_lossy(response.body.as_ref()).as_ref(),
                    ))
                }))
            }
        });

        RusotoFuture::new(future)
    }

    /// <p>Returns information about a single query.</p>
    fn get_named_query(
        &self,
        input: &GetNamedQueryInput,
    ) -> RusotoFuture<GetNamedQueryOutput, GetNamedQueryError> {
        let mut request = SignedRequest::new("POST", "athena", &self.region, "/");

        request.set_content_type("application/x-amz-json-1.1".to_owned());
        request.add_header("x-amz-target", "AmazonAthena.GetNamedQuery");
        let encoded = serde_json::to_string(input).unwrap();
        request.set_payload(Some(encoded.into_bytes()));

        let future = self.inner.sign_and_dispatch(request, |response| {
            if response.status == StatusCode::Ok {
                future::Either::A(response.buffer().from_err().map(|response| {
                    serde_json::from_str::<GetNamedQueryOutput>(
                        String::from_utf8_lossy(response.body.as_ref()).as_ref(),
                    ).unwrap()
                }))
            } else {
                future::Either::B(response.buffer().from_err().and_then(|response| {
                    Err(GetNamedQueryError::from_body(
                        String::from_utf8_lossy(response.body.as_ref()).as_ref(),
                    ))
                }))
            }
        });

        RusotoFuture::new(future)
    }

    /// <p>Returns information about a single execution of a query. Each time a query executes, information about the query execution is saved with a unique ID.</p>
    fn get_query_execution(
        &self,
        input: &GetQueryExecutionInput,
    ) -> RusotoFuture<GetQueryExecutionOutput, GetQueryExecutionError> {
        let mut request = SignedRequest::new("POST", "athena", &self.region, "/");

        request.set_content_type("application/x-amz-json-1.1".to_owned());
        request.add_header("x-amz-target", "AmazonAthena.GetQueryExecution");
        let encoded = serde_json::to_string(input).unwrap();
        request.set_payload(Some(encoded.into_bytes()));

        let future = self.inner.sign_and_dispatch(request, |response| {
            if response.status == StatusCode::Ok {
                future::Either::A(response.buffer().from_err().map(|response| {
                    serde_json::from_str::<GetQueryExecutionOutput>(
                        String::from_utf8_lossy(response.body.as_ref()).as_ref(),
                    ).unwrap()
                }))
            } else {
                future::Either::B(response.buffer().from_err().and_then(|response| {
                    Err(GetQueryExecutionError::from_body(
                        String::from_utf8_lossy(response.body.as_ref()).as_ref(),
                    ))
                }))
            }
        });

        RusotoFuture::new(future)
    }

    /// <p>Returns the results of a single query execution specified by <code>QueryExecutionId</code>. This request does not execute the query but returns results. Use <a>StartQueryExecution</a> to run a query.</p>
    fn get_query_results(
        &self,
        input: &GetQueryResultsInput,
    ) -> RusotoFuture<GetQueryResultsOutput, GetQueryResultsError> {
        let mut request = SignedRequest::new("POST", "athena", &self.region, "/");

        request.set_content_type("application/x-amz-json-1.1".to_owned());
        request.add_header("x-amz-target", "AmazonAthena.GetQueryResults");
        let encoded = serde_json::to_string(input).unwrap();
        request.set_payload(Some(encoded.into_bytes()));

        let future = self.inner.sign_and_dispatch(request, |response| {
            if response.status == StatusCode::Ok {
                future::Either::A(response.buffer().from_err().map(|response| {
                    serde_json::from_str::<GetQueryResultsOutput>(
                        String::from_utf8_lossy(response.body.as_ref()).as_ref(),
                    ).unwrap()
                }))
            } else {
                future::Either::B(response.buffer().from_err().and_then(|response| {
                    Err(GetQueryResultsError::from_body(
                        String::from_utf8_lossy(response.body.as_ref()).as_ref(),
                    ))
                }))
            }
        });

        RusotoFuture::new(future)
    }

    /// <p>Provides a list of all available query IDs.</p> <p>For code samples using the AWS SDK for Java, see <a href="http://docs.aws.amazon.com/athena/latest/ug/code-samples.html">Examples and Code Samples</a> in the <i>Amazon Athena User Guide</i>.</p>
    fn list_named_queries(
        &self,
        input: &ListNamedQueriesInput,
    ) -> RusotoFuture<ListNamedQueriesOutput, ListNamedQueriesError> {
        let mut request = SignedRequest::new("POST", "athena", &self.region, "/");

        request.set_content_type("application/x-amz-json-1.1".to_owned());
        request.add_header("x-amz-target", "AmazonAthena.ListNamedQueries");
        let encoded = serde_json::to_string(input).unwrap();
        request.set_payload(Some(encoded.into_bytes()));

        let future = self.inner.sign_and_dispatch(request, |response| {
            if response.status == StatusCode::Ok {
                future::Either::A(response.buffer().from_err().map(|response| {
                    serde_json::from_str::<ListNamedQueriesOutput>(
                        String::from_utf8_lossy(response.body.as_ref()).as_ref(),
                    ).unwrap()
                }))
            } else {
                future::Either::B(response.buffer().from_err().and_then(|response| {
                    Err(ListNamedQueriesError::from_body(
                        String::from_utf8_lossy(response.body.as_ref()).as_ref(),
                    ))
                }))
            }
        });

        RusotoFuture::new(future)
    }

    /// <p>Provides a list of all available query execution IDs.</p> <p>For code samples using the AWS SDK for Java, see <a href="http://docs.aws.amazon.com/athena/latest/ug/code-samples.html">Examples and Code Samples</a> in the <i>Amazon Athena User Guide</i>.</p>
    fn list_query_executions(
        &self,
        input: &ListQueryExecutionsInput,
    ) -> RusotoFuture<ListQueryExecutionsOutput, ListQueryExecutionsError> {
        let mut request = SignedRequest::new("POST", "athena", &self.region, "/");

        request.set_content_type("application/x-amz-json-1.1".to_owned());
        request.add_header("x-amz-target", "AmazonAthena.ListQueryExecutions");
        let encoded = serde_json::to_string(input).unwrap();
        request.set_payload(Some(encoded.into_bytes()));

        let future = self.inner.sign_and_dispatch(request, |response| {
            if response.status == StatusCode::Ok {
                future::Either::A(response.buffer().from_err().map(|response| {
                    serde_json::from_str::<ListQueryExecutionsOutput>(
                        String::from_utf8_lossy(response.body.as_ref()).as_ref(),
                    ).unwrap()
                }))
            } else {
                future::Either::B(response.buffer().from_err().and_then(|response| {
                    Err(ListQueryExecutionsError::from_body(
                        String::from_utf8_lossy(response.body.as_ref()).as_ref(),
                    ))
                }))
            }
        });

        RusotoFuture::new(future)
    }

    /// <p>Runs (executes) the SQL query statements contained in the <code>Query</code> string.</p> <p>For code samples using the AWS SDK for Java, see <a href="http://docs.aws.amazon.com/athena/latest/ug/code-samples.html">Examples and Code Samples</a> in the <i>Amazon Athena User Guide</i>.</p>
    fn start_query_execution(
        &self,
        input: &StartQueryExecutionInput,
    ) -> RusotoFuture<StartQueryExecutionOutput, StartQueryExecutionError> {
        let mut request = SignedRequest::new("POST", "athena", &self.region, "/");

        request.set_content_type("application/x-amz-json-1.1".to_owned());
        request.add_header("x-amz-target", "AmazonAthena.StartQueryExecution");
        let encoded = serde_json::to_string(input).unwrap();
        request.set_payload(Some(encoded.into_bytes()));

        let future = self.inner.sign_and_dispatch(request, |response| {
            if response.status == StatusCode::Ok {
                future::Either::A(response.buffer().from_err().map(|response| {
                    serde_json::from_str::<StartQueryExecutionOutput>(
                        String::from_utf8_lossy(response.body.as_ref()).as_ref(),
                    ).unwrap()
                }))
            } else {
                future::Either::B(response.buffer().from_err().and_then(|response| {
                    Err(StartQueryExecutionError::from_body(
                        String::from_utf8_lossy(response.body.as_ref()).as_ref(),
                    ))
                }))
            }
        });

        RusotoFuture::new(future)
    }

    /// <p>Stops a query execution.</p> <p>For code samples using the AWS SDK for Java, see <a href="http://docs.aws.amazon.com/athena/latest/ug/code-samples.html">Examples and Code Samples</a> in the <i>Amazon Athena User Guide</i>.</p>
    fn stop_query_execution(
        &self,
        input: &StopQueryExecutionInput,
    ) -> RusotoFuture<StopQueryExecutionOutput, StopQueryExecutionError> {
        let mut request = SignedRequest::new("POST", "athena", &self.region, "/");

        request.set_content_type("application/x-amz-json-1.1".to_owned());
        request.add_header("x-amz-target", "AmazonAthena.StopQueryExecution");
        let encoded = serde_json::to_string(input).unwrap();
        request.set_payload(Some(encoded.into_bytes()));

        let future = self.inner.sign_and_dispatch(request, |response| {
            if response.status == StatusCode::Ok {
                future::Either::A(response.buffer().from_err().map(|response| {
                    serde_json::from_str::<StopQueryExecutionOutput>(
                        String::from_utf8_lossy(response.body.as_ref()).as_ref(),
                    ).unwrap()
                }))
            } else {
                future::Either::B(response.buffer().from_err().and_then(|response| {
                    Err(StopQueryExecutionError::from_body(
                        String::from_utf8_lossy(response.body.as_ref()).as_ref(),
                    ))
                }))
            }
        });

        RusotoFuture::new(future)
    }
}

#[cfg(test)]
mod protocol_tests {}