{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:selectorSettings:AudioSelector' :: Maybe AudioSelectorSettings
selectorSettings = forall a. Maybe a
Prelude.Nothing,
$sel:name:AudioSelector' :: Text
name = Text
pName_
}
audioSelector_selectorSettings :: Lens.Lens' AudioSelector (Prelude.Maybe AudioSelectorSettings)
audioSelector_selectorSettings :: Lens' AudioSelector (Maybe AudioSelectorSettings)
audioSelector_selectorSettings = 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 :: Lens' AudioSelector Text
audioSelector_name = 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 Data.FromJSON AudioSelector where
parseJSON :: Value -> Parser AudioSelector
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"AudioSelector"
( \Object
x ->
Maybe AudioSelectorSettings -> Text -> AudioSelector
AudioSelector'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"selectorSettings")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"name")
)
instance Prelude.Hashable AudioSelector where
hashWithSalt :: Int -> AudioSelector -> Int
hashWithSalt Int
_salt AudioSelector' {Maybe AudioSelectorSettings
Text
name :: Text
selectorSettings :: Maybe AudioSelectorSettings
$sel:name:AudioSelector' :: AudioSelector -> Text
$sel:selectorSettings:AudioSelector' :: AudioSelector -> Maybe AudioSelectorSettings
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AudioSelectorSettings
selectorSettings
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
instance Prelude.NFData AudioSelector where
rnf :: AudioSelector -> ()
rnf AudioSelector' {Maybe AudioSelectorSettings
Text
name :: Text
selectorSettings :: Maybe AudioSelectorSettings
$sel:name:AudioSelector' :: AudioSelector -> Text
$sel:selectorSettings:AudioSelector' :: AudioSelector -> Maybe AudioSelectorSettings
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe AudioSelectorSettings
selectorSettings
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"selectorSettings" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AudioSelectorSettings
selectorSettings,
forall a. a -> Maybe a
Prelude.Just (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name)
]
)