@@ -324,7 +324,7 @@ impl RelayInfo {
324324}
325325
326326/// The operation mode of a relay.
327- #[ derive( Clone , Copy , Debug , Eq , PartialEq , Deserialize , Serialize ) ]
327+ #[ derive( Clone , Copy , Debug , Eq , PartialEq , Serialize ) ]
328328#[ serde( rename_all = "camelCase" ) ]
329329pub enum RelayMode {
330330 /// This relay acts as a proxy for all requests and events.
@@ -334,12 +334,6 @@ pub enum RelayMode {
334334 /// accepted unless overridden on the file system.
335335 Proxy ,
336336
337- /// This relay is configured statically in the file system.
338- ///
339- /// Events are only accepted for projects configured statically in the file system. All other
340- /// events are rejected. If configured, PII stripping is also performed on those events.
341- Static ,
342-
343337 /// Project configurations are managed by the upstream.
344338 ///
345339 /// Project configurations are always fetched from the upstream, unless they are statically
@@ -348,11 +342,30 @@ pub enum RelayMode {
348342 Managed ,
349343}
350344
345+ impl < ' de > Deserialize < ' de > for RelayMode {
346+ fn deserialize < D > ( deserializer : D ) -> Result < Self , D :: Error >
347+ where
348+ D : Deserializer < ' de > ,
349+ {
350+ let s = String :: deserialize ( deserializer) ?;
351+ match s. as_str ( ) {
352+ "proxy" => Ok ( RelayMode :: Proxy ) ,
353+ "managed" => Ok ( RelayMode :: Managed ) ,
354+ "static" => Err ( serde:: de:: Error :: custom (
355+ "Relay mode 'static' has been removed. Please use 'managed' or 'proxy' instead." ,
356+ ) ) ,
357+ other => Err ( serde:: de:: Error :: unknown_variant (
358+ other,
359+ & [ "proxy" , "managed" ] ,
360+ ) ) ,
361+ }
362+ }
363+ }
364+
351365impl fmt:: Display for RelayMode {
352366 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
353367 match self {
354368 RelayMode :: Proxy => write ! ( f, "proxy" ) ,
355- RelayMode :: Static => write ! ( f, "static" ) ,
356369 RelayMode :: Managed => write ! ( f, "managed" ) ,
357370 }
358371 }
@@ -402,10 +415,7 @@ pub struct ParseRelayModeError;
402415
403416impl fmt:: Display for ParseRelayModeError {
404417 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
405- write ! (
406- f,
407- "Relay mode must be one of: managed, static, proxy, capture"
408- )
418+ write ! ( f, "Relay mode must be one of: managed or proxy" )
409419 }
410420}
411421
@@ -417,7 +427,6 @@ impl FromStr for RelayMode {
417427 fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
418428 match s {
419429 "proxy" => Ok ( RelayMode :: Proxy ) ,
420- "static" => Ok ( RelayMode :: Static ) ,
421430 "managed" => Ok ( RelayMode :: Managed ) ,
422431 _ => Err ( ParseRelayModeError ) ,
423432 }
0 commit comments