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