mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-08-12 15:26:52 +00:00
Add basic support for the "Versioning" command
This commit is contained in:
@@ -195,6 +195,14 @@ pub struct ListBucketResult {
|
||||
pub common_prefixes: Vec<CommonPrefix>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, PartialEq)]
|
||||
pub struct VersioningConfiguration {
|
||||
#[serde(serialize_with = "xmlns_tag")]
|
||||
pub xmlns: (),
|
||||
#[serde(rename = "Status")]
|
||||
pub status: Option<Value>,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -279,6 +287,30 @@ mod tests {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn get_bucket_versioning_result() -> Result<(), ApiError> {
|
||||
let get_bucket_versioning = VersioningConfiguration {
|
||||
xmlns: (),
|
||||
status: None,
|
||||
};
|
||||
assert_eq!(
|
||||
to_xml_with_header(&get_bucket_versioning)?,
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\
|
||||
<VersioningConfiguration xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\"/>"
|
||||
);
|
||||
let get_bucket_versioning2 = VersioningConfiguration {
|
||||
xmlns: (),
|
||||
status: Some(Value("Suspended".to_string())),
|
||||
};
|
||||
assert_eq!(
|
||||
to_xml_with_header(&get_bucket_versioning2)?,
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\
|
||||
<VersioningConfiguration xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\"><Status>Suspended</Status></VersioningConfiguration>"
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn delete_result() -> Result<(), ApiError> {
|
||||
let delete_result = DeleteResult {
|
||||
|
||||
Reference in New Issue
Block a user