@@ -29,152 +29,95 @@ namespace cloud {
2929namespace storage {
3030GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
3131
32- /* *
33- * Google Managed Encryption (GMEK) enforcement config of a bucket.
34- */
35- struct GoogleManagedEncryptionEnforcementConfig {
36- std::string restriction_mode;
37- std::chrono::system_clock::time_point effective_time;
38- };
39-
40- // /@{
41- // / @name Comparison operators For GoogleManagedEncryptionEnforcementConfig
42- inline bool operator ==(GoogleManagedEncryptionEnforcementConfig const & lhs,
43- GoogleManagedEncryptionEnforcementConfig const & rhs) {
44- return std::tie (lhs.restriction_mode , lhs.effective_time ) ==
45- std::tie (rhs.restriction_mode , rhs.effective_time );
46- }
47-
48- inline bool operator <(GoogleManagedEncryptionEnforcementConfig const & lhs,
49- GoogleManagedEncryptionEnforcementConfig const & rhs) {
50- return std::tie (lhs.restriction_mode , lhs.effective_time ) <
51- std::tie (rhs.restriction_mode , rhs.effective_time );
52- }
53-
54- inline bool operator !=(GoogleManagedEncryptionEnforcementConfig const & lhs,
55- GoogleManagedEncryptionEnforcementConfig const & rhs) {
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- }
32+ template <typename Tag>
33+ struct EncryptionEnforcementConfigName ;
8234
83- struct CustomerManagedEncryptionEnforcementConfig {
35+ template <typename Tag>
36+ struct EncryptionEnforcementConfig {
8437 std::string restriction_mode;
8538 std::chrono::system_clock::time_point effective_time;
8639};
8740
88- // /@{
89- // / @name Comparison operators For CustomerManagedEncryptionEnforcementConfig
90- inline bool operator ==(CustomerManagedEncryptionEnforcementConfig const & lhs,
91- CustomerManagedEncryptionEnforcementConfig const & rhs) {
41+ template <typename Tag>
42+ inline bool operator ==(EncryptionEnforcementConfig<Tag> const & lhs,
43+ EncryptionEnforcementConfig<Tag> const & rhs) {
9244 return std::tie (lhs.restriction_mode , lhs.effective_time ) ==
9345 std::tie (rhs.restriction_mode , rhs.effective_time );
9446}
9547
96- inline bool operator <(CustomerManagedEncryptionEnforcementConfig const & lhs,
97- CustomerManagedEncryptionEnforcementConfig const & rhs) {
48+ template <typename Tag>
49+ inline bool operator <(EncryptionEnforcementConfig<Tag> const & lhs,
50+ EncryptionEnforcementConfig<Tag> const & rhs) {
9851 return std::tie (lhs.restriction_mode , lhs.effective_time ) <
9952 std::tie (rhs.restriction_mode , rhs.effective_time );
10053}
10154
102- inline bool operator !=(CustomerManagedEncryptionEnforcementConfig const & lhs,
103- CustomerManagedEncryptionEnforcementConfig const & rhs) {
55+ template <typename Tag>
56+ inline bool operator !=(EncryptionEnforcementConfig<Tag> const & lhs,
57+ EncryptionEnforcementConfig<Tag> const & rhs) {
10458 return std::rel_ops::operator !=(lhs, rhs);
10559}
10660
107- inline bool operator >(CustomerManagedEncryptionEnforcementConfig const & lhs,
108- CustomerManagedEncryptionEnforcementConfig const & rhs) {
61+ template <typename Tag>
62+ inline bool operator >(EncryptionEnforcementConfig<Tag> const & lhs,
63+ EncryptionEnforcementConfig<Tag> const & rhs) {
10964 return std::rel_ops::operator >(lhs, rhs);
11065}
11166
112- inline bool operator <=(CustomerManagedEncryptionEnforcementConfig const & lhs,
113- CustomerManagedEncryptionEnforcementConfig const & rhs) {
67+ template <typename Tag>
68+ inline bool operator <=(EncryptionEnforcementConfig<Tag> const & lhs,
69+ EncryptionEnforcementConfig<Tag> const & rhs) {
11470 return std::rel_ops::operator <=(lhs, rhs);
11571}
11672
117- inline bool operator >=(CustomerManagedEncryptionEnforcementConfig const & lhs,
118- CustomerManagedEncryptionEnforcementConfig const & rhs) {
73+ template <typename Tag>
74+ inline bool operator >=(EncryptionEnforcementConfig<Tag> const & lhs,
75+ EncryptionEnforcementConfig<Tag> const & rhs) {
11976 return std::rel_ops::operator >=(lhs, rhs);
12077}
121- // /@}
12278
123- inline std::ostream& operator <<(
124- std::ostream& os, CustomerManagedEncryptionEnforcementConfig const & rhs) {
125- return os << " CustomerManagedEncryptionEnforcementConfig={restriction_mode="
126- << rhs.restriction_mode << " , effective_time="
79+ template <typename Tag>
80+ inline std::ostream& operator <<(std::ostream& os,
81+ EncryptionEnforcementConfig<Tag> const & rhs) {
82+ return os << EncryptionEnforcementConfigName<Tag>::value
83+ << " ={restriction_mode=" << rhs.restriction_mode
84+ << " , effective_time="
12785 << google::cloud::internal::FormatRfc3339 (rhs.effective_time )
12886 << " }" ;
12987}
13088
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- }
89+ struct GoogleManagedEncryptionEnforcementConfigTag {};
90+ using GoogleManagedEncryptionEnforcementConfig =
91+ EncryptionEnforcementConfig<GoogleManagedEncryptionEnforcementConfigTag>;
14992
150- inline bool operator !=(CustomerSuppliedEncryptionEnforcementConfig const & lhs,
151- CustomerSuppliedEncryptionEnforcementConfig const & rhs) {
152- return std::rel_ops::operator !=(lhs, rhs);
153- }
93+ template <>
94+ struct EncryptionEnforcementConfigName <
95+ GoogleManagedEncryptionEnforcementConfigTag> {
96+ static constexpr char const * value =
97+ " GoogleManagedEncryptionEnforcementConfig" ;
98+ };
15499
155- inline bool operator >(CustomerSuppliedEncryptionEnforcementConfig const & lhs,
156- CustomerSuppliedEncryptionEnforcementConfig const & rhs) {
157- return std::rel_ops::operator >(lhs, rhs);
158- }
100+ struct CustomerManagedEncryptionEnforcementConfigTag {};
101+ using CustomerManagedEncryptionEnforcementConfig =
102+ EncryptionEnforcementConfig<CustomerManagedEncryptionEnforcementConfigTag>;
159103
160- inline bool operator <=(CustomerSuppliedEncryptionEnforcementConfig const & lhs,
161- CustomerSuppliedEncryptionEnforcementConfig const & rhs) {
162- return std::rel_ops::operator <=(lhs, rhs);
163- }
104+ template <>
105+ struct EncryptionEnforcementConfigName <
106+ CustomerManagedEncryptionEnforcementConfigTag> {
107+ static constexpr char const * value =
108+ " CustomerManagedEncryptionEnforcementConfig" ;
109+ };
164110
165- inline bool operator >=(CustomerSuppliedEncryptionEnforcementConfig const & lhs,
166- CustomerSuppliedEncryptionEnforcementConfig const & rhs) {
167- return std::rel_ops::operator >=(lhs, rhs);
168- }
169- // /@}
111+ struct CustomerSuppliedEncryptionEnforcementConfigTag {};
112+ using CustomerSuppliedEncryptionEnforcementConfig =
113+ EncryptionEnforcementConfig<CustomerSuppliedEncryptionEnforcementConfigTag>;
170114
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- }
115+ template <>
116+ struct EncryptionEnforcementConfigName <
117+ CustomerSuppliedEncryptionEnforcementConfigTag> {
118+ static constexpr char const * value =
119+ " CustomerSuppliedEncryptionEnforcementConfig" ;
120+ };
178121
179122/* *
180123 * Describes the default customer managed encryption key for a bucket.
0 commit comments