Skip to content

Commit d52a9d6

Browse files
authored
Merge pull request ceph#55796 from kchheda3/wip-fix-filterrule-json
rgw/notification: Fix the notification FilterRule to emit unique key name in json & Log successful delivery of notification event. Reviewed-by: Yuval Lifshitz <[email protected]>
2 parents fae9b9a + 0c37788 commit d52a9d6

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/rgw/rgw_pubsub.cc

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,24 @@ void set_event_id(std::string& id, const std::string& hash, const utime_t& ts) {
5050
}
5151

5252
void rgw_s3_key_filter::dump(Formatter *f) const {
53+
if (!has_content()) {
54+
return;
55+
}
56+
f->open_array_section("FilterRules");
5357
if (!prefix_rule.empty()) {
54-
f->open_object_section("FilterRule");
58+
f->open_object_section("");
5559
::encode_json("Name", "prefix", f);
5660
::encode_json("Value", prefix_rule, f);
5761
f->close_section();
5862
}
5963
if (!suffix_rule.empty()) {
60-
f->open_object_section("FilterRule");
64+
f->open_object_section("");
6165
::encode_json("Name", "suffix", f);
6266
::encode_json("Value", suffix_rule, f);
6367
f->close_section();
6468
}
6569
if (!regex_rule.empty()) {
66-
f->open_object_section("FilterRule");
70+
f->open_object_section("");
6771
::encode_json("Name", "regex", f);
6872
::encode_json("Value", regex_rule, f);
6973
f->close_section();
@@ -124,8 +128,12 @@ bool rgw_s3_key_filter::has_content() const {
124128
}
125129

126130
void rgw_s3_key_value_filter::dump(Formatter *f) const {
131+
if (!has_content()) {
132+
return;
133+
}
134+
f->open_array_section("FilterRules");
127135
for (const auto& key_value : kv) {
128-
f->open_object_section("FilterRule");
136+
f->open_object_section("");
129137
::encode_json("Name", key_value.first, f);
130138
::encode_json("Value", key_value.second, f);
131139
f->close_section();

0 commit comments

Comments
 (0)