Unverified Commit 48be48c7 authored by Nugine's avatar Nugine
Browse files

s3s: dto: Event

parent b783574b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ pub fn collect_rust_types(model: &smithy::Model, ops: &Operations) -> RustTypes
            "CopySource",                     //
            "Range",                          //
            "ContentType",                    //
            "Event",                          //
        ];

        if provided_types.contains(&name.as_str()) {
+7 −3
Original line number Diff line number Diff line
@@ -223,7 +223,7 @@ fn codegen_xml_ser(ops: &Operations, rust_types: &RustTypes, g: &mut Codegen) {
                }
            }
            rust::Type::Provided(ty) => {
                assert_eq!(ty.name, "Body");
                assert!(matches!(ty.name.as_str(), "Body" | "Event"));
            }
            rust::Type::Map(_) => unimplemented!(),
            rust::Type::Timestamp(_) => {}
@@ -405,7 +405,9 @@ fn codegen_xml_de(ops: &Operations, rust_types: &RustTypes, g: &mut Codegen) {
                    q.push_back(variant.type_.as_str());
                }
            }
            rust::Type::Provided(_) => unimplemented!(),
            rust::Type::Provided(ty) => {
                assert!(matches!(ty.name.as_str(), "Event"));
            }
            rust::Type::Map(_) => unimplemented!(),
            rust::Type::Timestamp(_) => {}
        }
@@ -513,7 +515,9 @@ fn codegen_xml_de(ops: &Operations, rust_types: &RustTypes, g: &mut Codegen) {
            }

            rust::Type::Alias(_) => {}
            rust::Type::Provided(_) => panic!(),
            rust::Type::Provided(ty) => {
                assert!(matches!(ty.name.as_str(), "Event"));
            }
            rust::Type::List(_) => panic!(),
            rust::Type::Map(_) => panic!(),
            rust::Type::Timestamp(_) => {}
+20 −1
Original line number Diff line number Diff line
@@ -3,6 +3,8 @@
use crate::http;
use crate::path;

use std::fmt::Write;

/// x-amz-copy-source
#[derive(Debug)]
pub enum CopySource {
@@ -54,7 +56,7 @@ impl CopySource {
    pub fn parse(header: &str) -> Result<Self, ParseCopySourceError> {
        let header = urlencoding::decode(header).map_err(|_| ParseCopySourceError::InvalidEncoding)?;

        // TODO: support access point
        // FIXME: support access point
        match header.split_once('/') {
            None => Err(ParseCopySourceError::PatternMismatch),
            Some((bucket, remaining)) => {
@@ -84,6 +86,23 @@ impl CopySource {
            }
        }
    }

    #[must_use]
    pub fn format_to_string(&self) -> String {
        let mut buf = String::new();
        match self {
            CopySource::Bucket { bucket, key, version_id } => {
                write!(&mut buf, "{bucket}/{key}").unwrap();
                if let Some(version_id) = version_id {
                    write!(&mut buf, "?versionId={version_id}").unwrap();
                }
            }
            CopySource::AccessPoint { .. } => {
                unimplemented!()
            }
        }
        buf
    }
}

impl http::TryFromHeaderValue for CopySource {
+20 −0
Original line number Diff line number Diff line
#[derive(Debug)]
pub struct Event(String);

impl From<String> for Event {
    fn from(value: String) -> Self {
        Self(value)
    }
}

impl AsRef<str> for Event {
    fn as_ref(&self) -> &str {
        self.0.as_ref()
    }
}

impl From<Event> for String {
    fn from(value: Event) -> Self {
        value.0
    }
}
+0 −3
Original line number Diff line number Diff line
@@ -3814,9 +3814,6 @@ pub type ErrorMessage = String;

pub type Errors = List<Error>;

/// <p>The bucket event for which to send notifications.</p>
pub type Event = String;

/// <p>A container for specifying the configuration for Amazon EventBridge.</p>
#[derive(Debug, Default)]
pub struct EventBridgeConfiguration {}
Loading