Also updates the location of Prefix, which is supposed to *generate*
as <Filter><Prefix/></Filter>, regardless of how we parsed it.
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
(cherry picked from commit
313a8a4db76842385a2da873832282fca2434c01)
{
f->dump_string("prefix", prefix);
f->dump_object("obj_tags", obj_tags);
+ if (have_flag(LCFlagType::ArchiveZone)) {
+ f->dump_string("archivezone", "");
+ }
}
void LCExpiration::dump(Formatter *f) const
}
bool empty() const {
- return !(has_prefix() || has_tags());
+ return !(has_prefix() || has_tags() || has_flags());
}
// Determine if we need AND tag when creating xml
bool has_multi_condition() const {
- if (obj_tags.count() > 1)
+ if (obj_tags.count() + int(has_prefix()) > 1) // Prefix is a member of Filter
return true;
return false;
}
return !obj_tags.empty();
}
+ bool has_flags() const {
+ return !(flags == uint32_t(LCFlagType::none));
+ }
+
+ bool have_flag(LCFlagType flag) const {
+ return flags & make_flag(flag);
+ }
+
void encode(bufferlist& bl) const {
ENCODE_START(3, 1, bl);
encode(prefix, bl);
void LCFilter_S3::dump_xml(Formatter *f) const
{
- if (has_prefix()) {
- encode_xml("Prefix", prefix, f);
- }
bool multi = has_multi_condition();
if (multi) {
f->open_array_section("And");
}
+ if (has_prefix()) {
+ encode_xml("Prefix", prefix, f);
+ }
if (has_tags()) {
const auto& tagset_s3 = static_cast<const RGWObjTagSet_S3 &>(obj_tags);
tagset_s3.dump_xml(f);
}
+ if (has_flags()) {
+ if (have_flag(LCFlagType::ArchiveZone)) {
+ encode_xml("ArchiveZone", "", f);
+ }
+ }
if (multi) {
- f->close_section();
+ f->close_section(); // And
}
}