{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.MediaLive.Types.UdpContainerSettings
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MediaLive.Types.UdpContainerSettings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types.M2tsSettings
import qualified Amazonka.Prelude as Prelude

-- | Udp Container Settings
--
-- /See:/ 'newUdpContainerSettings' smart constructor.
data UdpContainerSettings = UdpContainerSettings'
  { UdpContainerSettings -> Maybe M2tsSettings
m2tsSettings :: Prelude.Maybe M2tsSettings
  }
  deriving (UdpContainerSettings -> UdpContainerSettings -> Bool
(UdpContainerSettings -> UdpContainerSettings -> Bool)
-> (UdpContainerSettings -> UdpContainerSettings -> Bool)
-> Eq UdpContainerSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UdpContainerSettings -> UdpContainerSettings -> Bool
$c/= :: UdpContainerSettings -> UdpContainerSettings -> Bool
== :: UdpContainerSettings -> UdpContainerSettings -> Bool
$c== :: UdpContainerSettings -> UdpContainerSettings -> Bool
Prelude.Eq, ReadPrec [UdpContainerSettings]
ReadPrec UdpContainerSettings
Int -> ReadS UdpContainerSettings
ReadS [UdpContainerSettings]
(Int -> ReadS UdpContainerSettings)
-> ReadS [UdpContainerSettings]
-> ReadPrec UdpContainerSettings
-> ReadPrec [UdpContainerSettings]
-> Read UdpContainerSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UdpContainerSettings]
$creadListPrec :: ReadPrec [UdpContainerSettings]
readPrec :: ReadPrec UdpContainerSettings
$creadPrec :: ReadPrec UdpContainerSettings
readList :: ReadS [UdpContainerSettings]
$creadList :: ReadS [UdpContainerSettings]
readsPrec :: Int -> ReadS UdpContainerSettings
$creadsPrec :: Int -> ReadS UdpContainerSettings
Prelude.Read, Int -> UdpContainerSettings -> ShowS
[UdpContainerSettings] -> ShowS
UdpContainerSettings -> String
(Int -> UdpContainerSettings -> ShowS)
-> (UdpContainerSettings -> String)
-> ([UdpContainerSettings] -> ShowS)
-> Show UdpContainerSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UdpContainerSettings] -> ShowS
$cshowList :: [UdpContainerSettings] -> ShowS
show :: UdpContainerSettings -> String
$cshow :: UdpContainerSettings -> String
showsPrec :: Int -> UdpContainerSettings -> ShowS
$cshowsPrec :: Int -> UdpContainerSettings -> ShowS
Prelude.Show, (forall x. UdpContainerSettings -> Rep UdpContainerSettings x)
-> (forall x. Rep UdpContainerSettings x -> UdpContainerSettings)
-> Generic UdpContainerSettings
forall x. Rep UdpContainerSettings x -> UdpContainerSettings
forall x. UdpContainerSettings -> Rep UdpContainerSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UdpContainerSettings x -> UdpContainerSettings
$cfrom :: forall x. UdpContainerSettings -> Rep UdpContainerSettings x
Prelude.Generic)

-- |
-- Create a value of 'UdpContainerSettings' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'm2tsSettings', 'udpContainerSettings_m2tsSettings' - Undocumented member.
newUdpContainerSettings ::
  UdpContainerSettings
newUdpContainerSettings :: UdpContainerSettings
newUdpContainerSettings =
  UdpContainerSettings' :: Maybe M2tsSettings -> UdpContainerSettings
UdpContainerSettings'
    { $sel:m2tsSettings:UdpContainerSettings' :: Maybe M2tsSettings
m2tsSettings =
        Maybe M2tsSettings
forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
udpContainerSettings_m2tsSettings :: Lens.Lens' UdpContainerSettings (Prelude.Maybe M2tsSettings)
udpContainerSettings_m2tsSettings :: (Maybe M2tsSettings -> f (Maybe M2tsSettings))
-> UdpContainerSettings -> f UdpContainerSettings
udpContainerSettings_m2tsSettings = (UdpContainerSettings -> Maybe M2tsSettings)
-> (UdpContainerSettings
    -> Maybe M2tsSettings -> UdpContainerSettings)
-> Lens
     UdpContainerSettings
     UdpContainerSettings
     (Maybe M2tsSettings)
     (Maybe M2tsSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UdpContainerSettings' {Maybe M2tsSettings
m2tsSettings :: Maybe M2tsSettings
$sel:m2tsSettings:UdpContainerSettings' :: UdpContainerSettings -> Maybe M2tsSettings
m2tsSettings} -> Maybe M2tsSettings
m2tsSettings) (\s :: UdpContainerSettings
s@UdpContainerSettings' {} Maybe M2tsSettings
a -> UdpContainerSettings
s {$sel:m2tsSettings:UdpContainerSettings' :: Maybe M2tsSettings
m2tsSettings = Maybe M2tsSettings
a} :: UdpContainerSettings)

instance Core.FromJSON UdpContainerSettings where
  parseJSON :: Value -> Parser UdpContainerSettings
parseJSON =
    String
-> (Object -> Parser UdpContainerSettings)
-> Value
-> Parser UdpContainerSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"UdpContainerSettings"
      ( \Object
x ->
          Maybe M2tsSettings -> UdpContainerSettings
UdpContainerSettings'
            (Maybe M2tsSettings -> UdpContainerSettings)
-> Parser (Maybe M2tsSettings) -> Parser UdpContainerSettings
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe M2tsSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"m2tsSettings")
      )

instance Prelude.Hashable UdpContainerSettings

instance Prelude.NFData UdpContainerSettings

instance Core.ToJSON UdpContainerSettings where
  toJSON :: UdpContainerSettings -> Value
toJSON UdpContainerSettings' {Maybe M2tsSettings
m2tsSettings :: Maybe M2tsSettings
$sel:m2tsSettings:UdpContainerSettings' :: UdpContainerSettings -> Maybe M2tsSettings
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"m2tsSettings" Text -> M2tsSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (M2tsSettings -> Pair) -> Maybe M2tsSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe M2tsSettings
m2tsSettings]
      )