]> git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/rgw_bucket_encryption.h
import quincy 17.2.0
[ceph.git] / ceph / src / rgw / rgw_bucket_encryption.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab ft=cpp
3
4 #pragma once
5 #include <include/types.h>
6
7 class XMLObj;
8
9 class ApplyServerSideEncryptionByDefault
10 {
11 std::string kmsMasterKeyID;
12 std::string sseAlgorithm;
13
14 public:
15 ApplyServerSideEncryptionByDefault(): kmsMasterKeyID(""), sseAlgorithm("") {};
16
17 const std::string& kms_master_key_id() const {
18 return kmsMasterKeyID;
19 }
20
21 const std::string& sse_algorithm() const {
22 return sseAlgorithm;
23 }
24
25 void encode(bufferlist& bl) const {
26 ENCODE_START(1, 1, bl);
27 encode(kmsMasterKeyID, bl);
28 encode(sseAlgorithm, bl);
29 ENCODE_FINISH(bl);
30 }
31
32 void decode(bufferlist::const_iterator& bl) {
33 DECODE_START(1, bl);
34 decode(kmsMasterKeyID, bl);
35 decode(sseAlgorithm, bl);
36 DECODE_FINISH(bl);
37 }
38
39 void decode_xml(XMLObj *obj);
40 void dump_xml(Formatter *f) const;
41 };
42 WRITE_CLASS_ENCODER(ApplyServerSideEncryptionByDefault)
43
44 class ServerSideEncryptionConfiguration
45 {
46 protected:
47 ApplyServerSideEncryptionByDefault applyServerSideEncryptionByDefault;
48 bool bucketKeyEnabled;
49
50 public:
51 ServerSideEncryptionConfiguration(): bucketKeyEnabled(false) {};
52
53 const std::string& kms_master_key_id() const {
54 return applyServerSideEncryptionByDefault.kms_master_key_id();
55 }
56
57 const std::string& sse_algorithm() const {
58 return applyServerSideEncryptionByDefault.sse_algorithm();
59 }
60
61 bool bucket_key_enabled() const {
62 return bucketKeyEnabled;
63 }
64
65 void encode(bufferlist& bl) const {
66 ENCODE_START(1, 1, bl);
67 encode(applyServerSideEncryptionByDefault, bl);
68 encode(bucketKeyEnabled, bl);
69 ENCODE_FINISH(bl);
70 }
71
72 void decode(bufferlist::const_iterator& bl) {
73 DECODE_START(1, bl);
74 decode(applyServerSideEncryptionByDefault, bl);
75 decode(bucketKeyEnabled, bl);
76 DECODE_FINISH(bl);
77 }
78
79 void decode_xml(XMLObj *obj);
80 void dump_xml(Formatter *f) const;
81 };
82 WRITE_CLASS_ENCODER(ServerSideEncryptionConfiguration)
83
84 class RGWBucketEncryptionConfig
85 {
86 protected:
87 bool rule_exist;
88 ServerSideEncryptionConfiguration rule;
89
90 public:
91 RGWBucketEncryptionConfig(): rule_exist(false) {}
92
93 const std::string& kms_master_key_id() const {
94 return rule.kms_master_key_id();
95 }
96
97 const std::string& sse_algorithm() const {
98 return rule.sse_algorithm();
99 }
100
101 bool bucket_key_enabled() const {
102 return rule.bucket_key_enabled();
103 }
104
105 bool has_rule() const {
106 return rule_exist;
107 }
108
109 void encode(bufferlist& bl) const {
110 ENCODE_START(1, 1, bl);
111 encode(rule_exist, bl);
112 if (rule_exist) {
113 encode(rule, bl);
114 }
115 ENCODE_FINISH(bl);
116 }
117
118 void decode(bufferlist::const_iterator& bl) {
119 DECODE_START(1, bl);
120 decode(rule_exist, bl);
121 if (rule_exist) {
122 decode(rule, bl);
123 }
124 DECODE_FINISH(bl);
125 }
126
127 void decode_xml(XMLObj *obj);
128 void dump_xml(Formatter *f) const;
129 };
130 WRITE_CLASS_ENCODER(RGWBucketEncryptionConfig)