1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341

// =================================================================
//
//                           * 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.
//
// =================================================================

#[allow(warnings)]
use hyper::Client;
use hyper::status::StatusCode;
use rusoto_core::request::DispatchSignedRequest;
use rusoto_core::region;

use std::fmt;
use std::error::Error;
use std::io;
use std::io::Read;
use rusoto_core::request::HttpDispatchError;
use rusoto_core::credential::{CredentialsError, ProvideAwsCredentials};

use serde_json;
use rusoto_core::signature::SignedRequest;
use serde_json::Value as SerdeJsonValue;
use serde_json::from_str;
#[derive(Default,Debug,Clone,Serialize)]
pub struct DeleteRuleRequest {
    #[doc="<p>The name of the rule.</p>"]
    #[serde(rename="Name")]
    pub name: String,
}

#[derive(Default,Debug,Clone,Serialize)]
pub struct DescribeEventBusRequest;

#[derive(Default,Debug,Clone,Deserialize)]
pub struct DescribeEventBusResponse {
    #[doc="<p>The Amazon Resource Name (ARN) of the account permitted to write events to the current account.</p>"]
    #[serde(rename="Arn")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub arn: Option<String>,
    #[doc="<p>The name of the event bus. Currently, this is always <code>default</code>.</p>"]
    #[serde(rename="Name")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub name: Option<String>,
    #[doc="<p>The policy that enables the external account to send events to your account.</p>"]
    #[serde(rename="Policy")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub policy: Option<String>,
}

#[derive(Default,Debug,Clone,Serialize)]
pub struct DescribeRuleRequest {
    #[doc="<p>The name of the rule.</p>"]
    #[serde(rename="Name")]
    pub name: String,
}

#[derive(Default,Debug,Clone,Deserialize)]
pub struct DescribeRuleResponse {
    #[doc="<p>The Amazon Resource Name (ARN) of the rule.</p>"]
    #[serde(rename="Arn")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub arn: Option<String>,
    #[doc="<p>The description of the rule.</p>"]
    #[serde(rename="Description")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub description: Option<String>,
    #[doc="<p>The event pattern. For more information, see <a href=\"http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/CloudWatchEventsandEventPatterns.html\">Events and Event Patterns</a> in the <i>Amazon CloudWatch Events User Guide</i>.</p>"]
    #[serde(rename="EventPattern")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub event_pattern: Option<String>,
    #[doc="<p>The name of the rule.</p>"]
    #[serde(rename="Name")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub name: Option<String>,
    #[doc="<p>The Amazon Resource Name (ARN) of the IAM role associated with the rule.</p>"]
    #[serde(rename="RoleArn")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub role_arn: Option<String>,
    #[doc="<p>The scheduling expression. For example, \"cron(0 20 * * ? *)\", \"rate(5 minutes)\".</p>"]
    #[serde(rename="ScheduleExpression")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub schedule_expression: Option<String>,
    #[doc="<p>Specifies whether the rule is enabled or disabled.</p>"]
    #[serde(rename="State")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub state: Option<String>,
}

#[derive(Default,Debug,Clone,Serialize)]
pub struct DisableRuleRequest {
    #[doc="<p>The name of the rule.</p>"]
    #[serde(rename="Name")]
    pub name: String,
}

#[doc="<p>The custom parameters to be used when the target is an Amazon ECS cluster.</p>"]
#[derive(Default,Debug,Clone,Serialize,Deserialize)]
pub struct EcsParameters {
    #[doc="<p>The number of tasks to create based on the <code>TaskDefinition</code>. The default is one.</p>"]
    #[serde(rename="TaskCount")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub task_count: Option<i64>,
    #[doc="<p>The ARN of the task definition to use if the event target is an Amazon ECS cluster. </p>"]
    #[serde(rename="TaskDefinitionArn")]
    pub task_definition_arn: String,
}

#[derive(Default,Debug,Clone,Serialize)]
pub struct EnableRuleRequest {
    #[doc="<p>The name of the rule.</p>"]
    #[serde(rename="Name")]
    pub name: String,
}

#[doc="<p>Contains the parameters needed for you to provide custom input to a target based on one or more pieces of data extracted from the event.</p>"]
#[derive(Default,Debug,Clone,Serialize,Deserialize)]
pub struct InputTransformer {
    #[doc="<p>Map of JSON paths to be extracted from the event. These are key-value pairs, where each value is a JSON path. You must use JSON dot notation, not bracket notation.</p>"]
    #[serde(rename="InputPathsMap")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub input_paths_map: Option<::std::collections::HashMap<String, String>>,
    #[doc="<p>Input template where you can use the values of the keys from <code>InputPathsMap</code> to customize the data sent to the target.</p>"]
    #[serde(rename="InputTemplate")]
    pub input_template: String,
}

#[doc="<p>This object enables you to specify a JSON path to extract from the event and use as the partition key for the Amazon Kinesis stream, so that you can control the shard to which the event goes. If you do not include this parameter, the default is to use the <code>eventId</code> as the partition key.</p>"]
#[derive(Default,Debug,Clone,Serialize,Deserialize)]
pub struct KinesisParameters {
    #[doc="<p>The JSON path to be extracted from the event and used as the partition key. For more information, see <a href=\"http://docs.aws.amazon.com/streams/latest/dev/key-concepts.html#partition-key\">Amazon Kinesis Streams Key Concepts</a> in the <i>Amazon Kinesis Streams Developer Guide</i>.</p>"]
    #[serde(rename="PartitionKeyPath")]
    pub partition_key_path: String,
}

#[derive(Default,Debug,Clone,Serialize)]
pub struct ListRuleNamesByTargetRequest {
    #[doc="<p>The maximum number of results to return.</p>"]
    #[serde(rename="Limit")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub limit: Option<i64>,
    #[doc="<p>The token returned by a previous call to retrieve the next set of results.</p>"]
    #[serde(rename="NextToken")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub next_token: Option<String>,
    #[doc="<p>The Amazon Resource Name (ARN) of the target resource.</p>"]
    #[serde(rename="TargetArn")]
    pub target_arn: String,
}

#[derive(Default,Debug,Clone,Deserialize)]
pub struct ListRuleNamesByTargetResponse {
    #[doc="<p>Indicates whether there are additional results to retrieve. If there are no more results, the value is null.</p>"]
    #[serde(rename="NextToken")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub next_token: Option<String>,
    #[doc="<p>The names of the rules that can invoke the given target.</p>"]
    #[serde(rename="RuleNames")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub rule_names: Option<Vec<String>>,
}

#[derive(Default,Debug,Clone,Serialize)]
pub struct ListRulesRequest {
    #[doc="<p>The maximum number of results to return.</p>"]
    #[serde(rename="Limit")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub limit: Option<i64>,
    #[doc="<p>The prefix matching the rule name.</p>"]
    #[serde(rename="NamePrefix")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub name_prefix: Option<String>,
    #[doc="<p>The token returned by a previous call to retrieve the next set of results.</p>"]
    #[serde(rename="NextToken")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub next_token: Option<String>,
}

#[derive(Default,Debug,Clone,Deserialize)]
pub struct ListRulesResponse {
    #[doc="<p>Indicates whether there are additional results to retrieve. If there are no more results, the value is null.</p>"]
    #[serde(rename="NextToken")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub next_token: Option<String>,
    #[doc="<p>The rules that match the specified criteria.</p>"]
    #[serde(rename="Rules")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub rules: Option<Vec<Rule>>,
}

#[derive(Default,Debug,Clone,Serialize)]
pub struct ListTargetsByRuleRequest {
    #[doc="<p>The maximum number of results to return.</p>"]
    #[serde(rename="Limit")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub limit: Option<i64>,
    #[doc="<p>The token returned by a previous call to retrieve the next set of results.</p>"]
    #[serde(rename="NextToken")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub next_token: Option<String>,
    #[doc="<p>The name of the rule.</p>"]
    #[serde(rename="Rule")]
    pub rule: String,
}

#[derive(Default,Debug,Clone,Deserialize)]
pub struct ListTargetsByRuleResponse {
    #[doc="<p>Indicates whether there are additional results to retrieve. If there are no more results, the value is null.</p>"]
    #[serde(rename="NextToken")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub next_token: Option<String>,
    #[doc="<p>The targets assigned to the rule.</p>"]
    #[serde(rename="Targets")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub targets: Option<Vec<Target>>,
}

#[derive(Default,Debug,Clone,Serialize)]
pub struct PutEventsRequest {
    #[doc="<p>The entry that defines an event in your system. You can specify several parameters for the entry such as the source and type of the event, resources associated with the event, and so on.</p>"]
    #[serde(rename="Entries")]
    pub entries: Vec<PutEventsRequestEntry>,
}

#[doc="<p>Represents an event to be submitted.</p>"]
#[derive(Default,Debug,Clone,Serialize)]
pub struct PutEventsRequestEntry {
    #[doc="<p>In the JSON sense, an object containing fields, which may also contain nested subobjects. No constraints are imposed on its contents.</p>"]
    #[serde(rename="Detail")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub detail: Option<String>,
    #[doc="<p>Free-form string used to decide what fields to expect in the event detail.</p>"]
    #[serde(rename="DetailType")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub detail_type: Option<String>,
    #[doc="<p>AWS resources, identified by Amazon Resource Name (ARN), which the event primarily concerns. Any number, including zero, may be present.</p>"]
    #[serde(rename="Resources")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub resources: Option<Vec<String>>,
    #[doc="<p>The source of the event.</p>"]
    #[serde(rename="Source")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub source: Option<String>,
    #[doc="<p>The timestamp of the event, per <a href=\"https://www.rfc-editor.org/rfc/rfc3339.txt\">RFC3339</a>. If no timestamp is provided, the timestamp of the <a>PutEvents</a> call is used.</p>"]
    #[serde(rename="Time")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub time: Option<f64>,
}

#[derive(Default,Debug,Clone,Deserialize)]
pub struct PutEventsResponse {
    #[doc="<p>The successfully and unsuccessfully ingested events results. If the ingestion was successful, the entry has the event ID in it. Otherwise, you can use the error code and error message to identify the problem with the entry.</p>"]
    #[serde(rename="Entries")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub entries: Option<Vec<PutEventsResultEntry>>,
    #[doc="<p>The number of failed entries.</p>"]
    #[serde(rename="FailedEntryCount")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub failed_entry_count: Option<i64>,
}

#[doc="<p>Represents an event that failed to be submitted.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct PutEventsResultEntry {
    #[doc="<p>The error code that indicates why the event submission failed.</p>"]
    #[serde(rename="ErrorCode")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub error_code: Option<String>,
    #[doc="<p>The error message that explains why the event submission failed.</p>"]
    #[serde(rename="ErrorMessage")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub error_message: Option<String>,
    #[doc="<p>The ID of the event.</p>"]
    #[serde(rename="EventId")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub event_id: Option<String>,
}

#[derive(Default,Debug,Clone,Serialize)]
pub struct PutPermissionRequest {
    #[doc="<p>The action that you are enabling the other account to perform. Currently, this must be <code>events:PutEvents</code>.</p>"]
    #[serde(rename="Action")]
    pub action: String,
    #[doc="<p>The 12-digit AWS account ID that you are permitting to put events to your default event bus. Specify \"*\" to permit any account to put events to your default event bus.</p> <p>If you specify \"*\", avoid creating rules that may match undesirable events. To create more secure rules, make sure that the event pattern for each rule contains an <code>account</code> field with a specific account ID from which to receive events. Rules with an account field do not match any events sent from other accounts.</p>"]
    #[serde(rename="Principal")]
    pub principal: String,
    #[doc="<p>An identifier string for the external account that you are granting permissions to. If you later want to revoke the permission for this external account, specify this <code>StatementId</code> when you run <a>RemovePermission</a>.</p>"]
    #[serde(rename="StatementId")]
    pub statement_id: String,
}

#[derive(Default,Debug,Clone,Serialize)]
pub struct PutRuleRequest {
    #[doc="<p>A description of the rule.</p>"]
    #[serde(rename="Description")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub description: Option<String>,
    #[doc="<p>The event pattern. For more information, see <a href=\"http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/CloudWatchEventsandEventPatterns.html\">Events and Event Patterns</a> in the <i>Amazon CloudWatch Events User Guide</i>.</p>"]
    #[serde(rename="EventPattern")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub event_pattern: Option<String>,
    #[doc="<p>The name of the rule that you are creating or updating.</p>"]
    #[serde(rename="Name")]
    pub name: String,
    #[doc="<p>The Amazon Resource Name (ARN) of the IAM role associated with the rule.</p>"]
    #[serde(rename="RoleArn")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub role_arn: Option<String>,
    #[doc="<p>The scheduling expression. For example, \"cron(0 20 * * ? *)\" or \"rate(5 minutes)\".</p>"]
    #[serde(rename="ScheduleExpression")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub schedule_expression: Option<String>,
    #[doc="<p>Indicates whether the rule is enabled or disabled.</p>"]
    #[serde(rename="State")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub state: Option<String>,
}

#[derive(Default,Debug,Clone,Deserialize)]
pub struct PutRuleResponse {
    #[doc="<p>The Amazon Resource Name (ARN) of the rule.</p>"]
    #[serde(rename="RuleArn")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub rule_arn: Option<String>,
}

#[derive(Default,Debug,Clone,Serialize)]
pub struct PutTargetsRequest {
    #[doc="<p>The name of the rule.</p>"]
    #[serde(rename="Rule")]
    pub rule: String,
    #[doc="<p>The targets to update or add to the rule.</p>"]
    #[serde(rename="Targets")]
    pub targets: Vec<Target>,
}

#[derive(Default,Debug,Clone,Deserialize)]
pub struct PutTargetsResponse {
    #[doc="<p>The failed target entries.</p>"]
    #[serde(rename="FailedEntries")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub failed_entries: Option<Vec<PutTargetsResultEntry>>,
    #[doc="<p>The number of failed entries.</p>"]
    #[serde(rename="FailedEntryCount")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub failed_entry_count: Option<i64>,
}

#[doc="<p>Represents a target that failed to be added to a rule.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct PutTargetsResultEntry {
    #[doc="<p>The error code that indicates why the target addition failed. If the value is <code>ConcurrentModificationException</code>, too many requests were made at the same time.</p>"]
    #[serde(rename="ErrorCode")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub error_code: Option<String>,
    #[doc="<p>The error message that explains why the target addition failed.</p>"]
    #[serde(rename="ErrorMessage")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub error_message: Option<String>,
    #[doc="<p>The ID of the target.</p>"]
    #[serde(rename="TargetId")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub target_id: Option<String>,
}

#[derive(Default,Debug,Clone,Serialize)]
pub struct RemovePermissionRequest {
    #[doc="<p>The statement ID corresponding to the account that is no longer allowed to put events to the default event bus.</p>"]
    #[serde(rename="StatementId")]
    pub statement_id: String,
}

#[derive(Default,Debug,Clone,Serialize)]
pub struct RemoveTargetsRequest {
    #[doc="<p>The IDs of the targets to remove from the rule.</p>"]
    #[serde(rename="Ids")]
    pub ids: Vec<String>,
    #[doc="<p>The name of the rule.</p>"]
    #[serde(rename="Rule")]
    pub rule: String,
}

#[derive(Default,Debug,Clone,Deserialize)]
pub struct RemoveTargetsResponse {
    #[doc="<p>The failed target entries.</p>"]
    #[serde(rename="FailedEntries")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub failed_entries: Option<Vec<RemoveTargetsResultEntry>>,
    #[doc="<p>The number of failed entries.</p>"]
    #[serde(rename="FailedEntryCount")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub failed_entry_count: Option<i64>,
}

#[doc="<p>Represents a target that failed to be removed from a rule.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct RemoveTargetsResultEntry {
    #[doc="<p>The error code that indicates why the target removal failed. If the value is <code>ConcurrentModificationException</code>, too many requests were made at the same time.</p>"]
    #[serde(rename="ErrorCode")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub error_code: Option<String>,
    #[doc="<p>The error message that explains why the target removal failed.</p>"]
    #[serde(rename="ErrorMessage")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub error_message: Option<String>,
    #[doc="<p>The ID of the target.</p>"]
    #[serde(rename="TargetId")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub target_id: Option<String>,
}

#[doc="<p>Contains information about a rule in Amazon CloudWatch Events.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct Rule {
    #[doc="<p>The Amazon Resource Name (ARN) of the rule.</p>"]
    #[serde(rename="Arn")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub arn: Option<String>,
    #[doc="<p>The description of the rule.</p>"]
    #[serde(rename="Description")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub description: Option<String>,
    #[doc="<p>The event pattern of the rule. For more information, see <a href=\"http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/CloudWatchEventsandEventPatterns.html\">Events and Event Patterns</a> in the <i>Amazon CloudWatch Events User Guide</i>.</p>"]
    #[serde(rename="EventPattern")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub event_pattern: Option<String>,
    #[doc="<p>The name of the rule.</p>"]
    #[serde(rename="Name")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub name: Option<String>,
    #[doc="<p>The Amazon Resource Name (ARN) of the role that is used for target invocation.</p>"]
    #[serde(rename="RoleArn")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub role_arn: Option<String>,
    #[doc="<p>The scheduling expression. For example, \"cron(0 20 * * ? *)\", \"rate(5 minutes)\".</p>"]
    #[serde(rename="ScheduleExpression")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub schedule_expression: Option<String>,
    #[doc="<p>The state of the rule.</p>"]
    #[serde(rename="State")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub state: Option<String>,
}

#[doc="<p>This parameter contains the criteria (either InstanceIds or a tag) used to specify which EC2 instances are to be sent the command. </p>"]
#[derive(Default,Debug,Clone,Serialize,Deserialize)]
pub struct RunCommandParameters {
    #[doc="<p>Currently, we support including only one RunCommandTarget block, which specifies either an array of InstanceIds or a tag.</p>"]
    #[serde(rename="RunCommandTargets")]
    pub run_command_targets: Vec<RunCommandTarget>,
}

#[doc="<p>Information about the EC2 instances that are to be sent the command, specified as key-value pairs. Each <code>RunCommandTarget</code> block can include only one key, but this key may specify multiple values.</p>"]
#[derive(Default,Debug,Clone,Serialize,Deserialize)]
pub struct RunCommandTarget {
    #[doc="<p>Can be either <code>tag:</code> <i>tag-key</i> or <code>InstanceIds</code>.</p>"]
    #[serde(rename="Key")]
    pub key: String,
    #[doc="<p>If <code>Key</code> is <code>tag:</code> <i>tag-key</i>, <code>Values</code> is a list of tag values. If <code>Key</code> is <code>InstanceIds</code>, <code>Values</code> is a list of Amazon EC2 instance IDs.</p>"]
    #[serde(rename="Values")]
    pub values: Vec<String>,
}

#[doc="<p>Targets are the resources to be invoked when a rule is triggered. Target types include EC2 instances, AWS Lambda functions, Amazon Kinesis streams, Amazon ECS tasks, AWS Step Functions state machines, Run Command, and built-in targets.</p>"]
#[derive(Default,Debug,Clone,Serialize,Deserialize)]
pub struct Target {
    #[doc="<p>The Amazon Resource Name (ARN) of the target.</p>"]
    #[serde(rename="Arn")]
    pub arn: String,
    #[doc="<p>Contains the Amazon ECS task definition and task count to be used, if the event target is an Amazon ECS task. For more information about Amazon ECS tasks, see <a href=\"http://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_defintions.html\">Task Definitions </a> in the <i>Amazon EC2 Container Service Developer Guide</i>.</p>"]
    #[serde(rename="EcsParameters")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub ecs_parameters: Option<EcsParameters>,
    #[doc="<p>The ID of the target.</p>"]
    #[serde(rename="Id")]
    pub id: String,
    #[doc="<p>Valid JSON text passed to the target. In this case, nothing from the event itself is passed to the target. You must use JSON dot notation, not bracket notation. For more information, see <a href=\"http://www.rfc-editor.org/rfc/rfc7159.txt\">The JavaScript Object Notation (JSON) Data Interchange Format</a>.</p>"]
    #[serde(rename="Input")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub input: Option<String>,
    #[doc="<p>The value of the JSONPath that is used for extracting part of the matched event when passing it to the target. You must use JSON dot notation, not bracket notation. For more information about JSON paths, see <a href=\"http://goessner.net/articles/JsonPath/\">JSONPath</a>.</p>"]
    #[serde(rename="InputPath")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub input_path: Option<String>,
    #[doc="<p>Settings to enable you to provide custom input to a target based on certain event data. You can extract one or more key-value pairs from the event and then use that data to send customized input to the target.</p>"]
    #[serde(rename="InputTransformer")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub input_transformer: Option<InputTransformer>,
    #[doc="<p>The custom parameter you can use to control shard assignment, when the target is an Amazon Kinesis stream. If you do not include this parameter, the default is to use the <code>eventId</code> as the partition key.</p>"]
    #[serde(rename="KinesisParameters")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub kinesis_parameters: Option<KinesisParameters>,
    #[doc="<p>The Amazon Resource Name (ARN) of the IAM role to be used for this target when the rule is triggered. If one rule triggers multiple targets, you can use a different IAM role for each target.</p>"]
    #[serde(rename="RoleArn")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub role_arn: Option<String>,
    #[doc="<p>Parameters used when you are using the rule to invoke Amazon EC2 Run Command.</p>"]
    #[serde(rename="RunCommandParameters")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub run_command_parameters: Option<RunCommandParameters>,
}

#[derive(Default,Debug,Clone,Serialize)]
pub struct TestEventPatternRequest {
    #[doc="<p>The event, in JSON format, to test against the event pattern.</p>"]
    #[serde(rename="Event")]
    pub event: String,
    #[doc="<p>The event pattern. For more information, see <a href=\"http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/CloudWatchEventsandEventPatterns.html\">Events and Event Patterns</a> in the <i>Amazon CloudWatch Events User Guide</i>.</p>"]
    #[serde(rename="EventPattern")]
    pub event_pattern: String,
}

#[derive(Default,Debug,Clone,Deserialize)]
pub struct TestEventPatternResponse {
    #[doc="<p>Indicates whether the event matches the event pattern.</p>"]
    #[serde(rename="Result")]
    #[serde(skip_serializing_if="Option::is_none")]
    pub result: Option<bool>,
}

/// Errors returned by DeleteRule
#[derive(Debug, PartialEq)]
pub enum DeleteRuleError {
    ///<p>There is concurrent modification on a rule or target.</p>
    ConcurrentModification(String),
    ///<p>This exception occurs due to unexpected causes.</p>
    Internal(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 DeleteRuleError {
    pub fn from_body(body: &str) -> DeleteRuleError {
        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 {
                    "ConcurrentModificationException" => {
                        DeleteRuleError::ConcurrentModification(String::from(error_message))
                    }
                    "InternalException" => DeleteRuleError::Internal(String::from(error_message)),
                    "ValidationException" => DeleteRuleError::Validation(error_message.to_string()),
                    _ => DeleteRuleError::Unknown(String::from(body)),
                }
            }
            Err(_) => DeleteRuleError::Unknown(String::from(body)),
        }
    }
}

impl From<serde_json::error::Error> for DeleteRuleError {
    fn from(err: serde_json::error::Error) -> DeleteRuleError {
        DeleteRuleError::Unknown(err.description().to_string())
    }
}
impl From<CredentialsError> for DeleteRuleError {
    fn from(err: CredentialsError) -> DeleteRuleError {
        DeleteRuleError::Credentials(err)
    }
}
impl From<HttpDispatchError> for DeleteRuleError {
    fn from(err: HttpDispatchError) -> DeleteRuleError {
        DeleteRuleError::HttpDispatch(err)
    }
}
impl From<io::Error> for DeleteRuleError {
    fn from(err: io::Error) -> DeleteRuleError {
        DeleteRuleError::HttpDispatch(HttpDispatchError::from(err))
    }
}
impl fmt::Display for DeleteRuleError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.description())
    }
}
impl Error for DeleteRuleError {
    fn description(&self) -> &str {
        match *self {
            DeleteRuleError::ConcurrentModification(ref cause) => cause,
            DeleteRuleError::Internal(ref cause) => cause,
            DeleteRuleError::Validation(ref cause) => cause,
            DeleteRuleError::Credentials(ref err) => err.description(),
            DeleteRuleError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
            DeleteRuleError::Unknown(ref cause) => cause,
        }
    }
}
/// Errors returned by DescribeEventBus
#[derive(Debug, PartialEq)]
pub enum DescribeEventBusError {
    ///<p>This exception occurs due to unexpected causes.</p>
    Internal(String),
    ///<p>An entity that you specified does not exist.</p>
    ResourceNotFound(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 DescribeEventBusError {
    pub fn from_body(body: &str) -> DescribeEventBusError {
        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 {
                    "InternalException" => {
                        DescribeEventBusError::Internal(String::from(error_message))
                    }
                    "ResourceNotFoundException" => {
                        DescribeEventBusError::ResourceNotFound(String::from(error_message))
                    }
                    "ValidationException" => {
                        DescribeEventBusError::Validation(error_message.to_string())
                    }
                    _ => DescribeEventBusError::Unknown(String::from(body)),
                }
            }
            Err(_) => DescribeEventBusError::Unknown(String::from(body)),
        }
    }
}

impl From<serde_json::error::Error> for DescribeEventBusError {
    fn from(err: serde_json::error::Error) -> DescribeEventBusError {
        DescribeEventBusError::Unknown(err.description().to_string())
    }
}
impl From<CredentialsError> for DescribeEventBusError {
    fn from(err: CredentialsError) -> DescribeEventBusError {
        DescribeEventBusError::Credentials(err)
    }
}
impl From<HttpDispatchError> for DescribeEventBusError {
    fn from(err: HttpDispatchError) -> DescribeEventBusError {
        DescribeEventBusError::HttpDispatch(err)
    }
}
impl From<io::Error> for DescribeEventBusError {
    fn from(err: io::Error) -> DescribeEventBusError {
        DescribeEventBusError::HttpDispatch(HttpDispatchError::from(err))
    }
}
impl fmt::Display for DescribeEventBusError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.description())
    }
}
impl Error for DescribeEventBusError {
    fn description(&self) -> &str {
        match *self {
            DescribeEventBusError::Internal(ref cause) => cause,
            DescribeEventBusError::ResourceNotFound(ref cause) => cause,
            DescribeEventBusError::Validation(ref cause) => cause,
            DescribeEventBusError::Credentials(ref err) => err.description(),
            DescribeEventBusError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
            DescribeEventBusError::Unknown(ref cause) => cause,
        }
    }
}
/// Errors returned by DescribeRule
#[derive(Debug, PartialEq)]
pub enum DescribeRuleError {
    ///<p>This exception occurs due to unexpected causes.</p>
    Internal(String),
    ///<p>An entity that you specified does not exist.</p>
    ResourceNotFound(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 DescribeRuleError {
    pub fn from_body(body: &str) -> DescribeRuleError {
        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 {
                    "InternalException" => DescribeRuleError::Internal(String::from(error_message)),
                    "ResourceNotFoundException" => {
                        DescribeRuleError::ResourceNotFound(String::from(error_message))
                    }
                    "ValidationException" => {
                        DescribeRuleError::Validation(error_message.to_string())
                    }
                    _ => DescribeRuleError::Unknown(String::from(body)),
                }
            }
            Err(_) => DescribeRuleError::Unknown(String::from(body)),
        }
    }
}

impl From<serde_json::error::Error> for DescribeRuleError {
    fn from(err: serde_json::error::Error) -> DescribeRuleError {
        DescribeRuleError::Unknown(err.description().to_string())
    }
}
impl From<CredentialsError> for DescribeRuleError {
    fn from(err: CredentialsError) -> DescribeRuleError {
        DescribeRuleError::Credentials(err)
    }
}
impl From<HttpDispatchError> for DescribeRuleError {
    fn from(err: HttpDispatchError) -> DescribeRuleError {
        DescribeRuleError::HttpDispatch(err)
    }
}
impl From<io::Error> for DescribeRuleError {
    fn from(err: io::Error) -> DescribeRuleError {
        DescribeRuleError::HttpDispatch(HttpDispatchError::from(err))
    }
}
impl fmt::Display for DescribeRuleError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.description())
    }
}
impl Error for DescribeRuleError {
    fn description(&self) -> &str {
        match *self {
            DescribeRuleError::Internal(ref cause) => cause,
            DescribeRuleError::ResourceNotFound(ref cause) => cause,
            DescribeRuleError::Validation(ref cause) => cause,
            DescribeRuleError::Credentials(ref err) => err.description(),
            DescribeRuleError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
            DescribeRuleError::Unknown(ref cause) => cause,
        }
    }
}
/// Errors returned by DisableRule
#[derive(Debug, PartialEq)]
pub enum DisableRuleError {
    ///<p>There is concurrent modification on a rule or target.</p>
    ConcurrentModification(String),
    ///<p>This exception occurs due to unexpected causes.</p>
    Internal(String),
    ///<p>An entity that you specified does not exist.</p>
    ResourceNotFound(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 DisableRuleError {
    pub fn from_body(body: &str) -> DisableRuleError {
        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 {
                    "ConcurrentModificationException" => {
                        DisableRuleError::ConcurrentModification(String::from(error_message))
                    }
                    "InternalException" => DisableRuleError::Internal(String::from(error_message)),
                    "ResourceNotFoundException" => {
                        DisableRuleError::ResourceNotFound(String::from(error_message))
                    }
                    "ValidationException" => {
                        DisableRuleError::Validation(error_message.to_string())
                    }
                    _ => DisableRuleError::Unknown(String::from(body)),
                }
            }
            Err(_) => DisableRuleError::Unknown(String::from(body)),
        }
    }
}

impl From<serde_json::error::Error> for DisableRuleError {
    fn from(err: serde_json::error::Error) -> DisableRuleError {
        DisableRuleError::Unknown(err.description().to_string())
    }
}
impl From<CredentialsError> for DisableRuleError {
    fn from(err: CredentialsError) -> DisableRuleError {
        DisableRuleError::Credentials(err)
    }
}
impl From<HttpDispatchError> for DisableRuleError {
    fn from(err: HttpDispatchError) -> DisableRuleError {
        DisableRuleError::HttpDispatch(err)
    }
}
impl From<io::Error> for DisableRuleError {
    fn from(err: io::Error) -> DisableRuleError {
        DisableRuleError::HttpDispatch(HttpDispatchError::from(err))
    }
}
impl fmt::Display for DisableRuleError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.description())
    }
}
impl Error for DisableRuleError {
    fn description(&self) -> &str {
        match *self {
            DisableRuleError::ConcurrentModification(ref cause) => cause,
            DisableRuleError::Internal(ref cause) => cause,
            DisableRuleError::ResourceNotFound(ref cause) => cause,
            DisableRuleError::Validation(ref cause) => cause,
            DisableRuleError::Credentials(ref err) => err.description(),
            DisableRuleError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
            DisableRuleError::Unknown(ref cause) => cause,
        }
    }
}
/// Errors returned by EnableRule
#[derive(Debug, PartialEq)]
pub enum EnableRuleError {
    ///<p>There is concurrent modification on a rule or target.</p>
    ConcurrentModification(String),
    ///<p>This exception occurs due to unexpected causes.</p>
    Internal(String),
    ///<p>An entity that you specified does not exist.</p>
    ResourceNotFound(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 EnableRuleError {
    pub fn from_body(body: &str) -> EnableRuleError {
        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 {
                    "ConcurrentModificationException" => {
                        EnableRuleError::ConcurrentModification(String::from(error_message))
                    }
                    "InternalException" => EnableRuleError::Internal(String::from(error_message)),
                    "ResourceNotFoundException" => {
                        EnableRuleError::ResourceNotFound(String::from(error_message))
                    }
                    "ValidationException" => EnableRuleError::Validation(error_message.to_string()),
                    _ => EnableRuleError::Unknown(String::from(body)),
                }
            }
            Err(_) => EnableRuleError::Unknown(String::from(body)),
        }
    }
}

impl From<serde_json::error::Error> for EnableRuleError {
    fn from(err: serde_json::error::Error) -> EnableRuleError {
        EnableRuleError::Unknown(err.description().to_string())
    }
}
impl From<CredentialsError> for EnableRuleError {
    fn from(err: CredentialsError) -> EnableRuleError {
        EnableRuleError::Credentials(err)
    }
}
impl From<HttpDispatchError> for EnableRuleError {
    fn from(err: HttpDispatchError) -> EnableRuleError {
        EnableRuleError::HttpDispatch(err)
    }
}
impl From<io::Error> for EnableRuleError {
    fn from(err: io::Error) -> EnableRuleError {
        EnableRuleError::HttpDispatch(HttpDispatchError::from(err))
    }
}
impl fmt::Display for EnableRuleError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.description())
    }
}
impl Error for EnableRuleError {
    fn description(&self) -> &str {
        match *self {
            EnableRuleError::ConcurrentModification(ref cause) => cause,
            EnableRuleError::Internal(ref cause) => cause,
            EnableRuleError::ResourceNotFound(ref cause) => cause,
            EnableRuleError::Validation(ref cause) => cause,
            EnableRuleError::Credentials(ref err) => err.description(),
            EnableRuleError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
            EnableRuleError::Unknown(ref cause) => cause,
        }
    }
}
/// Errors returned by ListRuleNamesByTarget
#[derive(Debug, PartialEq)]
pub enum ListRuleNamesByTargetError {
    ///<p>This exception occurs due to unexpected causes.</p>
    Internal(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 ListRuleNamesByTargetError {
    pub fn from_body(body: &str) -> ListRuleNamesByTargetError {
        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 {
                    "InternalException" => {
                        ListRuleNamesByTargetError::Internal(String::from(error_message))
                    }
                    "ValidationException" => {
                        ListRuleNamesByTargetError::Validation(error_message.to_string())
                    }
                    _ => ListRuleNamesByTargetError::Unknown(String::from(body)),
                }
            }
            Err(_) => ListRuleNamesByTargetError::Unknown(String::from(body)),
        }
    }
}

impl From<serde_json::error::Error> for ListRuleNamesByTargetError {
    fn from(err: serde_json::error::Error) -> ListRuleNamesByTargetError {
        ListRuleNamesByTargetError::Unknown(err.description().to_string())
    }
}
impl From<CredentialsError> for ListRuleNamesByTargetError {
    fn from(err: CredentialsError) -> ListRuleNamesByTargetError {
        ListRuleNamesByTargetError::Credentials(err)
    }
}
impl From<HttpDispatchError> for ListRuleNamesByTargetError {
    fn from(err: HttpDispatchError) -> ListRuleNamesByTargetError {
        ListRuleNamesByTargetError::HttpDispatch(err)
    }
}
impl From<io::Error> for ListRuleNamesByTargetError {
    fn from(err: io::Error) -> ListRuleNamesByTargetError {
        ListRuleNamesByTargetError::HttpDispatch(HttpDispatchError::from(err))
    }
}
impl fmt::Display for ListRuleNamesByTargetError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.description())
    }
}
impl Error for ListRuleNamesByTargetError {
    fn description(&self) -> &str {
        match *self {
            ListRuleNamesByTargetError::Internal(ref cause) => cause,
            ListRuleNamesByTargetError::Validation(ref cause) => cause,
            ListRuleNamesByTargetError::Credentials(ref err) => err.description(),
            ListRuleNamesByTargetError::HttpDispatch(ref dispatch_error) => {
                dispatch_error.description()
            }
            ListRuleNamesByTargetError::Unknown(ref cause) => cause,
        }
    }
}
/// Errors returned by ListRules
#[derive(Debug, PartialEq)]
pub enum ListRulesError {
    ///<p>This exception occurs due to unexpected causes.</p>
    Internal(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 ListRulesError {
    pub fn from_body(body: &str) -> ListRulesError {
        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 {
                    "InternalException" => ListRulesError::Internal(String::from(error_message)),
                    "ValidationException" => ListRulesError::Validation(error_message.to_string()),
                    _ => ListRulesError::Unknown(String::from(body)),
                }
            }
            Err(_) => ListRulesError::Unknown(String::from(body)),
        }
    }
}

impl From<serde_json::error::Error> for ListRulesError {
    fn from(err: serde_json::error::Error) -> ListRulesError {
        ListRulesError::Unknown(err.description().to_string())
    }
}
impl From<CredentialsError> for ListRulesError {
    fn from(err: CredentialsError) -> ListRulesError {
        ListRulesError::Credentials(err)
    }
}
impl From<HttpDispatchError> for ListRulesError {
    fn from(err: HttpDispatchError) -> ListRulesError {
        ListRulesError::HttpDispatch(err)
    }
}
impl From<io::Error> for ListRulesError {
    fn from(err: io::Error) -> ListRulesError {
        ListRulesError::HttpDispatch(HttpDispatchError::from(err))
    }
}
impl fmt::Display for ListRulesError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.description())
    }
}
impl Error for ListRulesError {
    fn description(&self) -> &str {
        match *self {
            ListRulesError::Internal(ref cause) => cause,
            ListRulesError::Validation(ref cause) => cause,
            ListRulesError::Credentials(ref err) => err.description(),
            ListRulesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
            ListRulesError::Unknown(ref cause) => cause,
        }
    }
}
/// Errors returned by ListTargetsByRule
#[derive(Debug, PartialEq)]
pub enum ListTargetsByRuleError {
    ///<p>This exception occurs due to unexpected causes.</p>
    Internal(String),
    ///<p>An entity that you specified does not exist.</p>
    ResourceNotFound(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 ListTargetsByRuleError {
    pub fn from_body(body: &str) -> ListTargetsByRuleError {
        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 {
                    "InternalException" => {
                        ListTargetsByRuleError::Internal(String::from(error_message))
                    }
                    "ResourceNotFoundException" => {
                        ListTargetsByRuleError::ResourceNotFound(String::from(error_message))
                    }
                    "ValidationException" => {
                        ListTargetsByRuleError::Validation(error_message.to_string())
                    }
                    _ => ListTargetsByRuleError::Unknown(String::from(body)),
                }
            }
            Err(_) => ListTargetsByRuleError::Unknown(String::from(body)),
        }
    }
}

impl From<serde_json::error::Error> for ListTargetsByRuleError {
    fn from(err: serde_json::error::Error) -> ListTargetsByRuleError {
        ListTargetsByRuleError::Unknown(err.description().to_string())
    }
}
impl From<CredentialsError> for ListTargetsByRuleError {
    fn from(err: CredentialsError) -> ListTargetsByRuleError {
        ListTargetsByRuleError::Credentials(err)
    }
}
impl From<HttpDispatchError> for ListTargetsByRuleError {
    fn from(err: HttpDispatchError) -> ListTargetsByRuleError {
        ListTargetsByRuleError::HttpDispatch(err)
    }
}
impl From<io::Error> for ListTargetsByRuleError {
    fn from(err: io::Error) -> ListTargetsByRuleError {
        ListTargetsByRuleError::HttpDispatch(HttpDispatchError::from(err))
    }
}
impl fmt::Display for ListTargetsByRuleError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.description())
    }
}
impl Error for ListTargetsByRuleError {
    fn description(&self) -> &str {
        match *self {
            ListTargetsByRuleError::Internal(ref cause) => cause,
            ListTargetsByRuleError::ResourceNotFound(ref cause) => cause,
            ListTargetsByRuleError::Validation(ref cause) => cause,
            ListTargetsByRuleError::Credentials(ref err) => err.description(),
            ListTargetsByRuleError::HttpDispatch(ref dispatch_error) => {
                dispatch_error.description()
            }
            ListTargetsByRuleError::Unknown(ref cause) => cause,
        }
    }
}
/// Errors returned by PutEvents
#[derive(Debug, PartialEq)]
pub enum PutEventsError {
    ///<p>This exception occurs due to unexpected causes.</p>
    Internal(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 PutEventsError {
    pub fn from_body(body: &str) -> PutEventsError {
        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 {
                    "InternalException" => PutEventsError::Internal(String::from(error_message)),
                    "ValidationException" => PutEventsError::Validation(error_message.to_string()),
                    _ => PutEventsError::Unknown(String::from(body)),
                }
            }
            Err(_) => PutEventsError::Unknown(String::from(body)),
        }
    }
}

impl From<serde_json::error::Error> for PutEventsError {
    fn from(err: serde_json::error::Error) -> PutEventsError {
        PutEventsError::Unknown(err.description().to_string())
    }
}
impl From<CredentialsError> for PutEventsError {
    fn from(err: CredentialsError) -> PutEventsError {
        PutEventsError::Credentials(err)
    }
}
impl From<HttpDispatchError> for PutEventsError {
    fn from(err: HttpDispatchError) -> PutEventsError {
        PutEventsError::HttpDispatch(err)
    }
}
impl From<io::Error> for PutEventsError {
    fn from(err: io::Error) -> PutEventsError {
        PutEventsError::HttpDispatch(HttpDispatchError::from(err))
    }
}
impl fmt::Display for PutEventsError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.description())
    }
}
impl Error for PutEventsError {
    fn description(&self) -> &str {
        match *self {
            PutEventsError::Internal(ref cause) => cause,
            PutEventsError::Validation(ref cause) => cause,
            PutEventsError::Credentials(ref err) => err.description(),
            PutEventsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
            PutEventsError::Unknown(ref cause) => cause,
        }
    }
}
/// Errors returned by PutPermission
#[derive(Debug, PartialEq)]
pub enum PutPermissionError {
    ///<p>This exception occurs due to unexpected causes.</p>
    Internal(String),
    ///<p>The event bus policy is too long. For more information, see the limits.</p>
    PolicyLengthExceeded(String),
    ///<p>An entity that you specified does not exist.</p>
    ResourceNotFound(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 PutPermissionError {
    pub fn from_body(body: &str) -> PutPermissionError {
        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 {
                    "InternalException" => {
                        PutPermissionError::Internal(String::from(error_message))
                    }
                    "PolicyLengthExceededException" => {
                        PutPermissionError::PolicyLengthExceeded(String::from(error_message))
                    }
                    "ResourceNotFoundException" => {
                        PutPermissionError::ResourceNotFound(String::from(error_message))
                    }
                    "ValidationException" => {
                        PutPermissionError::Validation(error_message.to_string())
                    }
                    _ => PutPermissionError::Unknown(String::from(body)),
                }
            }
            Err(_) => PutPermissionError::Unknown(String::from(body)),
        }
    }
}

impl From<serde_json::error::Error> for PutPermissionError {
    fn from(err: serde_json::error::Error) -> PutPermissionError {
        PutPermissionError::Unknown(err.description().to_string())
    }
}
impl From<CredentialsError> for PutPermissionError {
    fn from(err: CredentialsError) -> PutPermissionError {
        PutPermissionError::Credentials(err)
    }
}
impl From<HttpDispatchError> for PutPermissionError {
    fn from(err: HttpDispatchError) -> PutPermissionError {
        PutPermissionError::HttpDispatch(err)
    }
}
impl From<io::Error> for PutPermissionError {
    fn from(err: io::Error) -> PutPermissionError {
        PutPermissionError::HttpDispatch(HttpDispatchError::from(err))
    }
}
impl fmt::Display for PutPermissionError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.description())
    }
}
impl Error for PutPermissionError {
    fn description(&self) -> &str {
        match *self {
            PutPermissionError::Internal(ref cause) => cause,
            PutPermissionError::PolicyLengthExceeded(ref cause) => cause,
            PutPermissionError::ResourceNotFound(ref cause) => cause,
            PutPermissionError::Validation(ref cause) => cause,
            PutPermissionError::Credentials(ref err) => err.description(),
            PutPermissionError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
            PutPermissionError::Unknown(ref cause) => cause,
        }
    }
}
/// Errors returned by PutRule
#[derive(Debug, PartialEq)]
pub enum PutRuleError {
    ///<p>There is concurrent modification on a rule or target.</p>
    ConcurrentModification(String),
    ///<p>This exception occurs due to unexpected causes.</p>
    Internal(String),
    ///<p>The event pattern is not valid.</p>
    InvalidEventPattern(String),
    ///<p>You tried to create more rules or add more targets to a rule than is allowed.</p>
    LimitExceeded(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 PutRuleError {
    pub fn from_body(body: &str) -> PutRuleError {
        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 {
                    "ConcurrentModificationException" => {
                        PutRuleError::ConcurrentModification(String::from(error_message))
                    }
                    "InternalException" => PutRuleError::Internal(String::from(error_message)),
                    "InvalidEventPatternException" => {
                        PutRuleError::InvalidEventPattern(String::from(error_message))
                    }
                    "LimitExceededException" => {
                        PutRuleError::LimitExceeded(String::from(error_message))
                    }
                    "ValidationException" => PutRuleError::Validation(error_message.to_string()),
                    _ => PutRuleError::Unknown(String::from(body)),
                }
            }
            Err(_) => PutRuleError::Unknown(String::from(body)),
        }
    }
}

impl From<serde_json::error::Error> for PutRuleError {
    fn from(err: serde_json::error::Error) -> PutRuleError {
        PutRuleError::Unknown(err.description().to_string())
    }
}
impl From<CredentialsError> for PutRuleError {
    fn from(err: CredentialsError) -> PutRuleError {
        PutRuleError::Credentials(err)
    }
}
impl From<HttpDispatchError> for PutRuleError {
    fn from(err: HttpDispatchError) -> PutRuleError {
        PutRuleError::HttpDispatch(err)
    }
}
impl From<io::Error> for PutRuleError {
    fn from(err: io::Error) -> PutRuleError {
        PutRuleError::HttpDispatch(HttpDispatchError::from(err))
    }
}
impl fmt::Display for PutRuleError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.description())
    }
}
impl Error for PutRuleError {
    fn description(&self) -> &str {
        match *self {
            PutRuleError::ConcurrentModification(ref cause) => cause,
            PutRuleError::Internal(ref cause) => cause,
            PutRuleError::InvalidEventPattern(ref cause) => cause,
            PutRuleError::LimitExceeded(ref cause) => cause,
            PutRuleError::Validation(ref cause) => cause,
            PutRuleError::Credentials(ref err) => err.description(),
            PutRuleError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
            PutRuleError::Unknown(ref cause) => cause,
        }
    }
}
/// Errors returned by PutTargets
#[derive(Debug, PartialEq)]
pub enum PutTargetsError {
    ///<p>There is concurrent modification on a rule or target.</p>
    ConcurrentModification(String),
    ///<p>This exception occurs due to unexpected causes.</p>
    Internal(String),
    ///<p>You tried to create more rules or add more targets to a rule than is allowed.</p>
    LimitExceeded(String),
    ///<p>An entity that you specified does not exist.</p>
    ResourceNotFound(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 PutTargetsError {
    pub fn from_body(body: &str) -> PutTargetsError {
        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 {
                    "ConcurrentModificationException" => {
                        PutTargetsError::ConcurrentModification(String::from(error_message))
                    }
                    "InternalException" => PutTargetsError::Internal(String::from(error_message)),
                    "LimitExceededException" => {
                        PutTargetsError::LimitExceeded(String::from(error_message))
                    }
                    "ResourceNotFoundException" => {
                        PutTargetsError::ResourceNotFound(String::from(error_message))
                    }
                    "ValidationException" => PutTargetsError::Validation(error_message.to_string()),
                    _ => PutTargetsError::Unknown(String::from(body)),
                }
            }
            Err(_) => PutTargetsError::Unknown(String::from(body)),
        }
    }
}

impl From<serde_json::error::Error> for PutTargetsError {
    fn from(err: serde_json::error::Error) -> PutTargetsError {
        PutTargetsError::Unknown(err.description().to_string())
    }
}
impl From<CredentialsError> for PutTargetsError {
    fn from(err: CredentialsError) -> PutTargetsError {
        PutTargetsError::Credentials(err)
    }
}
impl From<HttpDispatchError> for PutTargetsError {
    fn from(err: HttpDispatchError) -> PutTargetsError {
        PutTargetsError::HttpDispatch(err)
    }
}
impl From<io::Error> for PutTargetsError {
    fn from(err: io::Error) -> PutTargetsError {
        PutTargetsError::HttpDispatch(HttpDispatchError::from(err))
    }
}
impl fmt::Display for PutTargetsError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.description())
    }
}
impl Error for PutTargetsError {
    fn description(&self) -> &str {
        match *self {
            PutTargetsError::ConcurrentModification(ref cause) => cause,
            PutTargetsError::Internal(ref cause) => cause,
            PutTargetsError::LimitExceeded(ref cause) => cause,
            PutTargetsError::ResourceNotFound(ref cause) => cause,
            PutTargetsError::Validation(ref cause) => cause,
            PutTargetsError::Credentials(ref err) => err.description(),
            PutTargetsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
            PutTargetsError::Unknown(ref cause) => cause,
        }
    }
}
/// Errors returned by RemovePermission
#[derive(Debug, PartialEq)]
pub enum RemovePermissionError {
    ///<p>This exception occurs due to unexpected causes.</p>
    Internal(String),
    ///<p>An entity that you specified does not exist.</p>
    ResourceNotFound(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 RemovePermissionError {
    pub fn from_body(body: &str) -> RemovePermissionError {
        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 {
                    "InternalException" => {
                        RemovePermissionError::Internal(String::from(error_message))
                    }
                    "ResourceNotFoundException" => {
                        RemovePermissionError::ResourceNotFound(String::from(error_message))
                    }
                    "ValidationException" => {
                        RemovePermissionError::Validation(error_message.to_string())
                    }
                    _ => RemovePermissionError::Unknown(String::from(body)),
                }
            }
            Err(_) => RemovePermissionError::Unknown(String::from(body)),
        }
    }
}

impl From<serde_json::error::Error> for RemovePermissionError {
    fn from(err: serde_json::error::Error) -> RemovePermissionError {
        RemovePermissionError::Unknown(err.description().to_string())
    }
}
impl From<CredentialsError> for RemovePermissionError {
    fn from(err: CredentialsError) -> RemovePermissionError {
        RemovePermissionError::Credentials(err)
    }
}
impl From<HttpDispatchError> for RemovePermissionError {
    fn from(err: HttpDispatchError) -> RemovePermissionError {
        RemovePermissionError::HttpDispatch(err)
    }
}
impl From<io::Error> for RemovePermissionError {
    fn from(err: io::Error) -> RemovePermissionError {
        RemovePermissionError::HttpDispatch(HttpDispatchError::from(err))
    }
}
impl fmt::Display for RemovePermissionError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.description())
    }
}
impl Error for RemovePermissionError {
    fn description(&self) -> &str {
        match *self {
            RemovePermissionError::Internal(ref cause) => cause,
            RemovePermissionError::ResourceNotFound(ref cause) => cause,
            RemovePermissionError::Validation(ref cause) => cause,
            RemovePermissionError::Credentials(ref err) => err.description(),
            RemovePermissionError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
            RemovePermissionError::Unknown(ref cause) => cause,
        }
    }
}
/// Errors returned by RemoveTargets
#[derive(Debug, PartialEq)]
pub enum RemoveTargetsError {
    ///<p>There is concurrent modification on a rule or target.</p>
    ConcurrentModification(String),
    ///<p>This exception occurs due to unexpected causes.</p>
    Internal(String),
    ///<p>An entity that you specified does not exist.</p>
    ResourceNotFound(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 RemoveTargetsError {
    pub fn from_body(body: &str) -> RemoveTargetsError {
        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 {
                    "ConcurrentModificationException" => {
                        RemoveTargetsError::ConcurrentModification(String::from(error_message))
                    }
                    "InternalException" => {
                        RemoveTargetsError::Internal(String::from(error_message))
                    }
                    "ResourceNotFoundException" => {
                        RemoveTargetsError::ResourceNotFound(String::from(error_message))
                    }
                    "ValidationException" => {
                        RemoveTargetsError::Validation(error_message.to_string())
                    }
                    _ => RemoveTargetsError::Unknown(String::from(body)),
                }
            }
            Err(_) => RemoveTargetsError::Unknown(String::from(body)),
        }
    }
}

impl From<serde_json::error::Error> for RemoveTargetsError {
    fn from(err: serde_json::error::Error) -> RemoveTargetsError {
        RemoveTargetsError::Unknown(err.description().to_string())
    }
}
impl From<CredentialsError> for RemoveTargetsError {
    fn from(err: CredentialsError) -> RemoveTargetsError {
        RemoveTargetsError::Credentials(err)
    }
}
impl From<HttpDispatchError> for RemoveTargetsError {
    fn from(err: HttpDispatchError) -> RemoveTargetsError {
        RemoveTargetsError::HttpDispatch(err)
    }
}
impl From<io::Error> for RemoveTargetsError {
    fn from(err: io::Error) -> RemoveTargetsError {
        RemoveTargetsError::HttpDispatch(HttpDispatchError::from(err))
    }
}
impl fmt::Display for RemoveTargetsError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.description())
    }
}
impl Error for RemoveTargetsError {
    fn description(&self) -> &str {
        match *self {
            RemoveTargetsError::ConcurrentModification(ref cause) => cause,
            RemoveTargetsError::Internal(ref cause) => cause,
            RemoveTargetsError::ResourceNotFound(ref cause) => cause,
            RemoveTargetsError::Validation(ref cause) => cause,
            RemoveTargetsError::Credentials(ref err) => err.description(),
            RemoveTargetsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
            RemoveTargetsError::Unknown(ref cause) => cause,
        }
    }
}
/// Errors returned by TestEventPattern
#[derive(Debug, PartialEq)]
pub enum TestEventPatternError {
    ///<p>This exception occurs due to unexpected causes.</p>
    Internal(String),
    ///<p>The event pattern is not valid.</p>
    InvalidEventPattern(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 TestEventPatternError {
    pub fn from_body(body: &str) -> TestEventPatternError {
        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 {
                    "InternalException" => {
                        TestEventPatternError::Internal(String::from(error_message))
                    }
                    "InvalidEventPatternException" => {
                        TestEventPatternError::InvalidEventPattern(String::from(error_message))
                    }
                    "ValidationException" => {
                        TestEventPatternError::Validation(error_message.to_string())
                    }
                    _ => TestEventPatternError::Unknown(String::from(body)),
                }
            }
            Err(_) => TestEventPatternError::Unknown(String::from(body)),
        }
    }
}

impl From<serde_json::error::Error> for TestEventPatternError {
    fn from(err: serde_json::error::Error) -> TestEventPatternError {
        TestEventPatternError::Unknown(err.description().to_string())
    }
}
impl From<CredentialsError> for TestEventPatternError {
    fn from(err: CredentialsError) -> TestEventPatternError {
        TestEventPatternError::Credentials(err)
    }
}
impl From<HttpDispatchError> for TestEventPatternError {
    fn from(err: HttpDispatchError) -> TestEventPatternError {
        TestEventPatternError::HttpDispatch(err)
    }
}
impl From<io::Error> for TestEventPatternError {
    fn from(err: io::Error) -> TestEventPatternError {
        TestEventPatternError::HttpDispatch(HttpDispatchError::from(err))
    }
}
impl fmt::Display for TestEventPatternError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.description())
    }
}
impl Error for TestEventPatternError {
    fn description(&self) -> &str {
        match *self {
            TestEventPatternError::Internal(ref cause) => cause,
            TestEventPatternError::InvalidEventPattern(ref cause) => cause,
            TestEventPatternError::Validation(ref cause) => cause,
            TestEventPatternError::Credentials(ref err) => err.description(),
            TestEventPatternError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
            TestEventPatternError::Unknown(ref cause) => cause,
        }
    }
}
/// Trait representing the capabilities of the Amazon CloudWatch Events API. Amazon CloudWatch Events clients implement this trait.
pub trait CloudWatchEvents {
    #[doc="<p>Deletes the specified rule.</p> <p>You must remove all targets from a rule using <a>RemoveTargets</a> before you can delete the rule.</p> <p>When you delete a rule, incoming events might continue to match to the deleted rule. Please allow a short period of time for changes to take effect.</p>"]
    fn delete_rule(&self, input: &DeleteRuleRequest) -> Result<(), DeleteRuleError>;


    #[doc="<p>Displays the external AWS accounts that are permitted to write events to your account using your account's event bus, and the associated policy. To enable your account to receive events from other accounts, use <a>PutPermission</a>.</p>"]
    fn describe_event_bus(&self) -> Result<DescribeEventBusResponse, DescribeEventBusError>;


    #[doc="<p>Describes the specified rule.</p>"]
    fn describe_rule(&self,
                     input: &DescribeRuleRequest)
                     -> Result<DescribeRuleResponse, DescribeRuleError>;


    #[doc="<p>Disables the specified rule. A disabled rule won't match any events, and won't self-trigger if it has a schedule expression.</p> <p>When you disable a rule, incoming events might continue to match to the disabled rule. Please allow a short period of time for changes to take effect.</p>"]
    fn disable_rule(&self, input: &DisableRuleRequest) -> Result<(), DisableRuleError>;


    #[doc="<p>Enables the specified rule. If the rule does not exist, the operation fails.</p> <p>When you enable a rule, incoming events might not immediately start matching to a newly enabled rule. Please allow a short period of time for changes to take effect.</p>"]
    fn enable_rule(&self, input: &EnableRuleRequest) -> Result<(), EnableRuleError>;


    #[doc="<p>Lists the rules for the specified target. You can see which of the rules in Amazon CloudWatch Events can invoke a specific target in your account.</p>"]
    fn list_rule_names_by_target
        (&self,
         input: &ListRuleNamesByTargetRequest)
         -> Result<ListRuleNamesByTargetResponse, ListRuleNamesByTargetError>;


    #[doc="<p>Lists your Amazon CloudWatch Events rules. You can either list all the rules or you can provide a prefix to match to the rule names.</p>"]
    fn list_rules(&self, input: &ListRulesRequest) -> Result<ListRulesResponse, ListRulesError>;


    #[doc="<p>Lists the targets assigned to the specified rule.</p>"]
    fn list_targets_by_rule(&self,
                            input: &ListTargetsByRuleRequest)
                            -> Result<ListTargetsByRuleResponse, ListTargetsByRuleError>;


    #[doc="<p>Sends custom events to Amazon CloudWatch Events so that they can be matched to rules.</p>"]
    fn put_events(&self, input: &PutEventsRequest) -> Result<PutEventsResponse, PutEventsError>;


    #[doc="<p>Running <code>PutPermission</code> permits the specified AWS account to put events to your account's default <i>event bus</i>. CloudWatch Events rules in your account are triggered by these events arriving to your default event bus. </p> <p>For another account to send events to your account, that external account must have a CloudWatch Events rule with your account's default event bus as a target.</p> <p>To enable multiple AWS accounts to put events to your default event bus, run <code>PutPermission</code> once for each of these accounts.</p>"]
    fn put_permission(&self, input: &PutPermissionRequest) -> Result<(), PutPermissionError>;


    #[doc="<p>Creates or updates the specified rule. Rules are enabled by default, or based on value of the state. You can disable a rule using <a>DisableRule</a>.</p> <p>When you create or update a rule, incoming events might not immediately start matching to new or updated rules. Please allow a short period of time for changes to take effect.</p> <p>A rule must contain at least an EventPattern or ScheduleExpression. Rules with EventPatterns are triggered when a matching event is observed. Rules with ScheduleExpressions self-trigger based on the given schedule. A rule can have both an EventPattern and a ScheduleExpression, in which case the rule triggers on matching events as well as on a schedule.</p> <p>Most services in AWS treat : or / as the same character in Amazon Resource Names (ARNs). However, CloudWatch Events uses an exact match in event patterns and rules. Be sure to use the correct ARN characters when creating event patterns so that they match the ARN syntax in the event you want to match.</p>"]
    fn put_rule(&self, input: &PutRuleRequest) -> Result<PutRuleResponse, PutRuleError>;


    #[doc="<p>Adds the specified targets to the specified rule, or updates the targets if they are already associated with the rule.</p> <p>Targets are the resources that are invoked when a rule is triggered.</p> <p>You can configure the following as targets for CloudWatch Events:</p> <ul> <li> <p>EC2 instances</p> </li> <li> <p>AWS Lambda functions</p> </li> <li> <p>Streams in Amazon Kinesis Streams</p> </li> <li> <p>Delivery streams in Amazon Kinesis Firehose</p> </li> <li> <p>Amazon ECS tasks</p> </li> <li> <p>AWS Step Functions state machines</p> </li> <li> <p>Amazon SNS topics</p> </li> <li> <p>Amazon SQS queues</p> </li> </ul> <p>Note that creating rules with built-in targets is supported only in the AWS Management Console.</p> <p>For some target types, <code>PutTargets</code> provides target-specific parameters. If the target is an Amazon Kinesis stream, you can optionally specify which shard the event goes to by using the <code>KinesisParameters</code> argument. To invoke a command on multiple EC2 instances with one rule, you can use the <code>RunCommandParameters</code> field.</p> <p>To be able to make API calls against the resources that you own, Amazon CloudWatch Events needs the appropriate permissions. For AWS Lambda and Amazon SNS resources, CloudWatch Events relies on resource-based policies. For EC2 instances, Amazon Kinesis streams, and AWS Step Functions state machines, CloudWatch Events relies on IAM roles that you specify in the <code>RoleARN</code> argument in <code>PutTargets</code>. For more information, see <a href=\"http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/auth-and-access-control-cwe.html\">Authentication and Access Control</a> in the <i>Amazon CloudWatch Events User Guide</i>.</p> <p>If another AWS account is in the same region and has granted you permission (using <code>PutPermission</code>), you can set that account's event bus as a target of the rules in your account. To send the matched events to the other account, specify that account's event bus as the <code>Arn</code> when you run <code>PutTargets</code>. For more information about enabling cross-account events, see <a>PutPermission</a>.</p> <p> <b>Input</b>, <b>InputPath</b> and <b>InputTransformer</b> are mutually exclusive and optional parameters of a target. When a rule is triggered due to a matched event:</p> <ul> <li> <p>If none of the following arguments are specified for a target, then the entire event is passed to the target in JSON form (unless the target is Amazon EC2 Run Command or Amazon ECS task, in which case nothing from the event is passed to the target).</p> </li> <li> <p>If <b>Input</b> is specified in the form of valid JSON, then the matched event is overridden with this constant.</p> </li> <li> <p>If <b>InputPath</b> is specified in the form of JSONPath (for example, <code>$.detail</code>), then only the part of the event specified in the path is passed to the target (for example, only the detail part of the event is passed).</p> </li> <li> <p>If <b>InputTransformer</b> is specified, then one or more specified JSONPaths are extracted from the event and used as values in a template that you specify as the input to the target.</p> </li> </ul> <p>When you specify <code>Input</code>, <code>InputPath</code>, or <code>InputTransformer</code>, you must use JSON dot notation, not bracket notation.</p> <p>When you add targets to a rule and the associated rule triggers soon after, new or updated targets might not be immediately invoked. Please allow a short period of time for changes to take effect.</p> <p>This action can partially fail if too many requests are made at the same time. If that happens, <code>FailedEntryCount</code> is non-zero in the response and each entry in <code>FailedEntries</code> provides the ID of the failed target and the error code.</p>"]
    fn put_targets(&self,
                   input: &PutTargetsRequest)
                   -> Result<PutTargetsResponse, PutTargetsError>;


    #[doc="<p>Revokes the permission of another AWS account to be able to put events to your default event bus. Specify the account to revoke by the <code>StatementId</code> value that you associated with the account when you granted it permission with <code>PutPermission</code>. You can find the <code>StatementId</code> by using <a>DescribeEventBus</a>.</p>"]
    fn remove_permission(&self,
                         input: &RemovePermissionRequest)
                         -> Result<(), RemovePermissionError>;


    #[doc="<p>Removes the specified targets from the specified rule. When the rule is triggered, those targets are no longer be invoked.</p> <p>When you remove a target, when the associated rule triggers, removed targets might continue to be invoked. Please allow a short period of time for changes to take effect.</p> <p>This action can partially fail if too many requests are made at the same time. If that happens, <code>FailedEntryCount</code> is non-zero in the response and each entry in <code>FailedEntries</code> provides the ID of the failed target and the error code.</p>"]
    fn remove_targets(&self,
                      input: &RemoveTargetsRequest)
                      -> Result<RemoveTargetsResponse, RemoveTargetsError>;


    #[doc="<p>Tests whether the specified event pattern matches the provided event.</p> <p>Most services in AWS treat : or / as the same character in Amazon Resource Names (ARNs). However, CloudWatch Events uses an exact match in event patterns and rules. Be sure to use the correct ARN characters when creating event patterns so that they match the ARN syntax in the event you want to match.</p>"]
    fn test_event_pattern(&self,
                          input: &TestEventPatternRequest)
                          -> Result<TestEventPatternResponse, TestEventPatternError>;
}
/// A client for the Amazon CloudWatch Events API.
pub struct CloudWatchEventsClient<P, D>
    where P: ProvideAwsCredentials,
          D: DispatchSignedRequest
{
    credentials_provider: P,
    region: region::Region,
    dispatcher: D,
}

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

impl<P, D> CloudWatchEvents for CloudWatchEventsClient<P, D>
    where P: ProvideAwsCredentials,
          D: DispatchSignedRequest
{
    #[doc="<p>Deletes the specified rule.</p> <p>You must remove all targets from a rule using <a>RemoveTargets</a> before you can delete the rule.</p> <p>When you delete a rule, incoming events might continue to match to the deleted rule. Please allow a short period of time for changes to take effect.</p>"]
    fn delete_rule(&self, input: &DeleteRuleRequest) -> Result<(), DeleteRuleError> {
        let mut request = SignedRequest::new("POST", "events", &self.region, "/");

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

        request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);

        let mut response = try!(self.dispatcher.dispatch(&request));

        match response.status {
            StatusCode::Ok => Ok(()),
            _ => {
                let mut body: Vec<u8> = Vec::new();
                try!(response.body.read_to_end(&mut body));
                Err(DeleteRuleError::from_body(String::from_utf8_lossy(&body).as_ref()))
            }
        }
    }


    #[doc="<p>Displays the external AWS accounts that are permitted to write events to your account using your account's event bus, and the associated policy. To enable your account to receive events from other accounts, use <a>PutPermission</a>.</p>"]
    fn describe_event_bus(&self) -> Result<DescribeEventBusResponse, DescribeEventBusError> {
        let mut request = SignedRequest::new("POST", "events", &self.region, "/");

        request.set_content_type("application/x-amz-json-1.1".to_owned());
        request.add_header("x-amz-target", "AWSEvents.DescribeEventBus");
        request.set_payload(Some(b"{}".to_vec()));

        request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);

        let mut response = try!(self.dispatcher.dispatch(&request));

        match response.status {
            StatusCode::Ok => {
                let mut body: Vec<u8> = Vec::new();
                try!(response.body.read_to_end(&mut body));
                Ok(serde_json::from_str::<DescribeEventBusResponse>(String::from_utf8_lossy(&body)
                                                                        .as_ref())
                           .unwrap())
            }
            _ => {
                let mut body: Vec<u8> = Vec::new();
                try!(response.body.read_to_end(&mut body));
                Err(DescribeEventBusError::from_body(String::from_utf8_lossy(&body).as_ref()))
            }
        }
    }


    #[doc="<p>Describes the specified rule.</p>"]
    fn describe_rule(&self,
                     input: &DescribeRuleRequest)
                     -> Result<DescribeRuleResponse, DescribeRuleError> {
        let mut request = SignedRequest::new("POST", "events", &self.region, "/");

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

        request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);

        let mut response = try!(self.dispatcher.dispatch(&request));

        match response.status {
            StatusCode::Ok => {
                let mut body: Vec<u8> = Vec::new();
                try!(response.body.read_to_end(&mut body));
                Ok(serde_json::from_str::<DescribeRuleResponse>(String::from_utf8_lossy(&body)
                                                                    .as_ref())
                           .unwrap())
            }
            _ => {
                let mut body: Vec<u8> = Vec::new();
                try!(response.body.read_to_end(&mut body));
                Err(DescribeRuleError::from_body(String::from_utf8_lossy(&body).as_ref()))
            }
        }
    }


    #[doc="<p>Disables the specified rule. A disabled rule won't match any events, and won't self-trigger if it has a schedule expression.</p> <p>When you disable a rule, incoming events might continue to match to the disabled rule. Please allow a short period of time for changes to take effect.</p>"]
    fn disable_rule(&self, input: &DisableRuleRequest) -> Result<(), DisableRuleError> {
        let mut request = SignedRequest::new("POST", "events", &self.region, "/");

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

        request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);

        let mut response = try!(self.dispatcher.dispatch(&request));

        match response.status {
            StatusCode::Ok => Ok(()),
            _ => {
                let mut body: Vec<u8> = Vec::new();
                try!(response.body.read_to_end(&mut body));
                Err(DisableRuleError::from_body(String::from_utf8_lossy(&body).as_ref()))
            }
        }
    }


    #[doc="<p>Enables the specified rule. If the rule does not exist, the operation fails.</p> <p>When you enable a rule, incoming events might not immediately start matching to a newly enabled rule. Please allow a short period of time for changes to take effect.</p>"]
    fn enable_rule(&self, input: &EnableRuleRequest) -> Result<(), EnableRuleError> {
        let mut request = SignedRequest::new("POST", "events", &self.region, "/");

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

        request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);

        let mut response = try!(self.dispatcher.dispatch(&request));

        match response.status {
            StatusCode::Ok => Ok(()),
            _ => {
                let mut body: Vec<u8> = Vec::new();
                try!(response.body.read_to_end(&mut body));
                Err(EnableRuleError::from_body(String::from_utf8_lossy(&body).as_ref()))
            }
        }
    }


    #[doc="<p>Lists the rules for the specified target. You can see which of the rules in Amazon CloudWatch Events can invoke a specific target in your account.</p>"]
    fn list_rule_names_by_target
        (&self,
         input: &ListRuleNamesByTargetRequest)
         -> Result<ListRuleNamesByTargetResponse, ListRuleNamesByTargetError> {
        let mut request = SignedRequest::new("POST", "events", &self.region, "/");

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

        request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);

        let mut response = try!(self.dispatcher.dispatch(&request));

        match response.status {
            StatusCode::Ok => {
                let mut body: Vec<u8> = Vec::new();
                try!(response.body.read_to_end(&mut body));
                Ok(serde_json::from_str::<ListRuleNamesByTargetResponse>(String::from_utf8_lossy(&body).as_ref()).unwrap())
            }
            _ => {
                let mut body: Vec<u8> = Vec::new();
                try!(response.body.read_to_end(&mut body));
                Err(ListRuleNamesByTargetError::from_body(String::from_utf8_lossy(&body).as_ref()))
            }
        }
    }


    #[doc="<p>Lists your Amazon CloudWatch Events rules. You can either list all the rules or you can provide a prefix to match to the rule names.</p>"]
    fn list_rules(&self, input: &ListRulesRequest) -> Result<ListRulesResponse, ListRulesError> {
        let mut request = SignedRequest::new("POST", "events", &self.region, "/");

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

        request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);

        let mut response = try!(self.dispatcher.dispatch(&request));

        match response.status {
            StatusCode::Ok => {
                let mut body: Vec<u8> = Vec::new();
                try!(response.body.read_to_end(&mut body));
                Ok(serde_json::from_str::<ListRulesResponse>(String::from_utf8_lossy(&body)
                                                                 .as_ref())
                           .unwrap())
            }
            _ => {
                let mut body: Vec<u8> = Vec::new();
                try!(response.body.read_to_end(&mut body));
                Err(ListRulesError::from_body(String::from_utf8_lossy(&body).as_ref()))
            }
        }
    }


    #[doc="<p>Lists the targets assigned to the specified rule.</p>"]
    fn list_targets_by_rule(&self,
                            input: &ListTargetsByRuleRequest)
                            -> Result<ListTargetsByRuleResponse, ListTargetsByRuleError> {
        let mut request = SignedRequest::new("POST", "events", &self.region, "/");

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

        request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);

        let mut response = try!(self.dispatcher.dispatch(&request));

        match response.status {
            StatusCode::Ok => {
                let mut body: Vec<u8> = Vec::new();
                try!(response.body.read_to_end(&mut body));
                Ok(serde_json::from_str::<ListTargetsByRuleResponse>(String::from_utf8_lossy(&body).as_ref()).unwrap())
            }
            _ => {
                let mut body: Vec<u8> = Vec::new();
                try!(response.body.read_to_end(&mut body));
                Err(ListTargetsByRuleError::from_body(String::from_utf8_lossy(&body).as_ref()))
            }
        }
    }


    #[doc="<p>Sends custom events to Amazon CloudWatch Events so that they can be matched to rules.</p>"]
    fn put_events(&self, input: &PutEventsRequest) -> Result<PutEventsResponse, PutEventsError> {
        let mut request = SignedRequest::new("POST", "events", &self.region, "/");

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

        request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);

        let mut response = try!(self.dispatcher.dispatch(&request));

        match response.status {
            StatusCode::Ok => {
                let mut body: Vec<u8> = Vec::new();
                try!(response.body.read_to_end(&mut body));
                Ok(serde_json::from_str::<PutEventsResponse>(String::from_utf8_lossy(&body)
                                                                 .as_ref())
                           .unwrap())
            }
            _ => {
                let mut body: Vec<u8> = Vec::new();
                try!(response.body.read_to_end(&mut body));
                Err(PutEventsError::from_body(String::from_utf8_lossy(&body).as_ref()))
            }
        }
    }


    #[doc="<p>Running <code>PutPermission</code> permits the specified AWS account to put events to your account's default <i>event bus</i>. CloudWatch Events rules in your account are triggered by these events arriving to your default event bus. </p> <p>For another account to send events to your account, that external account must have a CloudWatch Events rule with your account's default event bus as a target.</p> <p>To enable multiple AWS accounts to put events to your default event bus, run <code>PutPermission</code> once for each of these accounts.</p>"]
    fn put_permission(&self, input: &PutPermissionRequest) -> Result<(), PutPermissionError> {
        let mut request = SignedRequest::new("POST", "events", &self.region, "/");

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

        request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);

        let mut response = try!(self.dispatcher.dispatch(&request));

        match response.status {
            StatusCode::Ok => Ok(()),
            _ => {
                let mut body: Vec<u8> = Vec::new();
                try!(response.body.read_to_end(&mut body));
                Err(PutPermissionError::from_body(String::from_utf8_lossy(&body).as_ref()))
            }
        }
    }


    #[doc="<p>Creates or updates the specified rule. Rules are enabled by default, or based on value of the state. You can disable a rule using <a>DisableRule</a>.</p> <p>When you create or update a rule, incoming events might not immediately start matching to new or updated rules. Please allow a short period of time for changes to take effect.</p> <p>A rule must contain at least an EventPattern or ScheduleExpression. Rules with EventPatterns are triggered when a matching event is observed. Rules with ScheduleExpressions self-trigger based on the given schedule. A rule can have both an EventPattern and a ScheduleExpression, in which case the rule triggers on matching events as well as on a schedule.</p> <p>Most services in AWS treat : or / as the same character in Amazon Resource Names (ARNs). However, CloudWatch Events uses an exact match in event patterns and rules. Be sure to use the correct ARN characters when creating event patterns so that they match the ARN syntax in the event you want to match.</p>"]
    fn put_rule(&self, input: &PutRuleRequest) -> Result<PutRuleResponse, PutRuleError> {
        let mut request = SignedRequest::new("POST", "events", &self.region, "/");

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

        request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);

        let mut response = try!(self.dispatcher.dispatch(&request));

        match response.status {
            StatusCode::Ok => {
                let mut body: Vec<u8> = Vec::new();
                try!(response.body.read_to_end(&mut body));
                Ok(serde_json::from_str::<PutRuleResponse>(String::from_utf8_lossy(&body).as_ref())
                       .unwrap())
            }
            _ => {
                let mut body: Vec<u8> = Vec::new();
                try!(response.body.read_to_end(&mut body));
                Err(PutRuleError::from_body(String::from_utf8_lossy(&body).as_ref()))
            }
        }
    }


    #[doc="<p>Adds the specified targets to the specified rule, or updates the targets if they are already associated with the rule.</p> <p>Targets are the resources that are invoked when a rule is triggered.</p> <p>You can configure the following as targets for CloudWatch Events:</p> <ul> <li> <p>EC2 instances</p> </li> <li> <p>AWS Lambda functions</p> </li> <li> <p>Streams in Amazon Kinesis Streams</p> </li> <li> <p>Delivery streams in Amazon Kinesis Firehose</p> </li> <li> <p>Amazon ECS tasks</p> </li> <li> <p>AWS Step Functions state machines</p> </li> <li> <p>Amazon SNS topics</p> </li> <li> <p>Amazon SQS queues</p> </li> </ul> <p>Note that creating rules with built-in targets is supported only in the AWS Management Console.</p> <p>For some target types, <code>PutTargets</code> provides target-specific parameters. If the target is an Amazon Kinesis stream, you can optionally specify which shard the event goes to by using the <code>KinesisParameters</code> argument. To invoke a command on multiple EC2 instances with one rule, you can use the <code>RunCommandParameters</code> field.</p> <p>To be able to make API calls against the resources that you own, Amazon CloudWatch Events needs the appropriate permissions. For AWS Lambda and Amazon SNS resources, CloudWatch Events relies on resource-based policies. For EC2 instances, Amazon Kinesis streams, and AWS Step Functions state machines, CloudWatch Events relies on IAM roles that you specify in the <code>RoleARN</code> argument in <code>PutTargets</code>. For more information, see <a href=\"http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/auth-and-access-control-cwe.html\">Authentication and Access Control</a> in the <i>Amazon CloudWatch Events User Guide</i>.</p> <p>If another AWS account is in the same region and has granted you permission (using <code>PutPermission</code>), you can set that account's event bus as a target of the rules in your account. To send the matched events to the other account, specify that account's event bus as the <code>Arn</code> when you run <code>PutTargets</code>. For more information about enabling cross-account events, see <a>PutPermission</a>.</p> <p> <b>Input</b>, <b>InputPath</b> and <b>InputTransformer</b> are mutually exclusive and optional parameters of a target. When a rule is triggered due to a matched event:</p> <ul> <li> <p>If none of the following arguments are specified for a target, then the entire event is passed to the target in JSON form (unless the target is Amazon EC2 Run Command or Amazon ECS task, in which case nothing from the event is passed to the target).</p> </li> <li> <p>If <b>Input</b> is specified in the form of valid JSON, then the matched event is overridden with this constant.</p> </li> <li> <p>If <b>InputPath</b> is specified in the form of JSONPath (for example, <code>$.detail</code>), then only the part of the event specified in the path is passed to the target (for example, only the detail part of the event is passed).</p> </li> <li> <p>If <b>InputTransformer</b> is specified, then one or more specified JSONPaths are extracted from the event and used as values in a template that you specify as the input to the target.</p> </li> </ul> <p>When you specify <code>Input</code>, <code>InputPath</code>, or <code>InputTransformer</code>, you must use JSON dot notation, not bracket notation.</p> <p>When you add targets to a rule and the associated rule triggers soon after, new or updated targets might not be immediately invoked. Please allow a short period of time for changes to take effect.</p> <p>This action can partially fail if too many requests are made at the same time. If that happens, <code>FailedEntryCount</code> is non-zero in the response and each entry in <code>FailedEntries</code> provides the ID of the failed target and the error code.</p>"]
    fn put_targets(&self,
                   input: &PutTargetsRequest)
                   -> Result<PutTargetsResponse, PutTargetsError> {
        let mut request = SignedRequest::new("POST", "events", &self.region, "/");

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

        request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);

        let mut response = try!(self.dispatcher.dispatch(&request));

        match response.status {
            StatusCode::Ok => {
                let mut body: Vec<u8> = Vec::new();
                try!(response.body.read_to_end(&mut body));
                Ok(serde_json::from_str::<PutTargetsResponse>(String::from_utf8_lossy(&body)
                                                                  .as_ref())
                           .unwrap())
            }
            _ => {
                let mut body: Vec<u8> = Vec::new();
                try!(response.body.read_to_end(&mut body));
                Err(PutTargetsError::from_body(String::from_utf8_lossy(&body).as_ref()))
            }
        }
    }


    #[doc="<p>Revokes the permission of another AWS account to be able to put events to your default event bus. Specify the account to revoke by the <code>StatementId</code> value that you associated with the account when you granted it permission with <code>PutPermission</code>. You can find the <code>StatementId</code> by using <a>DescribeEventBus</a>.</p>"]
    fn remove_permission(&self,
                         input: &RemovePermissionRequest)
                         -> Result<(), RemovePermissionError> {
        let mut request = SignedRequest::new("POST", "events", &self.region, "/");

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

        request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);

        let mut response = try!(self.dispatcher.dispatch(&request));

        match response.status {
            StatusCode::Ok => Ok(()),
            _ => {
                let mut body: Vec<u8> = Vec::new();
                try!(response.body.read_to_end(&mut body));
                Err(RemovePermissionError::from_body(String::from_utf8_lossy(&body).as_ref()))
            }
        }
    }


    #[doc="<p>Removes the specified targets from the specified rule. When the rule is triggered, those targets are no longer be invoked.</p> <p>When you remove a target, when the associated rule triggers, removed targets might continue to be invoked. Please allow a short period of time for changes to take effect.</p> <p>This action can partially fail if too many requests are made at the same time. If that happens, <code>FailedEntryCount</code> is non-zero in the response and each entry in <code>FailedEntries</code> provides the ID of the failed target and the error code.</p>"]
    fn remove_targets(&self,
                      input: &RemoveTargetsRequest)
                      -> Result<RemoveTargetsResponse, RemoveTargetsError> {
        let mut request = SignedRequest::new("POST", "events", &self.region, "/");

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

        request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);

        let mut response = try!(self.dispatcher.dispatch(&request));

        match response.status {
            StatusCode::Ok => {
                let mut body: Vec<u8> = Vec::new();
                try!(response.body.read_to_end(&mut body));
                Ok(serde_json::from_str::<RemoveTargetsResponse>(String::from_utf8_lossy(&body)
                                                                     .as_ref())
                           .unwrap())
            }
            _ => {
                let mut body: Vec<u8> = Vec::new();
                try!(response.body.read_to_end(&mut body));
                Err(RemoveTargetsError::from_body(String::from_utf8_lossy(&body).as_ref()))
            }
        }
    }


    #[doc="<p>Tests whether the specified event pattern matches the provided event.</p> <p>Most services in AWS treat : or / as the same character in Amazon Resource Names (ARNs). However, CloudWatch Events uses an exact match in event patterns and rules. Be sure to use the correct ARN characters when creating event patterns so that they match the ARN syntax in the event you want to match.</p>"]
    fn test_event_pattern(&self,
                          input: &TestEventPatternRequest)
                          -> Result<TestEventPatternResponse, TestEventPatternError> {
        let mut request = SignedRequest::new("POST", "events", &self.region, "/");

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

        request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);

        let mut response = try!(self.dispatcher.dispatch(&request));

        match response.status {
            StatusCode::Ok => {
                let mut body: Vec<u8> = Vec::new();
                try!(response.body.read_to_end(&mut body));
                Ok(serde_json::from_str::<TestEventPatternResponse>(String::from_utf8_lossy(&body)
                                                                        .as_ref())
                           .unwrap())
            }
            _ => {
                let mut body: Vec<u8> = Vec::new();
                try!(response.body.read_to_end(&mut body));
                Err(TestEventPatternError::from_body(String::from_utf8_lossy(&body).as_ref()))
            }
        }
    }
}

#[cfg(test)]
mod protocol_tests {}