if (lc_id){
id = lc_id->get_data();
} else {
- gen_rand_alphanumeric_lower(nullptr, &id, LC_ID_LENGTH);
+ gen_rand_alphanumeric_lower(cct, &id, LC_ID_LENGTH);
}
return true;
}
-void LCRule_S3::to_xml(CephContext *cct, ostream& out) {
+void LCRule_S3::to_xml(ostream& out) {
out << "<Rule>" ;
out << "<ID>" << id << "</ID>";
if (!filter.empty()) {
if (strcmp(el, "LifecycleConfiguration") == 0) {
obj = new RGWLifecycleConfiguration_S3(cct);
} else if (strcmp(el, "Rule") == 0) {
- obj = new LCRule_S3();
+ obj = new LCRule_S3(cct);
} else if (strcmp(el, "ID") == 0) {
obj = new LCID_S3();
} else if (strcmp(el, "Prefix") == 0) {
class LCRule_S3 : public LCRule, public XMLObj
{
+private:
+ CephContext *cct;
public:
- LCRule_S3() {}
+ LCRule_S3(): cct(nullptr) {}
+ LCRule_S3(CephContext *_cct): cct(_cct) {}
~LCRule_S3() override {}
- void to_xml(CephContext *cct, ostream& out);
+ void to_xml(ostream& out);
bool xml_end(const char *el) override;
bool xml_start(const char *el, const char **attr);
void dump_xml(Formatter *f) const {
f->close_section(); // Rule
}
+
+ void set_ctx(CephContext *ctx) {
+ cct = ctx;
+ }
};
class RGWLCXMLParser_S3 : public RGWXMLParser
multimap<string, LCRule>::iterator iter;
for (iter = rule_map.begin(); iter != rule_map.end(); ++iter) {
LCRule_S3& rule = static_cast<LCRule_S3&>(iter->second);
- rule.to_xml(cct, out);
+ rule.to_xml(out);
}
out << "</LifecycleConfiguration>";
}