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