Loading codegen/src/dto.rs +1 −0 Original line number Diff line number Diff line Loading @@ -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()) { Loading codegen/src/ops.rs +7 −3 Original line number Diff line number Diff line Loading @@ -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(_) => {} Loading Loading @@ -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(_) => {} } Loading Loading @@ -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(_) => {} Loading crates/s3s/src/dto/copy_source.rs +20 −1 Original line number Diff line number Diff line Loading @@ -3,6 +3,8 @@ use crate::http; use crate::path; use std::fmt::Write; /// x-amz-copy-source #[derive(Debug)] pub enum CopySource { Loading Loading @@ -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)) => { Loading Loading @@ -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 { Loading crates/s3s/src/dto/event.rs 0 → 100644 +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 } } crates/s3s/src/dto/generated.rs +0 −3 Original line number Diff line number Diff line Loading @@ -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 Loading
codegen/src/dto.rs +1 −0 Original line number Diff line number Diff line Loading @@ -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()) { Loading
codegen/src/ops.rs +7 −3 Original line number Diff line number Diff line Loading @@ -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(_) => {} Loading Loading @@ -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(_) => {} } Loading Loading @@ -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(_) => {} Loading
crates/s3s/src/dto/copy_source.rs +20 −1 Original line number Diff line number Diff line Loading @@ -3,6 +3,8 @@ use crate::http; use crate::path; use std::fmt::Write; /// x-amz-copy-source #[derive(Debug)] pub enum CopySource { Loading Loading @@ -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)) => { Loading Loading @@ -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 { Loading
crates/s3s/src/dto/event.rs 0 → 100644 +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 } }
crates/s3s/src/dto/generated.rs +0 −3 Original line number Diff line number Diff line Loading @@ -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