1 #ifndef CEPH_RGW_LC_S3_H
2 #define CEPH_RGW_LC_S3_H
7 #include <include/types.h>
11 #include "include/str_list.h"
19 class LCID_S3
: public XMLObj
23 ~LCID_S3() override
{}
24 string
& to_str() { return data
; }
27 class LCPrefix_S3
: public XMLObj
31 ~LCPrefix_S3() override
{}
32 string
& to_str() { return data
; }
35 class LCStatus_S3
: public XMLObj
39 ~LCStatus_S3() override
{}
40 string
& to_str() { return data
; }
43 class LCDays_S3
: public XMLObj
47 ~LCDays_S3() override
{}
48 string
& to_str() { return data
; }
51 class LCExpiration_S3
: public LCExpiration
, public XMLObj
55 ~LCExpiration_S3() override
{}
57 bool xml_end(const char *el
) override
;
58 void to_xml(ostream
& out
) {
59 out
<< "<Expiration>" << "<Days>" << days
<< "</Days>"<< "</Expiration>";
61 void dump_xml(Formatter
*f
) const {
62 f
->open_object_section("Expiration");
63 encode_xml("Days", days
, f
);
64 f
->close_section(); // Expiration
68 class LCNoncurExpiration_S3
: public LCExpiration
, public XMLObj
71 LCNoncurExpiration_S3() {}
72 ~LCNoncurExpiration_S3() override
{}
74 bool xml_end(const char *el
) override
;
75 void to_xml(ostream
& out
) {
76 out
<< "<NoncurrentVersionExpiration>" << "<NoncurrentDays>" << days
<< "</NoncurrentDays>"<< "</NoncurrentVersionExpiration>";
78 void dump_xml(Formatter
*f
) const {
79 f
->open_object_section("NoncurrentVersionExpiration");
80 encode_xml("NoncurrentDays", days
, f
);
85 class LCMPExpiration_S3
: public LCExpiration
, public XMLObj
88 LCMPExpiration_S3() {}
89 ~LCMPExpiration_S3() {}
91 bool xml_end(const char *el
);
92 void to_xml(ostream
& out
) {
93 out
<< "<AbortIncompleteMultipartUpload>" << "<DaysAfterInitiation>" << days
<< "</DaysAfterInitiation>" << "</AbortIncompleteMultipartUpload>";
95 void dump_xml(Formatter
*f
) const {
96 f
->open_object_section("AbortIncompleteMultipartUpload");
97 encode_xml("DaysAfterInitiation", days
, f
);
102 class LCRule_S3
: public LCRule
, public XMLObj
106 ~LCRule_S3() override
{}
108 void to_xml(CephContext
*cct
, ostream
& out
);
109 bool xml_end(const char *el
) override
;
110 bool xml_start(const char *el
, const char **attr
);
111 void dump_xml(Formatter
*f
) const {
112 f
->open_object_section("Rule");
113 encode_xml("ID", id
, f
);
114 encode_xml("Prefix", prefix
, f
);
115 encode_xml("Status", status
, f
);
116 if (!expiration
.empty()) {
117 const LCExpiration_S3
& expir
= static_cast<const LCExpiration_S3
&>(expiration
);
120 if (!noncur_expiration
.empty()) {
121 const LCNoncurExpiration_S3
& noncur_expir
= static_cast<const LCNoncurExpiration_S3
&>(noncur_expiration
);
122 noncur_expir
.dump_xml(f
);
124 if (!mp_expiration
.empty()) {
125 const LCMPExpiration_S3
& mp_expir
= static_cast<const LCMPExpiration_S3
&>(mp_expiration
);
126 mp_expir
.dump_xml(f
);
128 f
->close_section(); // Rule
132 class RGWLCXMLParser_S3
: public RGWXMLParser
136 XMLObj
*alloc_obj(const char *el
) override
;
138 RGWLCXMLParser_S3(CephContext
*_cct
) : cct(_cct
) {}
141 class RGWLifecycleConfiguration_S3
: public RGWLifecycleConfiguration
, public XMLObj
144 RGWLifecycleConfiguration_S3(CephContext
*_cct
) : RGWLifecycleConfiguration(_cct
) {}
145 RGWLifecycleConfiguration_S3() : RGWLifecycleConfiguration(NULL
) {}
146 ~RGWLifecycleConfiguration_S3() override
{}
148 bool xml_end(const char *el
) override
;
150 void to_xml(ostream
& out
) {
151 out
<< "<LifecycleConfiguration xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\">";
152 multimap
<string
, LCRule
>::iterator iter
;
153 for (iter
= rule_map
.begin(); iter
!= rule_map
.end(); ++iter
) {
154 LCRule_S3
& rule
= static_cast<LCRule_S3
&>(iter
->second
);
155 rule
.to_xml(cct
, out
);
157 out
<< "</LifecycleConfiguration>";
159 int rebuild(RGWRados
*store
, RGWLifecycleConfiguration
& dest
);
160 void dump_xml(Formatter
*f
) const;