File: layer1.py

package info (click to toggle)
python-boto 2.49.0-4.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 9,888 kB
  • sloc: python: 86,396; makefile: 112
file content (3783 lines) | stat: -rw-r--r-- 159,622 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
# Copyright (c) 2014 Amazon.com, Inc. or its affiliates.  All Rights Reserved
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish, dis-
# tribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the fol-
# lowing conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#

import boto
from boto.connection import AWSQueryConnection
from boto.regioninfo import RegionInfo
from boto.exception import JSONResponseError
from boto.rds2 import exceptions
from boto.compat import json


class RDSConnection(AWSQueryConnection):
    """
    Amazon Relational Database Service
    Amazon Relational Database Service (Amazon RDS) is a web service
    that makes it easier to set up, operate, and scale a relational
    database in the cloud. It provides cost-efficient, resizable
    capacity for an industry-standard relational database and manages
    common database administration tasks, freeing up developers to
    focus on what makes their applications and businesses unique.

    Amazon RDS gives you access to the capabilities of a familiar
    MySQL or Oracle database server. This means the code,
    applications, and tools you already use today with your existing
    MySQL or Oracle databases work with Amazon RDS without
    modification. Amazon RDS automatically backs up your database and
    maintains the database software that powers your DB instance.
    Amazon RDS is flexible: you can scale your database instance's
    compute resources and storage capacity to meet your application's
    demand. As with all Amazon Web Services, there are no up-front
    investments, and you pay only for the resources you use.

    This is the Amazon RDS API Reference . It contains a comprehensive
    description of all Amazon RDS Query APIs and data types. Note that
    this API is asynchronous and some actions may require polling to
    determine when an action has been applied. See the parameter
    description to determine if a change is applied immediately or on
    the next instance reboot or during the maintenance window. For
    more information on Amazon RDS concepts and usage scenarios, go to
    the `Amazon RDS User Guide`_.
    """
    APIVersion = "2013-09-09"
    DefaultRegionName = "us-east-1"
    DefaultRegionEndpoint = "rds.us-east-1.amazonaws.com"
    ResponseError = JSONResponseError

    _faults = {
        "InvalidSubnet": exceptions.InvalidSubnet,
        "DBParameterGroupQuotaExceeded": exceptions.DBParameterGroupQuotaExceeded,
        "DBSubnetGroupAlreadyExists": exceptions.DBSubnetGroupAlreadyExists,
        "DBSubnetGroupQuotaExceeded": exceptions.DBSubnetGroupQuotaExceeded,
        "InstanceQuotaExceeded": exceptions.InstanceQuotaExceeded,
        "InvalidRestore": exceptions.InvalidRestore,
        "InvalidDBParameterGroupState": exceptions.InvalidDBParameterGroupState,
        "AuthorizationQuotaExceeded": exceptions.AuthorizationQuotaExceeded,
        "DBSecurityGroupAlreadyExists": exceptions.DBSecurityGroupAlreadyExists,
        "InsufficientDBInstanceCapacity": exceptions.InsufficientDBInstanceCapacity,
        "ReservedDBInstanceQuotaExceeded": exceptions.ReservedDBInstanceQuotaExceeded,
        "DBSecurityGroupNotFound": exceptions.DBSecurityGroupNotFound,
        "DBInstanceAlreadyExists": exceptions.DBInstanceAlreadyExists,
        "ReservedDBInstanceNotFound": exceptions.ReservedDBInstanceNotFound,
        "DBSubnetGroupDoesNotCoverEnoughAZs": exceptions.DBSubnetGroupDoesNotCoverEnoughAZs,
        "InvalidDBSecurityGroupState": exceptions.InvalidDBSecurityGroupState,
        "InvalidVPCNetworkState": exceptions.InvalidVPCNetworkState,
        "ReservedDBInstancesOfferingNotFound": exceptions.ReservedDBInstancesOfferingNotFound,
        "SNSTopicArnNotFound": exceptions.SNSTopicArnNotFound,
        "SNSNoAuthorization": exceptions.SNSNoAuthorization,
        "SnapshotQuotaExceeded": exceptions.SnapshotQuotaExceeded,
        "OptionGroupQuotaExceeded": exceptions.OptionGroupQuotaExceeded,
        "DBParameterGroupNotFound": exceptions.DBParameterGroupNotFound,
        "SNSInvalidTopic": exceptions.SNSInvalidTopic,
        "InvalidDBSubnetGroupState": exceptions.InvalidDBSubnetGroupState,
        "DBSubnetGroupNotFound": exceptions.DBSubnetGroupNotFound,
        "InvalidOptionGroupState": exceptions.InvalidOptionGroupState,
        "SourceNotFound": exceptions.SourceNotFound,
        "SubscriptionCategoryNotFound": exceptions.SubscriptionCategoryNotFound,
        "EventSubscriptionQuotaExceeded": exceptions.EventSubscriptionQuotaExceeded,
        "DBSecurityGroupNotSupported": exceptions.DBSecurityGroupNotSupported,
        "InvalidEventSubscriptionState": exceptions.InvalidEventSubscriptionState,
        "InvalidDBSubnetState": exceptions.InvalidDBSubnetState,
        "InvalidDBSnapshotState": exceptions.InvalidDBSnapshotState,
        "SubscriptionAlreadyExist": exceptions.SubscriptionAlreadyExist,
        "DBSecurityGroupQuotaExceeded": exceptions.DBSecurityGroupQuotaExceeded,
        "ProvisionedIopsNotAvailableInAZ": exceptions.ProvisionedIopsNotAvailableInAZ,
        "AuthorizationNotFound": exceptions.AuthorizationNotFound,
        "OptionGroupAlreadyExists": exceptions.OptionGroupAlreadyExists,
        "SubscriptionNotFound": exceptions.SubscriptionNotFound,
        "DBUpgradeDependencyFailure": exceptions.DBUpgradeDependencyFailure,
        "PointInTimeRestoreNotEnabled": exceptions.PointInTimeRestoreNotEnabled,
        "AuthorizationAlreadyExists": exceptions.AuthorizationAlreadyExists,
        "DBSubnetQuotaExceeded": exceptions.DBSubnetQuotaExceeded,
        "OptionGroupNotFound": exceptions.OptionGroupNotFound,
        "DBParameterGroupAlreadyExists": exceptions.DBParameterGroupAlreadyExists,
        "DBInstanceNotFound": exceptions.DBInstanceNotFound,
        "ReservedDBInstanceAlreadyExists": exceptions.ReservedDBInstanceAlreadyExists,
        "InvalidDBInstanceState": exceptions.InvalidDBInstanceState,
        "DBSnapshotNotFound": exceptions.DBSnapshotNotFound,
        "DBSnapshotAlreadyExists": exceptions.DBSnapshotAlreadyExists,
        "StorageQuotaExceeded": exceptions.StorageQuotaExceeded,
        "SubnetAlreadyInUse": exceptions.SubnetAlreadyInUse,
    }


    def __init__(self, **kwargs):
        region = kwargs.pop('region', None)
        if not region:
            region = RegionInfo(self, self.DefaultRegionName,
                                self.DefaultRegionEndpoint)

        if 'host' not in kwargs:
            kwargs['host'] = region.endpoint

        super(RDSConnection, self).__init__(**kwargs)
        self.region = region

    def _required_auth_capability(self):
        return ['hmac-v4']

    def add_source_identifier_to_subscription(self, subscription_name,
                                              source_identifier):
        """
        Adds a source identifier to an existing RDS event notification
        subscription.

        :type subscription_name: string
        :param subscription_name: The name of the RDS event notification
            subscription you want to add a source identifier to.

        :type source_identifier: string
        :param source_identifier:
        The identifier of the event source to be added. An identifier must
            begin with a letter and must contain only ASCII letters, digits,
            and hyphens; it cannot end with a hyphen or contain two consecutive
            hyphens.

        Constraints:


        + If the source type is a DB instance, then a `DBInstanceIdentifier`
              must be supplied.
        + If the source type is a DB security group, a `DBSecurityGroupName`
              must be supplied.
        + If the source type is a DB parameter group, a `DBParameterGroupName`
              must be supplied.
        + If the source type is a DB snapshot, a `DBSnapshotIdentifier` must be
              supplied.

        """
        params = {
            'SubscriptionName': subscription_name,
            'SourceIdentifier': source_identifier,
        }
        return self._make_request(
            action='AddSourceIdentifierToSubscription',
            verb='POST',
            path='/', params=params)

    def add_tags_to_resource(self, resource_name, tags):
        """
        Adds metadata tags to an Amazon RDS resource. These tags can
        also be used with cost allocation reporting to track cost
        associated with Amazon RDS resources, or used in Condition
        statement in IAM policy for Amazon RDS.

        For an overview on tagging Amazon RDS resources, see `Tagging
        Amazon RDS Resources`_.

        :type resource_name: string
        :param resource_name: The Amazon RDS resource the tags will be added
            to. This value is an Amazon Resource Name (ARN). For information
            about creating an ARN, see ` Constructing an RDS Amazon Resource
            Name (ARN)`_.

        :type tags: list
        :param tags: The tags to be assigned to the Amazon RDS resource.
            Tags must be passed as tuples in the form
            [('key1', 'valueForKey1'), ('key2', 'valueForKey2')]

        """
        params = {'ResourceName': resource_name, }
        self.build_complex_list_params(
            params, tags,
            'Tags.member',
            ('Key', 'Value'))
        return self._make_request(
            action='AddTagsToResource',
            verb='POST',
            path='/', params=params)

    def authorize_db_security_group_ingress(self, db_security_group_name,
                                            cidrip=None,
                                            ec2_security_group_name=None,
                                            ec2_security_group_id=None,
                                            ec2_security_group_owner_id=None):
        """
        Enables ingress to a DBSecurityGroup using one of two forms of
        authorization. First, EC2 or VPC security groups can be added
        to the DBSecurityGroup if the application using the database
        is running on EC2 or VPC instances. Second, IP ranges are
        available if the application accessing your database is
        running on the Internet. Required parameters for this API are
        one of CIDR range, EC2SecurityGroupId for VPC, or
        (EC2SecurityGroupOwnerId and either EC2SecurityGroupName or
        EC2SecurityGroupId for non-VPC).
        You cannot authorize ingress from an EC2 security group in one
        Region to an Amazon RDS DB instance in another. You cannot
        authorize ingress from a VPC security group in one VPC to an
        Amazon RDS DB instance in another.
        For an overview of CIDR ranges, go to the `Wikipedia
        Tutorial`_.

        :type db_security_group_name: string
        :param db_security_group_name: The name of the DB security group to add
            authorization to.

        :type cidrip: string
        :param cidrip: The IP range to authorize.

        :type ec2_security_group_name: string
        :param ec2_security_group_name: Name of the EC2 security group to
            authorize. For VPC DB security groups, `EC2SecurityGroupId` must be
            provided. Otherwise, EC2SecurityGroupOwnerId and either
            `EC2SecurityGroupName` or `EC2SecurityGroupId` must be provided.

        :type ec2_security_group_id: string
        :param ec2_security_group_id: Id of the EC2 security group to
            authorize. For VPC DB security groups, `EC2SecurityGroupId` must be
            provided. Otherwise, EC2SecurityGroupOwnerId and either
            `EC2SecurityGroupName` or `EC2SecurityGroupId` must be provided.

        :type ec2_security_group_owner_id: string
        :param ec2_security_group_owner_id: AWS Account Number of the owner of
            the EC2 security group specified in the EC2SecurityGroupName
            parameter. The AWS Access Key ID is not an acceptable value. For
            VPC DB security groups, `EC2SecurityGroupId` must be provided.
            Otherwise, EC2SecurityGroupOwnerId and either
            `EC2SecurityGroupName` or `EC2SecurityGroupId` must be provided.

        """
        params = {'DBSecurityGroupName': db_security_group_name, }
        if cidrip is not None:
            params['CIDRIP'] = cidrip
        if ec2_security_group_name is not None:
            params['EC2SecurityGroupName'] = ec2_security_group_name
        if ec2_security_group_id is not None:
            params['EC2SecurityGroupId'] = ec2_security_group_id
        if ec2_security_group_owner_id is not None:
            params['EC2SecurityGroupOwnerId'] = ec2_security_group_owner_id
        return self._make_request(
            action='AuthorizeDBSecurityGroupIngress',
            verb='POST',
            path='/', params=params)

    def copy_db_snapshot(self, source_db_snapshot_identifier,
                         target_db_snapshot_identifier, tags=None):
        """
        Copies the specified DBSnapshot. The source DBSnapshot must be
        in the "available" state.

        :type source_db_snapshot_identifier: string
        :param source_db_snapshot_identifier: The identifier for the source DB
            snapshot.
        Constraints:


        + Must be the identifier for a valid system snapshot in the "available"
              state.


        Example: `rds:mydb-2012-04-02-00-01`

        :type target_db_snapshot_identifier: string
        :param target_db_snapshot_identifier: The identifier for the copied
            snapshot.
        Constraints:


        + Cannot be null, empty, or blank
        + Must contain from 1 to 255 alphanumeric characters or hyphens
        + First character must be a letter
        + Cannot end with a hyphen or contain two consecutive hyphens


        Example: `my-db-snapshot`

        :type tags: list
        :param tags: A list of tags. Tags must be passed as tuples in the form
            [('key1', 'valueForKey1'), ('key2', 'valueForKey2')]
        """
        params = {
            'SourceDBSnapshotIdentifier': source_db_snapshot_identifier,
            'TargetDBSnapshotIdentifier': target_db_snapshot_identifier,
        }
        if tags is not None:
            self.build_complex_list_params(
                params, tags,
                'Tags.member',
                ('Key', 'Value'))
        return self._make_request(
            action='CopyDBSnapshot',
            verb='POST',
            path='/', params=params)

    def create_db_instance(self, db_instance_identifier, allocated_storage,
                           db_instance_class, engine, master_username,
                           master_user_password, db_name=None,
                           db_security_groups=None,
                           vpc_security_group_ids=None,
                           availability_zone=None, db_subnet_group_name=None,
                           preferred_maintenance_window=None,
                           db_parameter_group_name=None,
                           backup_retention_period=None,
                           preferred_backup_window=None, port=None,
                           multi_az=None, engine_version=None,
                           auto_minor_version_upgrade=None,
                           license_model=None, iops=None,
                           option_group_name=None, character_set_name=None,
                           publicly_accessible=None, tags=None):
        """
        Creates a new DB instance.

        :type db_name: string
        :param db_name: The meaning of this parameter differs according to the
            database engine you use.
        **MySQL**

        The name of the database to create when the DB instance is created. If
            this parameter is not specified, no database is created in the DB
            instance.

        Constraints:


        + Must contain 1 to 64 alphanumeric characters
        + Cannot be a word reserved by the specified database engine


        Type: String

        **Oracle**

        The Oracle System ID (SID) of the created DB instance.

        Default: `ORCL`

        Constraints:


        + Cannot be longer than 8 characters


        **SQL Server**

        Not applicable. Must be null.

        :type db_instance_identifier: string
        :param db_instance_identifier: The DB instance identifier. This
            parameter is stored as a lowercase string.
        Constraints:


        + Must contain from 1 to 63 alphanumeric characters or hyphens (1 to 15
              for SQL Server).
        + First character must be a letter.
        + Cannot end with a hyphen or contain two consecutive hyphens.


        Example: `mydbinstance`

        :type allocated_storage: integer
        :param allocated_storage: The amount of storage (in gigabytes) to be
            initially allocated for the database instance.
        **MySQL**

        Constraints: Must be an integer from 5 to 1024.

        Type: Integer

        **Oracle**

        Constraints: Must be an integer from 10 to 1024.

        **SQL Server**

        Constraints: Must be an integer from 200 to 1024 (Standard Edition and
            Enterprise Edition) or from 30 to 1024 (Express Edition and Web
            Edition)

        :type db_instance_class: string
        :param db_instance_class: The compute and memory capacity of the DB
            instance.
        Valid Values: `db.t1.micro | db.m1.small | db.m1.medium | db.m1.large |
            db.m1.xlarge | db.m2.xlarge |db.m2.2xlarge | db.m2.4xlarge`

        :type engine: string
        :param engine: The name of the database engine to be used for this
            instance.
        Valid Values: `MySQL` | `oracle-se1` | `oracle-se` | `oracle-ee` |
            `sqlserver-ee` | `sqlserver-se` | `sqlserver-ex` | `sqlserver-web`

        :type master_username: string
        :param master_username:
        The name of master user for the client DB instance.

        **MySQL**

        Constraints:


        + Must be 1 to 16 alphanumeric characters.
        + First character must be a letter.
        + Cannot be a reserved word for the chosen database engine.


        Type: String

        **Oracle**

        Constraints:


        + Must be 1 to 30 alphanumeric characters.
        + First character must be a letter.
        + Cannot be a reserved word for the chosen database engine.


        **SQL Server**

        Constraints:


        + Must be 1 to 128 alphanumeric characters.
        + First character must be a letter.
        + Cannot be a reserved word for the chosen database engine.

        :type master_user_password: string
        :param master_user_password: The password for the master database user.
            Can be any printable ASCII character except "/", '"', or "@".
        Type: String

        **MySQL**

        Constraints: Must contain from 8 to 41 characters.

        **Oracle**

        Constraints: Must contain from 8 to 30 characters.

        **SQL Server**

        Constraints: Must contain from 8 to 128 characters.

        :type db_security_groups: list
        :param db_security_groups: A list of DB security groups to associate
            with this DB instance.
        Default: The default DB security group for the database engine.

        :type vpc_security_group_ids: list
        :param vpc_security_group_ids: A list of EC2 VPC security groups to
            associate with this DB instance.
        Default: The default EC2 VPC security group for the DB subnet group's
            VPC.

        :type availability_zone: string
        :param availability_zone: The EC2 Availability Zone that the database
            instance will be created in.
        Default: A random, system-chosen Availability Zone in the endpoint's
            region.

        Example: `us-east-1d`

        Constraint: The AvailabilityZone parameter cannot be specified if the
            MultiAZ parameter is set to `True`. The specified Availability Zone
            must be in the same region as the current endpoint.

        :type db_subnet_group_name: string
        :param db_subnet_group_name: A DB subnet group to associate with this
            DB instance.
        If there is no DB subnet group, then it is a non-VPC DB instance.

        :type preferred_maintenance_window: string
        :param preferred_maintenance_window: The weekly time range (in UTC)
            during which system maintenance can occur.
        Format: `ddd:hh24:mi-ddd:hh24:mi`

        Default: A 30-minute window selected at random from an 8-hour block of
            time per region, occurring on a random day of the week. To see the
            time blocks available, see ` Adjusting the Preferred Maintenance
            Window`_ in the Amazon RDS User Guide.

        Valid Days: Mon, Tue, Wed, Thu, Fri, Sat, Sun

        Constraints: Minimum 30-minute window.

        :type db_parameter_group_name: string
        :param db_parameter_group_name:
        The name of the DB parameter group to associate with this DB instance.
            If this argument is omitted, the default DBParameterGroup for the
            specified engine will be used.

        Constraints:


        + Must be 1 to 255 alphanumeric characters
        + First character must be a letter
        + Cannot end with a hyphen or contain two consecutive hyphens

        :type backup_retention_period: integer
        :param backup_retention_period:
        The number of days for which automated backups are retained. Setting
            this parameter to a positive number enables backups. Setting this
            parameter to 0 disables automated backups.

        Default: 1

        Constraints:


        + Must be a value from 0 to 8
        + Cannot be set to 0 if the DB instance is a master instance with read
              replicas

        :type preferred_backup_window: string
        :param preferred_backup_window: The daily time range during which
            automated backups are created if automated backups are enabled,
            using the `BackupRetentionPeriod` parameter.
        Default: A 30-minute window selected at random from an 8-hour block of
            time per region. See the Amazon RDS User Guide for the time blocks
            for each region from which the default backup windows are assigned.

        Constraints: Must be in the format `hh24:mi-hh24:mi`. Times should be
            Universal Time Coordinated (UTC). Must not conflict with the
            preferred maintenance window. Must be at least 30 minutes.

        :type port: integer
        :param port: The port number on which the database accepts connections.
        **MySQL**

        Default: `3306`

        Valid Values: `1150-65535`

        Type: Integer

        **Oracle**

        Default: `1521`

        Valid Values: `1150-65535`

        **SQL Server**

        Default: `1433`

        Valid Values: `1150-65535` except for `1434` and `3389`.

        :type multi_az: boolean
        :param multi_az: Specifies if the DB instance is a Multi-AZ deployment.
            You cannot set the AvailabilityZone parameter if the MultiAZ
            parameter is set to true.

        :type engine_version: string
        :param engine_version: The version number of the database engine to
            use.
        **MySQL**

        Example: `5.1.42`

        Type: String

        **Oracle**

        Example: `11.2.0.2.v2`

        Type: String

        **SQL Server**

        Example: `10.50.2789.0.v1`

        :type auto_minor_version_upgrade: boolean
        :param auto_minor_version_upgrade: Indicates that minor engine upgrades
            will be applied automatically to the DB instance during the
            maintenance window.
        Default: `True`

        :type license_model: string
        :param license_model: License model information for this DB instance.
        Valid values: `license-included` | `bring-your-own-license` | `general-
            public-license`

        :type iops: integer
        :param iops: The amount of Provisioned IOPS (input/output operations
            per second) to be initially allocated for the DB instance.
        Constraints: Must be an integer greater than 1000.

        :type option_group_name: string
        :param option_group_name: Indicates that the DB instance should be
            associated with the specified option group.
        Permanent options, such as the TDE option for Oracle Advanced Security
            TDE, cannot be removed from an option group, and that option group
            cannot be removed from a DB instance once it is associated with a
            DB instance

        :type character_set_name: string
        :param character_set_name: For supported engines, indicates that the DB
            instance should be associated with the specified CharacterSet.

        :type publicly_accessible: boolean
        :param publicly_accessible: Specifies the accessibility options for the
            DB instance. A value of true specifies an Internet-facing instance
            with a publicly resolvable DNS name, which resolves to a public IP
            address. A value of false specifies an internal instance with a DNS
            name that resolves to a private IP address.
        Default: The default behavior varies depending on whether a VPC has
            been requested or not. The following list shows the default
            behavior in each case.


        + **Default VPC:**true
        + **VPC:**false


        If no DB subnet group has been specified as part of the request and the
            PubliclyAccessible value has not been set, the DB instance will be
            publicly accessible. If a specific DB subnet group has been
            specified as part of the request and the PubliclyAccessible value
            has not been set, the DB instance will be private.

        :type tags: list
        :param tags: A list of tags. Tags must be passed as tuples in the form
            [('key1', 'valueForKey1'), ('key2', 'valueForKey2')]

        """
        params = {
            'DBInstanceIdentifier': db_instance_identifier,
            'AllocatedStorage': allocated_storage,
            'DBInstanceClass': db_instance_class,
            'Engine': engine,
            'MasterUsername': master_username,
            'MasterUserPassword': master_user_password,
        }
        if db_name is not None:
            params['DBName'] = db_name
        if db_security_groups is not None:
            self.build_list_params(params,
                                   db_security_groups,
                                   'DBSecurityGroups.member')
        if vpc_security_group_ids is not None:
            self.build_list_params(params,
                                   vpc_security_group_ids,
                                   'VpcSecurityGroupIds.member')
        if availability_zone is not None:
            params['AvailabilityZone'] = availability_zone
        if db_subnet_group_name is not None:
            params['DBSubnetGroupName'] = db_subnet_group_name
        if preferred_maintenance_window is not None:
            params['PreferredMaintenanceWindow'] = preferred_maintenance_window
        if db_parameter_group_name is not None:
            params['DBParameterGroupName'] = db_parameter_group_name
        if backup_retention_period is not None:
            params['BackupRetentionPeriod'] = backup_retention_period
        if preferred_backup_window is not None:
            params['PreferredBackupWindow'] = preferred_backup_window
        if port is not None:
            params['Port'] = port
        if multi_az is not None:
            params['MultiAZ'] = str(
                multi_az).lower()
        if engine_version is not None:
            params['EngineVersion'] = engine_version
        if auto_minor_version_upgrade is not None:
            params['AutoMinorVersionUpgrade'] = str(
                auto_minor_version_upgrade).lower()
        if license_model is not None:
            params['LicenseModel'] = license_model
        if iops is not None:
            params['Iops'] = iops
        if option_group_name is not None:
            params['OptionGroupName'] = option_group_name
        if character_set_name is not None:
            params['CharacterSetName'] = character_set_name
        if publicly_accessible is not None:
            params['PubliclyAccessible'] = str(
                publicly_accessible).lower()
        if tags is not None:
            self.build_complex_list_params(
                params, tags,
                'Tags.member',
                ('Key', 'Value'))
        return self._make_request(
            action='CreateDBInstance',
            verb='POST',
            path='/', params=params)

    def create_db_instance_read_replica(self, db_instance_identifier,
                                        source_db_instance_identifier,
                                        db_instance_class=None,
                                        availability_zone=None, port=None,
                                        auto_minor_version_upgrade=None,
                                        iops=None, option_group_name=None,
                                        publicly_accessible=None, tags=None):
        """
        Creates a DB instance that acts as a read replica of a source
        DB instance.

        All read replica DB instances are created as Single-AZ
        deployments with backups disabled. All other DB instance
        attributes (including DB security groups and DB parameter
        groups) are inherited from the source DB instance, except as
        specified below.

        The source DB instance must have backup retention enabled.

        :type db_instance_identifier: string
        :param db_instance_identifier: The DB instance identifier of the read
            replica. This is the unique key that identifies a DB instance. This
            parameter is stored as a lowercase string.

        :type source_db_instance_identifier: string
        :param source_db_instance_identifier: The identifier of the DB instance
            that will act as the source for the read replica. Each DB instance
            can have up to five read replicas.
        Constraints: Must be the identifier of an existing DB instance that is
            not already a read replica DB instance.

        :type db_instance_class: string
        :param db_instance_class: The compute and memory capacity of the read
            replica.
        Valid Values: `db.m1.small | db.m1.medium | db.m1.large | db.m1.xlarge
            | db.m2.xlarge |db.m2.2xlarge | db.m2.4xlarge`

        Default: Inherits from the source DB instance.

        :type availability_zone: string
        :param availability_zone: The Amazon EC2 Availability Zone that the
            read replica will be created in.
        Default: A random, system-chosen Availability Zone in the endpoint's
            region.

        Example: `us-east-1d`

        :type port: integer
        :param port: The port number that the DB instance uses for connections.
        Default: Inherits from the source DB instance

        Valid Values: `1150-65535`

        :type auto_minor_version_upgrade: boolean
        :param auto_minor_version_upgrade: Indicates that minor engine upgrades
            will be applied automatically to the read replica during the
            maintenance window.
        Default: Inherits from the source DB instance

        :type iops: integer
        :param iops: The amount of Provisioned IOPS (input/output operations
            per second) to be initially allocated for the DB instance.

        :type option_group_name: string
        :param option_group_name: The option group the DB instance will be
            associated with. If omitted, the default option group for the
            engine specified will be used.

        :type publicly_accessible: boolean
        :param publicly_accessible: Specifies the accessibility options for the
            DB instance. A value of true specifies an Internet-facing instance
            with a publicly resolvable DNS name, which resolves to a public IP
            address. A value of false specifies an internal instance with a DNS
            name that resolves to a private IP address.
        Default: The default behavior varies depending on whether a VPC has
            been requested or not. The following list shows the default
            behavior in each case.


        + **Default VPC:**true
        + **VPC:**false


        If no DB subnet group has been specified as part of the request and the
            PubliclyAccessible value has not been set, the DB instance will be
            publicly accessible. If a specific DB subnet group has been
            specified as part of the request and the PubliclyAccessible value
            has not been set, the DB instance will be private.

        :type tags: list
        :param tags: A list of tags. Tags must be passed as tuples in the form
            [('key1', 'valueForKey1'), ('key2', 'valueForKey2')]

        """
        params = {
            'DBInstanceIdentifier': db_instance_identifier,
            'SourceDBInstanceIdentifier': source_db_instance_identifier,
        }
        if db_instance_class is not None:
            params['DBInstanceClass'] = db_instance_class
        if availability_zone is not None:
            params['AvailabilityZone'] = availability_zone
        if port is not None:
            params['Port'] = port
        if auto_minor_version_upgrade is not None:
            params['AutoMinorVersionUpgrade'] = str(
                auto_minor_version_upgrade).lower()
        if iops is not None:
            params['Iops'] = iops
        if option_group_name is not None:
            params['OptionGroupName'] = option_group_name
        if publicly_accessible is not None:
            params['PubliclyAccessible'] = str(
                publicly_accessible).lower()
        if tags is not None:
            self.build_complex_list_params(
                params, tags,
                'Tags.member',
                ('Key', 'Value'))
        return self._make_request(
            action='CreateDBInstanceReadReplica',
            verb='POST',
            path='/', params=params)

    def create_db_parameter_group(self, db_parameter_group_name,
                                  db_parameter_group_family, description,
                                  tags=None):
        """
        Creates a new DB parameter group.

        A DB parameter group is initially created with the default
        parameters for the database engine used by the DB instance. To
        provide custom values for any of the parameters, you must
        modify the group after creating it using
        ModifyDBParameterGroup . Once you've created a DB parameter
        group, you need to associate it with your DB instance using
        ModifyDBInstance . When you associate a new DB parameter group
        with a running DB instance, you need to reboot the DB Instance
        for the new DB parameter group and associated settings to take
        effect.

        :type db_parameter_group_name: string
        :param db_parameter_group_name:
        The name of the DB parameter group.

        Constraints:


        + Must be 1 to 255 alphanumeric characters
        + First character must be a letter
        + Cannot end with a hyphen or contain two consecutive hyphens


        This value is stored as a lower-case string.

        :type db_parameter_group_family: string
        :param db_parameter_group_family: The DB parameter group family name. A
            DB parameter group can be associated with one and only one DB
            parameter group family, and can be applied only to a DB instance
            running a database engine and engine version compatible with that
            DB parameter group family.

        :type description: string
        :param description: The description for the DB parameter group.

        :type tags: list
        :param tags: A list of tags. Tags must be passed as tuples in the form
            [('key1', 'valueForKey1'), ('key2', 'valueForKey2')]

        """
        params = {
            'DBParameterGroupName': db_parameter_group_name,
            'DBParameterGroupFamily': db_parameter_group_family,
            'Description': description,
        }
        if tags is not None:
            self.build_complex_list_params(
                params, tags,
                'Tags.member',
                ('Key', 'Value'))
        return self._make_request(
            action='CreateDBParameterGroup',
            verb='POST',
            path='/', params=params)

    def create_db_security_group(self, db_security_group_name,
                                 db_security_group_description, tags=None):
        """
        Creates a new DB security group. DB security groups control
        access to a DB instance.

        :type db_security_group_name: string
        :param db_security_group_name: The name for the DB security group. This
            value is stored as a lowercase string.
        Constraints:


        + Must be 1 to 255 alphanumeric characters
        + First character must be a letter
        + Cannot end with a hyphen or contain two consecutive hyphens
        + Must not be "Default"
        + May not contain spaces


        Example: `mysecuritygroup`

        :type db_security_group_description: string
        :param db_security_group_description: The description for the DB
            security group.

        :type tags: list
        :param tags: A list of tags. Tags must be passed as tuples in the form
            [('key1', 'valueForKey1'), ('key2', 'valueForKey2')]

        """
        params = {
            'DBSecurityGroupName': db_security_group_name,
            'DBSecurityGroupDescription': db_security_group_description,
        }
        if tags is not None:
            self.build_complex_list_params(
                params, tags,
                'Tags.member',
                ('Key', 'Value'))
        return self._make_request(
            action='CreateDBSecurityGroup',
            verb='POST',
            path='/', params=params)

    def create_db_snapshot(self, db_snapshot_identifier,
                           db_instance_identifier, tags=None):
        """
        Creates a DBSnapshot. The source DBInstance must be in
        "available" state.

        :type db_snapshot_identifier: string
        :param db_snapshot_identifier: The identifier for the DB snapshot.
        Constraints:


        + Cannot be null, empty, or blank
        + Must contain from 1 to 255 alphanumeric characters or hyphens
        + First character must be a letter
        + Cannot end with a hyphen or contain two consecutive hyphens


        Example: `my-snapshot-id`

        :type db_instance_identifier: string
        :param db_instance_identifier:
        The DB instance identifier. This is the unique key that identifies a DB
            instance. This parameter isn't case sensitive.

        Constraints:


        + Must contain from 1 to 63 alphanumeric characters or hyphens
        + First character must be a letter
        + Cannot end with a hyphen or contain two consecutive hyphens

        :type tags: list
        :param tags: A list of tags. Tags must be passed as tuples in the form
            [('key1', 'valueForKey1'), ('key2', 'valueForKey2')]

        """
        params = {
            'DBSnapshotIdentifier': db_snapshot_identifier,
            'DBInstanceIdentifier': db_instance_identifier,
        }
        if tags is not None:
            self.build_complex_list_params(
                params, tags,
                'Tags.member',
                ('Key', 'Value'))
        return self._make_request(
            action='CreateDBSnapshot',
            verb='POST',
            path='/', params=params)

    def create_db_subnet_group(self, db_subnet_group_name,
                               db_subnet_group_description, subnet_ids,
                               tags=None):
        """
        Creates a new DB subnet group. DB subnet groups must contain
        at least one subnet in at least two AZs in the region.

        :type db_subnet_group_name: string
        :param db_subnet_group_name: The name for the DB subnet group. This
            value is stored as a lowercase string.
        Constraints: Must contain no more than 255 alphanumeric characters or
            hyphens. Must not be "Default".

        Example: `mySubnetgroup`

        :type db_subnet_group_description: string
        :param db_subnet_group_description: The description for the DB subnet
            group.

        :type subnet_ids: list
        :param subnet_ids: The EC2 Subnet IDs for the DB subnet group.

        :type tags: list
        :param tags: A list of tags. Tags must be passed as tuples in the form
            [('key1', 'valueForKey1'), ('key2', 'valueForKey2')]

        """
        params = {
            'DBSubnetGroupName': db_subnet_group_name,
            'DBSubnetGroupDescription': db_subnet_group_description,
        }
        self.build_list_params(params,
                               subnet_ids,
                               'SubnetIds.member')
        if tags is not None:
            self.build_complex_list_params(
                params, tags,
                'Tags.member',
                ('Key', 'Value'))
        return self._make_request(
            action='CreateDBSubnetGroup',
            verb='POST',
            path='/', params=params)

    def create_event_subscription(self, subscription_name, sns_topic_arn,
                                  source_type=None, event_categories=None,
                                  source_ids=None, enabled=None, tags=None):
        """
        Creates an RDS event notification subscription. This action
        requires a topic ARN (Amazon Resource Name) created by either
        the RDS console, the SNS console, or the SNS API. To obtain an
        ARN with SNS, you must create a topic in Amazon SNS and
        subscribe to the topic. The ARN is displayed in the SNS
        console.

        You can specify the type of source (SourceType) you want to be
        notified of, provide a list of RDS sources (SourceIds) that
        triggers the events, and provide a list of event categories
        (EventCategories) for events you want to be notified of. For
        example, you can specify SourceType = db-instance, SourceIds =
        mydbinstance1, mydbinstance2 and EventCategories =
        Availability, Backup.

        If you specify both the SourceType and SourceIds, such as
        SourceType = db-instance and SourceIdentifier = myDBInstance1,
        you will be notified of all the db-instance events for the
        specified source. If you specify a SourceType but do not
        specify a SourceIdentifier, you will receive notice of the
        events for that source type for all your RDS sources. If you
        do not specify either the SourceType nor the SourceIdentifier,
        you will be notified of events generated from all RDS sources
        belonging to your customer account.

        :type subscription_name: string
        :param subscription_name: The name of the subscription.
        Constraints: The name must be less than 255 characters.

        :type sns_topic_arn: string
        :param sns_topic_arn: The Amazon Resource Name (ARN) of the SNS topic
            created for event notification. The ARN is created by Amazon SNS
            when you create a topic and subscribe to it.

        :type source_type: string
        :param source_type: The type of source that will be generating the
            events. For example, if you want to be notified of events generated
            by a DB instance, you would set this parameter to db-instance. if
            this value is not specified, all events are returned.
        Valid values: db-instance | db-parameter-group | db-security-group |
            db-snapshot

        :type event_categories: list
        :param event_categories: A list of event categories for a SourceType
            that you want to subscribe to. You can see a list of the categories
            for a given SourceType in the `Events`_ topic in the Amazon RDS
            User Guide or by using the **DescribeEventCategories** action.

        :type source_ids: list
        :param source_ids:
        The list of identifiers of the event sources for which events will be
            returned. If not specified, then all sources are included in the
            response. An identifier must begin with a letter and must contain
            only ASCII letters, digits, and hyphens; it cannot end with a
            hyphen or contain two consecutive hyphens.

        Constraints:


        + If SourceIds are supplied, SourceType must also be provided.
        + If the source type is a DB instance, then a `DBInstanceIdentifier`
              must be supplied.
        + If the source type is a DB security group, a `DBSecurityGroupName`
              must be supplied.
        + If the source type is a DB parameter group, a `DBParameterGroupName`
              must be supplied.
        + If the source type is a DB snapshot, a `DBSnapshotIdentifier` must be
              supplied.

        :type enabled: boolean
        :param enabled: A Boolean value; set to **true** to activate the
            subscription, set to **false** to create the subscription but not
            active it.

        :type tags: list
        :param tags: A list of tags. Tags must be passed as tuples in the form
            [('key1', 'valueForKey1'), ('key2', 'valueForKey2')]

        """
        params = {
            'SubscriptionName': subscription_name,
            'SnsTopicArn': sns_topic_arn,
        }
        if source_type is not None:
            params['SourceType'] = source_type
        if event_categories is not None:
            self.build_list_params(params,
                                   event_categories,
                                   'EventCategories.member')
        if source_ids is not None:
            self.build_list_params(params,
                                   source_ids,
                                   'SourceIds.member')
        if enabled is not None:
            params['Enabled'] = str(
                enabled).lower()
        if tags is not None:
            self.build_complex_list_params(
                params, tags,
                'Tags.member',
                ('Key', 'Value'))
        return self._make_request(
            action='CreateEventSubscription',
            verb='POST',
            path='/', params=params)

    def create_option_group(self, option_group_name, engine_name,
                            major_engine_version, option_group_description,
                            tags=None):
        """
        Creates a new option group. You can create up to 20 option
        groups.

        :type option_group_name: string
        :param option_group_name: Specifies the name of the option group to be
            created.
        Constraints:


        + Must be 1 to 255 alphanumeric characters or hyphens
        + First character must be a letter
        + Cannot end with a hyphen or contain two consecutive hyphens


        Example: `myoptiongroup`

        :type engine_name: string
        :param engine_name: Specifies the name of the engine that this option
            group should be associated with.

        :type major_engine_version: string
        :param major_engine_version: Specifies the major version of the engine
            that this option group should be associated with.

        :type option_group_description: string
        :param option_group_description: The description of the option group.

        :type tags: list
        :param tags: A list of tags. Tags must be passed as tuples in the form
            [('key1', 'valueForKey1'), ('key2', 'valueForKey2')]

        """
        params = {
            'OptionGroupName': option_group_name,
            'EngineName': engine_name,
            'MajorEngineVersion': major_engine_version,
            'OptionGroupDescription': option_group_description,
        }
        if tags is not None:
            self.build_complex_list_params(
                params, tags,
                'Tags.member',
                ('Key', 'Value'))
        return self._make_request(
            action='CreateOptionGroup',
            verb='POST',
            path='/', params=params)

    def delete_db_instance(self, db_instance_identifier,
                           skip_final_snapshot=None,
                           final_db_snapshot_identifier=None):
        """
        The DeleteDBInstance action deletes a previously provisioned
        DB instance. A successful response from the web service
        indicates the request was received correctly. When you delete
        a DB instance, all automated backups for that instance are
        deleted and cannot be recovered. Manual DB snapshots of the DB
        instance to be deleted are not deleted.

        If a final DB snapshot is requested the status of the RDS
        instance will be "deleting" until the DB snapshot is created.
        The API action `DescribeDBInstance` is used to monitor the
        status of this operation. The action cannot be canceled or
        reverted once submitted.

        :type db_instance_identifier: string
        :param db_instance_identifier:
        The DB instance identifier for the DB instance to be deleted. This
            parameter isn't case sensitive.

        Constraints:


        + Must contain from 1 to 63 alphanumeric characters or hyphens
        + First character must be a letter
        + Cannot end with a hyphen or contain two consecutive hyphens

        :type skip_final_snapshot: boolean
        :param skip_final_snapshot: Determines whether a final DB snapshot is
            created before the DB instance is deleted. If `True` is specified,
            no DBSnapshot is created. If false is specified, a DB snapshot is
            created before the DB instance is deleted.
        The FinalDBSnapshotIdentifier parameter must be specified if
            SkipFinalSnapshot is `False`.

        Default: `False`

        :type final_db_snapshot_identifier: string
        :param final_db_snapshot_identifier:
        The DBSnapshotIdentifier of the new DBSnapshot created when
            SkipFinalSnapshot is set to `False`.

        Specifying this parameter and also setting the SkipFinalShapshot
            parameter to true results in an error.

        Constraints:


        + Must be 1 to 255 alphanumeric characters
        + First character must be a letter
        + Cannot end with a hyphen or contain two consecutive hyphens

        """
        params = {'DBInstanceIdentifier': db_instance_identifier, }
        if skip_final_snapshot is not None:
            params['SkipFinalSnapshot'] = str(
                skip_final_snapshot).lower()
        if final_db_snapshot_identifier is not None:
            params['FinalDBSnapshotIdentifier'] = final_db_snapshot_identifier
        return self._make_request(
            action='DeleteDBInstance',
            verb='POST',
            path='/', params=params)

    def delete_db_parameter_group(self, db_parameter_group_name):
        """
        Deletes a specified DBParameterGroup. The DBParameterGroup
        cannot be associated with any RDS instances to be deleted.
        The specified DB parameter group cannot be associated with any
        DB instances.

        :type db_parameter_group_name: string
        :param db_parameter_group_name:
        The name of the DB parameter group.

        Constraints:


        + Must be the name of an existing DB parameter group
        + You cannot delete a default DB parameter group
        + Cannot be associated with any DB instances

        """
        params = {'DBParameterGroupName': db_parameter_group_name, }
        return self._make_request(
            action='DeleteDBParameterGroup',
            verb='POST',
            path='/', params=params)

    def delete_db_security_group(self, db_security_group_name):
        """
        Deletes a DB security group.
        The specified DB security group must not be associated with
        any DB instances.

        :type db_security_group_name: string
        :param db_security_group_name:
        The name of the DB security group to delete.

        You cannot delete the default DB security group.

        Constraints:


        + Must be 1 to 255 alphanumeric characters
        + First character must be a letter
        + Cannot end with a hyphen or contain two consecutive hyphens
        + Must not be "Default"
        + May not contain spaces

        """
        params = {'DBSecurityGroupName': db_security_group_name, }
        return self._make_request(
            action='DeleteDBSecurityGroup',
            verb='POST',
            path='/', params=params)

    def delete_db_snapshot(self, db_snapshot_identifier):
        """
        Deletes a DBSnapshot.
        The DBSnapshot must be in the `available` state to be deleted.

        :type db_snapshot_identifier: string
        :param db_snapshot_identifier: The DBSnapshot identifier.
        Constraints: Must be the name of an existing DB snapshot in the
            `available` state.

        """
        params = {'DBSnapshotIdentifier': db_snapshot_identifier, }
        return self._make_request(
            action='DeleteDBSnapshot',
            verb='POST',
            path='/', params=params)

    def delete_db_subnet_group(self, db_subnet_group_name):
        """
        Deletes a DB subnet group.
        The specified database subnet group must not be associated
        with any DB instances.

        :type db_subnet_group_name: string
        :param db_subnet_group_name:
        The name of the database subnet group to delete.

        You cannot delete the default subnet group.

        Constraints:


        + Must be 1 to 255 alphanumeric characters
        + First character must be a letter
        + Cannot end with a hyphen or contain two consecutive hyphens

        """
        params = {'DBSubnetGroupName': db_subnet_group_name, }
        return self._make_request(
            action='DeleteDBSubnetGroup',
            verb='POST',
            path='/', params=params)

    def delete_event_subscription(self, subscription_name):
        """
        Deletes an RDS event notification subscription.

        :type subscription_name: string
        :param subscription_name: The name of the RDS event notification
            subscription you want to delete.

        """
        params = {'SubscriptionName': subscription_name, }
        return self._make_request(
            action='DeleteEventSubscription',
            verb='POST',
            path='/', params=params)

    def delete_option_group(self, option_group_name):
        """
        Deletes an existing option group.

        :type option_group_name: string
        :param option_group_name:
        The name of the option group to be deleted.

        You cannot delete default option groups.

        """
        params = {'OptionGroupName': option_group_name, }
        return self._make_request(
            action='DeleteOptionGroup',
            verb='POST',
            path='/', params=params)

    def describe_db_engine_versions(self, engine=None, engine_version=None,
                                    db_parameter_group_family=None,
                                    max_records=None, marker=None,
                                    default_only=None,
                                    list_supported_character_sets=None):
        """
        Returns a list of the available DB engines.

        :type engine: string
        :param engine: The database engine to return.

        :type engine_version: string
        :param engine_version: The database engine version to return.
        Example: `5.1.49`

        :type db_parameter_group_family: string
        :param db_parameter_group_family:
        The name of a specific DB parameter group family to return details for.

        Constraints:


        + Must be 1 to 255 alphanumeric characters
        + First character must be a letter
        + Cannot end with a hyphen or contain two consecutive hyphens

        :type max_records: integer
        :param max_records: The maximum number of records to include in the
            response. If more than the `MaxRecords` value is available, a
            pagination token called a marker is included in the response so
            that the following results can be retrieved.
        Default: 100

        Constraints: minimum 20, maximum 100

        :type marker: string
        :param marker: An optional pagination token provided by a previous
            request. If this parameter is specified, the response includes only
            records beyond the marker, up to the value specified by
            `MaxRecords`.

        :type default_only: boolean
        :param default_only: Indicates that only the default version of the
            specified engine or engine and major version combination is
            returned.

        :type list_supported_character_sets: boolean
        :param list_supported_character_sets: If this parameter is specified,
            and if the requested engine supports the CharacterSetName parameter
            for CreateDBInstance, the response includes a list of supported
            character sets for each engine version.

        """
        params = {}
        if engine is not None:
            params['Engine'] = engine
        if engine_version is not None:
            params['EngineVersion'] = engine_version
        if db_parameter_group_family is not None:
            params['DBParameterGroupFamily'] = db_parameter_group_family
        if max_records is not None:
            params['MaxRecords'] = max_records
        if marker is not None:
            params['Marker'] = marker
        if default_only is not None:
            params['DefaultOnly'] = str(
                default_only).lower()
        if list_supported_character_sets is not None:
            params['ListSupportedCharacterSets'] = str(
                list_supported_character_sets).lower()
        return self._make_request(
            action='DescribeDBEngineVersions',
            verb='POST',
            path='/', params=params)

    def describe_db_instances(self, db_instance_identifier=None,
                              filters=None, max_records=None, marker=None):
        """
        Returns information about provisioned RDS instances. This API
        supports pagination.

        :type db_instance_identifier: string
        :param db_instance_identifier:
        The user-supplied instance identifier. If this parameter is specified,
            information from only the specific DB instance is returned. This
            parameter isn't case sensitive.

        Constraints:


        + Must contain from 1 to 63 alphanumeric characters or hyphens
        + First character must be a letter
        + Cannot end with a hyphen or contain two consecutive hyphens

        :type filters: list
        :param filters:

        :type max_records: integer
        :param max_records: The maximum number of records to include in the
            response. If more records exist than the specified `MaxRecords`
            value, a pagination token called a marker is included in the
            response so that the remaining results may be retrieved.
        Default: 100

        Constraints: minimum 20, maximum 100

        :type marker: string
        :param marker: An optional pagination token provided by a previous
            DescribeDBInstances request. If this parameter is specified, the
            response includes only records beyond the marker, up to the value
            specified by `MaxRecords` .

        """
        params = {}
        if db_instance_identifier is not None:
            params['DBInstanceIdentifier'] = db_instance_identifier
        if filters is not None:
            self.build_complex_list_params(
                params, filters,
                'Filters.member',
                ('FilterName', 'FilterValue'))
        if max_records is not None:
            params['MaxRecords'] = max_records
        if marker is not None:
            params['Marker'] = marker
        return self._make_request(
            action='DescribeDBInstances',
            verb='POST',
            path='/', params=params)

    def describe_db_log_files(self, db_instance_identifier,
                              filename_contains=None, file_last_written=None,
                              file_size=None, max_records=None, marker=None):
        """
        Returns a list of DB log files for the DB instance.

        :type db_instance_identifier: string
        :param db_instance_identifier:
        The customer-assigned name of the DB instance that contains the log
            files you want to list.

        Constraints:


        + Must contain from 1 to 63 alphanumeric characters or hyphens
        + First character must be a letter
        + Cannot end with a hyphen or contain two consecutive hyphens

        :type filename_contains: string
        :param filename_contains: Filters the available log files for log file
            names that contain the specified string.

        :type file_last_written: long
        :param file_last_written: Filters the available log files for files
            written since the specified date, in POSIX timestamp format.

        :type file_size: long
        :param file_size: Filters the available log files for files larger than
            the specified size.

        :type max_records: integer
        :param max_records: The maximum number of records to include in the
            response. If more records exist than the specified MaxRecords
            value, a pagination token called a marker is included in the
            response so that the remaining results can be retrieved.

        :type marker: string
        :param marker: The pagination token provided in the previous request.
            If this parameter is specified the response includes only records
            beyond the marker, up to MaxRecords.

        """
        params = {'DBInstanceIdentifier': db_instance_identifier, }
        if filename_contains is not None:
            params['FilenameContains'] = filename_contains
        if file_last_written is not None:
            params['FileLastWritten'] = file_last_written
        if file_size is not None:
            params['FileSize'] = file_size
        if max_records is not None:
            params['MaxRecords'] = max_records
        if marker is not None:
            params['Marker'] = marker
        return self._make_request(
            action='DescribeDBLogFiles',
            verb='POST',
            path='/', params=params)

    def describe_db_parameter_groups(self, db_parameter_group_name=None,
                                     filters=None, max_records=None,
                                     marker=None):
        """
        Returns a list of `DBParameterGroup` descriptions. If a
        `DBParameterGroupName` is specified, the list will contain
        only the description of the specified DB parameter group.

        :type db_parameter_group_name: string
        :param db_parameter_group_name:
        The name of a specific DB parameter group to return details for.

        Constraints:


        + Must be 1 to 255 alphanumeric characters
        + First character must be a letter
        + Cannot end with a hyphen or contain two consecutive hyphens

        :type filters: list
        :param filters:

        :type max_records: integer
        :param max_records: The maximum number of records to include in the
            response. If more records exist than the specified `MaxRecords`
            value, a pagination token called a marker is included in the
            response so that the remaining results may be retrieved.
        Default: 100

        Constraints: minimum 20, maximum 100

        :type marker: string
        :param marker: An optional pagination token provided by a previous
            `DescribeDBParameterGroups` request. If this parameter is
            specified, the response includes only records beyond the marker, up
            to the value specified by `MaxRecords`.

        """
        params = {}
        if db_parameter_group_name is not None:
            params['DBParameterGroupName'] = db_parameter_group_name
        if filters is not None:
            self.build_complex_list_params(
                params, filters,
                'Filters.member',
                ('FilterName', 'FilterValue'))
        if max_records is not None:
            params['MaxRecords'] = max_records
        if marker is not None:
            params['Marker'] = marker
        return self._make_request(
            action='DescribeDBParameterGroups',
            verb='POST',
            path='/', params=params)

    def describe_db_parameters(self, db_parameter_group_name, source=None,
                               max_records=None, marker=None):
        """
        Returns the detailed parameter list for a particular DB
        parameter group.

        :type db_parameter_group_name: string
        :param db_parameter_group_name:
        The name of a specific DB parameter group to return details for.

        Constraints:


        + Must be 1 to 255 alphanumeric characters
        + First character must be a letter
        + Cannot end with a hyphen or contain two consecutive hyphens

        :type source: string
        :param source: The parameter types to return.
        Default: All parameter types returned

        Valid Values: `user | system | engine-default`

        :type max_records: integer
        :param max_records: The maximum number of records to include in the
            response. If more records exist than the specified `MaxRecords`
            value, a pagination token called a marker is included in the
            response so that the remaining results may be retrieved.
        Default: 100

        Constraints: minimum 20, maximum 100

        :type marker: string
        :param marker: An optional pagination token provided by a previous
            `DescribeDBParameters` request. If this parameter is specified, the
            response includes only records beyond the marker, up to the value
            specified by `MaxRecords`.

        """
        params = {'DBParameterGroupName': db_parameter_group_name, }
        if source is not None:
            params['Source'] = source
        if max_records is not None:
            params['MaxRecords'] = max_records
        if marker is not None:
            params['Marker'] = marker
        return self._make_request(
            action='DescribeDBParameters',
            verb='POST',
            path='/', params=params)

    def describe_db_security_groups(self, db_security_group_name=None,
                                    filters=None, max_records=None,
                                    marker=None):
        """
        Returns a list of `DBSecurityGroup` descriptions. If a
        `DBSecurityGroupName` is specified, the list will contain only
        the descriptions of the specified DB security group.

        :type db_security_group_name: string
        :param db_security_group_name: The name of the DB security group to
            return details for.

        :type filters: list
        :param filters:

        :type max_records: integer
        :param max_records: The maximum number of records to include in the
            response. If more records exist than the specified `MaxRecords`
            value, a pagination token called a marker is included in the
            response so that the remaining results may be retrieved.
        Default: 100

        Constraints: minimum 20, maximum 100

        :type marker: string
        :param marker: An optional pagination token provided by a previous
            DescribeDBSecurityGroups request. If this parameter is specified,
            the response includes only records beyond the marker, up to the
            value specified by `MaxRecords`.

        """
        params = {}
        if db_security_group_name is not None:
            params['DBSecurityGroupName'] = db_security_group_name
        if filters is not None:
            self.build_complex_list_params(
                params, filters,
                'Filters.member',
                ('FilterName', 'FilterValue'))
        if max_records is not None:
            params['MaxRecords'] = max_records
        if marker is not None:
            params['Marker'] = marker
        return self._make_request(
            action='DescribeDBSecurityGroups',
            verb='POST',
            path='/', params=params)

    def describe_db_snapshots(self, db_instance_identifier=None,
                              db_snapshot_identifier=None,
                              snapshot_type=None, filters=None,
                              max_records=None, marker=None):
        """
        Returns information about DB snapshots. This API supports
        pagination.

        :type db_instance_identifier: string
        :param db_instance_identifier:
        A DB instance identifier to retrieve the list of DB snapshots for.
            Cannot be used in conjunction with `DBSnapshotIdentifier`. This
            parameter is not case sensitive.

        Constraints:


        + Must contain from 1 to 63 alphanumeric characters or hyphens
        + First character must be a letter
        + Cannot end with a hyphen or contain two consecutive hyphens

        :type db_snapshot_identifier: string
        :param db_snapshot_identifier:
        A specific DB snapshot identifier to describe. Cannot be used in
            conjunction with `DBInstanceIdentifier`. This value is stored as a
            lowercase string.

        Constraints:


        + Must be 1 to 255 alphanumeric characters
        + First character must be a letter
        + Cannot end with a hyphen or contain two consecutive hyphens
        + If this is the identifier of an automated snapshot, the
              `SnapshotType` parameter must also be specified.

        :type snapshot_type: string
        :param snapshot_type: The type of snapshots that will be returned.
            Values can be "automated" or "manual." If not specified, the
            returned results will include all snapshots types.

        :type filters: list
        :param filters:

        :type max_records: integer
        :param max_records: The maximum number of records to include in the
            response. If more records exist than the specified `MaxRecords`
            value, a pagination token called a marker is included in the
            response so that the remaining results may be retrieved.
        Default: 100

        Constraints: minimum 20, maximum 100

        :type marker: string
        :param marker: An optional pagination token provided by a previous
            `DescribeDBSnapshots` request. If this parameter is specified, the
            response includes only records beyond the marker, up to the value
            specified by `MaxRecords`.

        """
        params = {}
        if db_instance_identifier is not None:
            params['DBInstanceIdentifier'] = db_instance_identifier
        if db_snapshot_identifier is not None:
            params['DBSnapshotIdentifier'] = db_snapshot_identifier
        if snapshot_type is not None:
            params['SnapshotType'] = snapshot_type
        if filters is not None:
            self.build_complex_list_params(
                params, filters,
                'Filters.member',
                ('FilterName', 'FilterValue'))
        if max_records is not None:
            params['MaxRecords'] = max_records
        if marker is not None:
            params['Marker'] = marker
        return self._make_request(
            action='DescribeDBSnapshots',
            verb='POST',
            path='/', params=params)

    def describe_db_subnet_groups(self, db_subnet_group_name=None,
                                  filters=None, max_records=None,
                                  marker=None):
        """
        Returns a list of DBSubnetGroup descriptions. If a
        DBSubnetGroupName is specified, the list will contain only the
        descriptions of the specified DBSubnetGroup.

        For an overview of CIDR ranges, go to the `Wikipedia
        Tutorial`_.

        :type db_subnet_group_name: string
        :param db_subnet_group_name: The name of the DB subnet group to return
            details for.

        :type filters: list
        :param filters:

        :type max_records: integer
        :param max_records: The maximum number of records to include in the
            response. If more records exist than the specified `MaxRecords`
            value, a pagination token called a marker is included in the
            response so that the remaining results may be retrieved.
        Default: 100

        Constraints: minimum 20, maximum 100

        :type marker: string
        :param marker: An optional pagination token provided by a previous
            DescribeDBSubnetGroups request. If this parameter is specified, the
            response includes only records beyond the marker, up to the value
            specified by `MaxRecords`.

        """
        params = {}
        if db_subnet_group_name is not None:
            params['DBSubnetGroupName'] = db_subnet_group_name
        if filters is not None:
            self.build_complex_list_params(
                params, filters,
                'Filters.member',
                ('FilterName', 'FilterValue'))
        if max_records is not None:
            params['MaxRecords'] = max_records
        if marker is not None:
            params['Marker'] = marker
        return self._make_request(
            action='DescribeDBSubnetGroups',
            verb='POST',
            path='/', params=params)

    def describe_engine_default_parameters(self, db_parameter_group_family,
                                           max_records=None, marker=None):
        """
        Returns the default engine and system parameter information
        for the specified database engine.

        :type db_parameter_group_family: string
        :param db_parameter_group_family: The name of the DB parameter group
            family.

        :type max_records: integer
        :param max_records: The maximum number of records to include in the
            response. If more records exist than the specified `MaxRecords`
            value, a pagination token called a marker is included in the
            response so that the remaining results may be retrieved.
        Default: 100

        Constraints: minimum 20, maximum 100

        :type marker: string
        :param marker: An optional pagination token provided by a previous
            `DescribeEngineDefaultParameters` request. If this parameter is
            specified, the response includes only records beyond the marker, up
            to the value specified by `MaxRecords`.

        """
        params = {
            'DBParameterGroupFamily': db_parameter_group_family,
        }
        if max_records is not None:
            params['MaxRecords'] = max_records
        if marker is not None:
            params['Marker'] = marker
        return self._make_request(
            action='DescribeEngineDefaultParameters',
            verb='POST',
            path='/', params=params)

    def describe_event_categories(self, source_type=None):
        """
        Displays a list of categories for all event source types, or,
        if specified, for a specified source type. You can see a list
        of the event categories and source types in the ` Events`_
        topic in the Amazon RDS User Guide.

        :type source_type: string
        :param source_type: The type of source that will be generating the
            events.
        Valid values: db-instance | db-parameter-group | db-security-group |
            db-snapshot

        """
        params = {}
        if source_type is not None:
            params['SourceType'] = source_type
        return self._make_request(
            action='DescribeEventCategories',
            verb='POST',
            path='/', params=params)

    def describe_event_subscriptions(self, subscription_name=None,
                                     filters=None, max_records=None,
                                     marker=None):
        """
        Lists all the subscription descriptions for a customer
        account. The description for a subscription includes
        SubscriptionName, SNSTopicARN, CustomerID, SourceType,
        SourceID, CreationTime, and Status.

        If you specify a SubscriptionName, lists the description for
        that subscription.

        :type subscription_name: string
        :param subscription_name: The name of the RDS event notification
            subscription you want to describe.

        :type filters: list
        :param filters:

        :type max_records: integer
        :param max_records: The maximum number of records to include in the
            response. If more records exist than the specified `MaxRecords`
            value, a pagination token called a marker is included in the
            response so that the remaining results can be retrieved.
        Default: 100

        Constraints: minimum 20, maximum 100

        :type marker: string
        :param marker: An optional pagination token provided by a previous
            DescribeOrderableDBInstanceOptions request. If this parameter is
            specified, the response includes only records beyond the marker, up
            to the value specified by `MaxRecords` .

        """
        params = {}
        if subscription_name is not None:
            params['SubscriptionName'] = subscription_name
        if filters is not None:
            self.build_complex_list_params(
                params, filters,
                'Filters.member',
                ('FilterName', 'FilterValue'))
        if max_records is not None:
            params['MaxRecords'] = max_records
        if marker is not None:
            params['Marker'] = marker
        return self._make_request(
            action='DescribeEventSubscriptions',
            verb='POST',
            path='/', params=params)

    def describe_events(self, source_identifier=None, source_type=None,
                        start_time=None, end_time=None, duration=None,
                        event_categories=None, max_records=None, marker=None):
        """
        Returns events related to DB instances, DB security groups, DB
        snapshots, and DB parameter groups for the past 14 days.
        Events specific to a particular DB instance, DB security
        group, database snapshot, or DB parameter group can be
        obtained by providing the name as a parameter. By default, the
        past hour of events are returned.

        :type source_identifier: string
        :param source_identifier:
        The identifier of the event source for which events will be returned.
            If not specified, then all sources are included in the response.

        Constraints:


        + If SourceIdentifier is supplied, SourceType must also be provided.
        + If the source type is `DBInstance`, then a `DBInstanceIdentifier`
              must be supplied.
        + If the source type is `DBSecurityGroup`, a `DBSecurityGroupName` must
              be supplied.
        + If the source type is `DBParameterGroup`, a `DBParameterGroupName`
              must be supplied.
        + If the source type is `DBSnapshot`, a `DBSnapshotIdentifier` must be
              supplied.
        + Cannot end with a hyphen or contain two consecutive hyphens.

        :type source_type: string
        :param source_type: The event source to retrieve events for. If no
            value is specified, all events are returned.

        :type start_time: timestamp
        :param start_time: The beginning of the time interval to retrieve
            events for, specified in ISO 8601 format. For more information
            about ISO 8601, go to the `ISO8601 Wikipedia page.`_
        Example: 2009-07-08T18:00Z

        :type end_time: timestamp
        :param end_time: The end of the time interval for which to retrieve
            events, specified in ISO 8601 format. For more information about
            ISO 8601, go to the `ISO8601 Wikipedia page.`_
        Example: 2009-07-08T18:00Z

        :type duration: integer
        :param duration: The number of minutes to retrieve events for.
        Default: 60

        :type event_categories: list
        :param event_categories: A list of event categories that trigger
            notifications for a event notification subscription.

        :type max_records: integer
        :param max_records: The maximum number of records to include in the
            response. If more records exist than the specified `MaxRecords`
            value, a pagination token called a marker is included in the
            response so that the remaining results may be retrieved.
        Default: 100

        Constraints: minimum 20, maximum 100

        :type marker: string
        :param marker: An optional pagination token provided by a previous
            DescribeEvents request. If this parameter is specified, the
            response includes only records beyond the marker, up to the value
            specified by `MaxRecords`.

        """
        params = {}
        if source_identifier is not None:
            params['SourceIdentifier'] = source_identifier
        if source_type is not None:
            params['SourceType'] = source_type
        if start_time is not None:
            params['StartTime'] = start_time
        if end_time is not None:
            params['EndTime'] = end_time
        if duration is not None:
            params['Duration'] = duration
        if event_categories is not None:
            self.build_list_params(params,
                                   event_categories,
                                   'EventCategories.member')
        if max_records is not None:
            params['MaxRecords'] = max_records
        if marker is not None:
            params['Marker'] = marker
        return self._make_request(
            action='DescribeEvents',
            verb='POST',
            path='/', params=params)

    def describe_option_group_options(self, engine_name,
                                      major_engine_version=None,
                                      max_records=None, marker=None):
        """
        Describes all available options.

        :type engine_name: string
        :param engine_name: A required parameter. Options available for the
            given Engine name will be described.

        :type major_engine_version: string
        :param major_engine_version: If specified, filters the results to
            include only options for the specified major engine version.

        :type max_records: integer
        :param max_records: The maximum number of records to include in the
            response. If more records exist than the specified `MaxRecords`
            value, a pagination token called a marker is included in the
            response so that the remaining results can be retrieved.
        Default: 100

        Constraints: minimum 20, maximum 100

        :type marker: string
        :param marker: An optional pagination token provided by a previous
            request. If this parameter is specified, the response includes only
            records beyond the marker, up to the value specified by
            `MaxRecords`.

        """
        params = {'EngineName': engine_name, }
        if major_engine_version is not None:
            params['MajorEngineVersion'] = major_engine_version
        if max_records is not None:
            params['MaxRecords'] = max_records
        if marker is not None:
            params['Marker'] = marker
        return self._make_request(
            action='DescribeOptionGroupOptions',
            verb='POST',
            path='/', params=params)

    def describe_option_groups(self, option_group_name=None, filters=None,
                               marker=None, max_records=None,
                               engine_name=None, major_engine_version=None):
        """
        Describes the available option groups.

        :type option_group_name: string
        :param option_group_name: The name of the option group to describe.
            Cannot be supplied together with EngineName or MajorEngineVersion.

        :type filters: list
        :param filters:

        :type marker: string
        :param marker: An optional pagination token provided by a previous
            DescribeOptionGroups request. If this parameter is specified, the
            response includes only records beyond the marker, up to the value
            specified by `MaxRecords`.

        :type max_records: integer
        :param max_records: The maximum number of records to include in the
            response. If more records exist than the specified `MaxRecords`
            value, a pagination token called a marker is included in the
            response so that the remaining results can be retrieved.
        Default: 100

        Constraints: minimum 20, maximum 100

        :type engine_name: string
        :param engine_name: Filters the list of option groups to only include
            groups associated with a specific database engine.

        :type major_engine_version: string
        :param major_engine_version: Filters the list of option groups to only
            include groups associated with a specific database engine version.
            If specified, then EngineName must also be specified.

        """
        params = {}
        if option_group_name is not None:
            params['OptionGroupName'] = option_group_name
        if filters is not None:
            self.build_complex_list_params(
                params, filters,
                'Filters.member',
                ('FilterName', 'FilterValue'))
        if marker is not None:
            params['Marker'] = marker
        if max_records is not None:
            params['MaxRecords'] = max_records
        if engine_name is not None:
            params['EngineName'] = engine_name
        if major_engine_version is not None:
            params['MajorEngineVersion'] = major_engine_version
        return self._make_request(
            action='DescribeOptionGroups',
            verb='POST',
            path='/', params=params)

    def describe_orderable_db_instance_options(self, engine,
                                               engine_version=None,
                                               db_instance_class=None,
                                               license_model=None, vpc=None,
                                               max_records=None, marker=None):
        """
        Returns a list of orderable DB instance options for the
        specified engine.

        :type engine: string
        :param engine: The name of the engine to retrieve DB instance options
            for.

        :type engine_version: string
        :param engine_version: The engine version filter value. Specify this
            parameter to show only the available offerings matching the
            specified engine version.

        :type db_instance_class: string
        :param db_instance_class: The DB instance class filter value. Specify
            this parameter to show only the available offerings matching the
            specified DB instance class.

        :type license_model: string
        :param license_model: The license model filter value. Specify this
            parameter to show only the available offerings matching the
            specified license model.

        :type vpc: boolean
        :param vpc: The VPC filter value. Specify this parameter to show only
            the available VPC or non-VPC offerings.

        :type max_records: integer
        :param max_records: The maximum number of records to include in the
            response. If more records exist than the specified `MaxRecords`
            value, a pagination token called a marker is included in the
            response so that the remaining results can be retrieved.
        Default: 100

        Constraints: minimum 20, maximum 100

        :type marker: string
        :param marker: An optional pagination token provided by a previous
            DescribeOrderableDBInstanceOptions request. If this parameter is
            specified, the response includes only records beyond the marker, up
            to the value specified by `MaxRecords` .

        """
        params = {'Engine': engine, }
        if engine_version is not None:
            params['EngineVersion'] = engine_version
        if db_instance_class is not None:
            params['DBInstanceClass'] = db_instance_class
        if license_model is not None:
            params['LicenseModel'] = license_model
        if vpc is not None:
            params['Vpc'] = str(
                vpc).lower()
        if max_records is not None:
            params['MaxRecords'] = max_records
        if marker is not None:
            params['Marker'] = marker
        return self._make_request(
            action='DescribeOrderableDBInstanceOptions',
            verb='POST',
            path='/', params=params)

    def describe_reserved_db_instances(self, reserved_db_instance_id=None,
                                       reserved_db_instances_offering_id=None,
                                       db_instance_class=None, duration=None,
                                       product_description=None,
                                       offering_type=None, multi_az=None,
                                       filters=None, max_records=None,
                                       marker=None):
        """
        Returns information about reserved DB instances for this
        account, or about a specified reserved DB instance.

        :type reserved_db_instance_id: string
        :param reserved_db_instance_id: The reserved DB instance identifier
            filter value. Specify this parameter to show only the reservation
            that matches the specified reservation ID.

        :type reserved_db_instances_offering_id: string
        :param reserved_db_instances_offering_id: The offering identifier
            filter value. Specify this parameter to show only purchased
            reservations matching the specified offering identifier.

        :type db_instance_class: string
        :param db_instance_class: The DB instance class filter value. Specify
            this parameter to show only those reservations matching the
            specified DB instances class.

        :type duration: string
        :param duration: The duration filter value, specified in years or
            seconds. Specify this parameter to show only reservations for this
            duration.
        Valid Values: `1 | 3 | 31536000 | 94608000`

        :type product_description: string
        :param product_description: The product description filter value.
            Specify this parameter to show only those reservations matching the
            specified product description.

        :type offering_type: string
        :param offering_type: The offering type filter value. Specify this
            parameter to show only the available offerings matching the
            specified offering type.
        Valid Values: `"Light Utilization" | "Medium Utilization" | "Heavy
            Utilization" `

        :type multi_az: boolean
        :param multi_az: The Multi-AZ filter value. Specify this parameter to
            show only those reservations matching the specified Multi-AZ
            parameter.

        :type filters: list
        :param filters:

        :type max_records: integer
        :param max_records: The maximum number of records to include in the
            response. If more than the `MaxRecords` value is available, a
            pagination token called a marker is included in the response so
            that the following results can be retrieved.
        Default: 100

        Constraints: minimum 20, maximum 100

        :type marker: string
        :param marker: An optional pagination token provided by a previous
            request. If this parameter is specified, the response includes only
            records beyond the marker, up to the value specified by
            `MaxRecords`.

        """
        params = {}
        if reserved_db_instance_id is not None:
            params['ReservedDBInstanceId'] = reserved_db_instance_id
        if reserved_db_instances_offering_id is not None:
            params['ReservedDBInstancesOfferingId'] = reserved_db_instances_offering_id
        if db_instance_class is not None:
            params['DBInstanceClass'] = db_instance_class
        if duration is not None:
            params['Duration'] = duration
        if product_description is not None:
            params['ProductDescription'] = product_description
        if offering_type is not None:
            params['OfferingType'] = offering_type
        if multi_az is not None:
            params['MultiAZ'] = str(
                multi_az).lower()
        if filters is not None:
            self.build_complex_list_params(
                params, filters,
                'Filters.member',
                ('FilterName', 'FilterValue'))
        if max_records is not None:
            params['MaxRecords'] = max_records
        if marker is not None:
            params['Marker'] = marker
        return self._make_request(
            action='DescribeReservedDBInstances',
            verb='POST',
            path='/', params=params)

    def describe_reserved_db_instances_offerings(self,
                                                 reserved_db_instances_offering_id=None,
                                                 db_instance_class=None,
                                                 duration=None,
                                                 product_description=None,
                                                 offering_type=None,
                                                 multi_az=None,
                                                 max_records=None,
                                                 marker=None):
        """
        Lists available reserved DB instance offerings.

        :type reserved_db_instances_offering_id: string
        :param reserved_db_instances_offering_id: The offering identifier
            filter value. Specify this parameter to show only the available
            offering that matches the specified reservation identifier.
        Example: `438012d3-4052-4cc7-b2e3-8d3372e0e706`

        :type db_instance_class: string
        :param db_instance_class: The DB instance class filter value. Specify
            this parameter to show only the available offerings matching the
            specified DB instance class.

        :type duration: string
        :param duration: Duration filter value, specified in years or seconds.
            Specify this parameter to show only reservations for this duration.
        Valid Values: `1 | 3 | 31536000 | 94608000`

        :type product_description: string
        :param product_description: Product description filter value. Specify
            this parameter to show only the available offerings matching the
            specified product description.

        :type offering_type: string
        :param offering_type: The offering type filter value. Specify this
            parameter to show only the available offerings matching the
            specified offering type.
        Valid Values: `"Light Utilization" | "Medium Utilization" | "Heavy
            Utilization" `

        :type multi_az: boolean
        :param multi_az: The Multi-AZ filter value. Specify this parameter to
            show only the available offerings matching the specified Multi-AZ
            parameter.

        :type max_records: integer
        :param max_records: The maximum number of records to include in the
            response. If more than the `MaxRecords` value is available, a
            pagination token called a marker is included in the response so
            that the following results can be retrieved.
        Default: 100

        Constraints: minimum 20, maximum 100

        :type marker: string
        :param marker: An optional pagination token provided by a previous
            request. If this parameter is specified, the response includes only
            records beyond the marker, up to the value specified by
            `MaxRecords`.

        """
        params = {}
        if reserved_db_instances_offering_id is not None:
            params['ReservedDBInstancesOfferingId'] = reserved_db_instances_offering_id
        if db_instance_class is not None:
            params['DBInstanceClass'] = db_instance_class
        if duration is not None:
            params['Duration'] = duration
        if product_description is not None:
            params['ProductDescription'] = product_description
        if offering_type is not None:
            params['OfferingType'] = offering_type
        if multi_az is not None:
            params['MultiAZ'] = str(
                multi_az).lower()
        if max_records is not None:
            params['MaxRecords'] = max_records
        if marker is not None:
            params['Marker'] = marker
        return self._make_request(
            action='DescribeReservedDBInstancesOfferings',
            verb='POST',
            path='/', params=params)

    def download_db_log_file_portion(self, db_instance_identifier,
                                     log_file_name, marker=None,
                                     number_of_lines=None):
        """
        Downloads the last line of the specified log file.

        :type db_instance_identifier: string
        :param db_instance_identifier:
        The customer-assigned name of the DB instance that contains the log
            files you want to list.

        Constraints:


        + Must contain from 1 to 63 alphanumeric characters or hyphens
        + First character must be a letter
        + Cannot end with a hyphen or contain two consecutive hyphens

        :type log_file_name: string
        :param log_file_name: The name of the log file to be downloaded.

        :type marker: string
        :param marker: The pagination token provided in the previous request.
            If this parameter is specified the response includes only records
            beyond the marker, up to MaxRecords.

        :type number_of_lines: integer
        :param number_of_lines: The number of lines remaining to be downloaded.

        """
        params = {
            'DBInstanceIdentifier': db_instance_identifier,
            'LogFileName': log_file_name,
        }
        if marker is not None:
            params['Marker'] = marker
        if number_of_lines is not None:
            params['NumberOfLines'] = number_of_lines
        return self._make_request(
            action='DownloadDBLogFilePortion',
            verb='POST',
            path='/', params=params)

    def list_tags_for_resource(self, resource_name):
        """
        Lists all tags on an Amazon RDS resource.

        For an overview on tagging an Amazon RDS resource, see
        `Tagging Amazon RDS Resources`_.

        :type resource_name: string
        :param resource_name: The Amazon RDS resource with tags to be listed.
            This value is an Amazon Resource Name (ARN). For information about
            creating an ARN, see ` Constructing an RDS Amazon Resource Name
            (ARN)`_.

        """
        params = {'ResourceName': resource_name, }
        return self._make_request(
            action='ListTagsForResource',
            verb='POST',
            path='/', params=params)

    def modify_db_instance(self, db_instance_identifier,
                           allocated_storage=None, db_instance_class=None,
                           db_security_groups=None,
                           vpc_security_group_ids=None,
                           apply_immediately=None, master_user_password=None,
                           db_parameter_group_name=None,
                           backup_retention_period=None,
                           preferred_backup_window=None,
                           preferred_maintenance_window=None, multi_az=None,
                           engine_version=None,
                           allow_major_version_upgrade=None,
                           auto_minor_version_upgrade=None, iops=None,
                           option_group_name=None,
                           new_db_instance_identifier=None):
        """
        Modify settings for a DB instance. You can change one or more
        database configuration parameters by specifying these
        parameters and the new values in the request.

        :type db_instance_identifier: string
        :param db_instance_identifier:
        The DB instance identifier. This value is stored as a lowercase string.

        Constraints:


        + Must be the identifier for an existing DB instance
        + Must contain from 1 to 63 alphanumeric characters or hyphens
        + First character must be a letter
        + Cannot end with a hyphen or contain two consecutive hyphens

        :type allocated_storage: integer
        :param allocated_storage: The new storage capacity of the RDS instance.
            Changing this parameter does not result in an outage and the change
            is applied during the next maintenance window unless the
            `ApplyImmediately` parameter is set to `True` for this request.
        **MySQL**

        Default: Uses existing setting

        Valid Values: 5-1024

        Constraints: Value supplied must be at least 10% greater than the
            current value. Values that are not at least 10% greater than the
            existing value are rounded up so that they are 10% greater than the
            current value.

        Type: Integer

        **Oracle**

        Default: Uses existing setting

        Valid Values: 10-1024

        Constraints: Value supplied must be at least 10% greater than the
            current value. Values that are not at least 10% greater than the
            existing value are rounded up so that they are 10% greater than the
            current value.

        **SQL Server**

        Cannot be modified.

        If you choose to migrate your DB instance from using standard storage
            to using Provisioned IOPS, or from using Provisioned IOPS to using
            standard storage, the process can take time. The duration of the
            migration depends on several factors such as database load, storage
            size, storage type (standard or Provisioned IOPS), amount of IOPS
            provisioned (if any), and the number of prior scale storage
            operations. Typical migration times are under 24 hours, but the
            process can take up to several days in some cases. During the
            migration, the DB instance will be available for use, but may
            experience performance degradation. While the migration takes
            place, nightly backups for the instance will be suspended. No other
            Amazon RDS operations can take place for the instance, including
            modifying the instance, rebooting the instance, deleting the
            instance, creating a read replica for the instance, and creating a
            DB snapshot of the instance.

        :type db_instance_class: string
        :param db_instance_class: The new compute and memory capacity of the DB
            instance. To determine the instance classes that are available for
            a particular DB engine, use the DescribeOrderableDBInstanceOptions
            action.
        Passing a value for this parameter causes an outage during the change
            and is applied during the next maintenance window, unless the
            `ApplyImmediately` parameter is specified as `True` for this
            request.

        Default: Uses existing setting

        Valid Values: `db.t1.micro | db.m1.small | db.m1.medium | db.m1.large |
            db.m1.xlarge | db.m2.xlarge | db.m2.2xlarge | db.m2.4xlarge`

        :type db_security_groups: list
        :param db_security_groups:
        A list of DB security groups to authorize on this DB instance. Changing
            this parameter does not result in an outage and the change is
            asynchronously applied as soon as possible.

        Constraints:


        + Must be 1 to 255 alphanumeric characters
        + First character must be a letter
        + Cannot end with a hyphen or contain two consecutive hyphens

        :type vpc_security_group_ids: list
        :param vpc_security_group_ids:
        A list of EC2 VPC security groups to authorize on this DB instance.
            This change is asynchronously applied as soon as possible.

        Constraints:


        + Must be 1 to 255 alphanumeric characters
        + First character must be a letter
        + Cannot end with a hyphen or contain two consecutive hyphens

        :type apply_immediately: boolean
        :param apply_immediately: Specifies whether or not the modifications in
            this request and any pending modifications are asynchronously
            applied as soon as possible, regardless of the
            `PreferredMaintenanceWindow` setting for the DB instance.
        If this parameter is passed as `False`, changes to the DB instance are
            applied on the next call to RebootDBInstance, the next maintenance
            reboot, or the next failure reboot, whichever occurs first. See
            each parameter to determine when a change is applied.

        Default: `False`

        :type master_user_password: string
        :param master_user_password:
        The new password for the DB instance master user. Can be any printable
            ASCII character except "/", '"', or "@".

        Changing this parameter does not result in an outage and the change is
            asynchronously applied as soon as possible. Between the time of the
            request and the completion of the request, the `MasterUserPassword`
            element exists in the `PendingModifiedValues` element of the
            operation response.

        Default: Uses existing setting

        Constraints: Must be 8 to 41 alphanumeric characters (MySQL), 8 to 30
            alphanumeric characters (Oracle), or 8 to 128 alphanumeric
            characters (SQL Server).

        Amazon RDS API actions never return the password, so this action
            provides a way to regain access to a master instance user if the
            password is lost.

        :type db_parameter_group_name: string
        :param db_parameter_group_name: The name of the DB parameter group to
            apply to this DB instance. Changing this parameter does not result
            in an outage and the change is applied during the next maintenance
            window unless the `ApplyImmediately` parameter is set to `True` for
            this request.
        Default: Uses existing setting

        Constraints: The DB parameter group must be in the same DB parameter
            group family as this DB instance.

        :type backup_retention_period: integer
        :param backup_retention_period:
        The number of days to retain automated backups. Setting this parameter
            to a positive number enables backups. Setting this parameter to 0
            disables automated backups.

        Changing this parameter can result in an outage if you change from 0 to
            a non-zero value or from a non-zero value to 0. These changes are
            applied during the next maintenance window unless the
            `ApplyImmediately` parameter is set to `True` for this request. If
            you change the parameter from one non-zero value to another non-
            zero value, the change is asynchronously applied as soon as
            possible.

        Default: Uses existing setting

        Constraints:


        + Must be a value from 0 to 8
        + Cannot be set to 0 if the DB instance is a master instance with read
              replicas or if the DB instance is a read replica

        :type preferred_backup_window: string
        :param preferred_backup_window:
        The daily time range during which automated backups are created if
            automated backups are enabled, as determined by the
            `BackupRetentionPeriod`. Changing this parameter does not result in
            an outage and the change is asynchronously applied as soon as
            possible.

        Constraints:


        + Must be in the format hh24:mi-hh24:mi
        + Times should be Universal Time Coordinated (UTC)
        + Must not conflict with the preferred maintenance window
        + Must be at least 30 minutes

        :type preferred_maintenance_window: string
        :param preferred_maintenance_window: The weekly time range (in UTC)
            during which system maintenance can occur, which may result in an
            outage. Changing this parameter does not result in an outage,
            except in the following situation, and the change is asynchronously
            applied as soon as possible. If there are pending actions that
            cause a reboot, and the maintenance window is changed to include
            the current time, then changing this parameter will cause a reboot
            of the DB instance. If moving this window to the current time,
            there must be at least 30 minutes between the current time and end
            of the window to ensure pending changes are applied.
        Default: Uses existing setting

        Format: ddd:hh24:mi-ddd:hh24:mi

        Valid Days: Mon | Tue | Wed | Thu | Fri | Sat | Sun

        Constraints: Must be at least 30 minutes

        :type multi_az: boolean
        :param multi_az: Specifies if the DB instance is a Multi-AZ deployment.
            Changing this parameter does not result in an outage and the change
            is applied during the next maintenance window unless the
            `ApplyImmediately` parameter is set to `True` for this request.
        Constraints: Cannot be specified if the DB instance is a read replica.

        :type engine_version: string
        :param engine_version: The version number of the database engine to
            upgrade to. Changing this parameter results in an outage and the
            change is applied during the next maintenance window unless the
            `ApplyImmediately` parameter is set to `True` for this request.
        For major version upgrades, if a non-default DB parameter group is
            currently in use, a new DB parameter group in the DB parameter
            group family for the new engine version must be specified. The new
            DB parameter group can be the default for that DB parameter group
            family.

        Example: `5.1.42`

        :type allow_major_version_upgrade: boolean
        :param allow_major_version_upgrade: Indicates that major version
            upgrades are allowed. Changing this parameter does not result in an
            outage and the change is asynchronously applied as soon as
            possible.
        Constraints: This parameter must be set to true when specifying a value
            for the EngineVersion parameter that is a different major version
            than the DB instance's current version.

        :type auto_minor_version_upgrade: boolean
        :param auto_minor_version_upgrade: Indicates that minor version
            upgrades will be applied automatically to the DB instance during
            the maintenance window. Changing this parameter does not result in
            an outage except in the following case and the change is
            asynchronously applied as soon as possible. An outage will result
            if this parameter is set to `True` during the maintenance window,
            and a newer minor version is available, and RDS has enabled auto
            patching for that engine version.

        :type iops: integer
        :param iops: The new Provisioned IOPS (I/O operations per second) value
            for the RDS instance. Changing this parameter does not result in an
            outage and the change is applied during the next maintenance window
            unless the `ApplyImmediately` parameter is set to `True` for this
            request.
        Default: Uses existing setting

        Constraints: Value supplied must be at least 10% greater than the
            current value. Values that are not at least 10% greater than the
            existing value are rounded up so that they are 10% greater than the
            current value.

        Type: Integer

        If you choose to migrate your DB instance from using standard storage
            to using Provisioned IOPS, or from using Provisioned IOPS to using
            standard storage, the process can take time. The duration of the
            migration depends on several factors such as database load, storage
            size, storage type (standard or Provisioned IOPS), amount of IOPS
            provisioned (if any), and the number of prior scale storage
            operations. Typical migration times are under 24 hours, but the
            process can take up to several days in some cases. During the
            migration, the DB instance will be available for use, but may
            experience performance degradation. While the migration takes
            place, nightly backups for the instance will be suspended. No other
            Amazon RDS operations can take place for the instance, including
            modifying the instance, rebooting the instance, deleting the
            instance, creating a read replica for the instance, and creating a
            DB snapshot of the instance.

        :type option_group_name: string
        :param option_group_name: Indicates that the DB instance should be
            associated with the specified option group. Changing this parameter
            does not result in an outage except in the following case and the
            change is applied during the next maintenance window unless the
            `ApplyImmediately` parameter is set to `True` for this request. If
            the parameter change results in an option group that enables OEM,
            this change can cause a brief (sub-second) period during which new
            connections are rejected but existing connections are not
            interrupted.
        Permanent options, such as the TDE option for Oracle Advanced Security
            TDE, cannot be removed from an option group, and that option group
            cannot be removed from a DB instance once it is associated with a
            DB instance

        :type new_db_instance_identifier: string
        :param new_db_instance_identifier:
        The new DB instance identifier for the DB instance when renaming a DB
            Instance. This value is stored as a lowercase string.

        Constraints:


        + Must contain from 1 to 63 alphanumeric characters or hyphens
        + First character must be a letter
        + Cannot end with a hyphen or contain two consecutive hyphens

        """
        params = {'DBInstanceIdentifier': db_instance_identifier, }
        if allocated_storage is not None:
            params['AllocatedStorage'] = allocated_storage
        if db_instance_class is not None:
            params['DBInstanceClass'] = db_instance_class
        if db_security_groups is not None:
            self.build_list_params(params,
                                   db_security_groups,
                                   'DBSecurityGroups.member')
        if vpc_security_group_ids is not None:
            self.build_list_params(params,
                                   vpc_security_group_ids,
                                   'VpcSecurityGroupIds.member')
        if apply_immediately is not None:
            params['ApplyImmediately'] = str(
                apply_immediately).lower()
        if master_user_password is not None:
            params['MasterUserPassword'] = master_user_password
        if db_parameter_group_name is not None:
            params['DBParameterGroupName'] = db_parameter_group_name
        if backup_retention_period is not None:
            params['BackupRetentionPeriod'] = backup_retention_period
        if preferred_backup_window is not None:
            params['PreferredBackupWindow'] = preferred_backup_window
        if preferred_maintenance_window is not None:
            params['PreferredMaintenanceWindow'] = preferred_maintenance_window
        if multi_az is not None:
            params['MultiAZ'] = str(
                multi_az).lower()
        if engine_version is not None:
            params['EngineVersion'] = engine_version
        if allow_major_version_upgrade is not None:
            params['AllowMajorVersionUpgrade'] = str(
                allow_major_version_upgrade).lower()
        if auto_minor_version_upgrade is not None:
            params['AutoMinorVersionUpgrade'] = str(
                auto_minor_version_upgrade).lower()
        if iops is not None:
            params['Iops'] = iops
        if option_group_name is not None:
            params['OptionGroupName'] = option_group_name
        if new_db_instance_identifier is not None:
            params['NewDBInstanceIdentifier'] = new_db_instance_identifier
        return self._make_request(
            action='ModifyDBInstance',
            verb='POST',
            path='/', params=params)

    def modify_db_parameter_group(self, db_parameter_group_name, parameters):
        """
        Modifies the parameters of a DB parameter group. To modify
        more than one parameter, submit a list of the following:
        `ParameterName`, `ParameterValue`, and `ApplyMethod`. A
        maximum of 20 parameters can be modified in a single request.

        The `apply-immediate` method can be used only for dynamic
        parameters; the `pending-reboot` method can be used with MySQL
        and Oracle DB instances for either dynamic or static
        parameters. For Microsoft SQL Server DB instances, the
        `pending-reboot` method can be used only for static
        parameters.

        :type db_parameter_group_name: string
        :param db_parameter_group_name:
        The name of the DB parameter group.

        Constraints:


        + Must be the name of an existing DB parameter group
        + Must be 1 to 255 alphanumeric characters
        + First character must be a letter
        + Cannot end with a hyphen or contain two consecutive hyphens

        :type parameters: list
        :param parameters:
        An array of parameter names, values, and the apply method for the
            parameter update. At least one parameter name, value, and apply
            method must be supplied; subsequent arguments are optional. A
            maximum of 20 parameters may be modified in a single request.

        Valid Values (for the application method): `immediate | pending-reboot`

        You can use the immediate value with dynamic parameters only. You can
            use the pending-reboot value for both dynamic and static
            parameters, and changes are applied when DB instance reboots.

        """
        params = {'DBParameterGroupName': db_parameter_group_name, }
        self.build_complex_list_params(
            params, parameters,
            'Parameters.member',
            ('ParameterName', 'ParameterValue', 'Description', 'Source', 'ApplyType', 'DataType', 'AllowedValues', 'IsModifiable', 'MinimumEngineVersion', 'ApplyMethod'))
        return self._make_request(
            action='ModifyDBParameterGroup',
            verb='POST',
            path='/', params=params)

    def modify_db_subnet_group(self, db_subnet_group_name, subnet_ids,
                               db_subnet_group_description=None):
        """
        Modifies an existing DB subnet group. DB subnet groups must
        contain at least one subnet in at least two AZs in the region.

        :type db_subnet_group_name: string
        :param db_subnet_group_name: The name for the DB subnet group. This
            value is stored as a lowercase string.
        Constraints: Must contain no more than 255 alphanumeric characters or
            hyphens. Must not be "Default".

        Example: `mySubnetgroup`

        :type db_subnet_group_description: string
        :param db_subnet_group_description: The description for the DB subnet
            group.

        :type subnet_ids: list
        :param subnet_ids: The EC2 subnet IDs for the DB subnet group.

        """
        params = {'DBSubnetGroupName': db_subnet_group_name, }
        self.build_list_params(params,
                               subnet_ids,
                               'SubnetIds.member')
        if db_subnet_group_description is not None:
            params['DBSubnetGroupDescription'] = db_subnet_group_description
        return self._make_request(
            action='ModifyDBSubnetGroup',
            verb='POST',
            path='/', params=params)

    def modify_event_subscription(self, subscription_name,
                                  sns_topic_arn=None, source_type=None,
                                  event_categories=None, enabled=None):
        """
        Modifies an existing RDS event notification subscription. Note
        that you cannot modify the source identifiers using this call;
        to change source identifiers for a subscription, use the
        AddSourceIdentifierToSubscription and
        RemoveSourceIdentifierFromSubscription calls.

        You can see a list of the event categories for a given
        SourceType in the `Events`_ topic in the Amazon RDS User Guide
        or by using the **DescribeEventCategories** action.

        :type subscription_name: string
        :param subscription_name: The name of the RDS event notification
            subscription.

        :type sns_topic_arn: string
        :param sns_topic_arn: The Amazon Resource Name (ARN) of the SNS topic
            created for event notification. The ARN is created by Amazon SNS
            when you create a topic and subscribe to it.

        :type source_type: string
        :param source_type: The type of source that will be generating the
            events. For example, if you want to be notified of events generated
            by a DB instance, you would set this parameter to db-instance. if
            this value is not specified, all events are returned.
        Valid values: db-instance | db-parameter-group | db-security-group |
            db-snapshot

        :type event_categories: list
        :param event_categories: A list of event categories for a SourceType
            that you want to subscribe to. You can see a list of the categories
            for a given SourceType in the `Events`_ topic in the Amazon RDS
            User Guide or by using the **DescribeEventCategories** action.

        :type enabled: boolean
        :param enabled: A Boolean value; set to **true** to activate the
            subscription.

        """
        params = {'SubscriptionName': subscription_name, }
        if sns_topic_arn is not None:
            params['SnsTopicArn'] = sns_topic_arn
        if source_type is not None:
            params['SourceType'] = source_type
        if event_categories is not None:
            self.build_list_params(params,
                                   event_categories,
                                   'EventCategories.member')
        if enabled is not None:
            params['Enabled'] = str(
                enabled).lower()
        return self._make_request(
            action='ModifyEventSubscription',
            verb='POST',
            path='/', params=params)

    def modify_option_group(self, option_group_name, options_to_include=None,
                            options_to_remove=None, apply_immediately=None):
        """
        Modifies an existing option group.

        :type option_group_name: string
        :param option_group_name: The name of the option group to be modified.
        Permanent options, such as the TDE option for Oracle Advanced Security
            TDE, cannot be removed from an option group, and that option group
            cannot be removed from a DB instance once it is associated with a
            DB instance

        :type options_to_include: list
        :param options_to_include: Options in this list are added to the option
            group or, if already present, the specified configuration is used
            to update the existing configuration.

        :type options_to_remove: list
        :param options_to_remove: Options in this list are removed from the
            option group.

        :type apply_immediately: boolean
        :param apply_immediately: Indicates whether the changes should be
            applied immediately, or during the next maintenance window for each
            instance associated with the option group.

        """
        params = {'OptionGroupName': option_group_name, }
        if options_to_include is not None:
            self.build_complex_list_params(
                params, options_to_include,
                'OptionsToInclude.member',
                ('OptionName', 'Port', 'DBSecurityGroupMemberships', 'VpcSecurityGroupMemberships', 'OptionSettings'))
        if options_to_remove is not None:
            self.build_list_params(params,
                                   options_to_remove,
                                   'OptionsToRemove.member')
        if apply_immediately is not None:
            params['ApplyImmediately'] = str(
                apply_immediately).lower()
        return self._make_request(
            action='ModifyOptionGroup',
            verb='POST',
            path='/', params=params)

    def promote_read_replica(self, db_instance_identifier,
                             backup_retention_period=None,
                             preferred_backup_window=None):
        """
        Promotes a read replica DB instance to a standalone DB
        instance.

        :type db_instance_identifier: string
        :param db_instance_identifier: The DB instance identifier. This value
            is stored as a lowercase string.
        Constraints:


        + Must be the identifier for an existing read replica DB instance
        + Must contain from 1 to 63 alphanumeric characters or hyphens
        + First character must be a letter
        + Cannot end with a hyphen or contain two consecutive hyphens


        Example: mydbinstance

        :type backup_retention_period: integer
        :param backup_retention_period:
        The number of days to retain automated backups. Setting this parameter
            to a positive number enables backups. Setting this parameter to 0
            disables automated backups.

        Default: 1

        Constraints:


        + Must be a value from 0 to 8

        :type preferred_backup_window: string
        :param preferred_backup_window: The daily time range during which
            automated backups are created if automated backups are enabled,
            using the `BackupRetentionPeriod` parameter.
        Default: A 30-minute window selected at random from an 8-hour block of
            time per region. See the Amazon RDS User Guide for the time blocks
            for each region from which the default backup windows are assigned.

        Constraints: Must be in the format `hh24:mi-hh24:mi`. Times should be
            Universal Time Coordinated (UTC). Must not conflict with the
            preferred maintenance window. Must be at least 30 minutes.

        """
        params = {'DBInstanceIdentifier': db_instance_identifier, }
        if backup_retention_period is not None:
            params['BackupRetentionPeriod'] = backup_retention_period
        if preferred_backup_window is not None:
            params['PreferredBackupWindow'] = preferred_backup_window
        return self._make_request(
            action='PromoteReadReplica',
            verb='POST',
            path='/', params=params)

    def purchase_reserved_db_instances_offering(self,
                                                reserved_db_instances_offering_id,
                                                reserved_db_instance_id=None,
                                                db_instance_count=None,
                                                tags=None):
        """
        Purchases a reserved DB instance offering.

        :type reserved_db_instances_offering_id: string
        :param reserved_db_instances_offering_id: The ID of the Reserved DB
            instance offering to purchase.
        Example: 438012d3-4052-4cc7-b2e3-8d3372e0e706

        :type reserved_db_instance_id: string
        :param reserved_db_instance_id: Customer-specified identifier to track
            this reservation.
        Example: myreservationID

        :type db_instance_count: integer
        :param db_instance_count: The number of instances to reserve.
        Default: `1`

        :type tags: list
        :param tags: A list of tags. Tags must be passed as tuples in the form
            [('key1', 'valueForKey1'), ('key2', 'valueForKey2')]

        """
        params = {
            'ReservedDBInstancesOfferingId': reserved_db_instances_offering_id,
        }
        if reserved_db_instance_id is not None:
            params['ReservedDBInstanceId'] = reserved_db_instance_id
        if db_instance_count is not None:
            params['DBInstanceCount'] = db_instance_count
        if tags is not None:
            self.build_complex_list_params(
                params, tags,
                'Tags.member',
                ('Key', 'Value'))
        return self._make_request(
            action='PurchaseReservedDBInstancesOffering',
            verb='POST',
            path='/', params=params)

    def reboot_db_instance(self, db_instance_identifier, force_failover=None):
        """
        Rebooting a DB instance restarts the database engine service.
        A reboot also applies to the DB instance any modifications to
        the associated DB parameter group that were pending. Rebooting
        a DB instance results in a momentary outage of the instance,
        during which the DB instance status is set to rebooting. If
        the RDS instance is configured for MultiAZ, it is possible
        that the reboot will be conducted through a failover. An
        Amazon RDS event is created when the reboot is completed.

        If your DB instance is deployed in multiple Availability
        Zones, you can force a failover from one AZ to the other
        during the reboot. You might force a failover to test the
        availability of your DB instance deployment or to restore
        operations to the original AZ after a failover occurs.

        The time required to reboot is a function of the specific
        database engine's crash recovery process. To improve the
        reboot time, we recommend that you reduce database activities
        as much as possible during the reboot process to reduce
        rollback activity for in-transit transactions.

        :type db_instance_identifier: string
        :param db_instance_identifier:
        The DB instance identifier. This parameter is stored as a lowercase
            string.

        Constraints:


        + Must contain from 1 to 63 alphanumeric characters or hyphens
        + First character must be a letter
        + Cannot end with a hyphen or contain two consecutive hyphens

        :type force_failover: boolean
        :param force_failover: When `True`, the reboot will be conducted
            through a MultiAZ failover.
        Constraint: You cannot specify `True` if the instance is not configured
            for MultiAZ.

        """
        params = {'DBInstanceIdentifier': db_instance_identifier, }
        if force_failover is not None:
            params['ForceFailover'] = str(
                force_failover).lower()
        return self._make_request(
            action='RebootDBInstance',
            verb='POST',
            path='/', params=params)

    def remove_source_identifier_from_subscription(self, subscription_name,
                                                   source_identifier):
        """
        Removes a source identifier from an existing RDS event
        notification subscription.

        :type subscription_name: string
        :param subscription_name: The name of the RDS event notification
            subscription you want to remove a source identifier from.

        :type source_identifier: string
        :param source_identifier: The source identifier to be removed from the
            subscription, such as the **DB instance identifier** for a DB
            instance or the name of a security group.

        """
        params = {
            'SubscriptionName': subscription_name,
            'SourceIdentifier': source_identifier,
        }
        return self._make_request(
            action='RemoveSourceIdentifierFromSubscription',
            verb='POST',
            path='/', params=params)

    def remove_tags_from_resource(self, resource_name, tag_keys):
        """
        Removes metadata tags from an Amazon RDS resource.

        For an overview on tagging an Amazon RDS resource, see
        `Tagging Amazon RDS Resources`_.

        :type resource_name: string
        :param resource_name: The Amazon RDS resource the tags will be removed
            from. This value is an Amazon Resource Name (ARN). For information
            about creating an ARN, see ` Constructing an RDS Amazon Resource
            Name (ARN)`_.

        :type tag_keys: list
        :param tag_keys: The tag key (name) of the tag to be removed.

        """
        params = {'ResourceName': resource_name, }
        self.build_list_params(params,
                               tag_keys,
                               'TagKeys.member')
        return self._make_request(
            action='RemoveTagsFromResource',
            verb='POST',
            path='/', params=params)

    def reset_db_parameter_group(self, db_parameter_group_name,
                                 reset_all_parameters=None, parameters=None):
        """
        Modifies the parameters of a DB parameter group to the
        engine/system default value. To reset specific parameters
        submit a list of the following: `ParameterName` and
        `ApplyMethod`. To reset the entire DB parameter group, specify
        the `DBParameterGroup` name and `ResetAllParameters`
        parameters. When resetting the entire group, dynamic
        parameters are updated immediately and static parameters are
        set to `pending-reboot` to take effect on the next DB instance
        restart or `RebootDBInstance` request.

        :type db_parameter_group_name: string
        :param db_parameter_group_name:
        The name of the DB parameter group.

        Constraints:


        + Must be 1 to 255 alphanumeric characters
        + First character must be a letter
        + Cannot end with a hyphen or contain two consecutive hyphens

        :type reset_all_parameters: boolean
        :param reset_all_parameters: Specifies whether ( `True`) or not (
            `False`) to reset all parameters in the DB parameter group to
            default values.
        Default: `True`

        :type parameters: list
        :param parameters: An array of parameter names, values, and the apply
            method for the parameter update. At least one parameter name,
            value, and apply method must be supplied; subsequent arguments are
            optional. A maximum of 20 parameters may be modified in a single
            request.
        **MySQL**

        Valid Values (for Apply method): `immediate` | `pending-reboot`

        You can use the immediate value with dynamic parameters only. You can
            use the `pending-reboot` value for both dynamic and static
            parameters, and changes are applied when DB instance reboots.

        **Oracle**

        Valid Values (for Apply method): `pending-reboot`

        """
        params = {'DBParameterGroupName': db_parameter_group_name, }
        if reset_all_parameters is not None:
            params['ResetAllParameters'] = str(
                reset_all_parameters).lower()
        if parameters is not None:
            self.build_complex_list_params(
                params, parameters,
                'Parameters.member',
                ('ParameterName', 'ParameterValue', 'Description', 'Source', 'ApplyType', 'DataType', 'AllowedValues', 'IsModifiable', 'MinimumEngineVersion', 'ApplyMethod'))
        return self._make_request(
            action='ResetDBParameterGroup',
            verb='POST',
            path='/', params=params)

    def restore_db_instance_from_db_snapshot(self, db_instance_identifier,
                                             db_snapshot_identifier,
                                             db_instance_class=None,
                                             port=None,
                                             availability_zone=None,
                                             db_subnet_group_name=None,
                                             multi_az=None,
                                             publicly_accessible=None,
                                             auto_minor_version_upgrade=None,
                                             license_model=None,
                                             db_name=None, engine=None,
                                             iops=None,
                                             option_group_name=None,
                                             tags=None):
        """
        Creates a new DB instance from a DB snapshot. The target
        database is created from the source database restore point
        with the same configuration as the original source database,
        except that the new RDS instance is created with the default
        security group.

        :type db_instance_identifier: string
        :param db_instance_identifier:
        The identifier for the DB snapshot to restore from.

        Constraints:


        + Must contain from 1 to 63 alphanumeric characters or hyphens
        + First character must be a letter
        + Cannot end with a hyphen or contain two consecutive hyphens

        :type db_snapshot_identifier: string
        :param db_snapshot_identifier: Name of the DB instance to create from
            the DB snapshot. This parameter isn't case sensitive.
        Constraints:


        + Must contain from 1 to 255 alphanumeric characters or hyphens
        + First character must be a letter
        + Cannot end with a hyphen or contain two consecutive hyphens


        Example: `my-snapshot-id`

        :type db_instance_class: string
        :param db_instance_class: The compute and memory capacity of the Amazon
            RDS DB instance.
        Valid Values: `db.t1.micro | db.m1.small | db.m1.medium | db.m1.large |
            db.m1.xlarge | db.m2.2xlarge | db.m2.4xlarge`

        :type port: integer
        :param port: The port number on which the database accepts connections.
        Default: The same port as the original DB instance

        Constraints: Value must be `1150-65535`

        :type availability_zone: string
        :param availability_zone: The EC2 Availability Zone that the database
            instance will be created in.
        Default: A random, system-chosen Availability Zone.

        Constraint: You cannot specify the AvailabilityZone parameter if the
            MultiAZ parameter is set to `True`.

        Example: `us-east-1a`

        :type db_subnet_group_name: string
        :param db_subnet_group_name: The DB subnet group name to use for the
            new instance.

        :type multi_az: boolean
        :param multi_az: Specifies if the DB instance is a Multi-AZ deployment.
        Constraint: You cannot specify the AvailabilityZone parameter if the
            MultiAZ parameter is set to `True`.

        :type publicly_accessible: boolean
        :param publicly_accessible: Specifies the accessibility options for the
            DB instance. A value of true specifies an Internet-facing instance
            with a publicly resolvable DNS name, which resolves to a public IP
            address. A value of false specifies an internal instance with a DNS
            name that resolves to a private IP address.
        Default: The default behavior varies depending on whether a VPC has
            been requested or not. The following list shows the default
            behavior in each case.


        + **Default VPC:**true
        + **VPC:**false


        If no DB subnet group has been specified as part of the request and the
            PubliclyAccessible value has not been set, the DB instance will be
            publicly accessible. If a specific DB subnet group has been
            specified as part of the request and the PubliclyAccessible value
            has not been set, the DB instance will be private.

        :type auto_minor_version_upgrade: boolean
        :param auto_minor_version_upgrade: Indicates that minor version
            upgrades will be applied automatically to the DB instance during
            the maintenance window.

        :type license_model: string
        :param license_model: License model information for the restored DB
            instance.
        Default: Same as source.

        Valid values: `license-included` | `bring-your-own-license` | `general-
            public-license`

        :type db_name: string
        :param db_name:
        The database name for the restored DB instance.


        This parameter doesn't apply to the MySQL engine.

        :type engine: string
        :param engine: The database engine to use for the new instance.
        Default: The same as source

        Constraint: Must be compatible with the engine of the source

        Example: `oracle-ee`

        :type iops: integer
        :param iops: Specifies the amount of provisioned IOPS for the DB
            instance, expressed in I/O operations per second. If this parameter
            is not specified, the IOPS value will be taken from the backup. If
            this parameter is set to 0, the new instance will be converted to a
            non-PIOPS instance, which will take additional time, though your DB
            instance will be available for connections before the conversion
            starts.
        Constraints: Must be an integer greater than 1000.

        :type option_group_name: string
        :param option_group_name: The name of the option group to be used for
            the restored DB instance.
        Permanent options, such as the TDE option for Oracle Advanced Security
            TDE, cannot be removed from an option group, and that option group
            cannot be removed from a DB instance once it is associated with a
            DB instance

        :type tags: list
        :param tags: A list of tags. Tags must be passed as tuples in the form
            [('key1', 'valueForKey1'), ('key2', 'valueForKey2')]

        """
        params = {
            'DBInstanceIdentifier': db_instance_identifier,
            'DBSnapshotIdentifier': db_snapshot_identifier,
        }
        if db_instance_class is not None:
            params['DBInstanceClass'] = db_instance_class
        if port is not None:
            params['Port'] = port
        if availability_zone is not None:
            params['AvailabilityZone'] = availability_zone
        if db_subnet_group_name is not None:
            params['DBSubnetGroupName'] = db_subnet_group_name
        if multi_az is not None:
            params['MultiAZ'] = str(
                multi_az).lower()
        if publicly_accessible is not None:
            params['PubliclyAccessible'] = str(
                publicly_accessible).lower()
        if auto_minor_version_upgrade is not None:
            params['AutoMinorVersionUpgrade'] = str(
                auto_minor_version_upgrade).lower()
        if license_model is not None:
            params['LicenseModel'] = license_model
        if db_name is not None:
            params['DBName'] = db_name
        if engine is not None:
            params['Engine'] = engine
        if iops is not None:
            params['Iops'] = iops
        if option_group_name is not None:
            params['OptionGroupName'] = option_group_name
        if tags is not None:
            self.build_complex_list_params(
                params, tags,
                'Tags.member',
                ('Key', 'Value'))
        return self._make_request(
            action='RestoreDBInstanceFromDBSnapshot',
            verb='POST',
            path='/', params=params)

    def restore_db_instance_to_point_in_time(self,
                                             source_db_instance_identifier,
                                             target_db_instance_identifier,
                                             restore_time=None,
                                             use_latest_restorable_time=None,
                                             db_instance_class=None,
                                             port=None,
                                             availability_zone=None,
                                             db_subnet_group_name=None,
                                             multi_az=None,
                                             publicly_accessible=None,
                                             auto_minor_version_upgrade=None,
                                             license_model=None,
                                             db_name=None, engine=None,
                                             iops=None,
                                             option_group_name=None,
                                             tags=None):
        """
        Restores a DB instance to an arbitrary point-in-time. Users
        can restore to any point in time before the
        latestRestorableTime for up to backupRetentionPeriod days. The
        target database is created from the source database with the
        same configuration as the original database except that the DB
        instance is created with the default DB security group.

        :type source_db_instance_identifier: string
        :param source_db_instance_identifier:
        The identifier of the source DB instance from which to restore.

        Constraints:


        + Must be the identifier of an existing database instance
        + Must contain from 1 to 63 alphanumeric characters or hyphens
        + First character must be a letter
        + Cannot end with a hyphen or contain two consecutive hyphens

        :type target_db_instance_identifier: string
        :param target_db_instance_identifier:
        The name of the new database instance to be created.

        Constraints:


        + Must contain from 1 to 63 alphanumeric characters or hyphens
        + First character must be a letter
        + Cannot end with a hyphen or contain two consecutive hyphens

        :type restore_time: timestamp
        :param restore_time: The date and time to restore from.
        Valid Values: Value must be a UTC time

        Constraints:


        + Must be before the latest restorable time for the DB instance
        + Cannot be specified if UseLatestRestorableTime parameter is true


        Example: `2009-09-07T23:45:00Z`

        :type use_latest_restorable_time: boolean
        :param use_latest_restorable_time: Specifies whether ( `True`) or not (
            `False`) the DB instance is restored from the latest backup time.
        Default: `False`

        Constraints: Cannot be specified if RestoreTime parameter is provided.

        :type db_instance_class: string
        :param db_instance_class: The compute and memory capacity of the Amazon
            RDS DB instance.
        Valid Values: `db.t1.micro | db.m1.small | db.m1.medium | db.m1.large |
            db.m1.xlarge | db.m2.2xlarge | db.m2.4xlarge`

        Default: The same DBInstanceClass as the original DB instance.

        :type port: integer
        :param port: The port number on which the database accepts connections.
        Constraints: Value must be `1150-65535`

        Default: The same port as the original DB instance.

        :type availability_zone: string
        :param availability_zone: The EC2 Availability Zone that the database
            instance will be created in.
        Default: A random, system-chosen Availability Zone.

        Constraint: You cannot specify the AvailabilityZone parameter if the
            MultiAZ parameter is set to true.

        Example: `us-east-1a`

        :type db_subnet_group_name: string
        :param db_subnet_group_name: The DB subnet group name to use for the
            new instance.

        :type multi_az: boolean
        :param multi_az: Specifies if the DB instance is a Multi-AZ deployment.
        Constraint: You cannot specify the AvailabilityZone parameter if the
            MultiAZ parameter is set to `True`.

        :type publicly_accessible: boolean
        :param publicly_accessible: Specifies the accessibility options for the
            DB instance. A value of true specifies an Internet-facing instance
            with a publicly resolvable DNS name, which resolves to a public IP
            address. A value of false specifies an internal instance with a DNS
            name that resolves to a private IP address.
        Default: The default behavior varies depending on whether a VPC has
            been requested or not. The following list shows the default
            behavior in each case.


        + **Default VPC:**true
        + **VPC:**false


        If no DB subnet group has been specified as part of the request and the
            PubliclyAccessible value has not been set, the DB instance will be
            publicly accessible. If a specific DB subnet group has been
            specified as part of the request and the PubliclyAccessible value
            has not been set, the DB instance will be private.

        :type auto_minor_version_upgrade: boolean
        :param auto_minor_version_upgrade: Indicates that minor version
            upgrades will be applied automatically to the DB instance during
            the maintenance window.

        :type license_model: string
        :param license_model: License model information for the restored DB
            instance.
        Default: Same as source.

        Valid values: `license-included` | `bring-your-own-license` | `general-
            public-license`

        :type db_name: string
        :param db_name:
        The database name for the restored DB instance.


        This parameter is not used for the MySQL engine.

        :type engine: string
        :param engine: The database engine to use for the new instance.
        Default: The same as source

        Constraint: Must be compatible with the engine of the source

        Example: `oracle-ee`

        :type iops: integer
        :param iops: The amount of Provisioned IOPS (input/output operations
            per second) to be initially allocated for the DB instance.
        Constraints: Must be an integer greater than 1000.

        :type option_group_name: string
        :param option_group_name: The name of the option group to be used for
            the restored DB instance.
        Permanent options, such as the TDE option for Oracle Advanced Security
            TDE, cannot be removed from an option group, and that option group
            cannot be removed from a DB instance once it is associated with a
            DB instance

        :type tags: list
        :param tags: A list of tags. Tags must be passed as tuples in the form
            [('key1', 'valueForKey1'), ('key2', 'valueForKey2')]

        """
        params = {
            'SourceDBInstanceIdentifier': source_db_instance_identifier,
            'TargetDBInstanceIdentifier': target_db_instance_identifier,
        }
        if restore_time is not None:
            params['RestoreTime'] = restore_time
        if use_latest_restorable_time is not None:
            params['UseLatestRestorableTime'] = str(
                use_latest_restorable_time).lower()
        if db_instance_class is not None:
            params['DBInstanceClass'] = db_instance_class
        if port is not None:
            params['Port'] = port
        if availability_zone is not None:
            params['AvailabilityZone'] = availability_zone
        if db_subnet_group_name is not None:
            params['DBSubnetGroupName'] = db_subnet_group_name
        if multi_az is not None:
            params['MultiAZ'] = str(
                multi_az).lower()
        if publicly_accessible is not None:
            params['PubliclyAccessible'] = str(
                publicly_accessible).lower()
        if auto_minor_version_upgrade is not None:
            params['AutoMinorVersionUpgrade'] = str(
                auto_minor_version_upgrade).lower()
        if license_model is not None:
            params['LicenseModel'] = license_model
        if db_name is not None:
            params['DBName'] = db_name
        if engine is not None:
            params['Engine'] = engine
        if iops is not None:
            params['Iops'] = iops
        if option_group_name is not None:
            params['OptionGroupName'] = option_group_name
        if tags is not None:
            self.build_complex_list_params(
                params, tags,
                'Tags.member',
                ('Key', 'Value'))
        return self._make_request(
            action='RestoreDBInstanceToPointInTime',
            verb='POST',
            path='/', params=params)

    def revoke_db_security_group_ingress(self, db_security_group_name,
                                         cidrip=None,
                                         ec2_security_group_name=None,
                                         ec2_security_group_id=None,
                                         ec2_security_group_owner_id=None):
        """
        Revokes ingress from a DBSecurityGroup for previously
        authorized IP ranges or EC2 or VPC Security Groups. Required
        parameters for this API are one of CIDRIP, EC2SecurityGroupId
        for VPC, or (EC2SecurityGroupOwnerId and either
        EC2SecurityGroupName or EC2SecurityGroupId).

        :type db_security_group_name: string
        :param db_security_group_name: The name of the DB security group to
            revoke ingress from.

        :type cidrip: string
        :param cidrip: The IP range to revoke access from. Must be a valid CIDR
            range. If `CIDRIP` is specified, `EC2SecurityGroupName`,
            `EC2SecurityGroupId` and `EC2SecurityGroupOwnerId` cannot be
            provided.

        :type ec2_security_group_name: string
        :param ec2_security_group_name: The name of the EC2 security group to
            revoke access from. For VPC DB security groups,
            `EC2SecurityGroupId` must be provided. Otherwise,
            EC2SecurityGroupOwnerId and either `EC2SecurityGroupName` or
            `EC2SecurityGroupId` must be provided.

        :type ec2_security_group_id: string
        :param ec2_security_group_id: The id of the EC2 security group to
            revoke access from. For VPC DB security groups,
            `EC2SecurityGroupId` must be provided. Otherwise,
            EC2SecurityGroupOwnerId and either `EC2SecurityGroupName` or
            `EC2SecurityGroupId` must be provided.

        :type ec2_security_group_owner_id: string
        :param ec2_security_group_owner_id: The AWS Account Number of the owner
            of the EC2 security group specified in the `EC2SecurityGroupName`
            parameter. The AWS Access Key ID is not an acceptable value. For
            VPC DB security groups, `EC2SecurityGroupId` must be provided.
            Otherwise, EC2SecurityGroupOwnerId and either
            `EC2SecurityGroupName` or `EC2SecurityGroupId` must be provided.

        """
        params = {'DBSecurityGroupName': db_security_group_name, }
        if cidrip is not None:
            params['CIDRIP'] = cidrip
        if ec2_security_group_name is not None:
            params['EC2SecurityGroupName'] = ec2_security_group_name
        if ec2_security_group_id is not None:
            params['EC2SecurityGroupId'] = ec2_security_group_id
        if ec2_security_group_owner_id is not None:
            params['EC2SecurityGroupOwnerId'] = ec2_security_group_owner_id
        return self._make_request(
            action='RevokeDBSecurityGroupIngress',
            verb='POST',
            path='/', params=params)

    def _make_request(self, action, verb, path, params):
        params['ContentType'] = 'JSON'
        response = self.make_request(action=action, verb='POST',
                                     path='/', params=params)
        body = response.read()
        boto.log.debug(body)
        if response.status == 200:
            return json.loads(body)
        else:
            json_body = json.loads(body)
            fault_name = json_body.get('Error', {}).get('Code', None)
            exception_class = self._faults.get(fault_name, self.ResponseError)
            raise exception_class(response.status, response.reason,
                                  body=json_body)