Skip to main content

s3_wire/operation/multipart/
listing.rs

1use super::UploadId;
2use crate::operation::{ObjectKey, PageSize, RequestIds};
3
4/// Request for one page of in-progress multipart uploads.
5#[derive(Clone, Debug, Default, Eq, PartialEq)]
6pub struct ListMultipartUploadsRequest {
7    /// Only uploads with keys beginning with this prefix are returned.
8    pub prefix: Option<String>,
9    /// Groups upload keys using this delimiter.
10    pub delimiter: Option<String>,
11    /// Key marker from a preceding response.
12    pub key_marker: Option<String>,
13    /// Upload-ID marker from a preceding response.
14    pub upload_id_marker: Option<UploadId>,
15    /// Maximum uploads requested from the service.
16    pub max_uploads: PageSize,
17}
18
19/// One in-progress multipart upload returned by the service.
20#[derive(Clone, Debug, Eq, PartialEq)]
21pub struct MultipartUploadEntry {
22    /// Destination object key.
23    pub key: ObjectKey,
24    /// Opaque upload identifier.
25    upload_id: UploadId,
26    /// Initiation time.
27    pub initiated: Option<time::OffsetDateTime>,
28    /// Storage class, when supplied.
29    pub storage_class: Option<String>,
30}
31
32impl MultipartUploadEntry {
33    pub(crate) fn new(
34        key: ObjectKey,
35        upload_id: UploadId,
36        initiated: Option<time::OffsetDateTime>,
37        storage_class: Option<String>,
38    ) -> Self {
39        Self {
40            key,
41            upload_id,
42            initiated,
43            storage_class,
44        }
45    }
46
47    /// Returns the validated upload identifier.
48    pub const fn upload_id(&self) -> &UploadId {
49        &self.upload_id
50    }
51}
52
53/// One page of in-progress multipart uploads.
54#[derive(Clone, Debug, Default, Eq, PartialEq)]
55pub struct ListMultipartUploadsOutput {
56    /// Upload entries.
57    pub uploads: Vec<MultipartUploadEntry>,
58    /// Grouped key prefixes.
59    pub common_prefixes: Vec<String>,
60    /// Whether another page exists.
61    pub is_truncated: bool,
62    /// Key marker for the next page.
63    pub next_key_marker: Option<String>,
64    /// Upload-ID marker for the next page.
65    pub next_upload_id_marker: Option<UploadId>,
66    /// Service request identifiers.
67    pub request_ids: RequestIds,
68}