aws-sdk-rust 0.1.6

BETA! - AWS SDK for Rust (only S3 currently). Allows for proxies. For a full AWS SDK look at rusoto. WIP and under heavy development with possible breaking changes - warning.
Documentation
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
/*
 Copyright 2016 LambdaStack All rights reserved.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
*/

/*
 Portions borrowed from the rusoto project. See README.md
*/

use std::str::FromStr;
use std::str;

use aws::common::params::{Params, ServiceParams};
use aws::common::xmlutil::*;
use aws::common::common::*;
use aws::errors::http::*;
use aws::s3::header::*;
use aws::s3::bucket::*;
use aws::s3::acl::*;
use aws::s3::grant::*;
use aws::s3::writeparse::*;

pub type TagSet = Vec<Tag>;

pub type PartNumber = i32;

pub type UploadIdMarker = String;

pub type NextUploadIdMarker = String;

pub type MultipartUploadList = Vec<MultipartUpload>;

pub type MaxUploads = i32;

pub type Expires = String;

/// Parse `Tag` from XML
pub struct TagParser;

/// Write `Tag` contents to a `SignedRequest`
pub struct TagWriter;

/// Parse `TagSet` from XML
pub struct TagSetParser;

/// Write `TagSet` contents to a `SignedRequest`
pub struct TagSetWriter;

/// Parse `PartNumber` from XML
pub struct PartNumberParser;

/// Write `PartNumber` contents to a `SignedRequest`
pub struct PartNumberWriter;

/// Parse `Part` from XML
pub struct PartParser;

/// Write `Part` contents to a `SignedRequest`
pub struct PartWriter;

/// Parse `MultipartUpload` from XML
pub struct MultipartUploadParser;

/// Write `MultipartUpload` contents to a `SignedRequest`
pub struct MultipartUploadWriter;

/// Parse `UploadIdMarker` from XML
pub struct UploadIdMarkerParser;

/// Write `UploadIdMarker` contents to a `SignedRequest`
pub struct UploadIdMarkerWriter;

/// Parse `NextUploadIdMarker` from XML
pub struct NextUploadIdMarkerParser;

/// Write `NextUploadIdMarker` contents to a `SignedRequest`
pub struct NextUploadIdMarkerWriter;

/// Parse `MultipartUploadList` from XML
pub struct MultipartUploadListParser;

/// Write `MultipartUploadList` contents to a `SignedRequest`
pub struct MultipartUploadListWriter;

/// Parse `ListMultipartUploadsOutput` from XML
pub struct ListMultipartUploadsOutputParser;

/// Write `ListMultipartUploadsOutput` contents to a `SignedRequest`
pub struct ListMultipartUploadsOutputWriter;

/// Parse `CompleteMultipartUploadOutput` from XML
pub struct CompleteMultipartUploadOutputParser;

/// Write `CompleteMultipartUploadOutput` contents to a `SignedRequest`
pub struct CompleteMultipartUploadOutputWriter;

/// Parse `GetObjectRequest` from XML
pub struct GetObjectRequestParser;

/// Write `GetObjectRequest` contents to a `SignedRequest`
pub struct GetObjectRequestWriter;

/// Parse `PutObjectOutput` from XML
pub struct PutObjectOutputParser;

/// Write `PutObjectOutput` contents to a `SignedRequest`
pub struct PutObjectOutputWriter;

/// Parse `MaxUploads` from XML
pub struct MaxUploadsParser;

/// Write `MaxUploads` contents to a `SignedRequest`
pub struct MaxUploadsWriter;

/// Parse `Expires` from XML
pub struct ExpiresParser;

/// Write `Expires` contents to a `SignedRequest`
pub struct ExpiresWriter;

#[derive(Debug, Default)]
pub struct Object {
    pub last_modified: LastModified,
    pub e_tag: ETag,
    /// The class of storage used to store the object.
    pub storage_class: ObjectStorageClass,
    pub key: ObjectKey,
    pub owner: Owner,
    pub size: Size,
}

#[derive(Debug, Default)]
pub struct Delete {
    pub objects: ObjectIdentifierList,
    /// Element to enable quiet mode for the request. When you add this element, you
    /// must set its value to true.
    pub quiet: Option<Quiet>,
}

#[derive(Debug, Default)]
pub struct GetObjectOutput {
    /// Last modified date of the object
    pub last_modified: LastModified,
    /// The portion of the object returned in the response.
    pub content_range: ContentRange,
    pub request_charged: RequestCharged,
    /// Specifies what content encodings have been applied to the object and thus what
    /// decoding mechanisms must be applied to obtain the media-type referenced by the
    /// Content-Type header field.
    pub content_encoding: ContentEncoding,
    pub replication_status: ReplicationStatus,
    pub storage_class: StorageClass,
    /// The Server-side encryption algorithm used when storing this object in S3
    /// (e.g., AES256, aws:kms).
    pub server_side_encryption: ServerSideEncryption,
    /// If present, specifies the ID of the AWS Key Management Service (KMS) master
    /// encryption key that was used for the object.
    pub ssekms_key_id: SSEKMSKeyId,
    /// Specifies presentational information for the object.
    pub content_disposition: ContentDisposition,
    /// A map of metadata to store with the object in S3.
    pub metadata: Metadata,
    /// Object data.
    pub body: Body,
    pub accept_ranges: AcceptRanges,
    /// If the bucket is configured as a website, redirects requests for this object
    /// to another object in the same bucket or to an external URL. Amazon S3 stores
    /// the value of this header in the object metadata.
    pub website_redirect_location: WebsiteRedirectLocation,
    /// The date and time at which the object is no longer cacheable.
    pub expires: Expires,
    /// Specifies whether the object retrieved was (true) or was not (false) a Delete
    /// Marker. If false, this response header does not appear in the response.
    pub delete_marker: DeleteMarker,
    /// Specifies caching behavior along the request/reply chain.
    pub cache_control: CacheControl,
    /// Size of the body in bytes.
    pub content_length: ContentLength,
    /// If the object expiration is configured (see PUT Bucket lifecycle), the
    /// response includes this header. It includes the expiry-date and rule-id key
    /// value pairs providing object expiration information. The value of the rule-id
    /// is URL encoded.
    pub expiration: Expiration,
    /// This is set to the number of metadata entries not returned in x-amz-meta
    /// headers. This can happen if you create metadata using an API like SOAP that
    /// supports more flexible metadata than the REST API. For example, using SOAP,
    /// you can create metadata whose values are not legal HTTP headers.
    pub missing_meta: MissingMeta,
    /// Provides information about object restoration operation and expiration time of
    /// the restored object copy.
    pub restore: Restore,
    /// If server-side encryption with a customer-provided encryption key was
    /// requested, the response will include this header confirming the encryption
    /// algorithm used.
    pub sse_customer_algorithm: SSECustomerAlgorithm,
    /// A standard MIME type describing the format of the object data.
    pub content_type: ContentType,
    /// The language the content is in.
    pub content_language: ContentLanguage,
    /// Version of the object.
    pub version_id: ObjectVersionId,
    /// An ETag is an opaque identifier assigned by a web server to a specific version
    /// of a resource found at a URL
    pub e_tag: ETag,
    /// If server-side encryption with a customer-provided encryption key was
    /// requested, the response will include this header to provide round trip message
    /// integrity verification of the customer-provided encryption key.
    pub sse_customer_key_md5: SSECustomerKeyMD5,
}

#[derive(Debug, Default)]
pub struct RestoreObjectOutput {
    pub request_charged: RequestCharged,
}

#[derive(Debug, Default)]
pub struct RestoreObjectRequest {
    pub version_id: Option<ObjectVersionId>,
    pub restore_request: Option<RestoreRequest>,
    pub bucket: BucketName,
    pub request_payer: Option<RequestPayer>,
    pub key: ObjectKey,
}

#[derive(Debug, Default)]
pub struct RestoreRequest {
    /// Lifetime of the active copy in days
    pub days: Days,
}

#[derive(Debug, Default)]
pub struct DeleteObjectRequest {
    /// The concatenation of the authentication device's serial number, a space, and
    /// the value that is displayed on your authentication device.
    pub mfa: Option<MFA>,
    /// VersionId used to reference a specific version of the object.
    pub version_id: Option<ObjectVersionId>,
    pub bucket: BucketName,
    pub request_payer: Option<RequestPayer>,
    pub key: ObjectKey,
}

#[derive(Debug, Default)]
pub struct DeleteObjectOutput {
    /// Returns the version ID of the delete marker created as a result of the DELETE
    /// operation.
    pub version_id: ObjectVersionId,
    pub request_charged: RequestCharged,
    /// Specifies whether the versioned object that was permanently deleted was (true)
    /// or was not (false) a delete marker.
    pub delete_marker: DeleteMarker,
}

#[derive(Debug, Default)]
pub struct DeleteObjectsOutput {
    pub deleted: DeletedObjects,
    pub errors: Errors,
    pub request_charged: RequestCharged,
}

#[derive(Debug, Default)]
pub struct DeletedObject {
    pub version_id: ObjectVersionId,
    pub delete_marker_version_id: DeleteMarkerVersionId,
    pub key: ObjectKey,
    pub delete_marker: DeleteMarker,
}

#[derive(Debug, Default)]
pub struct PutObjectOutput {
    /// If server-side encryption with a customer-provided encryption key was
    /// requested, the response will include this header confirming the encryption
    /// algorithm used.
    pub sse_customer_algorithm: SSECustomerAlgorithm,
    pub request_charged: RequestCharged,
    /// Version of the object.
    pub version_id: ObjectVersionId,
    /// Entity tag for the uploaded object.
    pub e_tag: ETag,
    /// If the object expiration is configured, this will contain the expiration date
    /// (expiry-date) and rule ID (rule-id). The value of rule-id is URL encoded.
    pub expiration: Expiration,
    /// The Server-side encryption algorithm used when storing this object in S3
    /// (e.g., AES256, aws:kms).
    pub server_side_encryption: ServerSideEncryption,
    /// If server-side encryption with a customer-provided encryption key was
    /// requested, the response will include this header to provide round trip message
    /// integrity verification of the customer-provided encryption key.
    pub sse_customer_key_md5: SSECustomerKeyMD5,
    /// If present, specifies the ID of the AWS Key Management Service (KMS) master
    /// encryption key that was used for the object.
    pub ssekms_key_id: SSEKMSKeyId,
}

/// Container for specifying the configuration when you want Amazon S3 to publish
/// events to an Amazon Simple Notification Service (Amazon SNS) topic.
#[derive(Debug, Default)]
pub struct TopicConfiguration {
    pub id: Option<NotificationId>,
    /// Amazon SNS topic ARN to which Amazon S3 will publish a message when it detects
    /// events of specified type.
    pub topic_arn: TopicArn,
    pub events: EventList,
}

/// Container for specifying an configuration when you want Amazon S3 to publish
/// events to an Amazon Simple Queue Service (Amazon SQS) queue.
#[derive(Debug, Default)]
pub struct QueueConfiguration {
    pub id: Option<NotificationId>,
    /// Amazon SQS queue ARN to which Amazon S3 will publish a message when it detects
    /// events of specified type.
    pub queue_arn: QueueArn,
    pub events: EventList,
}

#[derive(Debug, Default)]
pub struct ObjectIdentifier {
    /// VersionId for the specific version of the object to delete.
    pub version_id: Option<ObjectVersionId>,
    /// Key name of the object to delete.
    pub key: ObjectKey,
}

#[derive(Debug, Default)]
pub struct CreateMultipartUploadRequest {
    pub request_payer: Option<RequestPayer>,
    /// Specifies what content encodings have been applied to the object and thus what
    /// decoding mechanisms must be applied to obtain the media-type referenced by the
    /// Content-Type header field.
    pub content_encoding: Option<ContentEncoding>,
    /// The type of storage to use for the object. Defaults to 'STANDARD'.
    pub storage_class: Option<StorageClass>,
    /// Allows grantee to read the object ACL.
    pub grant_read_acp: Option<GrantReadACP>,
    /// The Server-side encryption algorithm used when storing this object in S3
    /// (e.g., AES256, aws:kms).
    pub server_side_encryption: Option<ServerSideEncryption>,
    /// Specifies the AWS KMS key ID to use for object encryption. All GET and PUT
    /// requests for an object protected by AWS KMS will fail if not made via SSL or
    /// using SigV4. Documentation on configuring any of the officially supported AWS
    /// SDKs and CLI can be found at
    /// http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-
    /// signature-version
    pub ssekms_key_id: Option<SSEKMSKeyId>,
    /// Specifies presentational information for the object.
    pub content_disposition: Option<ContentDisposition>,
    /// A map of metadata to store with the object in S3.
    pub metadata: Option<Metadata>,
    /// Specifies the customer-provided encryption key for Amazon S3 to use in
    /// encrypting data. This value is used to store the object and then it is
    /// discarded; Amazon does not store the encryption key. The key must be
    /// appropriate for use with the algorithm specified in the x-amz-server-side-
    /// encryption-customer-algorithm header.
    pub sse_customer_key: Option<SSECustomerKey>,
    /// If the bucket is configured as a website, redirects requests for this object
    /// to another object in the same bucket or to an external URL. Amazon S3 stores
    /// the value of this header in the object metadata.
    pub website_redirect_location: Option<WebsiteRedirectLocation>,
    /// The date and time at which the object is no longer cacheable.
    pub expires: Option<Expires>,
    pub key: ObjectKey,
    /// Specifies caching behavior along the request/reply chain.
    pub cache_control: Option<CacheControl>,
    pub bucket: BucketName,
    /// Allows grantee to read the object data and its metadata.
    pub grant_read: Option<GrantRead>,
    /// Allows grantee to write the ACL for the applicable object.
    pub grant_write_acp: Option<GrantWriteACP>,
    /// The canned ACL to apply to the object.
    pub acl: Option<ObjectCannedACL>,
    /// Gives the grantee READ, READ_ACP, and WRITE_ACP permissions on the object.
    pub grant_full_control: Option<GrantFullControl>,
    /// Specifies the algorithm to use to when encrypting the object (e.g., AES256).
    pub sse_customer_algorithm: Option<SSECustomerAlgorithm>,
    /// A standard MIME type describing the format of the object data.
    pub content_type: Option<ContentType>,
    /// The language the content is in.
    pub content_language: Option<ContentLanguage>,
    /// Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321.
    /// Amazon S3 uses this header for a message integrity check to ensure the
    /// encryption key was transmitted without error.
    pub sse_customer_key_md5: Option<SSECustomerKeyMD5>,
}

#[derive(Debug, Default)]
pub struct CompleteMultipartUploadRequest <'a> {
    pub multipart_upload: Option<&'a [u8]>,
    pub upload_id: MultipartUploadId,
    pub bucket: BucketName,
    pub request_payer: Option<RequestPayer>,
    pub key: ObjectKey,
}

#[derive(Debug, Default)]
pub struct UploadPartRequest <'a> {
    pub body: Option<&'a [u8]>,
    /// Specifies the algorithm to use to when encrypting the object (e.g., AES256).
    pub sse_customer_algorithm: Option<SSECustomerAlgorithm>,
    pub request_payer: Option<RequestPayer>,
    /// Size of the body in bytes. This parameter is useful when the size of the body
    /// cannot be determined automatically.
    pub content_length: Option<ContentLength>,
    pub content_md5: Option<ContentMD5>,
    pub bucket: BucketName,
    /// Specifies the customer-provided encryption key for Amazon S3 to use in
    /// encrypting data. This value is used to store the object and then it is
    /// discarded; Amazon does not store the encryption key. The key must be
    /// appropriate for use with the algorithm specified in the x-amz-server-side-
    /// encryption-customer-algorithm header. This must be the same encryption key
    /// specified in the initiate multipart upload request.
    pub sse_customer_key: Option<SSECustomerKey>,
    /// Upload ID identifying the multipart upload whose part is being uploaded.
    pub upload_id: MultipartUploadId,
    pub key: ObjectKey,
    /// Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321.
    /// Amazon S3 uses this header for a message integrity check to ensure the
    /// encryption key was transmitted without error.
    pub sse_customer_key_md5: Option<SSECustomerKeyMD5>,
    /// Part number of part being uploaded. This is a positive integer between 1 and
    /// 10,000.
    pub part_number: PartNumber,
}

#[derive(Debug, Default)]
pub struct Part {
    /// Date and time at which the part was uploaded.
    pub last_modified: LastModified,
    /// Part number identifying the part. This is a positive integer between 1 and
    /// 10,000.
    pub part_number: PartNumber,
    /// Entity tag returned when the part was uploaded.
    pub e_tag: ETag,
    /// Size of the uploaded part data.
    pub size: Size,
}

#[derive(Debug, Default)]
pub struct PutObjectRequest<'a> {
    pub request_payer: Option<RequestPayer>,
    /// Specifies what content encodings have been applied to the object and thus what
    /// decoding mechanisms must be applied to obtain the media-type referenced by the
    /// Content-Type header field.
    pub content_encoding: Option<ContentEncoding>,
    /// The type of storage to use for the object. Defaults to 'STANDARD'.
    pub storage_class: Option<StorageClass>,
    /// Allows grantee to read the object ACL.
    pub grant_read_acp: Option<GrantReadACP>,
    /// The Server-side encryption algorithm used when storing this object in S3
    /// (e.g., AES256, aws:kms).
    pub server_side_encryption: Option<ServerSideEncryption>,
    /// Specifies the AWS KMS key ID to use for object encryption. All GET and PUT
    /// requests for an object protected by AWS KMS will fail if not made via SSL or
    /// using SigV4. Documentation on configuring any of the officially supported AWS
    /// SDKs and CLI can be found at
    /// http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-
    /// signature-version
    pub ssekms_key_id: Option<SSEKMSKeyId>,
    /// Specifies presentational information for the object.
    pub content_disposition: Option<ContentDisposition>,
    /// A map of metadata to store with the object in S3.
    pub metadata: Option<Metadata>,
    /// Object data.
    pub body: Option<&'a [u8]>,
    /// Specifies the customer-provided encryption key for Amazon S3 to use in
    /// encrypting data. This value is used to store the object and then it is
    /// discarded; Amazon does not store the encryption key. The key must be
    /// appropriate for use with the algorithm specified in the x-amz-server-side-
    /// encryption-customer-algorithm header.
    pub sse_customer_key: Option<SSECustomerKey>,
    /// If the bucket is configured as a website, redirects requests for this object
    /// to another object in the same bucket or to an external URL. Amazon S3 stores
    /// the value of this header in the object metadata.
    pub website_redirect_location: Option<WebsiteRedirectLocation>,
    /// The date and time at which the object is no longer cacheable.
    pub expires: Option<Expires>,
    pub key: ObjectKey,
    /// Specifies caching behavior along the request/reply chain.
    pub cache_control: Option<CacheControl>,
    /// Size of the body in bytes. This parameter is useful when the size of the body
    /// cannot be determined automatically.
    pub content_length: Option<ContentLength>,
    pub bucket: BucketName,
    /// Allows grantee to read the object data and its metadata.
    pub grant_read: Option<GrantRead>,
    /// Allows grantee to write the ACL for the applicable object.
    pub grant_write_acp: Option<GrantWriteACP>,
    /// The canned ACL to apply to the object.
    pub acl: Option<CannedAcl>,
    /// Gives the grantee READ, READ_ACP, and WRITE_ACP permissions on the object.
    pub grant_full_control: Option<GrantFullControl>,
    /// Specifies the algorithm to use to when encrypting the object (e.g., AES256).
    pub sse_customer_algorithm: Option<SSECustomerAlgorithm>,
    /// A standard MIME type describing the format of the object data.
    pub content_type: Option<ContentType>,
    /// The language the content is in.
    pub content_language: Option<ContentLanguage>,
    pub content_md5: Option<ContentMD5>,
    /// Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321.
    /// Amazon S3 uses this header for a message integrity check to ensure the
    /// encryption key was transmitted without error.
    pub sse_customer_key_md5: Option<SSECustomerKeyMD5>,
}

#[derive(Debug, Default)]
pub struct GetObjectRequest {
    /// Sets the Content-Encoding header of the response.
    pub response_content_encoding: Option<ResponseContentEncoding>,
    /// Sets the Content-Language header of the response.
    pub response_content_language: Option<ResponseContentLanguage>,
    /// Specifies the algorithm to use to when encrypting the object (e.g., AES256).
    pub sse_customer_algorithm: Option<SSECustomerAlgorithm>,
    /// Sets the Content-Type header of the response.
    pub response_content_type: Option<ResponseContentType>,
    /// Return the object only if it has not been modified since the specified time,
    /// otherwise return a 412 (precondition failed).
    pub if_unmodified_since: Option<IfUnmodifiedSince>,
    /// VersionId used to reference a specific version of the object.
    pub version_id: Option<ObjectVersionId>,
    pub request_payer: Option<RequestPayer>,
    /// Sets the Cache-Control header of the response.
    pub response_cache_control: Option<ResponseCacheControl>,
    /// Specifies the customer-provided encryption key for Amazon S3 to use in
    /// encrypting data. This value is used to store the object and then it is
    /// discarded; Amazon does not store the encryption key. The key must be
    /// appropriate for use with the algorithm specified in the x-amz-server-side-
    /// encryption-customer-algorithm header.
    pub sse_customer_key: Option<SSECustomerKey>,
    pub bucket: BucketName,
    /// Return the object only if its entity tag (ETag) is different from the one
    /// specified, otherwise return a 304 (not modified).
    pub if_none_match: Option<IfNoneMatch>,
    /// Sets the Content-Disposition header of the response
    pub response_content_disposition: Option<ResponseContentDisposition>,
    /// Downloads the specified range bytes of an object. For more information about
    /// the HTTP Range header, go to
    /// http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.
    pub range: Option<Range>,
    pub key: ObjectKey,
    /// Return the object only if its entity tag (ETag) is the same as the one
    /// specified, otherwise return a 412 (precondition failed).
    pub if_match: Option<IfMatch>,
    /// Sets the Expires header of the response.
    pub response_expires: Option<ResponseExpires>,
    /// Return the object only if it has been modified since the specified time,
    /// otherwise return a 304 (not modified).
    pub if_modified_since: Option<IfModifiedSince>,
    /// Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321.
    /// Amazon S3 uses this header for a message integrity check to ensure the
    /// encryption key was transmitted without error.
    pub sse_customer_key_md5: Option<SSECustomerKeyMD5>,
}

#[derive(Debug, Default)]
pub struct Initiator {
    /// Name of the Principal.
    pub display_name: DisplayName,
    /// If the principal is an AWS account, it provides the Canonical User ID. If the
    /// principal is an IAM User, it provides a user ARN value.
    pub id: ID,
}

#[derive(Debug, Default)]
pub struct GetObjectTorrentRequest {
    pub bucket: BucketName,
    pub request_payer: Option<RequestPayer>,
    pub key: ObjectKey,
}

#[derive(Debug, Default)]
pub struct Redirect {
    /// The specific object key to use in the redirect request. For example, redirect
    /// request to error.html. Not required if one of the sibling is present. Can be
    /// present only if ReplaceKeyPrefixWith is not provided.
    pub replace_key_with: ReplaceKeyWith,
    /// The host name to use in the redirect request.
    pub host_name: HostName,
    /// Protocol to use (http, https) when redirecting requests. The default is the
    /// protocol that is used in the original request.
    pub protocol: Protocol,
    /// The object key prefix to use in the redirect request. For example, to redirect
    /// requests for all pages with prefix docs/ (objects in the docs/ folder) to
    /// documents/, you can set a condition block with KeyPrefixEquals set to docs/
    /// and in the Redirect set ReplaceKeyPrefixWith to /documents. Not required if
    /// one of the siblings is present. Can be present only if ReplaceKeyWith is not
    /// provided.
    pub replace_key_prefix_with: ReplaceKeyPrefixWith,
    /// The HTTP redirect code to use on the response. Not required if one of the
    /// siblings is present.
    pub http_redirect_code: HttpRedirectCode,
}

#[derive(Debug, Default)]
pub struct ErrorDocument {
    /// The object key name to use when a 4XX class error occurs.
    pub key: ObjectKey,
}

#[derive(Debug, Default)]
pub struct IndexDocument {
    /// A suffix that is appended to a request that is for a directory on the website
    /// endpoint (e.g. if the suffix is index.html and you make a request to
    /// samplebucket/images/ the data that is returned will be for the object with the
    /// key name images/index.html) The suffix must not be empty and must not include
    /// a slash character.
    pub suffix: Suffix,
}

#[derive(Debug, Default)]
pub struct RedirectAllRequestsTo {
    /// Name of the host where requests will be redirected.
    pub host_name: HostName,
    /// Protocol to use (http, https) when redirecting requests. The default is the
    /// protocol that is used in the original request.
    pub protocol: Option<Protocol>,
}

/// Container for specifying the AWS Lambda notification configuration.
#[derive(Debug, Default)]
pub struct LambdaFunctionConfiguration {
    /// Lambda cloud function ARN that Amazon S3 can invoke when it detects events of
    /// the specified type.
    pub lambda_function_arn: LambdaFunctionArn,
    pub id: Option<NotificationId>,
    pub events: EventList,
}

#[derive(Debug, Default)]
pub struct Tag {
    /// Value of the tag.
    pub value: Value,
    /// Name of the tag.
    pub key: ObjectKey,
}

#[derive(Debug, Default)]
pub struct CopyObjectResult {
    pub last_modified: LastModified,
    pub e_tag: ETag,
}

#[derive(Debug, Default)]
pub struct ListMultipartUploadsOutput {
    /// Upload ID after which listing began.
    pub upload_id_marker: UploadIdMarker,
    pub common_prefixes: CommonPrefixList,
    /// When a list is truncated, this element specifies the value that should be used
    /// for the key-marker request parameter in a subsequent request.
    pub next_key_marker: NextKeyMarker,
    /// Name of the bucket to which the multipart upload was initiated.
    pub bucket: BucketName,
    pub delimiter: Delimiter,
    /// When a list is truncated, this element specifies the value that should be used
    /// for the upload-id-marker request parameter in a subsequent request.
    pub next_upload_id_marker: NextUploadIdMarker,
    /// When a prefix is provided in the request, this field contains the specified
    /// prefix. The result contains only keys starting with the specified prefix.
    pub prefix: Prefix,
    pub uploads: MultipartUploadList,
    /// The key at or after which the listing began.
    pub key_marker: KeyMarker,
    /// Maximum number of multipart uploads that could have been included in the
    /// response.
    pub max_uploads: MaxUploads,
    /// Encoding type used by Amazon S3 to encode object keys in the response.
    pub encoding_type: EncodingType,
    /// Indicates whether the returned list of multipart uploads is truncated. A value
    /// of true indicates that the list was truncated. The list can be truncated if
    /// the number of multipart uploads exceeds the limit allowed or specified by max
    /// uploads.
    pub is_truncated: IsTruncated,
}

#[derive(Debug, Default)]
pub struct CreateMultipartUploadOutput {
    /// If server-side encryption with a customer-provided encryption key was
    /// requested, the response will include this header confirming the encryption
    /// algorithm used.
    pub sse_customer_algorithm: SSECustomerAlgorithm,
    pub request_charged: RequestCharged,
    /// Name of the bucket to which the multipart upload was initiated.
    pub bucket: BucketName,
    /// ID for the initiated multipart upload.
    pub upload_id: MultipartUploadId,
    /// Object key for which the multipart upload was initiated.
    pub key: ObjectKey,
    /// The Server-side encryption algorithm used when storing this object in S3
    /// (e.g., AES256, aws:kms).
    pub server_side_encryption: ServerSideEncryption,
    /// If server-side encryption with a customer-provided encryption key was
    /// requested, the response will include this header to provide round trip message
    /// integrity verification of the customer-provided encryption key.
    pub sse_customer_key_md5: SSECustomerKeyMD5,
    /// If present, specifies the ID of the AWS Key Management Service (KMS) master
    /// encryption key that was used for the object.
    pub ssekms_key_id: SSEKMSKeyId,
}

#[derive(Debug, Default)]
pub struct CompleteMultipartUploadOutput {
    pub request_charged: RequestCharged,
    pub bucket: BucketName,
    /// Version of the object.
    pub version_id: ObjectVersionId,
    /// Entity tag of the object.
    pub e_tag: ETag,
    pub location: Location,
    pub key: ObjectKey,
    /// The Server-side encryption algorithm used when storing this object in S3
    /// (e.g., AES256, aws:kms).
    pub server_side_encryption: ServerSideEncryption,
    /// If present, specifies the ID of the AWS Key Management Service (KMS) master
    /// encryption key that was used for the object.
    pub ssekms_key_id: SSEKMSKeyId,
    /// If the object expiration is configured, this will contain the expiration date
    /// (expiry-date) and rule ID (rule-id). The value of rule-id is URL encoded.
    pub expiration: Expiration,
}

/// Specifies when noncurrent object versions expire. Upon expiration, Amazon S3
/// permanently deletes the noncurrent object versions. You set this lifecycle
/// configuration action on a bucket that has versioning enabled (or suspended) to
/// request that Amazon S3 delete noncurrent object versions at a specific period
/// in the object's lifetime.
#[derive(Debug, Default)]
pub struct NoncurrentVersionExpiration {
    /// Specifies the number of days an object is noncurrent before Amazon S3 can
    /// perform the associated action. For information about the noncurrent days
    /// calculations, see [How Amazon S3 Calculates When an Object Became
    /// Noncurrent](/AmazonS3/latest/dev/s3-access-control.html) in the Amazon Simple
    /// Storage Service Developer Guide.
    pub noncurrent_days: Days,
}

#[derive(Debug, Default)]
pub struct ReplicationRule {
    /// The rule is ignored if status is not Enabled.
    pub status: ReplicationRuleStatus,
    /// Object keyname prefix identifying one or more objects to which the rule
    /// applies. Maximum prefix length can be up to 1,024 characters. Overlapping
    /// prefixes are not supported.
    pub prefix: Prefix,
    pub destination: Destination,
    /// Unique identifier for the rule. The value cannot be longer than 255
    /// characters.
    pub id: Option<ID>,
}

#[derive(Debug, Default)]
pub struct PutObjectAclRequest {
    /// Allows grantee the read, write, read ACP, and write ACP permissions on the
    /// bucket.
    pub grant_full_control: Option<GrantFullControl>,
    /// Allows grantee to write the ACL for the applicable bucket.
    pub grant_write_acp: Option<GrantWriteACP>,
    pub key: ObjectKey,
    pub request_payer: Option<RequestPayer>,
    pub content_md5: Option<ContentMD5>,
    pub bucket: BucketName,
    /// The canned ACL to apply to the object.
    pub acl: Option<CannedAcl>,
    pub access_control_policy: Option<AccessControlPolicy>,
    /// Allows grantee to create, overwrite, and delete any object in the bucket.
    pub grant_write: Option<GrantWrite>,
    /// Allows grantee to list the objects in the bucket.
    pub grant_read: Option<GrantRead>,
    /// Allows grantee to read the bucket ACL.
    pub grant_read_acp: Option<GrantReadACP>,
}

#[derive(Debug, Default)]
pub struct ListObjectsOutput {
    pub name: BucketName,
    /// When response is truncated (the IsTruncated element value in the response is
    /// true), you can use the key name in this field as marker in the subsequent
    /// request to get next set of objects. Amazon S3 lists objects in alphabetical
    /// order Note: This element is returned only if you have delimiter request
    /// parameter specified. If response does not include the NextMaker and it is
    /// truncated, you can use the value of the last Key in the response as the marker
    /// in the subsequent request to get the next set of object keys.
    pub next_marker: NextMarker,
    pub delimiter: Delimiter,
    pub max_keys: MaxKeys,
    pub prefix: Prefix,
    pub marker: Marker,
    /// Encoding type used by Amazon S3 to encode object keys in the response.
    pub encoding_type: EncodingType,
    /// A flag that indicates whether or not Amazon S3 returned all of the results
    /// that satisfied the search criteria.
    pub is_truncated: IsTruncated,
    pub contents: ObjectList,
    pub common_prefixes: CommonPrefixList,
}

#[derive(Debug, Default)]
pub struct ListObjectVersionsRequest {
    pub bucket: BucketName,
    /// Limits the response to keys that begin with the specified prefix.
    pub prefix: Option<Prefix>,
    /// Sets the maximum number of keys returned in the response. The response might
    /// contain fewer keys but will never contain more.
    pub max_keys: Option<MaxKeys>,
    /// A delimiter is a character you use to group keys.
    pub delimiter: Option<Delimiter>,
    /// Specifies the key to start with when listing objects in a bucket.
    pub key_marker: Option<KeyMarker>,
    pub encoding_type: Option<EncodingType>,
    /// Specifies the object version you want to start listing from.
    pub version_id_marker: Option<VersionIdMarker>,
}

// New way
#[derive(Debug, Default)]
pub struct ListVersionsResult {
    pub name: BucketName,
    pub prefix: Prefix,
    /// Marks the last Key returned in a truncated response.
    pub key_marker: KeyMarker,
    pub delete_markers: DeleteMarkers,
    pub max_keys: MaxKeys,
    /// A flag that indicates whether or not Amazon S3 returned all of the results
    /// that satisfied the search criteria. If your results were truncated, you can
    /// make a follow-up paginated request using the NextKeyMarker and
    /// NextVersionIdMarker response parameters as a starting place in another request
    /// to return the rest of the results.
    pub is_truncated: IsTruncated,
    pub versions: ObjectVersionList,
    /// Use this value for the key marker request parameter in a subsequent request.
    pub next_key_marker: NextKeyMarker,
    pub delimiter: Delimiter,
    /// Use this value for the next version id marker parameter in a subsequent
    /// request.
    pub next_version_id_marker: NextVersionIdMarker,
    /// Encoding type used by Amazon S3 to encode object keys in the response.
    pub encoding_type: EncodingType,
    pub version_id_marker: VersionIdMarker,
    pub common_prefixes: CommonPrefixList,
}

//OLD Way - begin
pub type ObjectVersionList = Vec<ObjectVersion>;

#[derive(Debug, Default)]
pub struct ListObjectVersionsOutput {
    pub name: BucketName,
    pub versions: ObjectVersionList,
    pub delete_markers: DeleteMarkers,
    /// Use this value for the key marker request parameter in a subsequent request.
    pub next_key_marker: NextKeyMarker,
    pub delimiter: Delimiter,
    pub max_keys: MaxKeys,
    pub prefix: Prefix,
    /// Marks the last Key returned in a truncated response.
    pub key_marker: KeyMarker,
    /// Use this value for the next version id marker parameter in a subsequent
    /// request.
    pub next_version_id_marker: NextVersionIdMarker,
    /// Encoding type used by Amazon S3 to encode object keys in the response.
    pub encoding_type: EncodingType,
    /// A flag that indicates whether or not Amazon S3 returned all of the results
    /// that satisfied the search criteria. If your results were truncated, you can
    /// make a follow-up paginated request using the NextKeyMarker and
    /// NextVersionIdMarker response parameters as a starting place in another request
    /// to return the rest of the results.
    pub is_truncated: IsTruncated,
    pub version_id_marker: VersionIdMarker,
    pub common_prefixes: CommonPrefixList,
}
//OLD Way - end

#[derive(Debug, Default)]
pub struct DeleteMarkerEntry {
    pub owner: Owner,
    /// Specifies whether the object is (true) or is not (false) the latest version of
    /// an object.
    pub is_latest: IsLatest,
    /// Version ID of an object.
    pub version_id: ObjectVersionId,
    /// The object key.
    pub key: ObjectKey,
    /// Date and time the object was last modified.
    pub last_modified: LastModified,
}

#[derive(Debug, Default)]
pub struct HeadObjectOutput {
    /// Last modified date of the object
    pub last_modified: LastModified,
    pub request_charged: RequestCharged,
    /// Specifies what content encodings have been applied to the object and thus what
    /// decoding mechanisms must be applied to obtain the media-type referenced by the
    /// Content-Type header field.
    pub content_encoding: ContentEncoding,
    pub replication_status: ReplicationStatus,
    pub storage_class: StorageClass,
    /// The Server-side encryption algorithm used when storing this object in S3
    /// (e.g., AES256, aws:kms).
    pub server_side_encryption: ServerSideEncryption,
    /// If present, specifies the ID of the AWS Key Management Service (KMS) master
    /// encryption key that was used for the object.
    pub ssekms_key_id: SSEKMSKeyId,
    /// Specifies presentational information for the object.
    pub content_disposition: ContentDisposition,
    /// A map of metadata to store with the object in S3.
    pub metadata: Metadata,
    pub accept_ranges: AcceptRanges,
    /// If the bucket is configured as a website, redirects requests for this object
    /// to another object in the same bucket or to an external URL. Amazon S3 stores
    /// the value of this header in the object metadata.
    pub website_redirect_location: WebsiteRedirectLocation,
    /// The date and time at which the object is no longer cacheable.
    pub expires: Expires,
    /// Specifies whether the object retrieved was (true) or was not (false) a Delete
    /// Marker. If false, this response header does not appear in the response.
    pub delete_marker: DeleteMarker,
    /// Specifies caching behavior along the request/reply chain.
    pub cache_control: CacheControl,
    /// Size of the body in bytes.
    pub content_length: ContentLength,
    /// If the object expiration is configured (see PUT Bucket lifecycle), the
    /// response includes this header. It includes the expiry-date and rule-id key
    /// value pairs providing object expiration information. The value of the rule-id
    /// is URL encoded.
    pub expiration: Expiration,
    /// This is set to the number of metadata entries not returned in x-amz-meta
    /// headers. This can happen if you create metadata using an API like SOAP that
    /// supports more flexible metadata than the REST API. For example, using SOAP,
    /// you can create metadata whose values are not legal HTTP headers.
    pub missing_meta: MissingMeta,
    /// Provides information about object restoration operation and expiration time of
    /// the restored object copy.
    pub restore: Restore,
    /// If server-side encryption with a customer-provided encryption key was
    /// requested, the response will include this header confirming the encryption
    /// algorithm used.
    pub sse_customer_algorithm: SSECustomerAlgorithm,
    /// A standard MIME type describing the format of the object data.
    pub content_type: ContentType,
    /// The language the content is in.
    pub content_language: ContentLanguage,
    /// Version of the object.
    pub version_id: ObjectVersionId,
    /// An ETag is an opaque identifier assigned by a web server to a specific version
    /// of a resource found at a URL
    pub e_tag: ETag,
    /// If server-side encryption with a customer-provided encryption key was
    /// requested, the response will include this header to provide round trip message
    /// integrity verification of the customer-provided encryption key.
    pub sse_customer_key_md5: SSECustomerKeyMD5,
}

#[derive(Debug, Default)]
pub struct ListObjectsRequest {
    pub bucket: BucketName,
    /// Limits the response to keys that begin with the specified prefix.
    pub prefix: Option<Prefix>,
    /// Sets the maximum number of keys returned in the response. The response might
    /// contain fewer keys but will never contain more.
    pub max_keys: Option<MaxKeys>,
    /// A delimiter is a character you use to group keys.
    pub delimiter: Option<Delimiter>,
    /// Specifies the key to start with when listing objects in a bucket.
    pub marker: Option<Marker>,
    pub encoding_type: Option<EncodingType>,
}

#[derive(Debug, Default)]
pub struct CopyObjectOutput {
    /// If server-side encryption with a customer-provided encryption key was
    /// requested, the response will include this header confirming the encryption
    /// algorithm used.
    pub sse_customer_algorithm: SSECustomerAlgorithm,
    pub copy_source_version_id: CopySourceVersionId,
    /// The Server-side encryption algorithm used when storing this object in S3
    /// (e.g., AES256, aws:kms).
    pub server_side_encryption: ServerSideEncryption,
    pub request_charged: RequestCharged,
    /// If the object expiration is configured, the response includes this header.
    pub expiration: Expiration,
    /// If server-side encryption with a customer-provided encryption key was
    /// requested, the response will include this header to provide round trip message
    /// integrity verification of the customer-provided encryption key.
    pub sse_customer_key_md5: SSECustomerKeyMD5,
    pub copy_object_result: CopyObjectResult,
    /// If present, specifies the ID of the AWS Key Management Service (KMS) master
    /// encryption key that was used for the object.
    pub ssekms_key_id: SSEKMSKeyId,
}

#[derive(Debug, Default)]
pub struct CopyObjectRequest {
    pub request_payer: Option<RequestPayer>,
    /// Copies the object if it has been modified since the specified time.
    pub copy_source_if_modified_since: Option<CopySourceIfModifiedSince>,
    /// Copies the object if it hasn't been modified since the specified time.
    pub copy_source_if_unmodified_since: Option<CopySourceIfUnmodifiedSince>,
    /// Specifies what content encodings have been applied to the object and thus what
    /// decoding mechanisms must be applied to obtain the media-type referenced by the
    /// Content-Type header field.
    pub content_encoding: Option<ContentEncoding>,
    /// Specifies the customer-provided encryption key for Amazon S3 to use to decrypt
    /// the source object. The encryption key provided in this header must be one that
    /// was used when the source object was created.
    pub copy_source_sse_customer_key: Option<CopySourceSSECustomerKey>,
    /// The type of storage to use for the object. Defaults to 'STANDARD'.
    pub storage_class: Option<StorageClass>,
    /// Allows grantee to read the object ACL.
    pub grant_read_acp: Option<GrantReadACP>,
    /// The Server-side encryption algorithm used when storing this object in S3
    /// (e.g., AES256, aws:kms).
    pub server_side_encryption: Option<ServerSideEncryption>,
    /// Specifies the AWS KMS key ID to use for object encryption. All GET and PUT
    /// requests for an object protected by AWS KMS will fail if not made via SSL or
    /// using SigV4. Documentation on configuring any of the officially supported AWS
    /// SDKs and CLI can be found at
    /// http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-
    /// signature-version
    pub ssekms_key_id: Option<SSEKMSKeyId>,
    /// Specifies presentational information for the object.
    pub content_disposition: Option<ContentDisposition>,
    /// A map of metadata to store with the object in S3.
    pub metadata: Option<Metadata>,
    /// Specifies the customer-provided encryption key for Amazon S3 to use in
    /// encrypting data. This value is used to store the object and then it is
    /// discarded; Amazon does not store the encryption key. The key must be
    /// appropriate for use with the algorithm specified in the x-amz-server-side-
    /// encryption-customer-algorithm header.
    pub sse_customer_key: Option<SSECustomerKey>,
    /// If the bucket is configured as a website, redirects requests for this object
    /// to another object in the same bucket or to an external URL. Amazon S3 stores
    /// the value of this header in the object metadata.
    pub website_redirect_location: Option<WebsiteRedirectLocation>,
    /// The name of the source bucket and key name of the source object, separated by
    /// a slash (/). Must be URL-encoded.
    pub copy_source: CopySource,
    /// The date and time at which the object is no longer cacheable.
    pub expires: Option<Expires>,
    pub key: ObjectKey,
    /// Specifies caching behavior along the request/reply chain.
    pub cache_control: Option<CacheControl>,
    /// Specifies the algorithm to use when decrypting the source object (e.g.,
    /// AES256).
    pub copy_source_sse_customer_algorithm: Option<CopySourceSSECustomerAlgorithm>,
    pub bucket: BucketName,
    /// Allows grantee to read the object data and its metadata.
    pub grant_read: Option<GrantRead>,
    /// Allows grantee to write the ACL for the applicable object.
    pub grant_write_acp: Option<GrantWriteACP>,
    /// Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321.
    /// Amazon S3 uses this header for a message integrity check to ensure the
    /// encryption key was transmitted without error.
    pub copy_source_sse_customer_key_md5: Option<CopySourceSSECustomerKeyMD5>,
    /// The canned ACL to apply to the object.
    pub acl: Option<CannedAcl>,
    /// Gives the grantee READ, READ_ACP, and WRITE_ACP permissions on the object.
    pub grant_full_control: Option<GrantFullControl>,
    /// Copies the object if its entity tag (ETag) matches the specified tag.
    pub copy_source_if_match: Option<CopySourceIfMatch>,
    /// Specifies the algorithm to use to when encrypting the object (e.g., AES256).
    pub sse_customer_algorithm: Option<SSECustomerAlgorithm>,
    /// A standard MIME type describing the format of the object data.
    pub content_type: Option<ContentType>,
    /// The language the content is in.
    pub content_language: Option<ContentLanguage>,
    /// Specifies whether the metadata is copied from the source object or replaced
    /// with metadata provided in the request.
    pub metadata_directive: Option<MetadataDirective>,
    /// Copies the object if its entity tag (ETag) is different than the specified
    /// ETag.
    pub copy_source_if_none_match: Option<CopySourceIfNoneMatch>,
    /// Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321.
    /// Amazon S3 uses this header for a message integrity check to ensure the
    /// encryption key was transmitted without error.
    pub sse_customer_key_md5: Option<SSECustomerKeyMD5>,
}

#[derive(Debug, Default)]
pub struct DeleteObjectsRequest {
    /// The concatenation of the authentication device's serial number, a space, and
    /// the value that is displayed on your authentication device.
    pub mfa: Option<MFA>,
    pub bucket: BucketName,
    pub request_payer: Option<RequestPayer>,
    pub delete: Delete,
}

#[derive(Debug, Default)]
pub struct MultipartUpload {
    /// Identifies who initiated the multipart upload.
    pub initiator: Initiator,
    /// Date and time at which the multipart upload was initiated.
    pub initiated: Initiated,
    /// Upload ID that identifies the multipart upload.
    pub upload_id: MultipartUploadId,
    /// The class of storage used to store the object.
    pub storage_class: StorageClass,
    /// Key of the object for which the multipart upload was initiated.
    pub key: ObjectKey,
    pub owner: Owner,
}

impl TagParser {
    pub fn parse_xml<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<Tag, XmlParseError> {
        try!(start_element(tag_name, stack));
        let mut obj = Tag::default();
        loop {
            let current_name = try!(peek_at_name(stack));
            if current_name == "Value" {
                obj.value = try!(ValueParser::parse_xml("Value", stack));
                continue;
            }
            if current_name == "Key" {
                obj.key = try!(ObjectKeyParser::parse_xml("Key", stack));
                continue;
            }
            break;
        }
        try!(end_element(tag_name, stack));
        Ok(obj)
    }
}

impl TagWriter {
    pub fn write_params(params: &mut Params, name: &str, obj: &Tag) {
        let mut prefix = name.to_string();
        if prefix != "" { prefix.push_str("."); }
        ValueWriter::write_params(params, &(prefix.to_string() + "Value"), &obj.value);
        ObjectKeyWriter::write_params(params, &(prefix.to_string() + "Key"), &obj.key);
    }
}

impl TagSetParser {
    pub fn parse_xml<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<TagSet, XmlParseError> {
        let mut obj = Vec::new();
        while try!(peek_at_name(stack)) == "Tag" {
            obj.push(try!(TagParser::parse_xml("Tag", stack)));
        }
        Ok(obj)
    }
}

impl TagSetWriter {
    pub fn write_params(params: &mut Params, name: &str, obj: &TagSet) {
        let mut index = 1;
        for element in obj.iter() {
            let key = &format!("{}.{}", name, index);
            TagWriter::write_params(params, key, element);
            index += 1;
        }
    }
}

impl PartNumberParser {
    pub fn parse_xml<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<PartNumber, XmlParseError> {
        try!(start_element(tag_name, stack));
        let obj = i32::from_str(try!(characters(stack)).as_ref()).unwrap();
        try!(end_element(tag_name, stack));
        Ok(obj)
    }
}

impl PartNumberWriter {
    pub fn write_params(params: &mut Params, name: &str, obj: &PartNumber) {
        params.put(name, &obj.to_string());
    }
}

impl PartParser {
    pub fn parse_xml<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<Part, XmlParseError> {
        try!(start_element(tag_name, stack));
        let mut obj = Part::default();
        loop {
            let current_name = try!(peek_at_name(stack));
            if current_name == "LastModified" {
                obj.last_modified = try!(LastModifiedParser::parse_xml("LastModified", stack));
                continue;
            }
            if current_name == "PartNumber" {
                obj.part_number = try!(PartNumberParser::parse_xml("PartNumber", stack));
                continue;
            }
            if current_name == "ETag" {
                obj.e_tag = try!(ETagParser::parse_xml("ETag", stack));
                continue;
            }
            if current_name == "Size" {
                obj.size = try!(SizeParser::parse_xml("Size", stack));
                continue;
            }
            break;
        }
        try!(end_element(tag_name, stack));
        Ok(obj)
    }
}

impl PartWriter {
    pub fn write_params(params: &mut Params, name: &str, obj: &Part) {
        let mut prefix = name.to_string();
        if prefix != "" { prefix.push_str("."); }
        LastModifiedWriter::write_params(params, &(prefix.to_string() + "LastModified"), &obj.last_modified);
        PartNumberWriter::write_params(params, &(prefix.to_string() + "PartNumber"), &obj.part_number);
        ETagWriter::write_params(params, &(prefix.to_string() + "ETag"), &obj.e_tag);
        SizeWriter::write_params(params, &(prefix.to_string() + "Size"), &obj.size);
    }
}

impl MultipartUploadParser {
    pub fn parse_xml<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<MultipartUpload, XmlParseError> {
        try!(start_element(tag_name, stack));
        let mut obj = MultipartUpload::default();
        loop {
            let current_name = try!(peek_at_name(stack));
            if current_name == "Initiator" {
                obj.initiator = try!(InitiatorParser::parse_xml("Initiator", stack));
                continue;
            }
            if current_name == "Initiated" {
                obj.initiated = try!(InitiatedParser::parse_xml("Initiated", stack));
                continue;
            }
            if current_name == "UploadId" {
                obj.upload_id = try!(MultipartUploadIdParser::parse_xml("UploadId", stack));
                continue;
            }
            if current_name == "StorageClass" {
                obj.storage_class = try!(StorageClassParser::parse_xml("StorageClass", stack));
                continue;
            }
            if current_name == "Key" {
                obj.key = try!(ObjectKeyParser::parse_xml("Key", stack));
                continue;
            }
            if current_name == "Owner" {
                obj.owner = try!(OwnerParser::parse_xml("Owner", stack));
                continue;
            }
            break;
        }
        try!(end_element(tag_name, stack));
        Ok(obj)
    }
}

impl MultipartUploadWriter {
    pub fn write_params(params: &mut Params, name: &str, obj: &MultipartUpload) {
        let mut prefix = name.to_string();
        if prefix != "" { prefix.push_str("."); }
        InitiatorWriter::write_params(params, &(prefix.to_string() + "Initiator"), &obj.initiator);
        InitiatedWriter::write_params(params, &(prefix.to_string() + "Initiated"), &obj.initiated);
        MultipartUploadIdWriter::write_params(params, &(prefix.to_string() + "UploadId"), &obj.upload_id);
        StorageClassWriter::write_params(params, &(prefix.to_string() + "StorageClass"), &obj.storage_class);
        ObjectKeyWriter::write_params(params, &(prefix.to_string() + "Key"), &obj.key);
        OwnerWriter::write_params(params, &(prefix.to_string() + "Owner"), &obj.owner);
    }
}

impl UploadIdMarkerParser {
    pub fn parse_xml<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<UploadIdMarker, XmlParseError> {
        try!(start_element(tag_name, stack));
        let mut obj = UploadIdMarker::default();

        match characters(stack) {
            Err(why) => return Ok(obj),
            Ok(chars) => obj = chars,
        }

        try!(end_element(tag_name, stack));
        Ok(obj)
    }
}

impl UploadIdMarkerWriter {
    pub fn write_params(params: &mut Params, name: &str, obj: &UploadIdMarker) {
        params.put(name, obj);
    }
}

impl NextUploadIdMarkerParser {
    pub fn parse_xml<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<NextUploadIdMarker, XmlParseError> {
        try!(start_element(tag_name, stack));

        let mut obj = NextUploadIdMarker::default();

        match characters(stack) {
            Err(why) => return Ok(obj),
            Ok(chars) => obj = chars,
        }

        try!(end_element(tag_name, stack));
        Ok(obj)
    }
}

impl NextUploadIdMarkerWriter {
    pub fn write_params(params: &mut Params, name: &str, obj: &NextUploadIdMarker) {
        params.put(name, obj);
    }
}

impl MultipartUploadListParser {
    pub fn parse_xml<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<MultipartUploadList, XmlParseError> {
        let mut obj = Vec::new();
        while try!(peek_at_name(stack)) == "MultipartUpload" {
            obj.push(try!(MultipartUploadParser::parse_xml("MultipartUpload", stack)));
        }
        Ok(obj)
    }
}

impl MultipartUploadListWriter {
    pub fn write_params(params: &mut Params, name: &str, obj: &MultipartUploadList) {
        let mut index = 1;
        for element in obj.iter() {
            let key = &format!("{}.{}", name, index);
            MultipartUploadWriter::write_params(params, key, element);
            index += 1;
        }
    }
}

impl ListMultipartUploadsOutputParser {
    pub fn parse_xml<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<ListMultipartUploadsOutput, XmlParseError> {
        try!(start_element(tag_name, stack));
        let mut obj = ListMultipartUploadsOutput::default();
        loop {
            let current_name = try!(peek_at_name(stack));
            if current_name == "UploadIdMarker" {
                obj.upload_id_marker = try!(UploadIdMarkerParser::parse_xml("UploadIdMarker", stack));
                continue;
            }
            if current_name == "CommonPrefix" {
                obj.common_prefixes = try!(CommonPrefixListParser::parse_xml("CommonPrefix", stack));
                continue;
            }
            if current_name == "NextKeyMarker" {
                obj.next_key_marker = try!(NextKeyMarkerParser::parse_xml("NextKeyMarker", stack));
                continue;
            }
            if current_name == "Bucket" {
                obj.bucket = try!(BucketNameParser::parse_xml("Bucket", stack));
                continue;
            }
            if current_name == "Delimiter" {
                obj.delimiter = try!(DelimiterParser::parse_xml("Delimiter", stack));
                continue;
            }
            if current_name == "NextUploadIdMarker" {
                obj.next_upload_id_marker = try!(NextUploadIdMarkerParser::parse_xml("NextUploadIdMarker", stack));
                continue;
            }
            if current_name == "Prefix" {
                obj.prefix = try!(PrefixParser::parse_xml("Prefix", stack));
                continue;
            }
            if current_name == "MultipartUpload" {
                obj.uploads = try!(MultipartUploadListParser::parse_xml("MultipartUpload", stack));
                continue;
            }
            if current_name == "KeyMarker" {
                obj.key_marker = try!(KeyMarkerParser::parse_xml("KeyMarker", stack));
                continue;
            }
            if current_name == "MaxUploads" {
                obj.max_uploads = try!(MaxUploadsParser::parse_xml("MaxUploads", stack));
                continue;
            }
            if current_name == "EncodingType" {
                obj.encoding_type = try!(EncodingTypeParser::parse_xml("EncodingType", stack));
                continue;
            }
            if current_name == "IsTruncated" {
                obj.is_truncated = try!(IsTruncatedParser::parse_xml("IsTruncated", stack));
                continue;
            }
            if current_name == "Upload" {
                obj.uploads.push(try!(MultipartUploadParser::parse_xml("Upload", stack)));
                continue;
            }
            break;
        }
        try!(end_element(tag_name, stack));
        Ok(obj)
    }
}

impl ListMultipartUploadsOutputWriter {
    pub fn write_params(params: &mut Params, name: &str, obj: &ListMultipartUploadsOutput) {
        let mut prefix = name.to_string();
        if prefix != "" { prefix.push_str("."); }
        UploadIdMarkerWriter::write_params(params, &(prefix.to_string() + "UploadIdMarker"), &obj.upload_id_marker);
        CommonPrefixListWriter::write_params(params, &(prefix.to_string() + "CommonPrefix"), &obj.common_prefixes);
        NextKeyMarkerWriter::write_params(params, &(prefix.to_string() + "NextKeyMarker"), &obj.next_key_marker);
        BucketNameWriter::write_params(params, &(prefix.to_string() + "Bucket"), &obj.bucket);
        DelimiterWriter::write_params(params, &(prefix.to_string() + "Delimiter"), &obj.delimiter);
        NextUploadIdMarkerWriter::write_params(params, &(prefix.to_string() + "NextUploadIdMarker"), &obj.next_upload_id_marker);
        PrefixWriter::write_params(params, &(prefix.to_string() + "Prefix"), &obj.prefix);
        MultipartUploadListWriter::write_params(params, &(prefix.to_string() + "MultipartUpload"), &obj.uploads);
        KeyMarkerWriter::write_params(params, &(prefix.to_string() + "KeyMarker"), &obj.key_marker);
        MaxUploadsWriter::write_params(params, &(prefix.to_string() + "MaxUploads"), &obj.max_uploads);
        EncodingTypeWriter::write_params(params, &(prefix.to_string() + "EncodingType"), &obj.encoding_type);
        IsTruncatedWriter::write_params(params, &(prefix.to_string() + "IsTruncated"), &obj.is_truncated);
    }
}

impl CompleteMultipartUploadOutputParser {
    pub fn parse_xml<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<CompleteMultipartUploadOutput, XmlParseError> {
        try!(start_element(tag_name, stack));
        let mut obj = CompleteMultipartUploadOutput::default();
        loop {
            let current_name = try!(peek_at_name(stack));
            if current_name == "x-amz-request-charged" {
                obj.request_charged = try!(RequestChargedParser::parse_xml("x-amz-request-charged", stack));
                continue;
            }
            if current_name == "Bucket" {
                obj.bucket = try!(BucketNameParser::parse_xml("Bucket", stack));
                continue;
            }
            if current_name == "x-amz-version-id" {
                obj.version_id = try!(ObjectVersionIdParser::parse_xml("x-amz-version-id", stack));
                continue;
            }
            if current_name == "ETag" {
                obj.e_tag = try!(ETagParser::parse_xml("ETag", stack));
                continue;
            }
            if current_name == "Location" {
                obj.location = try!(LocationParser::parse_xml("Location", stack));
                continue;
            }
            if current_name == "Key" {
                obj.key = try!(ObjectKeyParser::parse_xml("Key", stack));
                continue;
            }
            if current_name == "x-amz-server-side-encryption" {
                obj.server_side_encryption = try!(ServerSideEncryptionParser::parse_xml("x-amz-server-side-encryption", stack));
                continue;
            }
            if current_name == "x-amz-server-side-encryption-aws-kms-key-id" {
                obj.ssekms_key_id = try!(SSEKMSKeyIdParser::parse_xml("x-amz-server-side-encryption-aws-kms-key-id", stack));
                continue;
            }
            if current_name == "x-amz-expiration" {
                obj.expiration = try!(ExpirationParser::parse_xml("x-amz-expiration", stack));
                continue;
            }
            break;
        }
        try!(end_element(tag_name, stack));
        Ok(obj)
    }
}

impl CompleteMultipartUploadOutputWriter {
    pub fn write_params(params: &mut Params, name: &str, obj: &CompleteMultipartUploadOutput) {
        let mut prefix = name.to_string();
        if prefix != "" { prefix.push_str("."); }
        RequestChargedWriter::write_params(params, &(prefix.to_string() + "x-amz-request-charged"), &obj.request_charged);
        BucketNameWriter::write_params(params, &(prefix.to_string() + "Bucket"), &obj.bucket);
        ObjectVersionIdWriter::write_params(params, &(prefix.to_string() + "x-amz-version-id"), &obj.version_id);
        ETagWriter::write_params(params, &(prefix.to_string() + "ETag"), &obj.e_tag);
        LocationWriter::write_params(params, &(prefix.to_string() + "Location"), &obj.location);
        ObjectKeyWriter::write_params(params, &(prefix.to_string() + "Key"), &obj.key);
        ServerSideEncryptionWriter::write_params(params, &(prefix.to_string() + "x-amz-server-side-encryption"), &obj.server_side_encryption);
        SSEKMSKeyIdWriter::write_params(params, &(prefix.to_string() + "x-amz-server-side-encryption-aws-kms-key-id"), &obj.ssekms_key_id);
        ExpirationWriter::write_params(params, &(prefix.to_string() + "x-amz-expiration"), &obj.expiration);
    }
}

impl GetObjectRequestParser {
    pub fn parse_xml<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<GetObjectRequest, XmlParseError> {
        try!(start_element(tag_name, stack));
        let mut obj = GetObjectRequest::default();
        loop {
            let current_name = try!(peek_at_name(stack));
            if current_name == "response-content-encoding" {
                obj.response_content_encoding = Some(try!(ResponseContentEncodingParser::parse_xml("response-content-encoding", stack)));
                continue;
            }
            if current_name == "response-content-language" {
                obj.response_content_language = Some(try!(ResponseContentLanguageParser::parse_xml("response-content-language", stack)));
                continue;
            }
            if current_name == "x-amz-server-side-encryption-customer-algorithm" {
                obj.sse_customer_algorithm = Some(try!(SSECustomerAlgorithmParser::parse_xml("x-amz-server-side-encryption-customer-algorithm", stack)));
                continue;
            }
            if current_name == "response-content-type" {
                obj.response_content_type = Some(try!(ResponseContentTypeParser::parse_xml("response-content-type", stack)));
                continue;
            }
            if current_name == "If-Unmodified-Since" {
                obj.if_unmodified_since = Some(try!(IfUnmodifiedSinceParser::parse_xml("If-Unmodified-Since", stack)));
                continue;
            }
            if current_name == "versionId" {
                obj.version_id = Some(try!(ObjectVersionIdParser::parse_xml("versionId", stack)));
                continue;
            }
            if current_name == "x-amz-request-payer" {
                obj.request_payer = Some(try!(RequestPayerParser::parse_xml("x-amz-request-payer", stack)));
                continue;
            }
            if current_name == "response-cache-control" {
                obj.response_cache_control = Some(try!(ResponseCacheControlParser::parse_xml("response-cache-control", stack)));
                continue;
            }
            if current_name == "x-amz-server-side-encryption-customer-key" {
                obj.sse_customer_key = Some(try!(SSECustomerKeyParser::parse_xml("x-amz-server-side-encryption-customer-key", stack)));
                continue;
            }
            if current_name == "Bucket" {
                obj.bucket = try!(BucketNameParser::parse_xml("Bucket", stack));
                continue;
            }
            if current_name == "If-None-Match" {
                obj.if_none_match = Some(try!(IfNoneMatchParser::parse_xml("If-None-Match", stack)));
                continue;
            }
            if current_name == "response-content-disposition" {
                obj.response_content_disposition = Some(try!(ResponseContentDispositionParser::parse_xml("response-content-disposition", stack)));
                continue;
            }
            if current_name == "Range" {
                obj.range = Some(try!(RangeParser::parse_xml("Range", stack)));
                continue;
            }
            if current_name == "Key" {
                obj.key = try!(ObjectKeyParser::parse_xml("Key", stack));
                continue;
            }
            if current_name == "If-Match" {
                obj.if_match = Some(try!(IfMatchParser::parse_xml("If-Match", stack)));
                continue;
            }
            if current_name == "response-expires" {
                obj.response_expires = Some(try!(ResponseExpiresParser::parse_xml("response-expires", stack)));
                continue;
            }
            if current_name == "If-Modified-Since" {
                obj.if_modified_since = Some(try!(IfModifiedSinceParser::parse_xml("If-Modified-Since", stack)));
                continue;
            }
            if current_name == "x-amz-server-side-encryption-customer-key-MD5" {
                obj.sse_customer_key_md5 = Some(try!(SSECustomerKeyMD5Parser::parse_xml("x-amz-server-side-encryption-customer-key-MD5", stack)));
                continue;
            }
            break;
        }
        try!(end_element(tag_name, stack));
        Ok(obj)
    }
}

impl GetObjectRequestWriter {
    pub fn write_params(params: &mut Params, name: &str, obj: &GetObjectRequest) {
        let mut prefix = name.to_string();
        if prefix != "" { prefix.push_str("."); }
        if let Some(ref obj) = obj.response_content_encoding {
            ResponseContentEncodingWriter::write_params(params, &(prefix.to_string() + "response-content-encoding"), obj);
        }
        if let Some(ref obj) = obj.response_content_language {
            ResponseContentLanguageWriter::write_params(params, &(prefix.to_string() + "response-content-language"), obj);
        }
        if let Some(ref obj) = obj.sse_customer_algorithm {
            SSECustomerAlgorithmWriter::write_params(params, &(prefix.to_string() + "x-amz-server-side-encryption-customer-algorithm"), obj);
        }
        if let Some(ref obj) = obj.response_content_type {
            ResponseContentTypeWriter::write_params(params, &(prefix.to_string() + "response-content-type"), obj);
        }
        if let Some(ref obj) = obj.if_unmodified_since {
            IfUnmodifiedSinceWriter::write_params(params, &(prefix.to_string() + "If-Unmodified-Since"), obj);
        }
        if let Some(ref obj) = obj.version_id {
            ObjectVersionIdWriter::write_params(params, &(prefix.to_string() + "versionId"), obj);
        }
        if let Some(ref obj) = obj.request_payer {
            RequestPayerWriter::write_params(params, &(prefix.to_string() + "x-amz-request-payer"), obj);
        }
        if let Some(ref obj) = obj.response_cache_control {
            ResponseCacheControlWriter::write_params(params, &(prefix.to_string() + "response-cache-control"), obj);
        }
        if let Some(ref obj) = obj.sse_customer_key {
            SSECustomerKeyWriter::write_params(params, &(prefix.to_string() + "x-amz-server-side-encryption-customer-key"), obj);
        }
        BucketNameWriter::write_params(params, &(prefix.to_string() + "Bucket"), &obj.bucket);
        if let Some(ref obj) = obj.if_none_match {
            IfNoneMatchWriter::write_params(params, &(prefix.to_string() + "If-None-Match"), obj);
        }
        if let Some(ref obj) = obj.response_content_disposition {
            ResponseContentDispositionWriter::write_params(params, &(prefix.to_string() + "response-content-disposition"), obj);
        }
        if let Some(ref obj) = obj.range {
            RangeWriter::write_params(params, &(prefix.to_string() + "Range"), obj);
        }
        ObjectKeyWriter::write_params(params, &(prefix.to_string() + "Key"), &obj.key);
        if let Some(ref obj) = obj.if_match {
            IfMatchWriter::write_params(params, &(prefix.to_string() + "If-Match"), obj);
        }
        if let Some(ref obj) = obj.response_expires {
            ResponseExpiresWriter::write_params(params, &(prefix.to_string() + "response-expires"), obj);
        }
        if let Some(ref obj) = obj.if_modified_since {
            IfModifiedSinceWriter::write_params(params, &(prefix.to_string() + "If-Modified-Since"), obj);
        }
        if let Some(ref obj) = obj.sse_customer_key_md5 {
            SSECustomerKeyMD5Writer::write_params(params, &(prefix.to_string() + "x-amz-server-side-encryption-customer-key-MD5"), obj);
        }
    }
}

impl PutObjectOutputParser {
    pub fn parse_xml<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<PutObjectOutput, XmlParseError> {
        try!(start_element(tag_name, stack));
        let mut obj = PutObjectOutput::default();
        loop {
            let current_name = try!(peek_at_name(stack));
            if current_name == "x-amz-server-side-encryption-customer-algorithm" {
                obj.sse_customer_algorithm = try!(SSECustomerAlgorithmParser::parse_xml("x-amz-server-side-encryption-customer-algorithm", stack));
                continue;
            }
            if current_name == "x-amz-request-charged" {
                obj.request_charged = try!(RequestChargedParser::parse_xml("x-amz-request-charged", stack));
                continue;
            }
            if current_name == "x-amz-version-id" {
                obj.version_id = try!(ObjectVersionIdParser::parse_xml("x-amz-version-id", stack));
                continue;
            }
            if current_name == "ETag" {
                obj.e_tag = try!(ETagParser::parse_xml("ETag", stack));
                continue;
            }
            if current_name == "x-amz-expiration" {
                obj.expiration = try!(ExpirationParser::parse_xml("x-amz-expiration", stack));
                continue;
            }
            if current_name == "x-amz-server-side-encryption" {
                obj.server_side_encryption = try!(ServerSideEncryptionParser::parse_xml("x-amz-server-side-encryption", stack));
                continue;
            }
            if current_name == "x-amz-server-side-encryption-customer-key-MD5" {
                obj.sse_customer_key_md5 = try!(SSECustomerKeyMD5Parser::parse_xml("x-amz-server-side-encryption-customer-key-MD5", stack));
                continue;
            }
            if current_name == "x-amz-server-side-encryption-aws-kms-key-id" {
                obj.ssekms_key_id = try!(SSEKMSKeyIdParser::parse_xml("x-amz-server-side-encryption-aws-kms-key-id", stack));
                continue;
            }
            break;
        }
        try!(end_element(tag_name, stack));
        Ok(obj)
    }
}

impl PutObjectOutputWriter {
    pub fn write_params(params: &mut Params, name: &str, obj: &PutObjectOutput) {
        let mut prefix = name.to_string();
        if prefix != "" { prefix.push_str("."); }
        SSECustomerAlgorithmWriter::write_params(params, &(prefix.to_string() + "x-amz-server-side-encryption-customer-algorithm"), &obj.sse_customer_algorithm);
        RequestChargedWriter::write_params(params, &(prefix.to_string() + "x-amz-request-charged"), &obj.request_charged);
        ObjectVersionIdWriter::write_params(params, &(prefix.to_string() + "x-amz-version-id"), &obj.version_id);
        ETagWriter::write_params(params, &(prefix.to_string() + "ETag"), &obj.e_tag);
        ExpirationWriter::write_params(params, &(prefix.to_string() + "x-amz-expiration"), &obj.expiration);
        ServerSideEncryptionWriter::write_params(params, &(prefix.to_string() + "x-amz-server-side-encryption"), &obj.server_side_encryption);
        SSECustomerKeyMD5Writer::write_params(params, &(prefix.to_string() + "x-amz-server-side-encryption-customer-key-MD5"), &obj.sse_customer_key_md5);
        SSEKMSKeyIdWriter::write_params(params, &(prefix.to_string() + "x-amz-server-side-encryption-aws-kms-key-id"), &obj.ssekms_key_id);
    }
}

impl MaxUploadsParser {
    pub fn parse_xml<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<MaxUploads, XmlParseError> {
        try!(start_element(tag_name, stack));
        let obj = i32::from_str(try!(characters(stack)).as_ref()).unwrap();
        try!(end_element(tag_name, stack));
        Ok(obj)
    }
}

impl MaxUploadsWriter {
    pub fn write_params(params: &mut Params, name: &str, obj: &MaxUploads) {
        params.put(name, &obj.to_string());
    }
}

impl ExpiresParser {
    pub fn parse_xml<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<Expires, XmlParseError> {
        try!(start_element(tag_name, stack));
        let obj = try!(characters(stack));
        try!(end_element(tag_name, stack));
        Ok(obj)
    }
}

impl ExpiresWriter {
    pub fn write_params(params: &mut Params, name: &str, obj: &Expires) {
        params.put(name, obj);
    }
}