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
#![allow(unused_variables)]
#![allow(unused_mut)]
use aws::common::region::Region;
use aws::common::params::{Params, ServiceParams};
use aws::common::xmlutil::*;
use aws::errors::http::*;
use aws::s3::writeparse::*;
use aws::s3::object::*;
use aws::s3::policy::*;
use aws::s3::acl::*;
use aws::s3::header::*;
use aws::s3::grant::*;
pub type BucketName = String;
pub type Buckets = Vec<Bucket>;
pub type CloudFunctionConfigurationList = Vec<CloudFunctionConfiguration>;
pub type TopicConfigurationList = Vec<TopicConfiguration>;
pub type BucketLocationConstraint = String;
pub type TargetBucket = String;
pub type TargetPrefix = String;
pub struct BucketNameParser;
pub struct BucketParser;
pub struct BucketNameWriter;
pub struct BucketWriter;
pub struct BucketsParser;
pub struct BucketsWriter;
pub struct CloudFunctionConfigurationListParser;
pub struct CloudFunctionConfigurationListWriter;
pub struct TopicConfigurationListParser;
pub struct TopicConfigurationListWriter;
pub struct TopicConfigurationParser;
pub struct TopicConfigurationWriter;
pub struct NotificationConfigurationParser;
pub struct NotificationConfigurationWriter;
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct BucketAlreadyExists;
pub struct BucketAlreadyExistsParser;
pub struct BucketAlreadyExistsWriter;
pub struct BucketLocationConstraintParser;
pub struct BucketLocationConstraintWriter;
pub struct HeadBucketRequestParser;
pub struct HeadBucketRequestWriter;
pub struct TargetBucketParser;
pub struct TargetBucketWriter;
pub struct TargetPrefixParser;
pub struct TargetPrefixWriter;
pub struct TargetGrantsParser;
pub struct TargetGrantsWriter;
pub struct LoggingEnabledParser;
pub struct LoggingEnabledWriter;
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct TopicConfigurationDeprecated {
pub topic: TopicArn,
pub id: NotificationId,
pub event: Event,
pub events: EventList,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct QueueConfigurationDeprecated {
pub queue: QueueArn,
pub events: EventList,
pub id: NotificationId,
pub event: Event,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct CloudFunctionConfiguration {
pub invocation_role: CloudFunctionInvocationRole,
pub cloud_function: CloudFunction,
pub events: EventList,
pub id: NotificationId,
pub event: Event,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct PutBucketReplicationRequest {
pub replication_configuration: ReplicationConfiguration,
pub content_md5: Option<ContentMD5>,
pub bucket: BucketName,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct PutBucketNotificationRequest {
pub notification_configuration: NotificationConfigurationDeprecated,
pub content_md5: Option<ContentMD5>,
pub bucket: BucketName,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct GetBucketLoggingRequest {
pub bucket: BucketName,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct PutBucketLifecycleRequest {
pub lifecycle_configuration: Option<LifecycleConfiguration>,
pub content_md5: Option<ContentMD5>,
pub bucket: BucketName,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct GetBucketCorsRequest {
pub bucket: BucketName,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct GetBucketCorsOutput {
pub cors_rules: CORSRules,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct GetBucketVersioningRequest {
pub bucket: BucketName,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct GetBucketVersioningOutput {
pub status: BucketVersioningStatus,
pub mfa_delete: MFADeleteStatus,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct PutBucketVersioningRequest {
pub mfa: Option<MFA>,
pub content_md5: Option<ContentMD5>,
pub bucket: BucketName,
pub versioning_configuration: VersioningConfiguration,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct CORSRule {
pub allowed_headers: AllowedHeaders,
pub expose_headers: ExposeHeaders,
pub allowed_methods: AllowedMethods,
pub max_age_seconds: MaxAgeSeconds,
pub allowed_origins: AllowedOrigins,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct VersioningConfiguration {
pub status: BucketVersioningStatus,
pub mfa_delete: MFADelete,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct DeleteBucketCorsRequest {
pub bucket: BucketName,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct NotificationConfiguration {
pub queue_configurations: QueueConfigurationList,
pub lambda_function_configurations: LambdaFunctionConfigurationList,
pub topic_configurations: TopicConfigurationList,
pub cloud_function_configurations: CloudFunctionConfigurationList,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct GetBucketNotificationConfigurationRequest {
pub bucket: BucketName,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct DeleteBucketWebsiteRequest {
pub bucket: BucketName,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct DeleteBucketTaggingRequest {
pub bucket: BucketName,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct LifecycleConfiguration {
pub rules: Rules,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct PutBucketPolicyRequest {
pub policy: Policy,
pub content_md5: Option<ContentMD5>,
pub bucket: BucketName,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct RoutingRule {
pub redirect: Redirect,
pub condition: Option<Condition>,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct CreateBucketRequest {
pub grant_full_control: Option<GrantFullControl>,
pub create_bucket_configuration: Option<CreateBucketConfiguration>,
pub grant_write_acp: Option<GrantWriteACP>,
pub bucket: BucketName,
pub acl: Option<CannedAcl>,
pub grant_write: Option<GrantWrite>,
pub grant_read: Option<GrantRead>,
pub grant_read_acp: Option<GrantReadACP>,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct PutBucketLoggingRequest {
pub bucket_logging_status: BucketLoggingStatus,
pub content_md5: Option<ContentMD5>,
pub bucket: BucketName,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct ReplicationConfiguration {
pub rules: ReplicationRules,
pub role: Role,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct LoggingEnabled {
pub target_prefix: TargetPrefix,
pub target_bucket: TargetBucket,
pub target_grants: TargetGrants,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct WebsiteConfiguration {
pub redirect_all_requests_to: RedirectAllRequestsTo,
pub index_document: IndexDocument,
pub error_document: ErrorDocument,
pub routing_rules: RoutingRules,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct BucketLoggingStatus {
pub logging_enabled: LoggingEnabled,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct Destination {
pub bucket: BucketName,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct PutBucketRequestPaymentRequest {
pub request_payment_configuration: RequestPaymentConfiguration,
pub content_md5: Option<ContentMD5>,
pub bucket: BucketName,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct Bucket {
pub creation_date: CreationDate,
pub name: BucketName,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct HeadBucketRequest {
pub bucket: BucketName,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct DeleteBucketRequest {
pub bucket: BucketName,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct DeleteBucketPolicyRequest {
pub bucket: BucketName,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct DeleteBucketReplicationRequest {
pub bucket: BucketName,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct GetBucketLoggingOutput {
pub logging_enabled: LoggingEnabled,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct GetBucketReplicationOutput {
pub replication_configuration: ReplicationConfiguration,
}
#[derive(Debug, Default, RustcDecodable, RustcEncodable)]
pub struct PutBucketWebsiteRequest {
pub content_md5: Option<ContentMD5>,
pub bucket: BucketName,
pub website_configuration: WebsiteConfiguration,
}
pub fn needs_create_bucket_config(region: Region) -> bool {
match region {
Region::UsEast1 => false,
_ => true,
}
}
pub fn create_bucket_config_xml(region: Region) -> Vec<u8> {
match region {
Region::UsEast1 => {
Vec::new()
},
_ => {
let xml = format!(
"<CreateBucketConfiguration xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\">
<LocationConstraint>{}</LocationConstraint>
</CreateBucketConfiguration >", region);
xml.into_bytes()
},
}
}
impl BucketNameParser {
pub fn parse_xml<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<BucketName, XmlParseError> {
try!(start_element(tag_name, stack));
let obj = try!(characters(stack));
try!(end_element(tag_name, stack));
Ok(obj)
}
}
impl BucketParser {
pub fn parse_xml<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<Bucket, XmlParseError> {
try!(start_element(tag_name, stack));
let mut obj = Bucket::default();
loop {
let current_name = try!(peek_at_name(stack));
if current_name == "CreationDate" {
obj.creation_date = try!(CreationDateParser::parse_xml("CreationDate", stack));
continue;
}
if current_name == "Name" {
obj.name = try!(BucketNameParser::parse_xml("Name", stack));
continue;
}
break;
}
try!(end_element(tag_name, stack));
Ok(obj)
}
}
impl BucketNameWriter {
pub fn write_params(params: &mut Params, name: &str, obj: &BucketName) {
params.put(name, obj);
}
}
impl BucketWriter {
pub fn write_params(params: &mut Params, name: &str, obj: &Bucket) {
let mut prefix = name.to_string();
if prefix != "" { prefix.push_str("."); }
CreationDateWriter::write_params(params, &(prefix.to_string() + "CreationDate"), &obj.creation_date);
BucketNameWriter::write_params(params, &(prefix.to_string() + "Name"), &obj.name);
}
}
impl BucketsParser {
#[allow(unused_variables)]
pub fn parse_xml<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<Buckets, XmlParseError> {
let mut obj = Vec::new();
while try!(peek_at_name(stack)) == "Bucket" {
obj.push(try!(BucketParser::parse_xml("Bucket", stack)));
}
Ok(obj)
}
}
impl BucketsWriter {
pub fn write_params(params: &mut Params, name: &str, obj: &Buckets) {
let mut index = 1;
for element in obj.iter() {
let key = &format!("{}.{}", name, index);
BucketWriter::write_params(params, key, element);
index += 1;
}
}
}
impl CloudFunctionConfigurationListParser {
pub fn parse_xml<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<CloudFunctionConfigurationList, XmlParseError> {
let mut obj = Vec::new();
while try!(peek_at_name(stack)) == "CloudFunctionConfiguration" {
obj.push(try!(CloudFunctionConfigurationParser::parse_xml("CloudFunctionConfiguration", stack)));
}
Ok(obj)
}
}
impl CloudFunctionConfigurationListWriter {
pub fn write_params(params: &mut Params, name: &str, obj: &CloudFunctionConfigurationList) {
let mut index = 1;
for element in obj.iter() {
let key = &format!("{}.{}", name, index);
CloudFunctionConfigurationWriter::write_params(params, key, element);
index += 1;
}
}
}
impl TopicConfigurationListParser {
pub fn parse_xml<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<TopicConfigurationList, XmlParseError> {
let mut obj = Vec::new();
while try!(peek_at_name(stack)) == "TopicConfiguration" {
obj.push(try!(TopicConfigurationParser::parse_xml("TopicConfiguration", stack)));
}
Ok(obj)
}
}
impl TopicConfigurationListWriter {
pub fn write_params(params: &mut Params, name: &str, obj: &TopicConfigurationList) {
let mut index = 1;
for element in obj.iter() {
let key = &format!("{}.{}", name, index);
TopicConfigurationWriter::write_params(params, key, element);
index += 1;
}
}
}
impl TopicConfigurationParser {
pub fn parse_xml<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<TopicConfiguration, XmlParseError> {
try!(start_element(tag_name, stack));
let mut obj = TopicConfiguration::default();
loop {
let current_name = try!(peek_at_name(stack));
if current_name == "Id" {
obj.id = Some(try!(NotificationIdParser::parse_xml("Id", stack)));
continue;
}
if current_name == "Topic" {
obj.topic_arn = try!(TopicArnParser::parse_xml("Topic", stack));
continue;
}
if current_name == "Event" {
obj.events = try!(EventListParser::parse_xml("Event", stack));
continue;
}
break;
}
try!(end_element(tag_name, stack));
Ok(obj)
}
}
impl TopicConfigurationWriter {
pub fn write_params(params: &mut Params, name: &str, obj: &TopicConfiguration) {
let mut prefix = name.to_string();
if prefix != "" { prefix.push_str("."); }
if let Some(ref obj) = obj.id {
NotificationIdWriter::write_params(params, &(prefix.to_string() + "Id"), obj);
}
TopicArnWriter::write_params(params, &(prefix.to_string() + "Topic"), &obj.topic_arn);
EventListWriter::write_params(params, &(prefix.to_string() + "Event"), &obj.events);
}
}
impl NotificationConfigurationParser {
pub fn parse_xml<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<NotificationConfiguration, XmlParseError> {
try!(start_element(tag_name, stack));
let mut obj = NotificationConfiguration::default();
loop {
let current_name = try!(peek_at_name(stack));
if current_name == "QueueConfiguration" {
obj.queue_configurations = try!(QueueConfigurationListParser::parse_xml("QueueConfiguration", stack));
continue;
}
if current_name == "LambdaFunctionConfiguration" {
obj.lambda_function_configurations = try!(LambdaFunctionConfigurationListParser::parse_xml("LambdaFunctionConfiguration", stack));
continue;
}
if current_name == "TopicConfiguration" {
obj.topic_configurations = try!(TopicConfigurationListParser::parse_xml("TopicConfiguration", stack));
continue;
}
if current_name == "CloudFunctionConfiguration" {
obj.cloud_function_configurations = try!(CloudFunctionConfigurationListParser::parse_xml("CloudFunctionConfiguration", stack));
continue;
}
break;
}
try!(end_element(tag_name, stack));
Ok(obj)
}
}
impl NotificationConfigurationWriter {
pub fn write_params(params: &mut Params, name: &str, obj: &NotificationConfiguration) {
let mut prefix = name.to_string();
if prefix != "" { prefix.push_str("."); }
QueueConfigurationListWriter::write_params(params, &(prefix.to_string() + "QueueConfiguration"), &obj.queue_configurations);
LambdaFunctionConfigurationListWriter::write_params(params, &(prefix.to_string() + "LambdaFunctionConfiguration"), &obj.lambda_function_configurations);
TopicConfigurationListWriter::write_params(params, &(prefix.to_string() + "TopicConfiguration"), &obj.topic_configurations);
CloudFunctionConfigurationListWriter::write_params(params, &(prefix.to_string() + "CloudFunctionConfiguration"), &obj.cloud_function_configurations);
}
}
impl BucketAlreadyExistsParser {
pub fn parse_xml<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<BucketAlreadyExists, XmlParseError> {
try!(start_element(tag_name, stack));
let obj = BucketAlreadyExists::default();
try!(end_element(tag_name, stack));
Ok(obj)
}
}
impl BucketAlreadyExistsWriter {
#[allow(unused_variables)]
pub fn write_params(params: &mut Params, name: &str, obj: &BucketAlreadyExists) {
let mut prefix = name.to_string();
if prefix != "" { prefix.push_str("."); }
}
}
impl BucketLocationConstraintParser {
pub fn parse_xml<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<BucketLocationConstraint, XmlParseError> {
try!(start_element(tag_name, stack));
let obj = try!(characters(stack));
try!(end_element(tag_name, stack));
Ok(obj)
}
}
impl BucketLocationConstraintWriter {
pub fn write_params(params: &mut Params, name: &str, obj: &BucketLocationConstraint) {
params.put(name, obj);
}
}
impl HeadBucketRequestParser {
pub fn parse_xml<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<HeadBucketRequest, XmlParseError> {
try!(start_element(tag_name, stack));
let mut obj = HeadBucketRequest::default();
loop {
let current_name = try!(peek_at_name(stack));
if current_name == "Bucket" {
obj.bucket = try!(BucketNameParser::parse_xml("Bucket", stack));
continue;
}
break;
}
try!(end_element(tag_name, stack));
Ok(obj)
}
}
impl HeadBucketRequestWriter {
pub fn write_params(params: &mut Params, name: &str, obj: &HeadBucketRequest) {
let mut prefix = name.to_string();
if prefix != "" { prefix.push_str("."); }
BucketNameWriter::write_params(params, &(prefix.to_string() + "Bucket"), &obj.bucket);
}
}
impl TargetPrefixParser {
pub fn parse_xml<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<TargetPrefix, XmlParseError> {
try!(start_element(tag_name, stack));
let obj = try!(characters(stack));
try!(end_element(tag_name, stack));
Ok(obj)
}
}
impl TargetPrefixWriter {
pub fn write_params(params: &mut Params, name: &str, obj: &TargetPrefix) {
params.put(name, obj);
}
}
impl TargetBucketParser {
pub fn parse_xml<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<TargetBucket, XmlParseError> {
try!(start_element(tag_name, stack));
let obj = try!(characters(stack));
try!(end_element(tag_name, stack));
Ok(obj)
}
}
impl TargetBucketWriter {
pub fn write_params(params: &mut Params, name: &str, obj: &TargetBucket) {
params.put(name, obj);
}
}
impl TargetGrantsParser {
pub fn parse_xml<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<TargetGrants, XmlParseError> {
let mut obj = Vec::new();
while try!(peek_at_name(stack)) == "Grant" {
obj.push(try!(TargetGrantParser::parse_xml("Grant", stack)));
}
Ok(obj)
}
}
impl TargetGrantsWriter {
pub fn write_params(params: &mut Params, name: &str, obj: &TargetGrants) {
let mut index = 1;
for element in obj.iter() {
let key = &format!("{}.{}", name, index);
TargetGrantWriter::write_params(params, key, element);
index += 1;
}
}
}
impl LoggingEnabledParser {
pub fn parse_xml<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<LoggingEnabled, XmlParseError> {
try!(start_element(tag_name, stack));
let mut obj = LoggingEnabled::default();
loop {
let current_name = try!(peek_at_name(stack));
if current_name == "TargetPrefix" {
obj.target_prefix = try!(TargetPrefixParser::parse_xml("TargetPrefix", stack));
continue;
}
if current_name == "TargetBucket" {
obj.target_bucket = try!(TargetBucketParser::parse_xml("TargetBucket", stack));
continue;
}
if current_name == "Grant" {
obj.target_grants = try!(TargetGrantsParser::parse_xml("Grant", stack));
continue;
}
break;
}
try!(end_element(tag_name, stack));
Ok(obj)
}
}
impl LoggingEnabledWriter {
pub fn write_params(params: &mut Params, name: &str, obj: &LoggingEnabled) {
let mut prefix = name.to_string();
if prefix != "" { prefix.push_str("."); }
TargetPrefixWriter::write_params(params, &(prefix.to_string() + "TargetPrefix"), &obj.target_prefix);
TargetBucketWriter::write_params(params, &(prefix.to_string() + "TargetBucket"), &obj.target_bucket);
TargetGrantsWriter::write_params(params, &(prefix.to_string() + "Grant"), &obj.target_grants);
}
}