{-# 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.OutputGroup where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types.Output
import Amazonka.MediaLive.Types.OutputGroupSettings
import qualified Amazonka.Prelude as Prelude
data OutputGroup = OutputGroup'
{
OutputGroup -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
OutputGroup -> [Output]
outputs :: [Output],
OutputGroup -> OutputGroupSettings
outputGroupSettings :: OutputGroupSettings
}
deriving (OutputGroup -> OutputGroup -> Bool
(OutputGroup -> OutputGroup -> Bool)
-> (OutputGroup -> OutputGroup -> Bool) -> Eq OutputGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OutputGroup -> OutputGroup -> Bool
$c/= :: OutputGroup -> OutputGroup -> Bool
== :: OutputGroup -> OutputGroup -> Bool
$c== :: OutputGroup -> OutputGroup -> Bool
Prelude.Eq, ReadPrec [OutputGroup]
ReadPrec OutputGroup
Int -> ReadS OutputGroup
ReadS [OutputGroup]
(Int -> ReadS OutputGroup)
-> ReadS [OutputGroup]
-> ReadPrec OutputGroup
-> ReadPrec [OutputGroup]
-> Read OutputGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OutputGroup]
$creadListPrec :: ReadPrec [OutputGroup]
readPrec :: ReadPrec OutputGroup
$creadPrec :: ReadPrec OutputGroup
readList :: ReadS [OutputGroup]
$creadList :: ReadS [OutputGroup]
readsPrec :: Int -> ReadS OutputGroup
$creadsPrec :: Int -> ReadS OutputGroup
Prelude.Read, Int -> OutputGroup -> ShowS
[OutputGroup] -> ShowS
OutputGroup -> String
(Int -> OutputGroup -> ShowS)
-> (OutputGroup -> String)
-> ([OutputGroup] -> ShowS)
-> Show OutputGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OutputGroup] -> ShowS
$cshowList :: [OutputGroup] -> ShowS
show :: OutputGroup -> String
$cshow :: OutputGroup -> String
showsPrec :: Int -> OutputGroup -> ShowS
$cshowsPrec :: Int -> OutputGroup -> ShowS
Prelude.Show, (forall x. OutputGroup -> Rep OutputGroup x)
-> (forall x. Rep OutputGroup x -> OutputGroup)
-> Generic OutputGroup
forall x. Rep OutputGroup x -> OutputGroup
forall x. OutputGroup -> Rep OutputGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OutputGroup x -> OutputGroup
$cfrom :: forall x. OutputGroup -> Rep OutputGroup x
Prelude.Generic)
newOutputGroup ::
OutputGroupSettings ->
OutputGroup
newOutputGroup :: OutputGroupSettings -> OutputGroup
newOutputGroup OutputGroupSettings
pOutputGroupSettings_ =
OutputGroup' :: Maybe Text -> [Output] -> OutputGroupSettings -> OutputGroup
OutputGroup'
{ $sel:name:OutputGroup' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:outputs:OutputGroup' :: [Output]
outputs = [Output]
forall a. Monoid a => a
Prelude.mempty,
$sel:outputGroupSettings:OutputGroup' :: OutputGroupSettings
outputGroupSettings = OutputGroupSettings
pOutputGroupSettings_
}
outputGroup_name :: Lens.Lens' OutputGroup (Prelude.Maybe Prelude.Text)
outputGroup_name :: (Maybe Text -> f (Maybe Text)) -> OutputGroup -> f OutputGroup
outputGroup_name = (OutputGroup -> Maybe Text)
-> (OutputGroup -> Maybe Text -> OutputGroup)
-> Lens OutputGroup OutputGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputGroup' {Maybe Text
name :: Maybe Text
$sel:name:OutputGroup' :: OutputGroup -> Maybe Text
name} -> Maybe Text
name) (\s :: OutputGroup
s@OutputGroup' {} Maybe Text
a -> OutputGroup
s {$sel:name:OutputGroup' :: Maybe Text
name = Maybe Text
a} :: OutputGroup)
outputGroup_outputs :: Lens.Lens' OutputGroup [Output]
outputGroup_outputs :: ([Output] -> f [Output]) -> OutputGroup -> f OutputGroup
outputGroup_outputs = (OutputGroup -> [Output])
-> (OutputGroup -> [Output] -> OutputGroup)
-> Lens OutputGroup OutputGroup [Output] [Output]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputGroup' {[Output]
outputs :: [Output]
$sel:outputs:OutputGroup' :: OutputGroup -> [Output]
outputs} -> [Output]
outputs) (\s :: OutputGroup
s@OutputGroup' {} [Output]
a -> OutputGroup
s {$sel:outputs:OutputGroup' :: [Output]
outputs = [Output]
a} :: OutputGroup) (([Output] -> f [Output]) -> OutputGroup -> f OutputGroup)
-> (([Output] -> f [Output]) -> [Output] -> f [Output])
-> ([Output] -> f [Output])
-> OutputGroup
-> f OutputGroup
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Output] -> f [Output]) -> [Output] -> f [Output]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
outputGroup_outputGroupSettings :: Lens.Lens' OutputGroup OutputGroupSettings
outputGroup_outputGroupSettings :: (OutputGroupSettings -> f OutputGroupSettings)
-> OutputGroup -> f OutputGroup
outputGroup_outputGroupSettings = (OutputGroup -> OutputGroupSettings)
-> (OutputGroup -> OutputGroupSettings -> OutputGroup)
-> Lens
OutputGroup OutputGroup OutputGroupSettings OutputGroupSettings
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputGroup' {OutputGroupSettings
outputGroupSettings :: OutputGroupSettings
$sel:outputGroupSettings:OutputGroup' :: OutputGroup -> OutputGroupSettings
outputGroupSettings} -> OutputGroupSettings
outputGroupSettings) (\s :: OutputGroup
s@OutputGroup' {} OutputGroupSettings
a -> OutputGroup
s {$sel:outputGroupSettings:OutputGroup' :: OutputGroupSettings
outputGroupSettings = OutputGroupSettings
a} :: OutputGroup)
instance Core.FromJSON OutputGroup where
parseJSON :: Value -> Parser OutputGroup
parseJSON =
String
-> (Object -> Parser OutputGroup) -> Value -> Parser OutputGroup
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"OutputGroup"
( \Object
x ->
Maybe Text -> [Output] -> OutputGroupSettings -> OutputGroup
OutputGroup'
(Maybe Text -> [Output] -> OutputGroupSettings -> OutputGroup)
-> Parser (Maybe Text)
-> Parser ([Output] -> OutputGroupSettings -> OutputGroup)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"name")
Parser ([Output] -> OutputGroupSettings -> OutputGroup)
-> Parser [Output] -> Parser (OutputGroupSettings -> OutputGroup)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe [Output])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"outputs" Parser (Maybe [Output]) -> [Output] -> Parser [Output]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Output]
forall a. Monoid a => a
Prelude.mempty)
Parser (OutputGroupSettings -> OutputGroup)
-> Parser OutputGroupSettings -> Parser OutputGroup
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser OutputGroupSettings
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"outputGroupSettings")
)
instance Prelude.Hashable OutputGroup
instance Prelude.NFData OutputGroup
instance Core.ToJSON OutputGroup where
toJSON :: OutputGroup -> Value
toJSON OutputGroup' {[Output]
Maybe Text
OutputGroupSettings
outputGroupSettings :: OutputGroupSettings
outputs :: [Output]
name :: Maybe Text
$sel:outputGroupSettings:OutputGroup' :: OutputGroup -> OutputGroupSettings
$sel:outputs:OutputGroup' :: OutputGroup -> [Output]
$sel:name:OutputGroup' :: OutputGroup -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"outputs" Text -> [Output] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Output]
outputs),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"outputGroupSettings" Text -> OutputGroupSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= OutputGroupSettings
outputGroupSettings)
]
)