@@ -122,16 +122,6 @@ pub enum CurrentlySupportedListenerClasses {
122122 ExternalStable ,
123123}
124124
125- impl CurrentlySupportedListenerClasses {
126- pub fn k8s_service_type ( & self ) -> String {
127- match self {
128- CurrentlySupportedListenerClasses :: ClusterInternal => "ClusterIP" . to_string ( ) ,
129- CurrentlySupportedListenerClasses :: ExternalUnstable => "NodePort" . to_string ( ) ,
130- CurrentlySupportedListenerClasses :: ExternalStable => "LoadBalancer" . to_string ( ) ,
131- }
132- }
133- }
134-
135125#[ allow( clippy:: derive_partial_eq_without_eq) ]
136126#[ derive( Clone , Debug , Default , Fragment , JsonSchema , PartialEq ) ]
137127#[ fragment_attrs(
@@ -201,6 +191,42 @@ pub struct OpaConfig {
201191 pub graceful_shutdown_timeout : Option < Duration > ,
202192}
203193
194+ #[ derive(
195+ EnumIter ,
196+ Clone ,
197+ Debug ,
198+ Hash ,
199+ Deserialize ,
200+ Eq ,
201+ JsonSchema ,
202+ PartialEq ,
203+ Serialize ,
204+ Display ,
205+ EnumString ,
206+ ) ]
207+ pub enum OpaRole {
208+ #[ serde( rename = "server" ) ]
209+ #[ strum( serialize = "server" ) ]
210+ Server ,
211+ }
212+
213+ #[ derive( Clone , Default , Debug , Deserialize , Eq , JsonSchema , PartialEq , Serialize ) ]
214+ #[ serde( rename_all = "camelCase" ) ]
215+ pub struct OpaClusterStatus {
216+ #[ serde( default ) ]
217+ pub conditions : Vec < ClusterCondition > ,
218+ }
219+
220+ impl CurrentlySupportedListenerClasses {
221+ pub fn k8s_service_type ( & self ) -> String {
222+ match self {
223+ CurrentlySupportedListenerClasses :: ClusterInternal => "ClusterIP" . to_string ( ) ,
224+ CurrentlySupportedListenerClasses :: ExternalUnstable => "NodePort" . to_string ( ) ,
225+ CurrentlySupportedListenerClasses :: ExternalStable => "LoadBalancer" . to_string ( ) ,
226+ }
227+ }
228+ }
229+
204230impl OpaConfig {
205231 fn default_config ( ) -> OpaConfigFragment {
206232 OpaConfigFragment {
@@ -256,25 +282,6 @@ impl Configuration for OpaConfigFragment {
256282 }
257283}
258284
259- #[ derive(
260- EnumIter ,
261- Clone ,
262- Debug ,
263- Hash ,
264- Deserialize ,
265- Eq ,
266- JsonSchema ,
267- PartialEq ,
268- Serialize ,
269- Display ,
270- EnumString ,
271- ) ]
272- pub enum OpaRole {
273- #[ serde( rename = "server" ) ]
274- #[ strum( serialize = "server" ) ]
275- Server ,
276- }
277-
278285impl OpaCluster {
279286 /// Returns a reference to the role.
280287 pub fn role ( & self , role_variant : & OpaRole ) -> & Role < OpaConfigFragment , EmptyRoleConfig > {
@@ -354,13 +361,6 @@ impl OpaCluster {
354361 }
355362}
356363
357- #[ derive( Clone , Default , Debug , Deserialize , Eq , JsonSchema , PartialEq , Serialize ) ]
358- #[ serde( rename_all = "camelCase" ) ]
359- pub struct OpaClusterStatus {
360- #[ serde( default ) ]
361- pub conditions : Vec < ClusterCondition > ,
362- }
363-
364364impl HasStatusCondition for OpaCluster {
365365 fn conditions ( & self ) -> Vec < ClusterCondition > {
366366 match & self . status {
0 commit comments