1616#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_BUCKET_ENCRYPTION_H
1717
1818#include " google/cloud/storage/version.h"
19+ #include " google/cloud/internal/format_time_point.h"
20+ #include < chrono>
21+ #include < iosfwd>
22+ #include < iostream>
23+ #include < string>
24+ #include < tuple>
1925#include < utility>
2026
2127namespace google {
@@ -31,22 +37,144 @@ struct GoogleManagedEncryptionEnforcementConfig {
3137 std::chrono::system_clock::time_point effective_time;
3238};
3339
40+ // /@{
41+ // / @name Comparison operators For GoogleManagedEncryptionEnforcementConfig
3442inline bool operator ==(GoogleManagedEncryptionEnforcementConfig const & lhs,
3543 GoogleManagedEncryptionEnforcementConfig const & rhs) {
36- return std::tie (lhs.restriction_mode , lhs.effective_time ) ==
37- std::tie (rhs.restriction_mode , rhs.effective_time );
38- }
44+ return std::tie (lhs.restriction_mode , lhs.effective_time ) ==
45+ std::tie (rhs.restriction_mode , rhs.effective_time );
46+ }
3947
4048inline bool operator <(GoogleManagedEncryptionEnforcementConfig const & lhs,
4149 GoogleManagedEncryptionEnforcementConfig const & rhs) {
42- return std::tie (lhs.restriction_mode , lhs.effective_time ) <
43- std::tie (rhs.restriction_mode , rhs.effective_time );
44- }
50+ return std::tie (lhs.restriction_mode , lhs.effective_time ) <
51+ std::tie (rhs.restriction_mode , rhs.effective_time );
52+ }
4553
4654inline bool operator !=(GoogleManagedEncryptionEnforcementConfig const & lhs,
4755 GoogleManagedEncryptionEnforcementConfig const & rhs) {
48-
49- }
56+ return std::rel_ops::operator !=(lhs, rhs);
57+ }
58+
59+ inline bool operator >(GoogleManagedEncryptionEnforcementConfig const & lhs,
60+ GoogleManagedEncryptionEnforcementConfig const & rhs) {
61+ return std::rel_ops::operator >(lhs, rhs);
62+ }
63+
64+ inline bool operator <=(GoogleManagedEncryptionEnforcementConfig const & lhs,
65+ GoogleManagedEncryptionEnforcementConfig const & rhs) {
66+ return std::rel_ops::operator <=(lhs, rhs);
67+ }
68+
69+ inline bool operator >=(GoogleManagedEncryptionEnforcementConfig const & lhs,
70+ GoogleManagedEncryptionEnforcementConfig const & rhs) {
71+ return std::rel_ops::operator >=(lhs, rhs);
72+ }
73+ // /@}
74+
75+ inline std::ostream& operator <<(
76+ std::ostream& os, GoogleManagedEncryptionEnforcementConfig const & rhs) {
77+ return os << " GoogleManagedEncryptionEnforcementConfig={restriction_mode="
78+ << rhs.restriction_mode << " , effective_time="
79+ << google::cloud::internal::FormatRfc3339 (rhs.effective_time )
80+ << " }" ;
81+ }
82+
83+ struct CustomerManagedEncryptionEnforcementConfig {
84+ std::string restriction_mode;
85+ std::chrono::system_clock::time_point effective_time;
86+ };
87+
88+ // /@{
89+ // / @name Comparison operators For CustomerManagedEncryptionEnforcementConfig
90+ inline bool operator ==(CustomerManagedEncryptionEnforcementConfig const & lhs,
91+ CustomerManagedEncryptionEnforcementConfig const & rhs) {
92+ return std::tie (lhs.restriction_mode , lhs.effective_time ) ==
93+ std::tie (rhs.restriction_mode , rhs.effective_time );
94+ }
95+
96+ inline bool operator <(CustomerManagedEncryptionEnforcementConfig const & lhs,
97+ CustomerManagedEncryptionEnforcementConfig const & rhs) {
98+ return std::tie (lhs.restriction_mode , lhs.effective_time ) <
99+ std::tie (rhs.restriction_mode , rhs.effective_time );
100+ }
101+
102+ inline bool operator !=(CustomerManagedEncryptionEnforcementConfig const & lhs,
103+ CustomerManagedEncryptionEnforcementConfig const & rhs) {
104+ return std::rel_ops::operator !=(lhs, rhs);
105+ }
106+
107+ inline bool operator >(CustomerManagedEncryptionEnforcementConfig const & lhs,
108+ CustomerManagedEncryptionEnforcementConfig const & rhs) {
109+ return std::rel_ops::operator >(lhs, rhs);
110+ }
111+
112+ inline bool operator <=(CustomerManagedEncryptionEnforcementConfig const & lhs,
113+ CustomerManagedEncryptionEnforcementConfig const & rhs) {
114+ return std::rel_ops::operator <=(lhs, rhs);
115+ }
116+
117+ inline bool operator >=(CustomerManagedEncryptionEnforcementConfig const & lhs,
118+ CustomerManagedEncryptionEnforcementConfig const & rhs) {
119+ return std::rel_ops::operator >=(lhs, rhs);
120+ }
121+ // /@}
122+
123+ inline std::ostream& operator <<(
124+ std::ostream& os, CustomerManagedEncryptionEnforcementConfig const & rhs) {
125+ return os << " CustomerManagedEncryptionEnforcementConfig={restriction_mode="
126+ << rhs.restriction_mode << " , effective_time="
127+ << google::cloud::internal::FormatRfc3339 (rhs.effective_time )
128+ << " }" ;
129+ }
130+
131+ struct CustomerSuppliedEncryptionEnforcementConfig {
132+ std::string restriction_mode;
133+ std::chrono::system_clock::time_point effective_time;
134+ };
135+
136+ // /@{
137+ // / @name Comparison operators For CustomerSuppliedEncryptionEnforcementConfig
138+ inline bool operator ==(CustomerSuppliedEncryptionEnforcementConfig const & lhs,
139+ CustomerSuppliedEncryptionEnforcementConfig const & rhs) {
140+ return std::tie (lhs.restriction_mode , lhs.effective_time ) ==
141+ std::tie (rhs.restriction_mode , rhs.effective_time );
142+ }
143+
144+ inline bool operator <(CustomerSuppliedEncryptionEnforcementConfig const & lhs,
145+ CustomerSuppliedEncryptionEnforcementConfig const & rhs) {
146+ return std::tie (lhs.restriction_mode , lhs.effective_time ) <
147+ std::tie (rhs.restriction_mode , rhs.effective_time );
148+ }
149+
150+ inline bool operator !=(CustomerSuppliedEncryptionEnforcementConfig const & lhs,
151+ CustomerSuppliedEncryptionEnforcementConfig const & rhs) {
152+ return std::rel_ops::operator !=(lhs, rhs);
153+ }
154+
155+ inline bool operator >(CustomerSuppliedEncryptionEnforcementConfig const & lhs,
156+ CustomerSuppliedEncryptionEnforcementConfig const & rhs) {
157+ return std::rel_ops::operator >(lhs, rhs);
158+ }
159+
160+ inline bool operator <=(CustomerSuppliedEncryptionEnforcementConfig const & lhs,
161+ CustomerSuppliedEncryptionEnforcementConfig const & rhs) {
162+ return std::rel_ops::operator <=(lhs, rhs);
163+ }
164+
165+ inline bool operator >=(CustomerSuppliedEncryptionEnforcementConfig const & lhs,
166+ CustomerSuppliedEncryptionEnforcementConfig const & rhs) {
167+ return std::rel_ops::operator >=(lhs, rhs);
168+ }
169+ // /@}
170+
171+ inline std::ostream& operator <<(
172+ std::ostream& os, CustomerSuppliedEncryptionEnforcementConfig const & rhs) {
173+ return os << " CustomerSuppliedEncryptionEnforcementConfig={restriction_mode="
174+ << rhs.restriction_mode << " , effective_time="
175+ << google::cloud::internal::FormatRfc3339 (rhs.effective_time )
176+ << " }" ;
177+ }
50178
51179/* *
52180 * Describes the default customer managed encryption key for a bucket.
@@ -62,19 +190,36 @@ inline bool operator!=(GoogleManagedEncryptionEnforcementConfig const& lhs,
62190 */
63191struct BucketEncryption {
64192 std::string default_kms_key_name;
65- GoogleManagedEncryptionEnforcementConfig google_managed_encryption_enforcement_config;
66- CustomerManagedEncryptionEnforcementConfig customer_managed_encryption_enforcement_config;
67- CustomerSuppliedEncryptionEnforcementConfig customer_supplied_encryption_enforcement_config;
193+ GoogleManagedEncryptionEnforcementConfig
194+ google_managed_encryption_enforcement_config;
195+ CustomerManagedEncryptionEnforcementConfig
196+ customer_managed_encryption_enforcement_config;
197+ CustomerSuppliedEncryptionEnforcementConfig
198+ customer_supplied_encryption_enforcement_config;
68199};
69200
70201inline bool operator ==(BucketEncryption const & lhs,
71202 BucketEncryption const & rhs) {
72- return lhs.default_kms_key_name == rhs.default_kms_key_name ;
203+ return std::tie (lhs.default_kms_key_name ,
204+ lhs.google_managed_encryption_enforcement_config ,
205+ lhs.customer_managed_encryption_enforcement_config ,
206+ lhs.customer_supplied_encryption_enforcement_config ) ==
207+ std::tie (rhs.default_kms_key_name ,
208+ rhs.google_managed_encryption_enforcement_config ,
209+ rhs.customer_managed_encryption_enforcement_config ,
210+ rhs.customer_supplied_encryption_enforcement_config );
73211}
74212
75213inline bool operator <(BucketEncryption const & lhs,
76214 BucketEncryption const & rhs) {
77- return lhs.default_kms_key_name < rhs.default_kms_key_name ;
215+ return std::tie (lhs.default_kms_key_name ,
216+ lhs.google_managed_encryption_enforcement_config ,
217+ lhs.customer_managed_encryption_enforcement_config ,
218+ lhs.customer_supplied_encryption_enforcement_config ) <
219+ std::tie (rhs.default_kms_key_name ,
220+ rhs.google_managed_encryption_enforcement_config ,
221+ rhs.customer_managed_encryption_enforcement_config ,
222+ rhs.customer_supplied_encryption_enforcement_config );
78223}
79224
80225inline bool operator !=(BucketEncryption const & lhs,
@@ -97,6 +242,17 @@ inline bool operator>=(BucketEncryption const& lhs,
97242 return std::rel_ops::operator >=(lhs, rhs);
98243}
99244
245+ inline std::ostream& operator <<(std::ostream& os, BucketEncryption const & rhs) {
246+ os << " BucketEncryption={default_kms_key_name=" << rhs.default_kms_key_name ;
247+ os << " , google_managed_encryption_enforcement_config="
248+ << rhs.google_managed_encryption_enforcement_config ;
249+ os << " , customer_managed_encryption_enforcement_config="
250+ << rhs.customer_managed_encryption_enforcement_config ;
251+ os << " , customer_supplied_encryption_enforcement_config="
252+ << rhs.customer_supplied_encryption_enforcement_config ;
253+ return os << " }" ;
254+ }
255+
100256GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
101257} // namespace storage
102258} // namespace cloud
0 commit comments