{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.MediaLive.Types.AutomaticInputFailoverSettings where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types.FailoverCondition
import Amazonka.MediaLive.Types.InputPreference
import qualified Amazonka.Prelude as Prelude
data AutomaticInputFailoverSettings = AutomaticInputFailoverSettings'
{
AutomaticInputFailoverSettings -> Maybe [FailoverCondition]
failoverConditions :: Prelude.Maybe [FailoverCondition],
AutomaticInputFailoverSettings -> Maybe Natural
errorClearTimeMsec :: Prelude.Maybe Prelude.Natural,
AutomaticInputFailoverSettings -> Maybe InputPreference
inputPreference :: Prelude.Maybe InputPreference,
AutomaticInputFailoverSettings -> Text
secondaryInputId :: Prelude.Text
}
deriving (AutomaticInputFailoverSettings
-> AutomaticInputFailoverSettings -> Bool
(AutomaticInputFailoverSettings
-> AutomaticInputFailoverSettings -> Bool)
-> (AutomaticInputFailoverSettings
-> AutomaticInputFailoverSettings -> Bool)
-> Eq AutomaticInputFailoverSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AutomaticInputFailoverSettings
-> AutomaticInputFailoverSettings -> Bool
$c/= :: AutomaticInputFailoverSettings
-> AutomaticInputFailoverSettings -> Bool
== :: AutomaticInputFailoverSettings
-> AutomaticInputFailoverSettings -> Bool
$c== :: AutomaticInputFailoverSettings
-> AutomaticInputFailoverSettings -> Bool
Prelude.Eq, ReadPrec [AutomaticInputFailoverSettings]
ReadPrec AutomaticInputFailoverSettings
Int -> ReadS AutomaticInputFailoverSettings
ReadS [AutomaticInputFailoverSettings]
(Int -> ReadS AutomaticInputFailoverSettings)
-> ReadS [AutomaticInputFailoverSettings]
-> ReadPrec AutomaticInputFailoverSettings
-> ReadPrec [AutomaticInputFailoverSettings]
-> Read AutomaticInputFailoverSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AutomaticInputFailoverSettings]
$creadListPrec :: ReadPrec [AutomaticInputFailoverSettings]
readPrec :: ReadPrec AutomaticInputFailoverSettings
$creadPrec :: ReadPrec AutomaticInputFailoverSettings
readList :: ReadS [AutomaticInputFailoverSettings]
$creadList :: ReadS [AutomaticInputFailoverSettings]
readsPrec :: Int -> ReadS AutomaticInputFailoverSettings
$creadsPrec :: Int -> ReadS AutomaticInputFailoverSettings
Prelude.Read, Int -> AutomaticInputFailoverSettings -> ShowS
[AutomaticInputFailoverSettings] -> ShowS
AutomaticInputFailoverSettings -> String
(Int -> AutomaticInputFailoverSettings -> ShowS)
-> (AutomaticInputFailoverSettings -> String)
-> ([AutomaticInputFailoverSettings] -> ShowS)
-> Show AutomaticInputFailoverSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AutomaticInputFailoverSettings] -> ShowS
$cshowList :: [AutomaticInputFailoverSettings] -> ShowS
show :: AutomaticInputFailoverSettings -> String
$cshow :: AutomaticInputFailoverSettings -> String
showsPrec :: Int -> AutomaticInputFailoverSettings -> ShowS
$cshowsPrec :: Int -> AutomaticInputFailoverSettings -> ShowS
Prelude.Show, (forall x.
AutomaticInputFailoverSettings
-> Rep AutomaticInputFailoverSettings x)
-> (forall x.
Rep AutomaticInputFailoverSettings x
-> AutomaticInputFailoverSettings)
-> Generic AutomaticInputFailoverSettings
forall x.
Rep AutomaticInputFailoverSettings x
-> AutomaticInputFailoverSettings
forall x.
AutomaticInputFailoverSettings
-> Rep AutomaticInputFailoverSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AutomaticInputFailoverSettings x
-> AutomaticInputFailoverSettings
$cfrom :: forall x.
AutomaticInputFailoverSettings
-> Rep AutomaticInputFailoverSettings x
Prelude.Generic)
newAutomaticInputFailoverSettings ::
Prelude.Text ->
AutomaticInputFailoverSettings
newAutomaticInputFailoverSettings :: Text -> AutomaticInputFailoverSettings
newAutomaticInputFailoverSettings Text
pSecondaryInputId_ =
AutomaticInputFailoverSettings' :: Maybe [FailoverCondition]
-> Maybe Natural
-> Maybe InputPreference
-> Text
-> AutomaticInputFailoverSettings
AutomaticInputFailoverSettings'
{ $sel:failoverConditions:AutomaticInputFailoverSettings' :: Maybe [FailoverCondition]
failoverConditions =
Maybe [FailoverCondition]
forall a. Maybe a
Prelude.Nothing,
$sel:errorClearTimeMsec:AutomaticInputFailoverSettings' :: Maybe Natural
errorClearTimeMsec = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:inputPreference:AutomaticInputFailoverSettings' :: Maybe InputPreference
inputPreference = Maybe InputPreference
forall a. Maybe a
Prelude.Nothing,
$sel:secondaryInputId:AutomaticInputFailoverSettings' :: Text
secondaryInputId = Text
pSecondaryInputId_
}
automaticInputFailoverSettings_failoverConditions :: Lens.Lens' AutomaticInputFailoverSettings (Prelude.Maybe [FailoverCondition])
automaticInputFailoverSettings_failoverConditions :: (Maybe [FailoverCondition] -> f (Maybe [FailoverCondition]))
-> AutomaticInputFailoverSettings
-> f AutomaticInputFailoverSettings
automaticInputFailoverSettings_failoverConditions = (AutomaticInputFailoverSettings -> Maybe [FailoverCondition])
-> (AutomaticInputFailoverSettings
-> Maybe [FailoverCondition] -> AutomaticInputFailoverSettings)
-> Lens
AutomaticInputFailoverSettings
AutomaticInputFailoverSettings
(Maybe [FailoverCondition])
(Maybe [FailoverCondition])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutomaticInputFailoverSettings' {Maybe [FailoverCondition]
failoverConditions :: Maybe [FailoverCondition]
$sel:failoverConditions:AutomaticInputFailoverSettings' :: AutomaticInputFailoverSettings -> Maybe [FailoverCondition]
failoverConditions} -> Maybe [FailoverCondition]
failoverConditions) (\s :: AutomaticInputFailoverSettings
s@AutomaticInputFailoverSettings' {} Maybe [FailoverCondition]
a -> AutomaticInputFailoverSettings
s {$sel:failoverConditions:AutomaticInputFailoverSettings' :: Maybe [FailoverCondition]
failoverConditions = Maybe [FailoverCondition]
a} :: AutomaticInputFailoverSettings) ((Maybe [FailoverCondition] -> f (Maybe [FailoverCondition]))
-> AutomaticInputFailoverSettings
-> f AutomaticInputFailoverSettings)
-> ((Maybe [FailoverCondition] -> f (Maybe [FailoverCondition]))
-> Maybe [FailoverCondition] -> f (Maybe [FailoverCondition]))
-> (Maybe [FailoverCondition] -> f (Maybe [FailoverCondition]))
-> AutomaticInputFailoverSettings
-> f AutomaticInputFailoverSettings
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[FailoverCondition]
[FailoverCondition]
[FailoverCondition]
[FailoverCondition]
-> Iso
(Maybe [FailoverCondition])
(Maybe [FailoverCondition])
(Maybe [FailoverCondition])
(Maybe [FailoverCondition])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[FailoverCondition]
[FailoverCondition]
[FailoverCondition]
[FailoverCondition]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
automaticInputFailoverSettings_errorClearTimeMsec :: Lens.Lens' AutomaticInputFailoverSettings (Prelude.Maybe Prelude.Natural)
automaticInputFailoverSettings_errorClearTimeMsec :: (Maybe Natural -> f (Maybe Natural))
-> AutomaticInputFailoverSettings
-> f AutomaticInputFailoverSettings
automaticInputFailoverSettings_errorClearTimeMsec = (AutomaticInputFailoverSettings -> Maybe Natural)
-> (AutomaticInputFailoverSettings
-> Maybe Natural -> AutomaticInputFailoverSettings)
-> Lens
AutomaticInputFailoverSettings
AutomaticInputFailoverSettings
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutomaticInputFailoverSettings' {Maybe Natural
errorClearTimeMsec :: Maybe Natural
$sel:errorClearTimeMsec:AutomaticInputFailoverSettings' :: AutomaticInputFailoverSettings -> Maybe Natural
errorClearTimeMsec} -> Maybe Natural
errorClearTimeMsec) (\s :: AutomaticInputFailoverSettings
s@AutomaticInputFailoverSettings' {} Maybe Natural
a -> AutomaticInputFailoverSettings
s {$sel:errorClearTimeMsec:AutomaticInputFailoverSettings' :: Maybe Natural
errorClearTimeMsec = Maybe Natural
a} :: AutomaticInputFailoverSettings)
automaticInputFailoverSettings_inputPreference :: Lens.Lens' AutomaticInputFailoverSettings (Prelude.Maybe InputPreference)
automaticInputFailoverSettings_inputPreference :: (Maybe InputPreference -> f (Maybe InputPreference))
-> AutomaticInputFailoverSettings
-> f AutomaticInputFailoverSettings
automaticInputFailoverSettings_inputPreference = (AutomaticInputFailoverSettings -> Maybe InputPreference)
-> (AutomaticInputFailoverSettings
-> Maybe InputPreference -> AutomaticInputFailoverSettings)
-> Lens
AutomaticInputFailoverSettings
AutomaticInputFailoverSettings
(Maybe InputPreference)
(Maybe InputPreference)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutomaticInputFailoverSettings' {Maybe InputPreference
inputPreference :: Maybe InputPreference
$sel:inputPreference:AutomaticInputFailoverSettings' :: AutomaticInputFailoverSettings -> Maybe InputPreference
inputPreference} -> Maybe InputPreference
inputPreference) (\s :: AutomaticInputFailoverSettings
s@AutomaticInputFailoverSettings' {} Maybe InputPreference
a -> AutomaticInputFailoverSettings
s {$sel:inputPreference:AutomaticInputFailoverSettings' :: Maybe InputPreference
inputPreference = Maybe InputPreference
a} :: AutomaticInputFailoverSettings)
automaticInputFailoverSettings_secondaryInputId :: Lens.Lens' AutomaticInputFailoverSettings Prelude.Text
automaticInputFailoverSettings_secondaryInputId :: (Text -> f Text)
-> AutomaticInputFailoverSettings
-> f AutomaticInputFailoverSettings
automaticInputFailoverSettings_secondaryInputId = (AutomaticInputFailoverSettings -> Text)
-> (AutomaticInputFailoverSettings
-> Text -> AutomaticInputFailoverSettings)
-> Lens
AutomaticInputFailoverSettings
AutomaticInputFailoverSettings
Text
Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutomaticInputFailoverSettings' {Text
secondaryInputId :: Text
$sel:secondaryInputId:AutomaticInputFailoverSettings' :: AutomaticInputFailoverSettings -> Text
secondaryInputId} -> Text
secondaryInputId) (\s :: AutomaticInputFailoverSettings
s@AutomaticInputFailoverSettings' {} Text
a -> AutomaticInputFailoverSettings
s {$sel:secondaryInputId:AutomaticInputFailoverSettings' :: Text
secondaryInputId = Text
a} :: AutomaticInputFailoverSettings)
instance Core.FromJSON AutomaticInputFailoverSettings where
parseJSON :: Value -> Parser AutomaticInputFailoverSettings
parseJSON =
String
-> (Object -> Parser AutomaticInputFailoverSettings)
-> Value
-> Parser AutomaticInputFailoverSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AutomaticInputFailoverSettings"
( \Object
x ->
Maybe [FailoverCondition]
-> Maybe Natural
-> Maybe InputPreference
-> Text
-> AutomaticInputFailoverSettings
AutomaticInputFailoverSettings'
(Maybe [FailoverCondition]
-> Maybe Natural
-> Maybe InputPreference
-> Text
-> AutomaticInputFailoverSettings)
-> Parser (Maybe [FailoverCondition])
-> Parser
(Maybe Natural
-> Maybe InputPreference -> Text -> AutomaticInputFailoverSettings)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [FailoverCondition]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"failoverConditions"
Parser (Maybe (Maybe [FailoverCondition]))
-> Maybe [FailoverCondition] -> Parser (Maybe [FailoverCondition])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [FailoverCondition]
forall a. Monoid a => a
Prelude.mempty
)
Parser
(Maybe Natural
-> Maybe InputPreference -> Text -> AutomaticInputFailoverSettings)
-> Parser (Maybe Natural)
-> Parser
(Maybe InputPreference -> Text -> AutomaticInputFailoverSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"errorClearTimeMsec")
Parser
(Maybe InputPreference -> Text -> AutomaticInputFailoverSettings)
-> Parser (Maybe InputPreference)
-> Parser (Text -> AutomaticInputFailoverSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe InputPreference)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"inputPreference")
Parser (Text -> AutomaticInputFailoverSettings)
-> Parser Text -> Parser AutomaticInputFailoverSettings
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"secondaryInputId")
)
instance
Prelude.Hashable
AutomaticInputFailoverSettings
instance
Prelude.NFData
AutomaticInputFailoverSettings
instance Core.ToJSON AutomaticInputFailoverSettings where
toJSON :: AutomaticInputFailoverSettings -> Value
toJSON AutomaticInputFailoverSettings' {Maybe Natural
Maybe [FailoverCondition]
Maybe InputPreference
Text
secondaryInputId :: Text
inputPreference :: Maybe InputPreference
errorClearTimeMsec :: Maybe Natural
failoverConditions :: Maybe [FailoverCondition]
$sel:secondaryInputId:AutomaticInputFailoverSettings' :: AutomaticInputFailoverSettings -> Text
$sel:inputPreference:AutomaticInputFailoverSettings' :: AutomaticInputFailoverSettings -> Maybe InputPreference
$sel:errorClearTimeMsec:AutomaticInputFailoverSettings' :: AutomaticInputFailoverSettings -> Maybe Natural
$sel:failoverConditions:AutomaticInputFailoverSettings' :: AutomaticInputFailoverSettings -> Maybe [FailoverCondition]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"failoverConditions" Text -> [FailoverCondition] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([FailoverCondition] -> Pair)
-> Maybe [FailoverCondition] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [FailoverCondition]
failoverConditions,
(Text
"errorClearTimeMsec" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
errorClearTimeMsec,
(Text
"inputPreference" Text -> InputPreference -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(InputPreference -> Pair) -> Maybe InputPreference -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe InputPreference
inputPreference,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"secondaryInputId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
secondaryInputId)
]
)