{-# 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.ScheduleAction where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types.ScheduleActionSettings
import Amazonka.MediaLive.Types.ScheduleActionStartSettings
import qualified Amazonka.Prelude as Prelude
data ScheduleAction = ScheduleAction'
{
ScheduleAction -> Text
actionName :: Prelude.Text,
ScheduleAction -> ScheduleActionStartSettings
scheduleActionStartSettings :: ScheduleActionStartSettings,
ScheduleAction -> ScheduleActionSettings
scheduleActionSettings :: ScheduleActionSettings
}
deriving (ScheduleAction -> ScheduleAction -> Bool
(ScheduleAction -> ScheduleAction -> Bool)
-> (ScheduleAction -> ScheduleAction -> Bool) -> Eq ScheduleAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScheduleAction -> ScheduleAction -> Bool
$c/= :: ScheduleAction -> ScheduleAction -> Bool
== :: ScheduleAction -> ScheduleAction -> Bool
$c== :: ScheduleAction -> ScheduleAction -> Bool
Prelude.Eq, ReadPrec [ScheduleAction]
ReadPrec ScheduleAction
Int -> ReadS ScheduleAction
ReadS [ScheduleAction]
(Int -> ReadS ScheduleAction)
-> ReadS [ScheduleAction]
-> ReadPrec ScheduleAction
-> ReadPrec [ScheduleAction]
-> Read ScheduleAction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ScheduleAction]
$creadListPrec :: ReadPrec [ScheduleAction]
readPrec :: ReadPrec ScheduleAction
$creadPrec :: ReadPrec ScheduleAction
readList :: ReadS [ScheduleAction]
$creadList :: ReadS [ScheduleAction]
readsPrec :: Int -> ReadS ScheduleAction
$creadsPrec :: Int -> ReadS ScheduleAction
Prelude.Read, Int -> ScheduleAction -> ShowS
[ScheduleAction] -> ShowS
ScheduleAction -> String
(Int -> ScheduleAction -> ShowS)
-> (ScheduleAction -> String)
-> ([ScheduleAction] -> ShowS)
-> Show ScheduleAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScheduleAction] -> ShowS
$cshowList :: [ScheduleAction] -> ShowS
show :: ScheduleAction -> String
$cshow :: ScheduleAction -> String
showsPrec :: Int -> ScheduleAction -> ShowS
$cshowsPrec :: Int -> ScheduleAction -> ShowS
Prelude.Show, (forall x. ScheduleAction -> Rep ScheduleAction x)
-> (forall x. Rep ScheduleAction x -> ScheduleAction)
-> Generic ScheduleAction
forall x. Rep ScheduleAction x -> ScheduleAction
forall x. ScheduleAction -> Rep ScheduleAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ScheduleAction x -> ScheduleAction
$cfrom :: forall x. ScheduleAction -> Rep ScheduleAction x
Prelude.Generic)
newScheduleAction ::
Prelude.Text ->
ScheduleActionStartSettings ->
ScheduleActionSettings ->
ScheduleAction
newScheduleAction :: Text
-> ScheduleActionStartSettings
-> ScheduleActionSettings
-> ScheduleAction
newScheduleAction
Text
pActionName_
ScheduleActionStartSettings
pScheduleActionStartSettings_
ScheduleActionSettings
pScheduleActionSettings_ =
ScheduleAction' :: Text
-> ScheduleActionStartSettings
-> ScheduleActionSettings
-> ScheduleAction
ScheduleAction'
{ $sel:actionName:ScheduleAction' :: Text
actionName = Text
pActionName_,
$sel:scheduleActionStartSettings:ScheduleAction' :: ScheduleActionStartSettings
scheduleActionStartSettings =
ScheduleActionStartSettings
pScheduleActionStartSettings_,
$sel:scheduleActionSettings:ScheduleAction' :: ScheduleActionSettings
scheduleActionSettings = ScheduleActionSettings
pScheduleActionSettings_
}
scheduleAction_actionName :: Lens.Lens' ScheduleAction Prelude.Text
scheduleAction_actionName :: (Text -> f Text) -> ScheduleAction -> f ScheduleAction
scheduleAction_actionName = (ScheduleAction -> Text)
-> (ScheduleAction -> Text -> ScheduleAction)
-> Lens ScheduleAction ScheduleAction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleAction' {Text
actionName :: Text
$sel:actionName:ScheduleAction' :: ScheduleAction -> Text
actionName} -> Text
actionName) (\s :: ScheduleAction
s@ScheduleAction' {} Text
a -> ScheduleAction
s {$sel:actionName:ScheduleAction' :: Text
actionName = Text
a} :: ScheduleAction)
scheduleAction_scheduleActionStartSettings :: Lens.Lens' ScheduleAction ScheduleActionStartSettings
scheduleAction_scheduleActionStartSettings :: (ScheduleActionStartSettings -> f ScheduleActionStartSettings)
-> ScheduleAction -> f ScheduleAction
scheduleAction_scheduleActionStartSettings = (ScheduleAction -> ScheduleActionStartSettings)
-> (ScheduleAction
-> ScheduleActionStartSettings -> ScheduleAction)
-> Lens
ScheduleAction
ScheduleAction
ScheduleActionStartSettings
ScheduleActionStartSettings
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleAction' {ScheduleActionStartSettings
scheduleActionStartSettings :: ScheduleActionStartSettings
$sel:scheduleActionStartSettings:ScheduleAction' :: ScheduleAction -> ScheduleActionStartSettings
scheduleActionStartSettings} -> ScheduleActionStartSettings
scheduleActionStartSettings) (\s :: ScheduleAction
s@ScheduleAction' {} ScheduleActionStartSettings
a -> ScheduleAction
s {$sel:scheduleActionStartSettings:ScheduleAction' :: ScheduleActionStartSettings
scheduleActionStartSettings = ScheduleActionStartSettings
a} :: ScheduleAction)
scheduleAction_scheduleActionSettings :: Lens.Lens' ScheduleAction ScheduleActionSettings
scheduleAction_scheduleActionSettings :: (ScheduleActionSettings -> f ScheduleActionSettings)
-> ScheduleAction -> f ScheduleAction
scheduleAction_scheduleActionSettings = (ScheduleAction -> ScheduleActionSettings)
-> (ScheduleAction -> ScheduleActionSettings -> ScheduleAction)
-> Lens
ScheduleAction
ScheduleAction
ScheduleActionSettings
ScheduleActionSettings
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleAction' {ScheduleActionSettings
scheduleActionSettings :: ScheduleActionSettings
$sel:scheduleActionSettings:ScheduleAction' :: ScheduleAction -> ScheduleActionSettings
scheduleActionSettings} -> ScheduleActionSettings
scheduleActionSettings) (\s :: ScheduleAction
s@ScheduleAction' {} ScheduleActionSettings
a -> ScheduleAction
s {$sel:scheduleActionSettings:ScheduleAction' :: ScheduleActionSettings
scheduleActionSettings = ScheduleActionSettings
a} :: ScheduleAction)
instance Core.FromJSON ScheduleAction where
parseJSON :: Value -> Parser ScheduleAction
parseJSON =
String
-> (Object -> Parser ScheduleAction)
-> Value
-> Parser ScheduleAction
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ScheduleAction"
( \Object
x ->
Text
-> ScheduleActionStartSettings
-> ScheduleActionSettings
-> ScheduleAction
ScheduleAction'
(Text
-> ScheduleActionStartSettings
-> ScheduleActionSettings
-> ScheduleAction)
-> Parser Text
-> Parser
(ScheduleActionStartSettings
-> ScheduleActionSettings -> ScheduleAction)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"actionName")
Parser
(ScheduleActionStartSettings
-> ScheduleActionSettings -> ScheduleAction)
-> Parser ScheduleActionStartSettings
-> Parser (ScheduleActionSettings -> ScheduleAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ScheduleActionStartSettings
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"scheduleActionStartSettings")
Parser (ScheduleActionSettings -> ScheduleAction)
-> Parser ScheduleActionSettings -> Parser ScheduleAction
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ScheduleActionSettings
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"scheduleActionSettings")
)
instance Prelude.Hashable ScheduleAction
instance Prelude.NFData ScheduleAction
instance Core.ToJSON ScheduleAction where
toJSON :: ScheduleAction -> Value
toJSON ScheduleAction' {Text
ScheduleActionStartSettings
ScheduleActionSettings
scheduleActionSettings :: ScheduleActionSettings
scheduleActionStartSettings :: ScheduleActionStartSettings
actionName :: Text
$sel:scheduleActionSettings:ScheduleAction' :: ScheduleAction -> ScheduleActionSettings
$sel:scheduleActionStartSettings:ScheduleAction' :: ScheduleAction -> ScheduleActionStartSettings
$sel:actionName:ScheduleAction' :: ScheduleAction -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"actionName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
actionName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"scheduleActionStartSettings"
Text -> ScheduleActionStartSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ScheduleActionStartSettings
scheduleActionStartSettings
),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"scheduleActionSettings"
Text -> ScheduleActionSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ScheduleActionSettings
scheduleActionSettings
)
]
)