Skip to main content

minio_rsc/datatype/
mod.rs

1//! Data types
2
3mod select_object_content;
4
5pub use select_object_content::*;
6
7use serde::{Deserialize, Serialize};
8
9use crate::time::UtcTime;
10
11#[derive(Clone, Debug, PartialEq)]
12pub struct Region(pub String);
13
14trait XmlSelf {}
15
16macro_rules! impl_xmlself {
17    ($($name:tt )*) => {
18        $(
19            impl XmlSelf for $name{}
20        )*
21    };
22}
23
24impl_xmlself!(
25    CommonPrefix
26    LegalHold
27    VersioningConfiguration
28    Retention
29    CompleteMultipartUpload
30    CompleteMultipartUploadResult
31    InitiateMultipartUploadResult
32    ListMultipartUploadsResult
33    CopyPartResult
34    ListPartsResult
35    ListAllMyBucketsResult
36    ListBucketResult
37    ListVersionsResult
38    ServerSideEncryptionConfiguration
39    CORSConfiguration
40    LocationConstraint
41    PublicAccessBlockConfiguration
42    AccessControlPolicy
43    ReplicationConfiguration
44    WebsiteConfiguration
45    LifecycleConfiguration
46    PolicyStatus
47    AnalyticsConfiguration
48);
49
50pub trait ToXml {
51    /// try get xml string
52    fn to_xml(&self) -> crate::error::Result<String>;
53}
54
55impl<T: Serialize + XmlSelf> ToXml for T {
56    fn to_xml(&self) -> crate::error::Result<String> {
57        crate::xml::ser::to_string(&self).map_err(Into::into)
58    }
59}
60
61pub trait FromXml: Sized {
62    /// try from xml string
63    fn from_xml(v: String) -> crate::error::Result<Self>;
64}
65
66impl<'de, T: Deserialize<'de> + XmlSelf> FromXml for T {
67    fn from_xml(v: String) -> crate::error::Result<Self> {
68        crate::xml::de::from_string(v).map_err(Into::into)
69    }
70}
71
72impl Region {
73    pub fn from<S>(region: S) -> Self
74    where
75        S: Into<String>,
76    {
77        return Self(region.into());
78    }
79
80    pub fn as_str(&self) -> &str {
81        self.0.as_str()
82    }
83}
84
85/// Specifies the days since the initiation of an incomplete multipart upload
86/// that Amazon S3 will wait before permanently removing all parts of the upload.
87#[derive(Debug, Clone, Deserialize, Serialize)]
88#[serde(rename_all = "PascalCase")]
89pub struct AbortIncompleteMultipartUpload {
90    /// Specifies the number of days after which Amazon S3 aborts an incomplete multipart upload.
91    pub days_after_initiation: i32,
92}
93
94#[derive(Debug, Clone, Deserialize, Serialize)]
95#[serde(rename_all = "PascalCase")]
96pub struct AccessControlList {
97    /// Array of [Grant]
98    pub grant: Vec<Grant>,
99}
100
101/// Contains the elements that set the ACL permissions for an object per grantee.
102#[derive(Debug, Clone, Deserialize, Serialize)]
103#[serde(rename_all = "PascalCase")]
104pub struct AccessControlPolicy {
105    pub access_control_list: AccessControlList,
106    pub owner: Option<Owner>,
107}
108
109/// A container for information about access control for replicas.
110#[derive(Debug, Clone, Deserialize, Serialize)]
111#[serde(rename_all = "PascalCase")]
112pub struct AccessControlTranslation {
113    pub owner: String,
114}
115
116///A conjunction (logical AND) of predicates, which is used in evaluating a metrics filter.
117#[derive(Debug, Clone, Deserialize, Serialize)]
118#[serde(rename_all = "PascalCase")]
119pub struct AnalyticsAndOperator {
120    /// The prefix to use when evaluating an AND predicate:
121    /// The prefix that an object must have to be included in the metrics results.
122    pub prefix: Option<String>,
123    /// The list of tags to use when evaluating an AND predicate.
124    #[serde(rename = "tag", default)]
125    pub tags: Vec<Tag>,
126}
127
128/// AnalyticsConfiguration parameters.
129#[derive(Debug, Clone, Deserialize, Serialize)]
130#[serde(rename_all = "PascalCase")]
131pub struct AnalyticsConfiguration {
132    /// The ID that identifies the analytics configuration.
133    pub id: String,
134    /// Contains data related to access patterns to be collected and made available to analyze the tradeoffs between different storage classes.
135    pub storage_class_analysis: StorageClassAnalysis,
136    /// The filter used to describe a set of objects for analyses.
137    pub filter: AnalyticsFilter,
138}
139
140/// Where to publish the analytics results.
141#[derive(Debug, Clone, Deserialize, Serialize)]
142#[serde(rename_all = "PascalCase")]
143pub struct AnalyticsExportDestination {
144    pub s3_bucket_destination: AnalyticsS3BucketDestination,
145}
146
147/// The filter used to describe a set of objects for analyses.
148#[derive(Debug, Clone, Deserialize, Serialize)]
149#[serde(rename_all = "PascalCase")]
150pub struct AnalyticsFilter {
151    /// The prefix to use when evaluating an analytics filter.
152    pub prefix: Option<String>,
153    /// A conjunction (logical AND) of predicates, which is used in evaluating an analytics filter.
154    /// The operator must have at least two predicates.
155    pub and: Option<AnalyticsAndOperator>,
156    /// The filter used to describe a set of objects for analyses.
157    pub tag: Tag,
158}
159/// Contains information about where to publish the analytics results.
160#[derive(Debug, Clone, Deserialize, Serialize)]
161#[serde(rename_all = "PascalCase")]
162pub struct AnalyticsS3BucketDestination {
163    /// The Amazon Resource Name (ARN) of the bucket to which data is exported.
164    pub bucket: String,
165    /// Specifies the file format used when exporting data to Amazon S3.
166    /// Valid Values: CSV
167    pub format: String,
168    /// The account ID that owns the destination bucket.
169    pub bucket_account_id: Option<String>,
170    /// The prefix to use when exporting data. The prefix is prepended to all results.
171    pub prefix: Option<String>,
172}
173
174/// In terms of implementation, a Bucket is a resource.
175/// An Amazon S3 bucket name is globally unique, and the namespace is shared by all AWS accounts.
176#[derive(Debug, Clone, Deserialize, Serialize)]
177#[serde(rename_all = "PascalCase")]
178pub struct Bucket {
179    /// The name of the bucket.
180    pub name: String,
181    /// Date the bucket was created. This date can change when making changes to your bucket, such as editing its bucket policy.
182    pub creation_date: String,
183}
184
185#[derive(Clone, Debug, Default, Deserialize, Serialize)]
186#[serde(rename_all = "PascalCase")]
187pub struct Buckets {
188    #[serde(default)]
189    pub bucket: Vec<Bucket>,
190}
191
192/// Container for all (if there are any) keys between Prefix and the next occurrence of the string specified by a delimiter.
193#[derive(Debug, Clone, Deserialize, Serialize)]
194#[serde(rename_all = "PascalCase")]
195pub struct CommonPrefix {
196    pub prefix: String,
197}
198
199/// The container for the completed multipart upload details.
200#[derive(Debug, Clone, Deserialize, Serialize)]
201#[serde(rename_all = "PascalCase")]
202pub struct CompleteMultipartUpload {
203    #[serde(default, rename = "Part")]
204    pub parts: Vec<Part>,
205}
206
207#[derive(Debug, Clone, Deserialize, Serialize)]
208#[serde(rename_all = "PascalCase")]
209pub struct CompleteMultipartUploadResult {
210    pub bucket: String,
211    pub key: String,
212    pub e_tag: String,
213    pub location: String,
214}
215
216#[derive(Debug, Clone, Deserialize, Serialize)]
217#[serde(rename_all = "PascalCase")]
218pub struct Condition {
219    pub http_error_code_returned_equals: Option<String>,
220    pub key_prefix_equals: Option<String>,
221}
222
223#[derive(Debug, Clone, Deserialize, Serialize)]
224#[serde(rename_all = "PascalCase")]
225pub struct CopyPartResult {
226    pub e_tag: String,
227}
228
229/// Describes the cross-origin access configuration for objects in an Amazon S3 bucket.
230#[derive(Debug, Clone, Deserialize, Serialize)]
231#[serde(rename_all = "PascalCase")]
232pub struct CORSConfiguration {
233    #[serde(rename = "CORSRule")]
234    pub rules: Vec<CORSRule>,
235}
236
237/// Specifies a cross-origin access rule for an Amazon S3 bucket.
238#[derive(Debug, Clone, Deserialize, Serialize, Default)]
239#[serde(rename_all = "PascalCase")]
240pub struct CORSRule {
241    /// **Required**. Valid values are `GET`, `PUT`, `HEAD`, `POST`, and `DELETE`.
242    #[serde(rename = "AllowedMethod", default)]
243    pub allowed_methods: Vec<String>,
244    /// **Required**
245    #[serde(rename = "AllowedOrigin", default)]
246    pub allowed_origins: Vec<String>,
247    #[serde(rename = "AllowedHeader", default)]
248    pub allowed_headers: Vec<String>,
249    #[serde(rename = "ExposeHeader", default)]
250    pub expose_headers: Vec<String>,
251    #[serde(rename = "ID")]
252    pub id: Option<String>,
253    pub max_age_seconds: usize,
254}
255
256/// The container element for specifying the default Object Lock retention settings
257/// for new objects placed in the specified bucket.
258///
259/// **Note**
260/// - The DefaultRetention settings require **both** a `mode` and a `period`.
261/// - The DefaultRetention period can be either Days or Years but you must select one.
262///   You cannot specify Days and Years at the same time.
263#[derive(Debug, Clone, Deserialize, Serialize, Default)]
264#[serde(rename_all = "PascalCase")]
265pub struct DefaultRetention {
266    pub days: Option<usize>,
267    pub mode: RetentionMode,
268    pub years: Option<usize>,
269}
270
271/// Information about the delete marker.
272#[derive(Clone, Debug, Deserialize, Serialize)]
273#[serde(rename_all = "PascalCase")]
274pub struct DeleteMarkerEntry {
275    /// The object key.
276    pub key: String,
277    /// Date and time when the object was last modified.
278    pub last_modified: String,
279    /// Specifies whether the object is (true) or is not (false) the latest version of an object.
280    pub is_latest: bool,
281    /// The entity tag is an MD5 hash of that version of the object.
282    pub owner: Option<Owner>,
283    /// Version ID of an object.
284    pub version_id: Option<String>,
285}
286
287/// Specifies whether Amazon S3 replicates delete markers.
288#[derive(Clone, Debug, Deserialize, Serialize)]
289#[serde(rename_all = "PascalCase")]
290pub struct DeleteMarkerReplication {
291    pub status: Status,
292}
293
294/// Specifies information about where to publish analysis or configuration results for an Amazon S3 bucket and S3 Replication Time Control (S3 RTC).
295#[derive(Debug, Clone, Deserialize, Serialize)]
296#[serde(rename_all = "PascalCase")]
297pub struct Destination {
298    pub bucket: String,
299    pub account: Option<String>,
300    pub storage_class: StorageClass,
301    pub access_control_translation: Option<AccessControlTranslation>,
302    pub encryption_configuration: Option<EncryptionConfiguration>,
303    pub replication_time: Option<ReplicationTime>,
304    pub metrics: Option<Metrics>,
305}
306
307/// Specifies encryption-related information for an Amazon S3 bucket that is a destination for replicated objects.
308#[derive(Debug, Clone, Deserialize, Serialize)]
309#[serde(rename_all = "PascalCase")]
310pub struct EncryptionConfiguration {
311    #[serde(rename = "ReplicaKmsKeyID")]
312    pub replica_kms_key_id: String,
313}
314
315/// The error information.
316#[derive(Debug, Clone, Deserialize, Serialize)]
317#[serde(rename_all = "PascalCase")]
318pub struct ErrorDocument {
319    /// The object key name to use when a 4XX class error occurs.
320    /// Minimum length of 1.
321    pub key: String,
322}
323
324/// Optional configuration to replicate existing source bucket objects.
325#[derive(Clone, Debug, Deserialize, Serialize)]
326#[serde(rename_all = "PascalCase")]
327pub struct ExistingObjectReplication {
328    pub status: Status,
329}
330
331/// Container for grant information.
332#[derive(Debug, Clone, Deserialize, Serialize)]
333#[serde(rename_all = "PascalCase")]
334pub struct Grant {
335    pub grantee: Option<Grantee>,
336    pub permission: Option<Permission>,
337}
338
339/// Container for the person being granted permissions.
340#[derive(Debug, Clone, Deserialize, Serialize)]
341#[serde(rename_all = "PascalCase")]
342pub struct Grantee {
343    pub display_name: Option<String>,
344    pub email_address: Option<String>,
345    pub id: Option<String>,
346    #[serde(alias = "Type", alias = "type")]
347    pub r#type: GranteeType,
348    pub uri: Option<String>,
349}
350
351/// The name of the index document for the website.
352#[derive(Debug, Clone, Deserialize, Serialize)]
353#[serde(rename_all = "PascalCase")]
354pub struct IndexDocument {
355    /// A suffix that is appended to a request that is for a directory on the website endpoint.
356    pub suffix: String,
357}
358
359#[derive(Debug, Clone, Deserialize, Serialize)]
360#[serde(rename_all = "PascalCase")]
361pub(crate) struct InitiateMultipartUploadResult {
362    pub bucket: String,
363    pub key: String,
364    pub upload_id: String,
365}
366
367/// Container element that identifies who initiated the multipart upload.
368#[derive(Clone, Debug, Deserialize, Serialize)]
369#[serde(rename_all = "PascalCase")]
370pub struct Initiator {
371    /// Name of the Principal.
372    pub display_name: String,
373    #[serde(rename = "ID")]
374    pub id: String,
375}
376
377/// A legal hold configuration for an object.
378#[derive(Debug, Clone, Deserialize, Serialize)]
379#[serde(rename_all = "PascalCase")]
380pub struct LegalHold {
381    pub status: LegalHoldStatus,
382}
383
384///  LifecycleConfiguration parameters.
385#[derive(Debug, Clone, Deserialize, Serialize)]
386#[serde(rename_all = "PascalCase")]
387pub struct LifecycleConfiguration {
388    pub rule: Vec<LifecycleRule>,
389}
390
391#[derive(Clone, Debug, Deserialize, Serialize)]
392#[serde(rename_all = "PascalCase")]
393pub struct LifecycleExpiration {
394    pub date: Option<String>,
395    /// Indicates the lifetime, in days, of the objects that are subject to the rule.
396    /// The value must be a non-zero positive integer.
397    pub days: u32,
398    pub expired_object_delete_marker: Option<bool>,
399}
400
401/// A lifecycle rule for individual objects in an Amazon S3 bucket.
402#[derive(Debug, Clone, Deserialize, Serialize)]
403#[serde(rename_all = "PascalCase")]
404pub struct LifecycleRule {
405    /// Unique identifier for the rule. The value cannot be longer than 255 characters.
406    #[serde(rename = "ID")]
407    pub id: Option<String>,
408
409    pub prefix: Option<String>,
410    /// If 'Enabled', the rule is currently being applied. If 'Disabled', the rule is not currently being applied.
411    pub status: Status,
412    /// Specifies the days since the initiation of an incomplete multipart upload
413    /// that Amazon S3 will wait before permanently removing all parts of the upload.
414    pub abort_incomplete_multipart_upload: Option<AbortIncompleteMultipartUpload>,
415    /// Specifies the expiration for the lifecycle of the object in the form of date, days and, whether the object has a delete marker.
416    pub expiration: Option<LifecycleExpiration>,
417    /// The Filter is used to identify objects that a Lifecycle Rule applies to.
418    pub filter: Option<LifecycleRuleFilter>,
419    /// Specifies when noncurrent object versions expire.
420    pub noncurrent_version_expiration: Option<NoncurrentVersionExpiration>,
421    /// Specifies the transition rule for the lifecycle rule that describes when noncurrent objects transition to a specific storage class.
422    #[serde(rename = "NoncurrentVersionTransition", default)]
423    pub noncurrent_version_transitions: Vec<NoncurrentVersionTransition>,
424    /// Specifies when an Amazon S3 object transitions to a specified storage class.
425    #[serde(rename = "Transition", default)]
426    pub transitions: Vec<Transition>,
427}
428
429/// This is used in a Lifecycle Rule Filter to apply a logical AND to two or more predicates.
430/// The Lifecycle Rule will apply to any object matching all of the predicates configured inside the And operator.
431#[derive(Debug, Clone, Deserialize, Serialize)]
432#[serde(rename_all = "PascalCase")]
433pub struct LifecycleRuleAndOperator {
434    /// Minimum object size to which the rule applies.
435    pub object_size_greater_than: Option<u32>,
436    /// Maximum object size to which the rule applies.
437    pub object_size_less_than: Option<u32>,
438    /// Prefix identifying one or more objects to which the rule applies.
439    pub prefix: Option<String>,
440    /// All of these tags must exist in the object's tag set in order for the rule to apply.
441    #[serde(rename = "tag", default)]
442    pub tags: Vec<Tag>,
443}
444
445/// The Filter is used to identify objects that a Lifecycle Rule applies to.
446/// A Filter can have exactly one of Prefix, Tag, ObjectSizeGreaterThan,
447/// ObjectSizeLessThan, or And specified. If the Filter element is left empty,
448/// the Lifecycle Rule applies to all objects in the bucket.
449#[derive(Debug, Clone, Deserialize, Serialize)]
450#[serde(rename_all = "PascalCase")]
451pub struct LifecycleRuleFilter {
452    /// This is used in a Lifecycle Rule Filter to apply a logical AND to two or more predicates.
453    /// The Lifecycle Rule will apply to any object matching all of the predicates configured inside the And operator.
454    pub and: Option<LifecycleRuleAndOperator>,
455    /// Minimum object size to which the rule applies.
456    pub object_size_greater_than: Option<u32>,
457    /// Maximum object size to which the rule applies.
458    pub object_size_less_than: Option<u32>,
459    /// Prefix identifying one or more objects to which the rule applies.
460    pub prefix: Option<String>,
461    /// This tag must exist in the object's tag set in order for the rule to apply.
462    pub tag: Option<Tag>,
463}
464
465#[derive(Debug, Clone, Deserialize, Serialize)]
466#[serde(rename_all = "PascalCase")]
467pub struct ListAllMyBucketsResult {
468    #[serde(default)]
469    pub buckets: Buckets,
470    pub owner: Owner,
471}
472
473#[derive(Debug, Clone, Deserialize, Serialize)]
474#[serde(rename_all = "PascalCase")]
475pub struct ListBucketResult {
476    pub name: String,
477    pub prefix: String,
478    pub key_count: usize,
479    pub max_keys: usize,
480    #[serde(default)]
481    pub delimiter: String,
482    pub is_truncated: bool,
483    pub start_after: Option<String>,
484    #[serde(default)]
485    pub contents: Vec<Object>,
486    #[serde(default)]
487    pub common_prefixes: Vec<CommonPrefix>,
488    #[serde(default)]
489    pub next_continuation_token: String,
490    #[serde(default)]
491    pub continuation_token: String,
492}
493
494#[derive(Debug, Clone, Deserialize, Serialize)]
495#[serde(rename_all = "PascalCase")]
496pub struct ListMultipartUploadsResult {
497    pub bucket: String,
498    pub key_marker: String,
499    pub upload_id_marker: String,
500    pub next_key_marker: String,
501    pub prefix: String,
502    pub delimiter: String,
503    pub next_upload_id_marker: String,
504    pub max_uploads: usize,
505    pub is_truncated: bool,
506    #[serde(default, rename = "Upload")]
507    pub uploads: Vec<MultipartUpload>,
508    #[serde(default)]
509    pub common_prefixes: Vec<CommonPrefix>,
510    pub encoding_type: Option<String>,
511}
512
513#[derive(Debug, Clone, Deserialize, Serialize)]
514#[serde(rename_all = "PascalCase")]
515pub struct ListPartsResult {
516    pub bucket: String,
517    pub key: String,
518    pub upload_id: String,
519    pub part_number_marker: usize,
520    pub max_parts: usize,
521    pub next_part_number_marker: usize,
522    pub is_truncated: bool,
523    #[serde(default, rename = "Part")]
524    pub parts: Vec<Part>,
525    pub storage_class: String,
526    pub checksum_algorithm: String,
527    pub initiator: Initiator,
528    pub owner: Owner,
529}
530
531#[derive(Debug, Clone, Deserialize, Serialize)]
532#[serde(rename_all = "PascalCase")]
533pub struct ListVersionsResult {
534    /// A flag that indicates whether Amazon S3 returned all of the results
535    /// that satisfied the search criteria. If your results were truncated,
536    /// you can make a follow-up paginated request by using the `NextKeyMarker`
537    /// and `NextVersionIdMarker` response parameters as a starting place in
538    /// another request to return the rest of the results.
539    pub is_truncated: bool,
540    /// All of the keys rolled up into a common prefix count as a single return when calculating the number of returns.
541    #[serde(default)]
542    pub common_prefixes: Vec<CommonPrefix>,
543    #[serde(default, rename = "Version")]
544    pub versions: Vec<ObjectVersion>,
545    /// Container for an object that is a delete marker.
546    #[serde(default, rename = "DeleteMarker")]
547    pub delete_markers: Vec<DeleteMarkerEntry>,
548    pub name: String,
549    pub prefix: String,
550    pub max_keys: usize,
551    #[serde(default)]
552    pub delimiter: String,
553    pub encoding_type: Option<String>,
554    /// Marks the last key returned in a truncated response.
555    #[serde(default)]
556    pub key_marker: String,
557    /// When the number of responses exceeds the value of `MaxKeys`,
558    /// `NextKeyMarker` specifies the first key not returned that
559    /// satisfies the search criteria. Use this value for the `key-marker`
560    /// request parameter in a subsequent request.
561    #[serde(default)]
562    pub next_key_marker: String,
563    /// Marks the last version of the key returned in a truncated response.
564    #[serde(default)]
565    pub version_id_marker: String,
566    /// When the number of responses exceeds the value of `MaxKeys`,
567    /// `NextVersionIdMarker` specifies the first object version not
568    /// returned that satisfies the search criteria. Use this value
569    /// for the `version-id-marker` request parameter in a subsequent request.
570    #[serde(default)]
571    pub next_version_id_marker: String,
572}
573
574#[derive(Clone, Debug, Deserialize, Serialize)]
575#[serde(rename_all = "PascalCase")]
576pub struct LocationConstraint {
577    pub location_constraint: String,
578}
579
580#[derive(Clone, Debug, Deserialize, Serialize)]
581#[serde(rename_all = "PascalCase")]
582pub struct Metrics {
583    pub status: Status,
584    pub event_threshold: Option<ReplicationTimeValue>,
585}
586
587#[derive(Clone, Debug, Deserialize, Serialize)]
588#[serde(rename_all = "PascalCase")]
589pub struct MultipartUpload {
590    pub checksum_algorithm: String,
591    pub upload_id: String,
592    pub storage_class: String,
593    pub key: String,
594    pub initiated: String,
595}
596
597/// Specifies when noncurrent object versions expire.
598#[derive(Clone, Debug, Deserialize, Serialize)]
599#[serde(rename_all = "PascalCase")]
600pub struct NoncurrentVersionExpiration {
601    /// Specifies how many noncurrent versions Amazon S3 will retain.
602    pub newer_noncurrent_versions: Option<i32>,
603    /// Specifies the number of days an object is noncurrent before Amazon S3 can perform the associated action.
604    pub noncurrent_days: Option<i32>,
605}
606
607#[derive(Clone, Debug, Deserialize, Serialize)]
608#[serde(rename_all = "PascalCase")]
609pub struct NoncurrentVersionTransition {
610    /// Specifies how many noncurrent versions Amazon S3 will retain.
611    pub newer_noncurrent_versions: Option<i32>,
612    /// Specifies the number of days an object is noncurrent before Amazon S3 can perform the associated action.
613    pub noncurrent_days: Option<i32>,
614    pub storage_class: Option<StorageClass>,
615}
616
617#[derive(Clone, Debug, Deserialize, Serialize)]
618#[serde(rename_all = "PascalCase")]
619pub struct Object {
620    pub key: String,
621    pub last_modified: String,
622    pub e_tag: String,
623    pub size: u64,
624    pub storage_class: String,
625    pub owner: Option<Owner>,
626    pub checksum_algorithm: Option<String>,
627}
628
629/// The container element for an Object Lock rule.
630#[derive(Debug, Clone, Deserialize, Serialize, Default)]
631#[serde(rename_all = "PascalCase")]
632pub struct ObjectLockRule {
633    pub default_retention: DefaultRetention,
634}
635
636/// Object representation of
637/// - request XML of `put_object_lock_configuration` API
638/// - response XML of `get_object_lock_configuration` API.
639#[derive(Debug, Clone, Deserialize, Serialize)]
640#[serde(rename_all = "PascalCase")]
641pub struct ObjectLockConfiguration {
642    /// Indicates whether this bucket has an Object Lock configuration enabled.
643    /// Enable ObjectLockEnabled when you apply ObjectLockConfiguration to a bucket.
644    ///
645    /// Valid Values: `Enabled`
646    /// Required: No
647    pub object_lock_enabled: String,
648    pub rule: Option<ObjectLockRule>,
649}
650
651#[derive(Clone, Debug, Deserialize, Serialize)]
652#[serde(rename_all = "PascalCase")]
653pub struct ObjectVersion {
654    /// The object key.
655    pub key: String,
656    /// Date and time when the object was last modified.
657    pub last_modified: String,
658    /// Specifies whether the object is (true) or is not (false) the latest version of an object.
659    pub is_latest: bool,
660    /// The entity tag is an MD5 hash of that version of the object.
661    pub e_tag: String,
662    pub size: u64,
663    pub storage_class: String,
664    pub owner: Option<Owner>,
665    /// Version ID of an object.
666    pub version_id: Option<String>,
667}
668
669#[derive(Debug, Clone, Deserialize, Serialize)]
670#[serde(rename_all = "PascalCase")]
671pub struct Owner {
672    pub display_name: String,
673    #[serde(rename = "ID")]
674    pub id: String,
675}
676
677#[derive(Debug, Clone, Deserialize, Serialize)]
678#[serde(rename_all = "PascalCase")]
679pub struct Part {
680    pub e_tag: String,
681    pub part_number: usize,
682}
683
684#[derive(Debug, Clone, Deserialize, Serialize)]
685#[serde(rename_all = "PascalCase")]
686pub struct Policy {
687    version: String,
688    id: String,
689    statement: Vec<PolicyStatement>,
690}
691
692#[derive(Debug, Clone, Deserialize, Serialize)]
693#[serde(rename_all = "PascalCase")]
694pub struct PolicyPrincipal {
695    #[serde(rename = "AWS", default)]
696    aws: Vec<String>,
697}
698
699#[derive(Debug, Clone, Deserialize, Serialize)]
700#[serde(rename_all = "PascalCase")]
701pub struct PolicyStatement {
702    sid: String,
703    principal: PolicyPrincipal,
704    effect: String,
705    action: Vec<String>,
706    resource: Vec<String>,
707    condition: Option<String>,
708}
709
710#[derive(Debug, Clone, Deserialize, Serialize)]
711#[serde(rename_all = "PascalCase")]
712pub struct PolicyStatus {
713    /// The policy status for this bucket.
714    pub is_public: bool,
715}
716
717/// This data type contains information about progress of an operation.
718#[derive(Debug, Clone, Deserialize, Serialize)]
719#[serde(rename_all = "PascalCase")]
720pub struct Progress {
721    pub bytes_processed: u64,
722    pub bytes_returned: u64,
723    pub bytes_scanned: u64,
724}
725
726/// PublicAccessBlockConfiguration parameters
727#[derive(Debug, Clone, Deserialize, Serialize)]
728#[serde(rename_all = "PascalCase")]
729pub struct PublicAccessBlockConfiguration {
730    pub block_public_acls: bool,
731    pub block_public_policy: bool,
732    pub ignore_public_acls: bool,
733    pub restrict_public_buckets: bool,
734}
735
736/// Specifies how requests are redirected.
737/// In the event of an error, you can specify a different error code to return.
738#[derive(Debug, Clone, Deserialize, Serialize)]
739#[serde(rename_all = "PascalCase")]
740pub struct Redirect {
741    pub host_name: Option<String>,
742    pub http_redirect_code: Option<String>,
743    pub protocol: Option<Protocol>,
744    pub replace_key_prefix_with: Option<String>,
745    pub replace_key_with: Option<String>,
746}
747
748/// Specifies the redirect behavior of all requests to a website endpoint of an Amazon S3 bucket.
749#[derive(Debug, Clone, Deserialize, Serialize)]
750#[serde(rename_all = "PascalCase")]
751pub struct RedirectAllRequestsTo {
752    pub host_name: String,
753    pub protocol: Option<Protocol>,
754}
755
756/// ReplicationConfiguration parameters.
757#[derive(Debug, Clone, Deserialize, Serialize)]
758#[serde(rename_all = "PascalCase")]
759pub struct ReplicationConfiguration {
760    pub role: Option<String>,
761    #[serde(rename = "Rule", default)]
762    pub rules: Vec<ReplicationRule>,
763}
764
765/// A filter that you can specify for selection for modifications on replicas.
766#[derive(Debug, Clone, Deserialize, Serialize)]
767#[serde(rename_all = "PascalCase")]
768pub struct ReplicaModifications {
769    pub status: Status,
770}
771
772/// Specifies which Amazon S3 objects to replicate and where to store the replicas.
773#[derive(Debug, Clone, Deserialize, Serialize)]
774#[serde(rename_all = "PascalCase")]
775pub struct ReplicationRule {
776    #[serde(rename = "ID", default)]
777    pub id: Option<String>,
778    pub prefix: Option<String>,
779    pub priority: Option<i64>,
780    pub delete_marker_replication: Option<DeleteMarkerReplication>,
781    pub existing_object_replication: Option<ExistingObjectReplication>,
782    /// Specifies whether the rule is enabled.
783    pub status: Status,
784    pub destination: Destination,
785    pub source_selection_criteria: Option<SourceSelectionCriteria>,
786    pub filter: Option<ReplicationRuleFilter>,
787}
788
789/// A container for specifying rule filters.
790/// The filters determine the subset of objects to which the rule applies.
791/// This element is required only if you specify more than one filter.
792#[derive(Debug, Clone, Deserialize, Serialize)]
793#[serde(rename_all = "PascalCase")]
794pub struct ReplicationRuleAndOperator {
795    pub prefix: Option<String>,
796    #[serde(rename = "tag")]
797    pub tags: Option<Vec<Tag>>,
798}
799
800/// A filter that identifies the subset of objects to which the replication rule applies.
801/// A Filter must specify exactly one Prefix, Tag, or an And child element.
802#[derive(Debug, Clone, Deserialize, Serialize)]
803#[serde(rename_all = "PascalCase")]
804pub struct ReplicationRuleFilter {
805    pub prefix: Option<String>,
806    pub tag: Option<Tag>,
807    pub and: Option<ReplicationRuleAndOperator>,
808}
809
810/// A container specifying S3 Replication Time Control (S3 RTC) related information,
811/// including whether S3 RTC is enabled and the time when all objects and operations on objects must be replicated.
812/// Must be specified together with a Metrics block.
813#[derive(Debug, Clone, Deserialize, Serialize)]
814#[serde(rename_all = "PascalCase")]
815pub struct ReplicationTime {
816    pub status: Status,
817    pub time: ReplicationTimeValue,
818}
819
820/// A container specifying the time value for S3 Replication Time Control (S3 RTC) and replication metrics EventThreshold.
821#[derive(Debug, Clone, Deserialize, Serialize)]
822#[serde(rename_all = "PascalCase")]
823pub struct ReplicationTimeValue {
824    pub minutes: Option<i32>,
825}
826
827/// Object representation of request XML of `put_object_retention` API
828/// and response XML of `get_object_retention` API.
829#[derive(Debug, Clone, Deserialize, Serialize)]
830#[serde(rename_all = "PascalCase")]
831pub struct Retention {
832    /// Valid Values: GOVERNANCE | COMPLIANCE
833    pub mode: RetentionMode,
834    /// The date on which this Object Lock Retention will expire.
835    #[serde(deserialize_with = "crate::time::deserialize_with_str")]
836    pub retain_until_date: UtcTime,
837}
838
839/// Specifies the redirect behavior and when a redirect is applied.
840#[derive(Debug, Clone, Deserialize, Serialize)]
841#[serde(rename_all = "PascalCase")]
842pub struct RoutingRule {
843    pub redirect: Redirect,
844    pub condition: Option<Condition>,
845}
846
847/// Rules that define when a redirect is applied and the redirect behavior.
848#[derive(Debug, Clone, Deserialize, Serialize, Default)]
849#[serde(rename_all = "PascalCase")]
850pub struct RoutingRules {
851    pub routing_rule: Vec<RoutingRule>,
852}
853
854/// A container for filter information for the selection of S3 objects encrypted with AWS KMS.
855#[derive(Debug, Clone, Deserialize, Serialize)]
856#[serde(rename_all = "PascalCase")]
857pub struct SseKmsEncryptedObjects {
858    pub status: Status,
859}
860
861/// Specifies data related to access patterns to be collected and made available to analyze
862/// the tradeoffs between different storage classes for an Amazon S3 bucket.
863#[derive(Debug, Clone, Deserialize, Serialize)]
864#[serde(rename_all = "PascalCase")]
865pub struct StorageClassAnalysis {
866    /// Specifies how data related to the storage class analysis for an Amazon S3 bucket should be exported.
867    pub data_export: Option<StorageClassAnalysisDataExport>,
868}
869
870/// Container for data related to the storage class analysis for an Amazon S3 bucket for export.
871#[derive(Debug, Clone, Deserialize, Serialize)]
872#[serde(rename_all = "PascalCase")]
873pub struct StorageClassAnalysisDataExport {
874    /// The place to store the data for an analysis.
875    pub destination: AnalyticsExportDestination,
876    /// The version of the output schema to use when exporting data. Must be V_1.
877    pub output_schema_version: String,
878}
879
880/// Describes the default server-side encryption to apply to new objects in the bucket.
881#[derive(Debug, Clone, Deserialize, Serialize)]
882#[serde(rename_all = "PascalCase")]
883pub struct ServerSideEncryptionByDefault {
884    #[serde(rename = "SSEAlgorithm")]
885    pub ssealgorithm: String,
886    #[serde(rename = " KMSMasterKeyID")]
887    pub kmsmaster_key_id: Option<String>,
888}
889
890/// Root level tag for the ServerSideEncryptionConfiguration parameters
891#[derive(Debug, Clone, Deserialize, Serialize)]
892#[serde(rename_all = "PascalCase")]
893pub struct ServerSideEncryptionConfiguration {
894    #[serde(rename = "Rule")]
895    pub rules: Vec<ServerSideEncryptionRule>,
896}
897
898/// Specifies the default server-side encryption configuration.
899#[derive(Debug, Clone, Deserialize, Serialize)]
900#[serde(rename_all = "PascalCase")]
901pub struct ServerSideEncryptionRule {
902    pub apply_server_side_encryption_by_default: ServerSideEncryptionByDefault,
903    #[serde(default)]
904    pub bucket_key_enabled: bool,
905}
906
907/// A container that describes additional filters for identifying the source objects that you want to replicate.
908#[derive(Debug, Clone, Deserialize, Serialize)]
909#[serde(rename_all = "PascalCase")]
910pub struct SourceSelectionCriteria {
911    pub replica_modifications: Option<ReplicaModifications>,
912    pub sse_kms_encrypted_objects: Option<SseKmsEncryptedObjects>,
913}
914
915/// Container for the stats details.
916#[derive(Debug, Clone, Deserialize, Serialize)]
917#[serde(rename_all = "PascalCase")]
918pub struct Stats {
919    /// The total number of uncompressed object bytes processed.
920    pub bytes_processed: u64,
921    /// The total number of bytes of records payload data returned.
922    pub bytes_returned: u64,
923    /// The total number of object bytes scanned.
924    pub bytes_scanned: u64,
925}
926
927/// A container of a key value name pair.
928#[derive(Debug, Clone, Deserialize, Serialize)]
929#[serde(rename_all = "PascalCase")]
930pub struct Tag {
931    /// Name of the tag.
932    pub key: String,
933    /// Value of the tag.
934    pub value: String,
935}
936
937/// A collection for a set of tags
938#[derive(Debug, Clone, Deserialize, Serialize)]
939#[serde(rename_all = "PascalCase")]
940pub struct TagSet {
941    /// Array of [Tag]
942    #[serde(rename = "Tag", default)]
943    pub tags: Vec<Tag>,
944}
945
946/// Container for TagSet elements.
947#[derive(Debug, Clone, Deserialize, Serialize)]
948#[serde(rename_all = "PascalCase")]
949pub struct Tagging {
950    /// A collection for a set of tags.
951    pub tag_set: TagSet,
952}
953
954/// Specifies when an object transitions to a specified storage class.
955#[derive(Debug, Clone, Deserialize, Serialize)]
956#[serde(rename_all = "PascalCase")]
957pub struct Transition {
958    /// Indicates when objects are transitioned to the specified storage class.
959    /// The date value must be in ISO 8601 format. The time is always midnight UTC.
960    pub date: Option<String>,
961    /// Indicates the number of days after creation when objects are transitioned to the specified storage class.
962    pub days: Option<i32>,
963    /// The storage class to which you want the object to transition.
964    pub storage_class: Option<StorageClass>,
965}
966
967/// Describes the versioning state of an Amazon S3 bucket.
968#[derive(Debug, Clone, Deserialize, Serialize)]
969#[serde(rename_all = "PascalCase")]
970pub struct VersioningConfiguration {
971    /// Specifies whether MFA delete is enabled in the bucket versioning configuration.
972    /// This element is only returned if the bucket has been configured with MFA delete.
973    /// If the bucket has never been so configured, this element is not returned.
974    ///
975    /// Valid Values: Enabled | Disabled
976    pub mfa_delete: Option<MFADelete>,
977
978    /// The versioning state of the bucket.
979    ///
980    /// Valid Values: Enabled | Suspended
981    pub status: Option<VersioningStatus>,
982}
983
984///  WebsiteConfiguration parameters.
985#[derive(Debug, Clone, Deserialize, Serialize)]
986#[serde(rename_all = "PascalCase")]
987pub struct WebsiteConfiguration {
988    pub error_document: Option<ErrorDocument>,
989    pub index_document: IndexDocument,
990    pub redirect_all_requests_to: Option<RedirectAllRequestsTo>,
991    #[serde(default)]
992    pub routing_rules: RoutingRules,
993}
994
995//////////////////  Enum Type
996
997#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
998pub enum ChecksumAlgorithm {
999    CRC32,
1000    CRC32C,
1001    SHA1,
1002    SHA256,
1003}
1004
1005/// Type of grantee
1006#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
1007pub enum GranteeType {
1008    CanonicalUser,
1009    AmazonCustomerByEmail,
1010    Group,
1011}
1012
1013#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
1014pub enum LegalHoldStatus {
1015    ON,
1016    OFF,
1017}
1018
1019/// Specifies whether MFA delete is enabled in the bucket versioning configuration.
1020/// This element is only returned if the bucket has been configured with MFA delete.
1021/// If the bucket has never been so configured, this element is not returned.
1022#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
1023pub enum MFADelete {
1024    Enabled,
1025    Disabled,
1026}
1027
1028#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
1029pub enum Protocol {
1030    http,
1031    https,
1032}
1033
1034/// Retention mode, Valid Values: `GOVERNANCE | COMPLIANCE`
1035#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Default)]
1036pub enum RetentionMode {
1037    #[default]
1038    GOVERNANCE,
1039    COMPLIANCE,
1040}
1041
1042/// The permission given to the grantee.. Valid Values: `FULL_CONTROL | WRITE | WRITE_ACP | READ | READ_ACP`
1043#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
1044pub enum Permission {
1045    FULL_CONTROL,
1046    WRITE,
1047    WRITE_ACP,
1048    READ,
1049    READ_ACP,
1050}
1051
1052/// Valid Values: `Enabled | Disabled`
1053#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
1054pub enum Status {
1055    Enabled,
1056    Disabled,
1057}
1058
1059/// The storage class to use when replicating objects, such as S3 Standard or reduced redundancy.
1060/// By default, Amazon S3 uses the storage class of the source object to create the object replica.
1061#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
1062pub enum StorageClass {
1063    STANDARD,
1064    REDUCED_REDUNDANCY,
1065    STANDARD_IA,
1066    ONEZONE_IA,
1067    INTELLIGENT_TIERING,
1068    GLACIER,
1069    DEEP_ARCHIVE,
1070    OUTPOSTS,
1071    GLACIER_IR,
1072    SNOW,
1073    EXPRESS_ONEZONE,
1074}
1075
1076/// The versioning state of the bucket.
1077#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
1078pub enum VersioningStatus {
1079    Enabled,
1080    Suspended,
1081}