]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/rgw_tag_s3.cc
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
8 #include "include/types.h"
10 #include "rgw_tag_s3.h"
12 void RGWObjTagEntry_S3::decode_xml(XMLObj
*obj
) {
13 RGWXMLDecoder::decode_xml("Key", key
, obj
, true);
14 RGWXMLDecoder::decode_xml("Value", val
, obj
, true);
17 void RGWObjTagEntry_S3::dump_xml(Formatter
*f
) const {
18 encode_xml("Key", key
, f
);
19 encode_xml("Value", val
, f
);
22 throw RGWXMLDecoder::err("empty key");
26 throw RGWXMLDecoder::err("empty val");
30 void RGWObjTagSet_S3::decode_xml(XMLObj
*obj
) {
31 vector
<RGWObjTagEntry_S3
> entries
;
33 RGWXMLDecoder::decode_xml("Tag", entries
, obj
, true);
35 for (auto& entry
: entries
) {
36 const std::string
& key
= entry
.get_key();
37 const std::string
& val
= entry
.get_val();
38 if (!add_tag(key
,val
)) {
39 throw RGWXMLDecoder::err("failed to add tag");
44 int RGWObjTagSet_S3::rebuild(RGWObjTags
& dest
) {
46 for (const auto &it
: tag_map
){
47 ret
= dest
.check_and_add_tag(it
.first
, it
.second
);
54 void RGWObjTagging_S3::decode_xml(XMLObj
*obj
) {
55 RGWXMLDecoder::decode_xml("TagSet", tagset
, obj
, true);
58 void RGWObjTagSet_S3::dump_xml(Formatter
*f
) const {
59 for (const auto& tag
: tag_map
){
60 Formatter::ObjectSection
os(*f
, "Tag");
61 encode_xml("Key", tag
.first
, f
);
62 encode_xml("Value", tag
.second
, f
);