diff options
author | Yehuda Sadeh <yehuda@redhat.com> | 2015-03-23 08:06:18 +0100 |
---|---|---|
committer | Robin H. Johnson <robin.johnson@dreamhost.com> | 2015-08-24 23:27:47 +0200 |
commit | 33c57102a914e43b57d189835e0036087469417e (patch) | |
tree | d46c41260808b8f4010329380310e940644d785a /src/rgw/rgw_xml_enc.cc | |
parent | rgw: add xml encoders for website conf (diff) | |
download | ceph-33c57102a914e43b57d189835e0036087469417e.tar.xz ceph-33c57102a914e43b57d189835e0036087469417e.zip |
rgw: set bucket website operation
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
Diffstat (limited to 'src/rgw/rgw_xml_enc.cc')
-rw-r--r-- | src/rgw/rgw_xml_enc.cc | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/rgw/rgw_xml_enc.cc b/src/rgw/rgw_xml_enc.cc index 3b604c8b002..9a94dcdb432 100644 --- a/src/rgw/rgw_xml_enc.cc +++ b/src/rgw/rgw_xml_enc.cc @@ -25,6 +25,16 @@ void RGWBWRedirectInfo::dump_xml(Formatter *f) const } } +void RGWBWRedirectInfo::decode_xml(XMLObj *obj) { + RGWXMLDecoder::decode_xml("Protocol", redirect.protocol, obj); + RGWXMLDecoder::decode_xml("Hostname", redirect.hostname, obj); + int code = 0; + RGWXMLDecoder::decode_xml("HttpRedirectCode", code, obj); + redirect.http_redirect_code = code; + RGWXMLDecoder::decode_xml("ReplaceKeyPrefixWith", replace_key_prefix_with, obj); + RGWXMLDecoder::decode_xml("ReplcaeKeyWith", replace_key_with, obj); +} + void RGWBWRoutingRuleCondition::dump_xml(Formatter *f) const { if (!key_prefix_equals.empty()) { @@ -35,12 +45,24 @@ void RGWBWRoutingRuleCondition::dump_xml(Formatter *f) const } } +void RGWBWRoutingRuleCondition::decode_xml(XMLObj *obj) { + RGWXMLDecoder::decode_xml("KeyPrefixEquals", key_prefix_equals, obj); + int code = 0; + RGWXMLDecoder::decode_xml("HttpErrorCodeReturnedEquals", code, obj); + http_error_code_returned_equals = code; +} + void RGWBWRoutingRule::dump_xml(Formatter *f) const { encode_xml("Condition", condition, f); encode_xml("Redirect", redirect_info, f); } +void RGWBWRoutingRule::decode_xml(XMLObj *obj) { + RGWXMLDecoder::decode_xml("Condition", condition, obj); + RGWXMLDecoder::decode_xml("Redirect", redirect_info, obj); +} + static void encode_xml(const char *name, const std::list<RGWBWRoutingRule>& l, ceph::Formatter *f) { do_encode_xml("RoutingRules", l, "RoutingRule", f); @@ -63,3 +85,20 @@ void RGWBucketWebsiteConf::dump_xml(Formatter *f) const } } +void decode_xml_obj(list<RGWBWRoutingRule>& l, XMLObj *obj) +{ + do_decode_xml_obj(l, "RoutingRule", obj); +} + +void RGWBucketWebsiteConf::decode_xml(XMLObj *obj) { + XMLObj *o = obj->find_first("IndexDocument"); + if (o) { + RGWXMLDecoder::decode_xml("Suffix", index_doc_suffix, obj); + } + o = obj->find_first("ErrorDocument"); + if (o) { + RGWXMLDecoder::decode_xml("Key", error_doc, obj); + } + RGWXMLDecoder::decode_xml("RoutingRules", routing_rules.rules, obj); +} + |