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