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
#[allow(warnings)]
use hyper::Client;
use hyper::status::StatusCode;
use rusoto_core::request::DispatchSignedRequest;
use rusoto_core::region;
use std::fmt;
use std::error::Error;
use std::io;
use std::io::Read;
use rusoto_core::request::HttpDispatchError;
use rusoto_core::credential::{CredentialsError, ProvideAwsCredentials};
use serde_json;
use rusoto_core::signature::SignedRequest;
use serde_json::Value as SerdeJsonValue;
use serde_json::from_str;
#[doc="<p>Contains information about the compute type of a WorkSpace bundle.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct ComputeType {
#[doc="<p>The name of the compute type for the bundle.</p>"]
#[serde(rename="Name")]
#[serde(skip_serializing_if="Option::is_none")]
pub name: Option<String>,
}
#[doc="<p>The request of the <a>CreateTags</a> operation.</p>"]
#[derive(Default,Debug,Clone,Serialize)]
pub struct CreateTagsRequest {
#[doc="<p>The resource ID of the request.</p>"]
#[serde(rename="ResourceId")]
pub resource_id: String,
#[doc="<p>The tags of the request.</p>"]
#[serde(rename="Tags")]
pub tags: Vec<Tag>,
}
#[doc="<p>The result of the <a>CreateTags</a> operation.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct CreateTagsResult;
#[doc="<p>Contains the inputs for the <a>CreateWorkspaces</a> operation.</p>"]
#[derive(Default,Debug,Clone,Serialize)]
pub struct CreateWorkspacesRequest {
#[doc="<p>An array of structures that specify the WorkSpaces to create.</p>"]
#[serde(rename="Workspaces")]
pub workspaces: Vec<WorkspaceRequest>,
}
#[doc="<p>Contains the result of the <a>CreateWorkspaces</a> operation.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct CreateWorkspacesResult {
#[doc="<p>An array of structures that represent the WorkSpaces that could not be created.</p>"]
#[serde(rename="FailedRequests")]
#[serde(skip_serializing_if="Option::is_none")]
pub failed_requests: Option<Vec<FailedCreateWorkspaceRequest>>,
#[doc="<p>An array of structures that represent the WorkSpaces that were created.</p> <p>Because this operation is asynchronous, the identifier in <code>WorkspaceId</code> is not immediately available. If you immediately call <a>DescribeWorkspaces</a> with this identifier, no information will be returned.</p>"]
#[serde(rename="PendingRequests")]
#[serde(skip_serializing_if="Option::is_none")]
pub pending_requests: Option<Vec<Workspace>>,
}
#[doc="<p>Contains default WorkSpace creation information.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct DefaultWorkspaceCreationProperties {
#[doc="<p>The identifier of any custom security groups that are applied to the WorkSpaces when they are created.</p>"]
#[serde(rename="CustomSecurityGroupId")]
#[serde(skip_serializing_if="Option::is_none")]
pub custom_security_group_id: Option<String>,
#[doc="<p>The organizational unit (OU) in the directory that the WorkSpace machine accounts are placed in.</p>"]
#[serde(rename="DefaultOu")]
#[serde(skip_serializing_if="Option::is_none")]
pub default_ou: Option<String>,
#[doc="<p>A public IP address will be attached to all WorkSpaces that are created or rebuilt.</p>"]
#[serde(rename="EnableInternetAccess")]
#[serde(skip_serializing_if="Option::is_none")]
pub enable_internet_access: Option<bool>,
#[doc="<p>Specifies if the directory is enabled for Amazon WorkDocs.</p>"]
#[serde(rename="EnableWorkDocs")]
#[serde(skip_serializing_if="Option::is_none")]
pub enable_work_docs: Option<bool>,
#[doc="<p>The WorkSpace user is an administrator on the WorkSpace.</p>"]
#[serde(rename="UserEnabledAsLocalAdministrator")]
#[serde(skip_serializing_if="Option::is_none")]
pub user_enabled_as_local_administrator: Option<bool>,
}
#[doc="<p>The request of the <a>DeleteTags</a> operation.</p>"]
#[derive(Default,Debug,Clone,Serialize)]
pub struct DeleteTagsRequest {
#[doc="<p>The resource ID of the request.</p>"]
#[serde(rename="ResourceId")]
pub resource_id: String,
#[doc="<p>The tag keys of the request.</p>"]
#[serde(rename="TagKeys")]
pub tag_keys: Vec<String>,
}
#[doc="<p>The result of the <a>DeleteTags</a> operation.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct DeleteTagsResult;
#[doc="<p>The request of the <a>DescribeTags</a> operation.</p>"]
#[derive(Default,Debug,Clone,Serialize)]
pub struct DescribeTagsRequest {
#[doc="<p>The resource ID of the request.</p>"]
#[serde(rename="ResourceId")]
pub resource_id: String,
}
#[doc="<p>The result of the <a>DescribeTags</a> operation.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct DescribeTagsResult {
#[doc="<p>The list of tags.</p>"]
#[serde(rename="TagList")]
#[serde(skip_serializing_if="Option::is_none")]
pub tag_list: Option<Vec<Tag>>,
}
#[doc="<p>Contains the inputs for the <a>DescribeWorkspaceBundles</a> operation.</p>"]
#[derive(Default,Debug,Clone,Serialize)]
pub struct DescribeWorkspaceBundlesRequest {
#[doc="<p>An array of strings that contains the identifiers of the bundles to retrieve. This parameter cannot be combined with any other filter parameter.</p>"]
#[serde(rename="BundleIds")]
#[serde(skip_serializing_if="Option::is_none")]
pub bundle_ids: Option<Vec<String>>,
#[doc="<p>The <code>NextToken</code> value from a previous call to this operation. Pass null if this is the first call.</p>"]
#[serde(rename="NextToken")]
#[serde(skip_serializing_if="Option::is_none")]
pub next_token: Option<String>,
#[doc="<p>The owner of the bundles to retrieve. This parameter cannot be combined with any other filter parameter.</p> <p>This contains one of the following values:</p> <ul> <li> <p>null- Retrieves the bundles that belong to the account making the call.</p> </li> <li> <p> <code>AMAZON</code>- Retrieves the bundles that are provided by AWS.</p> </li> </ul>"]
#[serde(rename="Owner")]
#[serde(skip_serializing_if="Option::is_none")]
pub owner: Option<String>,
}
#[doc="<p>Contains the results of the <a>DescribeWorkspaceBundles</a> operation.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct DescribeWorkspaceBundlesResult {
#[doc="<p>An array of structures that contain information about the bundles.</p>"]
#[serde(rename="Bundles")]
#[serde(skip_serializing_if="Option::is_none")]
pub bundles: Option<Vec<WorkspaceBundle>>,
#[doc="<p>If not null, more results are available. Pass this value for the <code>NextToken</code> parameter in a subsequent call to this operation to retrieve the next set of items. This token is valid for one day and must be used within that time frame.</p>"]
#[serde(rename="NextToken")]
#[serde(skip_serializing_if="Option::is_none")]
pub next_token: Option<String>,
}
#[doc="<p>Contains the inputs for the <a>DescribeWorkspaceDirectories</a> operation.</p>"]
#[derive(Default,Debug,Clone,Serialize)]
pub struct DescribeWorkspaceDirectoriesRequest {
#[doc="<p>An array of strings that contains the directory identifiers to retrieve information for. If this member is null, all directories are retrieved.</p>"]
#[serde(rename="DirectoryIds")]
#[serde(skip_serializing_if="Option::is_none")]
pub directory_ids: Option<Vec<String>>,
#[doc="<p>The <code>NextToken</code> value from a previous call to this operation. Pass null if this is the first call.</p>"]
#[serde(rename="NextToken")]
#[serde(skip_serializing_if="Option::is_none")]
pub next_token: Option<String>,
}
#[doc="<p>Contains the results of the <a>DescribeWorkspaceDirectories</a> operation.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct DescribeWorkspaceDirectoriesResult {
#[doc="<p>An array of structures that contain information about the directories.</p>"]
#[serde(rename="Directories")]
#[serde(skip_serializing_if="Option::is_none")]
pub directories: Option<Vec<WorkspaceDirectory>>,
#[doc="<p>If not null, more results are available. Pass this value for the <code>NextToken</code> parameter in a subsequent call to this operation to retrieve the next set of items. This token is valid for one day and must be used within that time frame.</p>"]
#[serde(rename="NextToken")]
#[serde(skip_serializing_if="Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default,Debug,Clone,Serialize)]
pub struct DescribeWorkspacesConnectionStatusRequest {
#[doc="<p>The next token of the request.</p>"]
#[serde(rename="NextToken")]
#[serde(skip_serializing_if="Option::is_none")]
pub next_token: Option<String>,
#[doc="<p>An array of strings that contain the identifiers of the WorkSpaces.</p>"]
#[serde(rename="WorkspaceIds")]
#[serde(skip_serializing_if="Option::is_none")]
pub workspace_ids: Option<Vec<String>>,
}
#[derive(Default,Debug,Clone,Deserialize)]
pub struct DescribeWorkspacesConnectionStatusResult {
#[doc="<p>The next token of the result.</p>"]
#[serde(rename="NextToken")]
#[serde(skip_serializing_if="Option::is_none")]
pub next_token: Option<String>,
#[doc="<p>The connection status of the WorkSpace.</p>"]
#[serde(rename="WorkspacesConnectionStatus")]
#[serde(skip_serializing_if="Option::is_none")]
pub workspaces_connection_status: Option<Vec<WorkspaceConnectionStatus>>,
}
#[doc="<p>Contains the inputs for the <a>DescribeWorkspaces</a> operation.</p>"]
#[derive(Default,Debug,Clone,Serialize)]
pub struct DescribeWorkspacesRequest {
#[doc="<p>The identifier of a bundle to obtain the WorkSpaces for. All WorkSpaces that are created from this bundle will be retrieved. This parameter cannot be combined with any other filter parameter.</p>"]
#[serde(rename="BundleId")]
#[serde(skip_serializing_if="Option::is_none")]
pub bundle_id: Option<String>,
#[doc="<p>Specifies the directory identifier to which to limit the WorkSpaces. Optionally, you can specify a specific directory user with the <code>UserName</code> parameter. This parameter cannot be combined with any other filter parameter.</p>"]
#[serde(rename="DirectoryId")]
#[serde(skip_serializing_if="Option::is_none")]
pub directory_id: Option<String>,
#[doc="<p>The maximum number of items to return.</p>"]
#[serde(rename="Limit")]
#[serde(skip_serializing_if="Option::is_none")]
pub limit: Option<i64>,
#[doc="<p>The <code>NextToken</code> value from a previous call to this operation. Pass null if this is the first call.</p>"]
#[serde(rename="NextToken")]
#[serde(skip_serializing_if="Option::is_none")]
pub next_token: Option<String>,
#[doc="<p>Used with the <code>DirectoryId</code> parameter to specify the directory user for whom to obtain the WorkSpace.</p>"]
#[serde(rename="UserName")]
#[serde(skip_serializing_if="Option::is_none")]
pub user_name: Option<String>,
#[doc="<p>An array of strings that contain the identifiers of the WorkSpaces for which to retrieve information. This parameter cannot be combined with any other filter parameter.</p> <p>Because the <a>CreateWorkspaces</a> operation is asynchronous, the identifier it returns is not immediately available. If you immediately call <a>DescribeWorkspaces</a> with this identifier, no information is returned.</p>"]
#[serde(rename="WorkspaceIds")]
#[serde(skip_serializing_if="Option::is_none")]
pub workspace_ids: Option<Vec<String>>,
}
#[doc="<p>Contains the results for the <a>DescribeWorkspaces</a> operation.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct DescribeWorkspacesResult {
#[doc="<p>If not null, more results are available. Pass this value for the <code>NextToken</code> parameter in a subsequent call to this operation to retrieve the next set of items. This token is valid for one day and must be used within that time frame.</p>"]
#[serde(rename="NextToken")]
#[serde(skip_serializing_if="Option::is_none")]
pub next_token: Option<String>,
#[doc="<p>An array of structures that contain the information about the WorkSpaces.</p> <p>Because the <a>CreateWorkspaces</a> operation is asynchronous, some of this information may be incomplete for a newly-created WorkSpace.</p>"]
#[serde(rename="Workspaces")]
#[serde(skip_serializing_if="Option::is_none")]
pub workspaces: Option<Vec<Workspace>>,
}
#[doc="<p>Contains information about a WorkSpace that could not be created.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct FailedCreateWorkspaceRequest {
#[doc="<p>The error code.</p>"]
#[serde(rename="ErrorCode")]
#[serde(skip_serializing_if="Option::is_none")]
pub error_code: Option<String>,
#[doc="<p>The textual error message.</p>"]
#[serde(rename="ErrorMessage")]
#[serde(skip_serializing_if="Option::is_none")]
pub error_message: Option<String>,
#[doc="<p>A <a>FailedCreateWorkspaceRequest$WorkspaceRequest</a> object that contains the information about the WorkSpace that could not be created.</p>"]
#[serde(rename="WorkspaceRequest")]
#[serde(skip_serializing_if="Option::is_none")]
pub workspace_request: Option<WorkspaceRequest>,
}
#[doc="<p>Contains information about a WorkSpace that could not be rebooted (<a>RebootWorkspaces</a>), rebuilt (<a>RebuildWorkspaces</a>), terminated (<a>TerminateWorkspaces</a>), started (<a>StartWorkspaces</a>), or stopped (<a>StopWorkspaces</a>).</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct FailedWorkspaceChangeRequest {
#[doc="<p>The error code.</p>"]
#[serde(rename="ErrorCode")]
#[serde(skip_serializing_if="Option::is_none")]
pub error_code: Option<String>,
#[doc="<p>The textual error message.</p>"]
#[serde(rename="ErrorMessage")]
#[serde(skip_serializing_if="Option::is_none")]
pub error_message: Option<String>,
#[doc="<p>The identifier of the WorkSpace.</p>"]
#[serde(rename="WorkspaceId")]
#[serde(skip_serializing_if="Option::is_none")]
pub workspace_id: Option<String>,
}
#[derive(Default,Debug,Clone,Serialize)]
pub struct ModifyWorkspacePropertiesRequest {
#[doc="<p>The ID of the WorkSpace.</p>"]
#[serde(rename="WorkspaceId")]
pub workspace_id: String,
#[doc="<p>The WorkSpace properties of the request.</p>"]
#[serde(rename="WorkspaceProperties")]
pub workspace_properties: WorkspaceProperties,
}
#[derive(Default,Debug,Clone,Deserialize)]
pub struct ModifyWorkspacePropertiesResult;
#[doc="<p>Contains information used with the <a>RebootWorkspaces</a> operation to reboot a WorkSpace.</p>"]
#[derive(Default,Debug,Clone,Serialize)]
pub struct RebootRequest {
#[doc="<p>The identifier of the WorkSpace to reboot.</p>"]
#[serde(rename="WorkspaceId")]
pub workspace_id: String,
}
#[doc="<p>Contains the inputs for the <a>RebootWorkspaces</a> operation.</p>"]
#[derive(Default,Debug,Clone,Serialize)]
pub struct RebootWorkspacesRequest {
#[doc="<p>An array of structures that specify the WorkSpaces to reboot.</p>"]
#[serde(rename="RebootWorkspaceRequests")]
pub reboot_workspace_requests: Vec<RebootRequest>,
}
#[doc="<p>Contains the results of the <a>RebootWorkspaces</a> operation.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct RebootWorkspacesResult {
#[doc="<p>An array of structures representing any WorkSpaces that could not be rebooted.</p>"]
#[serde(rename="FailedRequests")]
#[serde(skip_serializing_if="Option::is_none")]
pub failed_requests: Option<Vec<FailedWorkspaceChangeRequest>>,
}
#[doc="<p>Contains information used with the <a>RebuildWorkspaces</a> operation to rebuild a WorkSpace.</p>"]
#[derive(Default,Debug,Clone,Serialize)]
pub struct RebuildRequest {
#[doc="<p>The identifier of the WorkSpace to rebuild.</p>"]
#[serde(rename="WorkspaceId")]
pub workspace_id: String,
}
#[doc="<p>Contains the inputs for the <a>RebuildWorkspaces</a> operation.</p>"]
#[derive(Default,Debug,Clone,Serialize)]
pub struct RebuildWorkspacesRequest {
#[doc="<p>An array of structures that specify the WorkSpaces to rebuild.</p>"]
#[serde(rename="RebuildWorkspaceRequests")]
pub rebuild_workspace_requests: Vec<RebuildRequest>,
}
#[doc="<p>Contains the results of the <a>RebuildWorkspaces</a> operation.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct RebuildWorkspacesResult {
#[doc="<p>An array of structures representing any WorkSpaces that could not be rebuilt.</p>"]
#[serde(rename="FailedRequests")]
#[serde(skip_serializing_if="Option::is_none")]
pub failed_requests: Option<Vec<FailedWorkspaceChangeRequest>>,
}
#[doc="<p>Describes the start request.</p>"]
#[derive(Default,Debug,Clone,Serialize)]
pub struct StartRequest {
#[doc="<p>The ID of the WorkSpace.</p>"]
#[serde(rename="WorkspaceId")]
#[serde(skip_serializing_if="Option::is_none")]
pub workspace_id: Option<String>,
}
#[derive(Default,Debug,Clone,Serialize)]
pub struct StartWorkspacesRequest {
#[doc="<p>The requests.</p>"]
#[serde(rename="StartWorkspaceRequests")]
pub start_workspace_requests: Vec<StartRequest>,
}
#[derive(Default,Debug,Clone,Deserialize)]
pub struct StartWorkspacesResult {
#[doc="<p>The failed requests.</p>"]
#[serde(rename="FailedRequests")]
#[serde(skip_serializing_if="Option::is_none")]
pub failed_requests: Option<Vec<FailedWorkspaceChangeRequest>>,
}
#[doc="<p>Describes the stop request.</p>"]
#[derive(Default,Debug,Clone,Serialize)]
pub struct StopRequest {
#[doc="<p>The ID of the WorkSpace.</p>"]
#[serde(rename="WorkspaceId")]
#[serde(skip_serializing_if="Option::is_none")]
pub workspace_id: Option<String>,
}
#[derive(Default,Debug,Clone,Serialize)]
pub struct StopWorkspacesRequest {
#[doc="<p>The requests.</p>"]
#[serde(rename="StopWorkspaceRequests")]
pub stop_workspace_requests: Vec<StopRequest>,
}
#[derive(Default,Debug,Clone,Deserialize)]
pub struct StopWorkspacesResult {
#[doc="<p>The failed requests.</p>"]
#[serde(rename="FailedRequests")]
#[serde(skip_serializing_if="Option::is_none")]
pub failed_requests: Option<Vec<FailedWorkspaceChangeRequest>>,
}
#[doc="<p>Describes the tag of the WorkSpace.</p>"]
#[derive(Default,Debug,Clone,Serialize,Deserialize)]
pub struct Tag {
#[doc="<p>The key of the tag.</p>"]
#[serde(rename="Key")]
pub key: String,
#[doc="<p>The value of the tag.</p>"]
#[serde(rename="Value")]
#[serde(skip_serializing_if="Option::is_none")]
pub value: Option<String>,
}
#[doc="<p>Contains information used with the <a>TerminateWorkspaces</a> operation to terminate a WorkSpace.</p>"]
#[derive(Default,Debug,Clone,Serialize)]
pub struct TerminateRequest {
#[doc="<p>The identifier of the WorkSpace to terminate.</p>"]
#[serde(rename="WorkspaceId")]
pub workspace_id: String,
}
#[doc="<p>Contains the inputs for the <a>TerminateWorkspaces</a> operation.</p>"]
#[derive(Default,Debug,Clone,Serialize)]
pub struct TerminateWorkspacesRequest {
#[doc="<p>An array of structures that specify the WorkSpaces to terminate.</p>"]
#[serde(rename="TerminateWorkspaceRequests")]
pub terminate_workspace_requests: Vec<TerminateRequest>,
}
#[doc="<p>Contains the results of the <a>TerminateWorkspaces</a> operation.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct TerminateWorkspacesResult {
#[doc="<p>An array of structures representing any WorkSpaces that could not be terminated.</p>"]
#[serde(rename="FailedRequests")]
#[serde(skip_serializing_if="Option::is_none")]
pub failed_requests: Option<Vec<FailedWorkspaceChangeRequest>>,
}
#[doc="<p>Contains information about the user storage for a WorkSpace bundle.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct UserStorage {
#[doc="<p>The amount of user storage for the bundle.</p>"]
#[serde(rename="Capacity")]
#[serde(skip_serializing_if="Option::is_none")]
pub capacity: Option<String>,
}
#[doc="<p>Contains information about a WorkSpace.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct Workspace {
#[doc="<p>The identifier of the bundle that the WorkSpace was created from.</p>"]
#[serde(rename="BundleId")]
#[serde(skip_serializing_if="Option::is_none")]
pub bundle_id: Option<String>,
#[doc="<p>The name of the WorkSpace as seen by the operating system.</p>"]
#[serde(rename="ComputerName")]
#[serde(skip_serializing_if="Option::is_none")]
pub computer_name: Option<String>,
#[doc="<p>The identifier of the AWS Directory Service directory that the WorkSpace belongs to.</p>"]
#[serde(rename="DirectoryId")]
#[serde(skip_serializing_if="Option::is_none")]
pub directory_id: Option<String>,
#[doc="<p>If the WorkSpace could not be created, this contains the error code.</p>"]
#[serde(rename="ErrorCode")]
#[serde(skip_serializing_if="Option::is_none")]
pub error_code: Option<String>,
#[doc="<p>If the WorkSpace could not be created, this contains a textual error message that describes the failure.</p>"]
#[serde(rename="ErrorMessage")]
#[serde(skip_serializing_if="Option::is_none")]
pub error_message: Option<String>,
#[doc="<p>The IP address of the WorkSpace.</p>"]
#[serde(rename="IpAddress")]
#[serde(skip_serializing_if="Option::is_none")]
pub ip_address: Option<String>,
#[doc="<p>Specifies whether the data stored on the root volume, or C: drive, is encrypted.</p>"]
#[serde(rename="RootVolumeEncryptionEnabled")]
#[serde(skip_serializing_if="Option::is_none")]
pub root_volume_encryption_enabled: Option<bool>,
#[doc="<p>The operational state of the WorkSpace.</p>"]
#[serde(rename="State")]
#[serde(skip_serializing_if="Option::is_none")]
pub state: Option<String>,
#[doc="<p>The identifier of the subnet that the WorkSpace is in.</p>"]
#[serde(rename="SubnetId")]
#[serde(skip_serializing_if="Option::is_none")]
pub subnet_id: Option<String>,
#[doc="<p>The user that the WorkSpace is assigned to.</p>"]
#[serde(rename="UserName")]
#[serde(skip_serializing_if="Option::is_none")]
pub user_name: Option<String>,
#[doc="<p>Specifies whether the data stored on the user volume, or D: drive, is encrypted.</p>"]
#[serde(rename="UserVolumeEncryptionEnabled")]
#[serde(skip_serializing_if="Option::is_none")]
pub user_volume_encryption_enabled: Option<bool>,
#[doc="<p>The KMS key used to encrypt data stored on your WorkSpace.</p>"]
#[serde(rename="VolumeEncryptionKey")]
#[serde(skip_serializing_if="Option::is_none")]
pub volume_encryption_key: Option<String>,
#[doc="<p>The identifier of the WorkSpace.</p>"]
#[serde(rename="WorkspaceId")]
#[serde(skip_serializing_if="Option::is_none")]
pub workspace_id: Option<String>,
#[serde(rename="WorkspaceProperties")]
#[serde(skip_serializing_if="Option::is_none")]
pub workspace_properties: Option<WorkspaceProperties>,
}
#[doc="<p>Contains information about a WorkSpace bundle.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct WorkspaceBundle {
#[doc="<p>The bundle identifier.</p>"]
#[serde(rename="BundleId")]
#[serde(skip_serializing_if="Option::is_none")]
pub bundle_id: Option<String>,
#[doc="<p>A <a>ComputeType</a> object that specifies the compute type for the bundle.</p>"]
#[serde(rename="ComputeType")]
#[serde(skip_serializing_if="Option::is_none")]
pub compute_type: Option<ComputeType>,
#[doc="<p>The bundle description.</p>"]
#[serde(rename="Description")]
#[serde(skip_serializing_if="Option::is_none")]
pub description: Option<String>,
#[doc="<p>The name of the bundle.</p>"]
#[serde(rename="Name")]
#[serde(skip_serializing_if="Option::is_none")]
pub name: Option<String>,
#[doc="<p>The owner of the bundle. This contains the owner's account identifier, or <code>AMAZON</code> if the bundle is provided by AWS.</p>"]
#[serde(rename="Owner")]
#[serde(skip_serializing_if="Option::is_none")]
pub owner: Option<String>,
#[doc="<p>A <a>UserStorage</a> object that specifies the amount of user storage that the bundle contains.</p>"]
#[serde(rename="UserStorage")]
#[serde(skip_serializing_if="Option::is_none")]
pub user_storage: Option<UserStorage>,
}
#[doc="<p>Describes the connection status of a WorkSpace.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct WorkspaceConnectionStatus {
#[doc="<p>The connection state of the WorkSpace. Returns UNKOWN if the WorkSpace is in a Stopped state.</p>"]
#[serde(rename="ConnectionState")]
#[serde(skip_serializing_if="Option::is_none")]
pub connection_state: Option<String>,
#[doc="<p>The timestamp of the connection state check.</p>"]
#[serde(rename="ConnectionStateCheckTimestamp")]
#[serde(skip_serializing_if="Option::is_none")]
pub connection_state_check_timestamp: Option<f64>,
#[doc="<p>The timestamp of the last known user connection.</p>"]
#[serde(rename="LastKnownUserConnectionTimestamp")]
#[serde(skip_serializing_if="Option::is_none")]
pub last_known_user_connection_timestamp: Option<f64>,
#[doc="<p>The ID of the WorkSpace.</p>"]
#[serde(rename="WorkspaceId")]
#[serde(skip_serializing_if="Option::is_none")]
pub workspace_id: Option<String>,
}
#[doc="<p>Contains information about an AWS Directory Service directory for use with Amazon WorkSpaces.</p>"]
#[derive(Default,Debug,Clone,Deserialize)]
pub struct WorkspaceDirectory {
#[doc="<p>The directory alias.</p>"]
#[serde(rename="Alias")]
#[serde(skip_serializing_if="Option::is_none")]
pub alias: Option<String>,
#[doc="<p>The user name for the service account.</p>"]
#[serde(rename="CustomerUserName")]
#[serde(skip_serializing_if="Option::is_none")]
pub customer_user_name: Option<String>,
#[doc="<p>The directory identifier.</p>"]
#[serde(rename="DirectoryId")]
#[serde(skip_serializing_if="Option::is_none")]
pub directory_id: Option<String>,
#[doc="<p>The name of the directory.</p>"]
#[serde(rename="DirectoryName")]
#[serde(skip_serializing_if="Option::is_none")]
pub directory_name: Option<String>,
#[doc="<p>The directory type.</p>"]
#[serde(rename="DirectoryType")]
#[serde(skip_serializing_if="Option::is_none")]
pub directory_type: Option<String>,
#[doc="<p>An array of strings that contains the IP addresses of the DNS servers for the directory.</p>"]
#[serde(rename="DnsIpAddresses")]
#[serde(skip_serializing_if="Option::is_none")]
pub dns_ip_addresses: Option<Vec<String>>,
#[doc="<p>The identifier of the IAM role. This is the role that allows Amazon WorkSpaces to make calls to other services, such as Amazon EC2, on your behalf.</p>"]
#[serde(rename="IamRoleId")]
#[serde(skip_serializing_if="Option::is_none")]
pub iam_role_id: Option<String>,
#[doc="<p>The registration code for the directory. This is the code that users enter in their Amazon WorkSpaces client application to connect to the directory.</p>"]
#[serde(rename="RegistrationCode")]
#[serde(skip_serializing_if="Option::is_none")]
pub registration_code: Option<String>,
#[doc="<p>The state of the directory's registration with Amazon WorkSpaces</p>"]
#[serde(rename="State")]
#[serde(skip_serializing_if="Option::is_none")]
pub state: Option<String>,
#[doc="<p>An array of strings that contains the identifiers of the subnets used with the directory.</p>"]
#[serde(rename="SubnetIds")]
#[serde(skip_serializing_if="Option::is_none")]
pub subnet_ids: Option<Vec<String>>,
#[doc="<p>A structure that specifies the default creation properties for all WorkSpaces in the directory.</p>"]
#[serde(rename="WorkspaceCreationProperties")]
#[serde(skip_serializing_if="Option::is_none")]
pub workspace_creation_properties: Option<DefaultWorkspaceCreationProperties>,
#[doc="<p>The identifier of the security group that is assigned to new WorkSpaces.</p>"]
#[serde(rename="WorkspaceSecurityGroupId")]
#[serde(skip_serializing_if="Option::is_none")]
pub workspace_security_group_id: Option<String>,
}
#[doc="<p>Describes the properties of a WorkSpace.</p>"]
#[derive(Default,Debug,Clone,Serialize,Deserialize)]
pub struct WorkspaceProperties {
#[doc="<p>The running mode of the WorkSpace. AlwaysOn WorkSpaces are billed monthly. AutoStop WorkSpaces are billed by the hour and stopped when no longer being used in order to save on costs.</p>"]
#[serde(rename="RunningMode")]
#[serde(skip_serializing_if="Option::is_none")]
pub running_mode: Option<String>,
#[doc="<p>The time after a user logs off when WorkSpaces are automatically stopped. Configured in 60 minute intervals.</p>"]
#[serde(rename="RunningModeAutoStopTimeoutInMinutes")]
#[serde(skip_serializing_if="Option::is_none")]
pub running_mode_auto_stop_timeout_in_minutes: Option<i64>,
}
#[doc="<p>Contains information about a WorkSpace creation request.</p>"]
#[derive(Default,Debug,Clone,Serialize,Deserialize)]
pub struct WorkspaceRequest {
#[doc="<p>The identifier of the bundle to create the WorkSpace from. You can use the <a>DescribeWorkspaceBundles</a> operation to obtain a list of the bundles that are available.</p>"]
#[serde(rename="BundleId")]
pub bundle_id: String,
#[doc="<p>The identifier of the AWS Directory Service directory to create the WorkSpace in. You can use the <a>DescribeWorkspaceDirectories</a> operation to obtain a list of the directories that are available.</p>"]
#[serde(rename="DirectoryId")]
pub directory_id: String,
#[doc="<p>Specifies whether the data stored on the root volume, or C: drive, is encrypted.</p>"]
#[serde(rename="RootVolumeEncryptionEnabled")]
#[serde(skip_serializing_if="Option::is_none")]
pub root_volume_encryption_enabled: Option<bool>,
#[doc="<p>The tags of the WorkSpace request.</p>"]
#[serde(rename="Tags")]
#[serde(skip_serializing_if="Option::is_none")]
pub tags: Option<Vec<Tag>>,
#[doc="<p>The username that the WorkSpace is assigned to. This username must exist in the AWS Directory Service directory specified by the <code>DirectoryId</code> member.</p>"]
#[serde(rename="UserName")]
pub user_name: String,
#[doc="<p>Specifies whether the data stored on the user volume, or D: drive, is encrypted.</p>"]
#[serde(rename="UserVolumeEncryptionEnabled")]
#[serde(skip_serializing_if="Option::is_none")]
pub user_volume_encryption_enabled: Option<bool>,
#[doc="<p>The KMS key used to encrypt data stored on your WorkSpace.</p>"]
#[serde(rename="VolumeEncryptionKey")]
#[serde(skip_serializing_if="Option::is_none")]
pub volume_encryption_key: Option<String>,
#[serde(rename="WorkspaceProperties")]
#[serde(skip_serializing_if="Option::is_none")]
pub workspace_properties: Option<WorkspaceProperties>,
}
#[derive(Debug, PartialEq)]
pub enum CreateTagsError {
InvalidParameterValues(String),
ResourceLimitExceeded(String),
ResourceNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl CreateTagsError {
pub fn from_body(body: &str) -> CreateTagsError {
match from_str::<SerdeJsonValue>(body) {
Ok(json) => {
let raw_error_type = json.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or(body);
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"InvalidParameterValuesException" => {
CreateTagsError::InvalidParameterValues(String::from(error_message))
}
"ResourceLimitExceededException" => {
CreateTagsError::ResourceLimitExceeded(String::from(error_message))
}
"ResourceNotFoundException" => {
CreateTagsError::ResourceNotFound(String::from(error_message))
}
"ValidationException" => CreateTagsError::Validation(error_message.to_string()),
_ => CreateTagsError::Unknown(String::from(body)),
}
}
Err(_) => CreateTagsError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for CreateTagsError {
fn from(err: serde_json::error::Error) -> CreateTagsError {
CreateTagsError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for CreateTagsError {
fn from(err: CredentialsError) -> CreateTagsError {
CreateTagsError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateTagsError {
fn from(err: HttpDispatchError) -> CreateTagsError {
CreateTagsError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateTagsError {
fn from(err: io::Error) -> CreateTagsError {
CreateTagsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateTagsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateTagsError {
fn description(&self) -> &str {
match *self {
CreateTagsError::InvalidParameterValues(ref cause) => cause,
CreateTagsError::ResourceLimitExceeded(ref cause) => cause,
CreateTagsError::ResourceNotFound(ref cause) => cause,
CreateTagsError::Validation(ref cause) => cause,
CreateTagsError::Credentials(ref err) => err.description(),
CreateTagsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateTagsError::Unknown(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateWorkspacesError {
InvalidParameterValues(String),
ResourceLimitExceeded(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl CreateWorkspacesError {
pub fn from_body(body: &str) -> CreateWorkspacesError {
match from_str::<SerdeJsonValue>(body) {
Ok(json) => {
let raw_error_type = json.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or(body);
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"InvalidParameterValuesException" => {
CreateWorkspacesError::InvalidParameterValues(String::from(error_message))
}
"ResourceLimitExceededException" => {
CreateWorkspacesError::ResourceLimitExceeded(String::from(error_message))
}
"ValidationException" => {
CreateWorkspacesError::Validation(error_message.to_string())
}
_ => CreateWorkspacesError::Unknown(String::from(body)),
}
}
Err(_) => CreateWorkspacesError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for CreateWorkspacesError {
fn from(err: serde_json::error::Error) -> CreateWorkspacesError {
CreateWorkspacesError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for CreateWorkspacesError {
fn from(err: CredentialsError) -> CreateWorkspacesError {
CreateWorkspacesError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateWorkspacesError {
fn from(err: HttpDispatchError) -> CreateWorkspacesError {
CreateWorkspacesError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateWorkspacesError {
fn from(err: io::Error) -> CreateWorkspacesError {
CreateWorkspacesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateWorkspacesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateWorkspacesError {
fn description(&self) -> &str {
match *self {
CreateWorkspacesError::InvalidParameterValues(ref cause) => cause,
CreateWorkspacesError::ResourceLimitExceeded(ref cause) => cause,
CreateWorkspacesError::Validation(ref cause) => cause,
CreateWorkspacesError::Credentials(ref err) => err.description(),
CreateWorkspacesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateWorkspacesError::Unknown(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteTagsError {
InvalidParameterValues(String),
ResourceNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl DeleteTagsError {
pub fn from_body(body: &str) -> DeleteTagsError {
match from_str::<SerdeJsonValue>(body) {
Ok(json) => {
let raw_error_type = json.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or(body);
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"InvalidParameterValuesException" => {
DeleteTagsError::InvalidParameterValues(String::from(error_message))
}
"ResourceNotFoundException" => {
DeleteTagsError::ResourceNotFound(String::from(error_message))
}
"ValidationException" => DeleteTagsError::Validation(error_message.to_string()),
_ => DeleteTagsError::Unknown(String::from(body)),
}
}
Err(_) => DeleteTagsError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for DeleteTagsError {
fn from(err: serde_json::error::Error) -> DeleteTagsError {
DeleteTagsError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteTagsError {
fn from(err: CredentialsError) -> DeleteTagsError {
DeleteTagsError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteTagsError {
fn from(err: HttpDispatchError) -> DeleteTagsError {
DeleteTagsError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteTagsError {
fn from(err: io::Error) -> DeleteTagsError {
DeleteTagsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteTagsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteTagsError {
fn description(&self) -> &str {
match *self {
DeleteTagsError::InvalidParameterValues(ref cause) => cause,
DeleteTagsError::ResourceNotFound(ref cause) => cause,
DeleteTagsError::Validation(ref cause) => cause,
DeleteTagsError::Credentials(ref err) => err.description(),
DeleteTagsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteTagsError::Unknown(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeTagsError {
ResourceNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl DescribeTagsError {
pub fn from_body(body: &str) -> DescribeTagsError {
match from_str::<SerdeJsonValue>(body) {
Ok(json) => {
let raw_error_type = json.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or(body);
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"ResourceNotFoundException" => {
DescribeTagsError::ResourceNotFound(String::from(error_message))
}
"ValidationException" => {
DescribeTagsError::Validation(error_message.to_string())
}
_ => DescribeTagsError::Unknown(String::from(body)),
}
}
Err(_) => DescribeTagsError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for DescribeTagsError {
fn from(err: serde_json::error::Error) -> DescribeTagsError {
DescribeTagsError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeTagsError {
fn from(err: CredentialsError) -> DescribeTagsError {
DescribeTagsError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeTagsError {
fn from(err: HttpDispatchError) -> DescribeTagsError {
DescribeTagsError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeTagsError {
fn from(err: io::Error) -> DescribeTagsError {
DescribeTagsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeTagsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeTagsError {
fn description(&self) -> &str {
match *self {
DescribeTagsError::ResourceNotFound(ref cause) => cause,
DescribeTagsError::Validation(ref cause) => cause,
DescribeTagsError::Credentials(ref err) => err.description(),
DescribeTagsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DescribeTagsError::Unknown(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeWorkspaceBundlesError {
InvalidParameterValues(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl DescribeWorkspaceBundlesError {
pub fn from_body(body: &str) -> DescribeWorkspaceBundlesError {
match from_str::<SerdeJsonValue>(body) {
Ok(json) => {
let raw_error_type = json.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or(body);
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"InvalidParameterValuesException" => DescribeWorkspaceBundlesError::InvalidParameterValues(String::from(error_message)),
"ValidationException" => {
DescribeWorkspaceBundlesError::Validation(error_message.to_string())
}
_ => DescribeWorkspaceBundlesError::Unknown(String::from(body)),
}
}
Err(_) => DescribeWorkspaceBundlesError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for DescribeWorkspaceBundlesError {
fn from(err: serde_json::error::Error) -> DescribeWorkspaceBundlesError {
DescribeWorkspaceBundlesError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeWorkspaceBundlesError {
fn from(err: CredentialsError) -> DescribeWorkspaceBundlesError {
DescribeWorkspaceBundlesError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeWorkspaceBundlesError {
fn from(err: HttpDispatchError) -> DescribeWorkspaceBundlesError {
DescribeWorkspaceBundlesError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeWorkspaceBundlesError {
fn from(err: io::Error) -> DescribeWorkspaceBundlesError {
DescribeWorkspaceBundlesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeWorkspaceBundlesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeWorkspaceBundlesError {
fn description(&self) -> &str {
match *self {
DescribeWorkspaceBundlesError::InvalidParameterValues(ref cause) => cause,
DescribeWorkspaceBundlesError::Validation(ref cause) => cause,
DescribeWorkspaceBundlesError::Credentials(ref err) => err.description(),
DescribeWorkspaceBundlesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeWorkspaceBundlesError::Unknown(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeWorkspaceDirectoriesError {
InvalidParameterValues(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl DescribeWorkspaceDirectoriesError {
pub fn from_body(body: &str) -> DescribeWorkspaceDirectoriesError {
match from_str::<SerdeJsonValue>(body) {
Ok(json) => {
let raw_error_type = json.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or(body);
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"InvalidParameterValuesException" => DescribeWorkspaceDirectoriesError::InvalidParameterValues(String::from(error_message)),
"ValidationException" => {
DescribeWorkspaceDirectoriesError::Validation(error_message.to_string())
}
_ => DescribeWorkspaceDirectoriesError::Unknown(String::from(body)),
}
}
Err(_) => DescribeWorkspaceDirectoriesError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for DescribeWorkspaceDirectoriesError {
fn from(err: serde_json::error::Error) -> DescribeWorkspaceDirectoriesError {
DescribeWorkspaceDirectoriesError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeWorkspaceDirectoriesError {
fn from(err: CredentialsError) -> DescribeWorkspaceDirectoriesError {
DescribeWorkspaceDirectoriesError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeWorkspaceDirectoriesError {
fn from(err: HttpDispatchError) -> DescribeWorkspaceDirectoriesError {
DescribeWorkspaceDirectoriesError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeWorkspaceDirectoriesError {
fn from(err: io::Error) -> DescribeWorkspaceDirectoriesError {
DescribeWorkspaceDirectoriesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeWorkspaceDirectoriesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeWorkspaceDirectoriesError {
fn description(&self) -> &str {
match *self {
DescribeWorkspaceDirectoriesError::InvalidParameterValues(ref cause) => cause,
DescribeWorkspaceDirectoriesError::Validation(ref cause) => cause,
DescribeWorkspaceDirectoriesError::Credentials(ref err) => err.description(),
DescribeWorkspaceDirectoriesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeWorkspaceDirectoriesError::Unknown(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeWorkspacesError {
InvalidParameterValues(String),
ResourceUnavailable(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl DescribeWorkspacesError {
pub fn from_body(body: &str) -> DescribeWorkspacesError {
match from_str::<SerdeJsonValue>(body) {
Ok(json) => {
let raw_error_type = json.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or(body);
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"InvalidParameterValuesException" => {
DescribeWorkspacesError::InvalidParameterValues(String::from(error_message))
}
"ResourceUnavailableException" => {
DescribeWorkspacesError::ResourceUnavailable(String::from(error_message))
}
"ValidationException" => {
DescribeWorkspacesError::Validation(error_message.to_string())
}
_ => DescribeWorkspacesError::Unknown(String::from(body)),
}
}
Err(_) => DescribeWorkspacesError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for DescribeWorkspacesError {
fn from(err: serde_json::error::Error) -> DescribeWorkspacesError {
DescribeWorkspacesError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeWorkspacesError {
fn from(err: CredentialsError) -> DescribeWorkspacesError {
DescribeWorkspacesError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeWorkspacesError {
fn from(err: HttpDispatchError) -> DescribeWorkspacesError {
DescribeWorkspacesError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeWorkspacesError {
fn from(err: io::Error) -> DescribeWorkspacesError {
DescribeWorkspacesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeWorkspacesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeWorkspacesError {
fn description(&self) -> &str {
match *self {
DescribeWorkspacesError::InvalidParameterValues(ref cause) => cause,
DescribeWorkspacesError::ResourceUnavailable(ref cause) => cause,
DescribeWorkspacesError::Validation(ref cause) => cause,
DescribeWorkspacesError::Credentials(ref err) => err.description(),
DescribeWorkspacesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeWorkspacesError::Unknown(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeWorkspacesConnectionStatusError {
InvalidParameterValues(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl DescribeWorkspacesConnectionStatusError {
pub fn from_body(body: &str) -> DescribeWorkspacesConnectionStatusError {
match from_str::<SerdeJsonValue>(body) {
Ok(json) => {
let raw_error_type = json.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or(body);
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"InvalidParameterValuesException" => DescribeWorkspacesConnectionStatusError::InvalidParameterValues(String::from(error_message)),
"ValidationException" => {
DescribeWorkspacesConnectionStatusError::Validation(error_message
.to_string())
}
_ => DescribeWorkspacesConnectionStatusError::Unknown(String::from(body)),
}
}
Err(_) => DescribeWorkspacesConnectionStatusError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for DescribeWorkspacesConnectionStatusError {
fn from(err: serde_json::error::Error) -> DescribeWorkspacesConnectionStatusError {
DescribeWorkspacesConnectionStatusError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeWorkspacesConnectionStatusError {
fn from(err: CredentialsError) -> DescribeWorkspacesConnectionStatusError {
DescribeWorkspacesConnectionStatusError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeWorkspacesConnectionStatusError {
fn from(err: HttpDispatchError) -> DescribeWorkspacesConnectionStatusError {
DescribeWorkspacesConnectionStatusError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeWorkspacesConnectionStatusError {
fn from(err: io::Error) -> DescribeWorkspacesConnectionStatusError {
DescribeWorkspacesConnectionStatusError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeWorkspacesConnectionStatusError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeWorkspacesConnectionStatusError {
fn description(&self) -> &str {
match *self {
DescribeWorkspacesConnectionStatusError::InvalidParameterValues(ref cause) => cause,
DescribeWorkspacesConnectionStatusError::Validation(ref cause) => cause,
DescribeWorkspacesConnectionStatusError::Credentials(ref err) => err.description(),
DescribeWorkspacesConnectionStatusError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeWorkspacesConnectionStatusError::Unknown(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum ModifyWorkspacePropertiesError {
AccessDenied(String),
InvalidParameterValues(String),
InvalidResourceState(String),
OperationInProgress(String),
ResourceNotFound(String),
ResourceUnavailable(String),
UnsupportedWorkspaceConfiguration(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl ModifyWorkspacePropertiesError {
pub fn from_body(body: &str) -> ModifyWorkspacePropertiesError {
match from_str::<SerdeJsonValue>(body) {
Ok(json) => {
let raw_error_type = json.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or(body);
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
ModifyWorkspacePropertiesError::AccessDenied(String::from(error_message))
}
"InvalidParameterValuesException" => ModifyWorkspacePropertiesError::InvalidParameterValues(String::from(error_message)),
"InvalidResourceStateException" => ModifyWorkspacePropertiesError::InvalidResourceState(String::from(error_message)),
"OperationInProgressException" => ModifyWorkspacePropertiesError::OperationInProgress(String::from(error_message)),
"ResourceNotFoundException" => ModifyWorkspacePropertiesError::ResourceNotFound(String::from(error_message)),
"ResourceUnavailableException" => ModifyWorkspacePropertiesError::ResourceUnavailable(String::from(error_message)),
"UnsupportedWorkspaceConfigurationException" => ModifyWorkspacePropertiesError::UnsupportedWorkspaceConfiguration(String::from(error_message)),
"ValidationException" => {
ModifyWorkspacePropertiesError::Validation(error_message.to_string())
}
_ => ModifyWorkspacePropertiesError::Unknown(String::from(body)),
}
}
Err(_) => ModifyWorkspacePropertiesError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for ModifyWorkspacePropertiesError {
fn from(err: serde_json::error::Error) -> ModifyWorkspacePropertiesError {
ModifyWorkspacePropertiesError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for ModifyWorkspacePropertiesError {
fn from(err: CredentialsError) -> ModifyWorkspacePropertiesError {
ModifyWorkspacePropertiesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ModifyWorkspacePropertiesError {
fn from(err: HttpDispatchError) -> ModifyWorkspacePropertiesError {
ModifyWorkspacePropertiesError::HttpDispatch(err)
}
}
impl From<io::Error> for ModifyWorkspacePropertiesError {
fn from(err: io::Error) -> ModifyWorkspacePropertiesError {
ModifyWorkspacePropertiesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ModifyWorkspacePropertiesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ModifyWorkspacePropertiesError {
fn description(&self) -> &str {
match *self {
ModifyWorkspacePropertiesError::AccessDenied(ref cause) => cause,
ModifyWorkspacePropertiesError::InvalidParameterValues(ref cause) => cause,
ModifyWorkspacePropertiesError::InvalidResourceState(ref cause) => cause,
ModifyWorkspacePropertiesError::OperationInProgress(ref cause) => cause,
ModifyWorkspacePropertiesError::ResourceNotFound(ref cause) => cause,
ModifyWorkspacePropertiesError::ResourceUnavailable(ref cause) => cause,
ModifyWorkspacePropertiesError::UnsupportedWorkspaceConfiguration(ref cause) => cause,
ModifyWorkspacePropertiesError::Validation(ref cause) => cause,
ModifyWorkspacePropertiesError::Credentials(ref err) => err.description(),
ModifyWorkspacePropertiesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ModifyWorkspacePropertiesError::Unknown(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum RebootWorkspacesError {
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl RebootWorkspacesError {
pub fn from_body(body: &str) -> RebootWorkspacesError {
match from_str::<SerdeJsonValue>(body) {
Ok(json) => {
let raw_error_type = json.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or(body);
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"ValidationException" => {
RebootWorkspacesError::Validation(error_message.to_string())
}
_ => RebootWorkspacesError::Unknown(String::from(body)),
}
}
Err(_) => RebootWorkspacesError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for RebootWorkspacesError {
fn from(err: serde_json::error::Error) -> RebootWorkspacesError {
RebootWorkspacesError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for RebootWorkspacesError {
fn from(err: CredentialsError) -> RebootWorkspacesError {
RebootWorkspacesError::Credentials(err)
}
}
impl From<HttpDispatchError> for RebootWorkspacesError {
fn from(err: HttpDispatchError) -> RebootWorkspacesError {
RebootWorkspacesError::HttpDispatch(err)
}
}
impl From<io::Error> for RebootWorkspacesError {
fn from(err: io::Error) -> RebootWorkspacesError {
RebootWorkspacesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for RebootWorkspacesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for RebootWorkspacesError {
fn description(&self) -> &str {
match *self {
RebootWorkspacesError::Validation(ref cause) => cause,
RebootWorkspacesError::Credentials(ref err) => err.description(),
RebootWorkspacesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
RebootWorkspacesError::Unknown(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum RebuildWorkspacesError {
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl RebuildWorkspacesError {
pub fn from_body(body: &str) -> RebuildWorkspacesError {
match from_str::<SerdeJsonValue>(body) {
Ok(json) => {
let raw_error_type = json.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or(body);
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"ValidationException" => {
RebuildWorkspacesError::Validation(error_message.to_string())
}
_ => RebuildWorkspacesError::Unknown(String::from(body)),
}
}
Err(_) => RebuildWorkspacesError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for RebuildWorkspacesError {
fn from(err: serde_json::error::Error) -> RebuildWorkspacesError {
RebuildWorkspacesError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for RebuildWorkspacesError {
fn from(err: CredentialsError) -> RebuildWorkspacesError {
RebuildWorkspacesError::Credentials(err)
}
}
impl From<HttpDispatchError> for RebuildWorkspacesError {
fn from(err: HttpDispatchError) -> RebuildWorkspacesError {
RebuildWorkspacesError::HttpDispatch(err)
}
}
impl From<io::Error> for RebuildWorkspacesError {
fn from(err: io::Error) -> RebuildWorkspacesError {
RebuildWorkspacesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for RebuildWorkspacesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for RebuildWorkspacesError {
fn description(&self) -> &str {
match *self {
RebuildWorkspacesError::Validation(ref cause) => cause,
RebuildWorkspacesError::Credentials(ref err) => err.description(),
RebuildWorkspacesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
RebuildWorkspacesError::Unknown(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum StartWorkspacesError {
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl StartWorkspacesError {
pub fn from_body(body: &str) -> StartWorkspacesError {
match from_str::<SerdeJsonValue>(body) {
Ok(json) => {
let raw_error_type = json.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or(body);
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"ValidationException" => {
StartWorkspacesError::Validation(error_message.to_string())
}
_ => StartWorkspacesError::Unknown(String::from(body)),
}
}
Err(_) => StartWorkspacesError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for StartWorkspacesError {
fn from(err: serde_json::error::Error) -> StartWorkspacesError {
StartWorkspacesError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for StartWorkspacesError {
fn from(err: CredentialsError) -> StartWorkspacesError {
StartWorkspacesError::Credentials(err)
}
}
impl From<HttpDispatchError> for StartWorkspacesError {
fn from(err: HttpDispatchError) -> StartWorkspacesError {
StartWorkspacesError::HttpDispatch(err)
}
}
impl From<io::Error> for StartWorkspacesError {
fn from(err: io::Error) -> StartWorkspacesError {
StartWorkspacesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for StartWorkspacesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for StartWorkspacesError {
fn description(&self) -> &str {
match *self {
StartWorkspacesError::Validation(ref cause) => cause,
StartWorkspacesError::Credentials(ref err) => err.description(),
StartWorkspacesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
StartWorkspacesError::Unknown(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum StopWorkspacesError {
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl StopWorkspacesError {
pub fn from_body(body: &str) -> StopWorkspacesError {
match from_str::<SerdeJsonValue>(body) {
Ok(json) => {
let raw_error_type = json.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or(body);
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"ValidationException" => {
StopWorkspacesError::Validation(error_message.to_string())
}
_ => StopWorkspacesError::Unknown(String::from(body)),
}
}
Err(_) => StopWorkspacesError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for StopWorkspacesError {
fn from(err: serde_json::error::Error) -> StopWorkspacesError {
StopWorkspacesError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for StopWorkspacesError {
fn from(err: CredentialsError) -> StopWorkspacesError {
StopWorkspacesError::Credentials(err)
}
}
impl From<HttpDispatchError> for StopWorkspacesError {
fn from(err: HttpDispatchError) -> StopWorkspacesError {
StopWorkspacesError::HttpDispatch(err)
}
}
impl From<io::Error> for StopWorkspacesError {
fn from(err: io::Error) -> StopWorkspacesError {
StopWorkspacesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for StopWorkspacesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for StopWorkspacesError {
fn description(&self) -> &str {
match *self {
StopWorkspacesError::Validation(ref cause) => cause,
StopWorkspacesError::Credentials(ref err) => err.description(),
StopWorkspacesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
StopWorkspacesError::Unknown(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum TerminateWorkspacesError {
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
Unknown(String),
}
impl TerminateWorkspacesError {
pub fn from_body(body: &str) -> TerminateWorkspacesError {
match from_str::<SerdeJsonValue>(body) {
Ok(json) => {
let raw_error_type = json.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or(body);
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"ValidationException" => {
TerminateWorkspacesError::Validation(error_message.to_string())
}
_ => TerminateWorkspacesError::Unknown(String::from(body)),
}
}
Err(_) => TerminateWorkspacesError::Unknown(String::from(body)),
}
}
}
impl From<serde_json::error::Error> for TerminateWorkspacesError {
fn from(err: serde_json::error::Error) -> TerminateWorkspacesError {
TerminateWorkspacesError::Unknown(err.description().to_string())
}
}
impl From<CredentialsError> for TerminateWorkspacesError {
fn from(err: CredentialsError) -> TerminateWorkspacesError {
TerminateWorkspacesError::Credentials(err)
}
}
impl From<HttpDispatchError> for TerminateWorkspacesError {
fn from(err: HttpDispatchError) -> TerminateWorkspacesError {
TerminateWorkspacesError::HttpDispatch(err)
}
}
impl From<io::Error> for TerminateWorkspacesError {
fn from(err: io::Error) -> TerminateWorkspacesError {
TerminateWorkspacesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for TerminateWorkspacesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for TerminateWorkspacesError {
fn description(&self) -> &str {
match *self {
TerminateWorkspacesError::Validation(ref cause) => cause,
TerminateWorkspacesError::Credentials(ref err) => err.description(),
TerminateWorkspacesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
TerminateWorkspacesError::Unknown(ref cause) => cause,
}
}
}
pub trait Workspaces {
#[doc="<p>Creates tags for a WorkSpace.</p>"]
fn create_tags(&self, input: &CreateTagsRequest) -> Result<CreateTagsResult, CreateTagsError>;
#[doc="<p>Creates one or more WorkSpaces.</p> <note> <p>This operation is asynchronous and returns before the WorkSpaces are created.</p> </note>"]
fn create_workspaces(&self,
input: &CreateWorkspacesRequest)
-> Result<CreateWorkspacesResult, CreateWorkspacesError>;
#[doc="<p>Deletes tags from a WorkSpace.</p>"]
fn delete_tags(&self, input: &DeleteTagsRequest) -> Result<DeleteTagsResult, DeleteTagsError>;
#[doc="<p>Describes tags for a WorkSpace.</p>"]
fn describe_tags(&self,
input: &DescribeTagsRequest)
-> Result<DescribeTagsResult, DescribeTagsError>;
#[doc="<p>Obtains information about the WorkSpace bundles that are available to your account in the specified region.</p> <p>You can filter the results with either the <code>BundleIds</code> parameter, or the <code>Owner</code> parameter, but not both.</p> <p>This operation supports pagination with the use of the <code>NextToken</code> request and response parameters. If more results are available, the <code>NextToken</code> response member contains a token that you pass in the next call to this operation to retrieve the next set of items.</p>"]
fn describe_workspace_bundles
(&self,
input: &DescribeWorkspaceBundlesRequest)
-> Result<DescribeWorkspaceBundlesResult, DescribeWorkspaceBundlesError>;
#[doc="<p>Retrieves information about the AWS Directory Service directories in the region that are registered with Amazon WorkSpaces and are available to your account.</p> <p>This operation supports pagination with the use of the <code>NextToken</code> request and response parameters. If more results are available, the <code>NextToken</code> response member contains a token that you pass in the next call to this operation to retrieve the next set of items.</p>"]
fn describe_workspace_directories
(&self,
input: &DescribeWorkspaceDirectoriesRequest)
-> Result<DescribeWorkspaceDirectoriesResult, DescribeWorkspaceDirectoriesError>;
#[doc="<p>Obtains information about the specified WorkSpaces.</p> <p>Only one of the filter parameters, such as <code>BundleId</code>, <code>DirectoryId</code>, or <code>WorkspaceIds</code>, can be specified at a time.</p> <p>This operation supports pagination with the use of the <code>NextToken</code> request and response parameters. If more results are available, the <code>NextToken</code> response member contains a token that you pass in the next call to this operation to retrieve the next set of items.</p>"]
fn describe_workspaces(&self,
input: &DescribeWorkspacesRequest)
-> Result<DescribeWorkspacesResult, DescribeWorkspacesError>;
#[doc="<p>Describes the connection status of a specified WorkSpace.</p>"]
fn describe_workspaces_connection_status
(&self,
input: &DescribeWorkspacesConnectionStatusRequest)
-> Result<DescribeWorkspacesConnectionStatusResult,
DescribeWorkspacesConnectionStatusError>;
#[doc="<p>Modifies the WorkSpace properties, including the running mode and AutoStop time.</p>"]
fn modify_workspace_properties
(&self,
input: &ModifyWorkspacePropertiesRequest)
-> Result<ModifyWorkspacePropertiesResult, ModifyWorkspacePropertiesError>;
#[doc="<p>Reboots the specified WorkSpaces.</p> <p>To be able to reboot a WorkSpace, the WorkSpace must have a <b>State</b> of <code>AVAILABLE</code>, <code>IMPAIRED</code>, or <code>INOPERABLE</code>.</p> <note> <p>This operation is asynchronous and returns before the WorkSpaces have rebooted.</p> </note>"]
fn reboot_workspaces(&self,
input: &RebootWorkspacesRequest)
-> Result<RebootWorkspacesResult, RebootWorkspacesError>;
#[doc="<p>Rebuilds the specified WorkSpaces.</p> <p>Rebuilding a WorkSpace is a potentially destructive action that can result in the loss of data. Rebuilding a WorkSpace causes the following to occur:</p> <ul> <li> <p>The system is restored to the image of the bundle that the WorkSpace is created from. Any applications that have been installed, or system settings that have been made since the WorkSpace was created will be lost.</p> </li> <li> <p>The data drive (D drive) is re-created from the last automatic snapshot taken of the data drive. The current contents of the data drive are overwritten. Automatic snapshots of the data drive are taken every 12 hours, so the snapshot can be as much as 12 hours old.</p> </li> </ul> <p>To be able to rebuild a WorkSpace, the WorkSpace must have a <b>State</b> of <code>AVAILABLE</code> or <code>ERROR</code>.</p> <note> <p>This operation is asynchronous and returns before the WorkSpaces have been completely rebuilt.</p> </note>"]
fn rebuild_workspaces(&self,
input: &RebuildWorkspacesRequest)
-> Result<RebuildWorkspacesResult, RebuildWorkspacesError>;
#[doc="<p>Starts the specified WorkSpaces. The WorkSpaces must have a running mode of AutoStop and a state of STOPPED.</p>"]
fn start_workspaces(&self,
input: &StartWorkspacesRequest)
-> Result<StartWorkspacesResult, StartWorkspacesError>;
#[doc="<p> Stops the specified WorkSpaces. The WorkSpaces must have a running mode of AutoStop and a state of AVAILABLE, IMPAIRED, UNHEALTHY, or ERROR.</p>"]
fn stop_workspaces(&self,
input: &StopWorkspacesRequest)
-> Result<StopWorkspacesResult, StopWorkspacesError>;
#[doc="<p>Terminates the specified WorkSpaces.</p> <p>Terminating a WorkSpace is a permanent action and cannot be undone. The user's data is not maintained and will be destroyed. If you need to archive any user data, contact Amazon Web Services before terminating the WorkSpace.</p> <p>You can terminate a WorkSpace that is in any state except <code>SUSPENDED</code>.</p> <note> <p>This operation is asynchronous and returns before the WorkSpaces have been completely terminated.</p> </note>"]
fn terminate_workspaces(&self,
input: &TerminateWorkspacesRequest)
-> Result<TerminateWorkspacesResult, TerminateWorkspacesError>;
}
pub struct WorkspacesClient<P, D>
where P: ProvideAwsCredentials,
D: DispatchSignedRequest
{
credentials_provider: P,
region: region::Region,
dispatcher: D,
}
impl<P, D> WorkspacesClient<P, D>
where P: ProvideAwsCredentials,
D: DispatchSignedRequest
{
pub fn new(request_dispatcher: D, credentials_provider: P, region: region::Region) -> Self {
WorkspacesClient {
credentials_provider: credentials_provider,
region: region,
dispatcher: request_dispatcher,
}
}
}
impl<P, D> Workspaces for WorkspacesClient<P, D>
where P: ProvideAwsCredentials,
D: DispatchSignedRequest
{
#[doc="<p>Creates tags for a WorkSpace.</p>"]
fn create_tags(&self, input: &CreateTagsRequest) -> Result<CreateTagsResult, CreateTagsError> {
let mut request = SignedRequest::new("POST", "workspaces", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "WorkspacesService.CreateTags");
let encoded = serde_json::to_string(input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);
let mut response = try!(self.dispatcher.dispatch(&request));
match response.status {
StatusCode::Ok => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Ok(serde_json::from_str::<CreateTagsResult>(String::from_utf8_lossy(&body)
.as_ref())
.unwrap())
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(CreateTagsError::from_body(String::from_utf8_lossy(&body).as_ref()))
}
}
}
#[doc="<p>Creates one or more WorkSpaces.</p> <note> <p>This operation is asynchronous and returns before the WorkSpaces are created.</p> </note>"]
fn create_workspaces(&self,
input: &CreateWorkspacesRequest)
-> Result<CreateWorkspacesResult, CreateWorkspacesError> {
let mut request = SignedRequest::new("POST", "workspaces", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "WorkspacesService.CreateWorkspaces");
let encoded = serde_json::to_string(input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);
let mut response = try!(self.dispatcher.dispatch(&request));
match response.status {
StatusCode::Ok => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Ok(serde_json::from_str::<CreateWorkspacesResult>(String::from_utf8_lossy(&body)
.as_ref())
.unwrap())
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(CreateWorkspacesError::from_body(String::from_utf8_lossy(&body).as_ref()))
}
}
}
#[doc="<p>Deletes tags from a WorkSpace.</p>"]
fn delete_tags(&self, input: &DeleteTagsRequest) -> Result<DeleteTagsResult, DeleteTagsError> {
let mut request = SignedRequest::new("POST", "workspaces", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "WorkspacesService.DeleteTags");
let encoded = serde_json::to_string(input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);
let mut response = try!(self.dispatcher.dispatch(&request));
match response.status {
StatusCode::Ok => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Ok(serde_json::from_str::<DeleteTagsResult>(String::from_utf8_lossy(&body)
.as_ref())
.unwrap())
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(DeleteTagsError::from_body(String::from_utf8_lossy(&body).as_ref()))
}
}
}
#[doc="<p>Describes tags for a WorkSpace.</p>"]
fn describe_tags(&self,
input: &DescribeTagsRequest)
-> Result<DescribeTagsResult, DescribeTagsError> {
let mut request = SignedRequest::new("POST", "workspaces", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "WorkspacesService.DescribeTags");
let encoded = serde_json::to_string(input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);
let mut response = try!(self.dispatcher.dispatch(&request));
match response.status {
StatusCode::Ok => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Ok(serde_json::from_str::<DescribeTagsResult>(String::from_utf8_lossy(&body)
.as_ref())
.unwrap())
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(DescribeTagsError::from_body(String::from_utf8_lossy(&body).as_ref()))
}
}
}
#[doc="<p>Obtains information about the WorkSpace bundles that are available to your account in the specified region.</p> <p>You can filter the results with either the <code>BundleIds</code> parameter, or the <code>Owner</code> parameter, but not both.</p> <p>This operation supports pagination with the use of the <code>NextToken</code> request and response parameters. If more results are available, the <code>NextToken</code> response member contains a token that you pass in the next call to this operation to retrieve the next set of items.</p>"]
fn describe_workspace_bundles
(&self,
input: &DescribeWorkspaceBundlesRequest)
-> Result<DescribeWorkspaceBundlesResult, DescribeWorkspaceBundlesError> {
let mut request = SignedRequest::new("POST", "workspaces", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "WorkspacesService.DescribeWorkspaceBundles");
let encoded = serde_json::to_string(input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);
let mut response = try!(self.dispatcher.dispatch(&request));
match response.status {
StatusCode::Ok => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Ok(serde_json::from_str::<DescribeWorkspaceBundlesResult>(String::from_utf8_lossy(&body).as_ref()).unwrap())
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(DescribeWorkspaceBundlesError::from_body(String::from_utf8_lossy(&body)
.as_ref()))
}
}
}
#[doc="<p>Retrieves information about the AWS Directory Service directories in the region that are registered with Amazon WorkSpaces and are available to your account.</p> <p>This operation supports pagination with the use of the <code>NextToken</code> request and response parameters. If more results are available, the <code>NextToken</code> response member contains a token that you pass in the next call to this operation to retrieve the next set of items.</p>"]
fn describe_workspace_directories
(&self,
input: &DescribeWorkspaceDirectoriesRequest)
-> Result<DescribeWorkspaceDirectoriesResult, DescribeWorkspaceDirectoriesError> {
let mut request = SignedRequest::new("POST", "workspaces", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target",
"WorkspacesService.DescribeWorkspaceDirectories");
let encoded = serde_json::to_string(input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);
let mut response = try!(self.dispatcher.dispatch(&request));
match response.status {
StatusCode::Ok => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Ok(serde_json::from_str::<DescribeWorkspaceDirectoriesResult>(String::from_utf8_lossy(&body).as_ref()).unwrap())
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(DescribeWorkspaceDirectoriesError::from_body(String::from_utf8_lossy(&body)
.as_ref()))
}
}
}
#[doc="<p>Obtains information about the specified WorkSpaces.</p> <p>Only one of the filter parameters, such as <code>BundleId</code>, <code>DirectoryId</code>, or <code>WorkspaceIds</code>, can be specified at a time.</p> <p>This operation supports pagination with the use of the <code>NextToken</code> request and response parameters. If more results are available, the <code>NextToken</code> response member contains a token that you pass in the next call to this operation to retrieve the next set of items.</p>"]
fn describe_workspaces(&self,
input: &DescribeWorkspacesRequest)
-> Result<DescribeWorkspacesResult, DescribeWorkspacesError> {
let mut request = SignedRequest::new("POST", "workspaces", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "WorkspacesService.DescribeWorkspaces");
let encoded = serde_json::to_string(input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);
let mut response = try!(self.dispatcher.dispatch(&request));
match response.status {
StatusCode::Ok => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Ok(serde_json::from_str::<DescribeWorkspacesResult>(String::from_utf8_lossy(&body)
.as_ref())
.unwrap())
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(DescribeWorkspacesError::from_body(String::from_utf8_lossy(&body).as_ref()))
}
}
}
#[doc="<p>Describes the connection status of a specified WorkSpace.</p>"]
fn describe_workspaces_connection_status
(&self,
input: &DescribeWorkspacesConnectionStatusRequest)
-> Result<DescribeWorkspacesConnectionStatusResult,
DescribeWorkspacesConnectionStatusError> {
let mut request = SignedRequest::new("POST", "workspaces", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target",
"WorkspacesService.DescribeWorkspacesConnectionStatus");
let encoded = serde_json::to_string(input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);
let mut response = try!(self.dispatcher.dispatch(&request));
match response.status {
StatusCode::Ok => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Ok(serde_json::from_str::<DescribeWorkspacesConnectionStatusResult>(String::from_utf8_lossy(&body).as_ref()).unwrap())
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(DescribeWorkspacesConnectionStatusError::from_body(String::from_utf8_lossy(&body).as_ref()))
}
}
}
#[doc="<p>Modifies the WorkSpace properties, including the running mode and AutoStop time.</p>"]
fn modify_workspace_properties
(&self,
input: &ModifyWorkspacePropertiesRequest)
-> Result<ModifyWorkspacePropertiesResult, ModifyWorkspacePropertiesError> {
let mut request = SignedRequest::new("POST", "workspaces", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target",
"WorkspacesService.ModifyWorkspaceProperties");
let encoded = serde_json::to_string(input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);
let mut response = try!(self.dispatcher.dispatch(&request));
match response.status {
StatusCode::Ok => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Ok(serde_json::from_str::<ModifyWorkspacePropertiesResult>(String::from_utf8_lossy(&body).as_ref()).unwrap())
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(ModifyWorkspacePropertiesError::from_body(String::from_utf8_lossy(&body)
.as_ref()))
}
}
}
#[doc="<p>Reboots the specified WorkSpaces.</p> <p>To be able to reboot a WorkSpace, the WorkSpace must have a <b>State</b> of <code>AVAILABLE</code>, <code>IMPAIRED</code>, or <code>INOPERABLE</code>.</p> <note> <p>This operation is asynchronous and returns before the WorkSpaces have rebooted.</p> </note>"]
fn reboot_workspaces(&self,
input: &RebootWorkspacesRequest)
-> Result<RebootWorkspacesResult, RebootWorkspacesError> {
let mut request = SignedRequest::new("POST", "workspaces", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "WorkspacesService.RebootWorkspaces");
let encoded = serde_json::to_string(input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);
let mut response = try!(self.dispatcher.dispatch(&request));
match response.status {
StatusCode::Ok => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Ok(serde_json::from_str::<RebootWorkspacesResult>(String::from_utf8_lossy(&body)
.as_ref())
.unwrap())
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(RebootWorkspacesError::from_body(String::from_utf8_lossy(&body).as_ref()))
}
}
}
#[doc="<p>Rebuilds the specified WorkSpaces.</p> <p>Rebuilding a WorkSpace is a potentially destructive action that can result in the loss of data. Rebuilding a WorkSpace causes the following to occur:</p> <ul> <li> <p>The system is restored to the image of the bundle that the WorkSpace is created from. Any applications that have been installed, or system settings that have been made since the WorkSpace was created will be lost.</p> </li> <li> <p>The data drive (D drive) is re-created from the last automatic snapshot taken of the data drive. The current contents of the data drive are overwritten. Automatic snapshots of the data drive are taken every 12 hours, so the snapshot can be as much as 12 hours old.</p> </li> </ul> <p>To be able to rebuild a WorkSpace, the WorkSpace must have a <b>State</b> of <code>AVAILABLE</code> or <code>ERROR</code>.</p> <note> <p>This operation is asynchronous and returns before the WorkSpaces have been completely rebuilt.</p> </note>"]
fn rebuild_workspaces(&self,
input: &RebuildWorkspacesRequest)
-> Result<RebuildWorkspacesResult, RebuildWorkspacesError> {
let mut request = SignedRequest::new("POST", "workspaces", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "WorkspacesService.RebuildWorkspaces");
let encoded = serde_json::to_string(input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);
let mut response = try!(self.dispatcher.dispatch(&request));
match response.status {
StatusCode::Ok => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Ok(serde_json::from_str::<RebuildWorkspacesResult>(String::from_utf8_lossy(&body)
.as_ref())
.unwrap())
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(RebuildWorkspacesError::from_body(String::from_utf8_lossy(&body).as_ref()))
}
}
}
#[doc="<p>Starts the specified WorkSpaces. The WorkSpaces must have a running mode of AutoStop and a state of STOPPED.</p>"]
fn start_workspaces(&self,
input: &StartWorkspacesRequest)
-> Result<StartWorkspacesResult, StartWorkspacesError> {
let mut request = SignedRequest::new("POST", "workspaces", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "WorkspacesService.StartWorkspaces");
let encoded = serde_json::to_string(input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);
let mut response = try!(self.dispatcher.dispatch(&request));
match response.status {
StatusCode::Ok => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Ok(serde_json::from_str::<StartWorkspacesResult>(String::from_utf8_lossy(&body)
.as_ref())
.unwrap())
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(StartWorkspacesError::from_body(String::from_utf8_lossy(&body).as_ref()))
}
}
}
#[doc="<p> Stops the specified WorkSpaces. The WorkSpaces must have a running mode of AutoStop and a state of AVAILABLE, IMPAIRED, UNHEALTHY, or ERROR.</p>"]
fn stop_workspaces(&self,
input: &StopWorkspacesRequest)
-> Result<StopWorkspacesResult, StopWorkspacesError> {
let mut request = SignedRequest::new("POST", "workspaces", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "WorkspacesService.StopWorkspaces");
let encoded = serde_json::to_string(input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);
let mut response = try!(self.dispatcher.dispatch(&request));
match response.status {
StatusCode::Ok => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Ok(serde_json::from_str::<StopWorkspacesResult>(String::from_utf8_lossy(&body)
.as_ref())
.unwrap())
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(StopWorkspacesError::from_body(String::from_utf8_lossy(&body).as_ref()))
}
}
}
#[doc="<p>Terminates the specified WorkSpaces.</p> <p>Terminating a WorkSpace is a permanent action and cannot be undone. The user's data is not maintained and will be destroyed. If you need to archive any user data, contact Amazon Web Services before terminating the WorkSpace.</p> <p>You can terminate a WorkSpace that is in any state except <code>SUSPENDED</code>.</p> <note> <p>This operation is asynchronous and returns before the WorkSpaces have been completely terminated.</p> </note>"]
fn terminate_workspaces(&self,
input: &TerminateWorkspacesRequest)
-> Result<TerminateWorkspacesResult, TerminateWorkspacesError> {
let mut request = SignedRequest::new("POST", "workspaces", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "WorkspacesService.TerminateWorkspaces");
let encoded = serde_json::to_string(input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
request.sign_with_plus(&try!(self.credentials_provider.credentials()), true);
let mut response = try!(self.dispatcher.dispatch(&request));
match response.status {
StatusCode::Ok => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Ok(serde_json::from_str::<TerminateWorkspacesResult>(String::from_utf8_lossy(&body).as_ref()).unwrap())
}
_ => {
let mut body: Vec<u8> = Vec::new();
try!(response.body.read_to_end(&mut body));
Err(TerminateWorkspacesError::from_body(String::from_utf8_lossy(&body).as_ref()))
}
}
}
}
#[cfg(test)]
mod protocol_tests {}