{-# 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.MediaPackage.Types.HlsIngest
-- 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.MediaPackage.Types.HlsIngest where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaPackage.Types.IngestEndpoint
import qualified Amazonka.Prelude as Prelude

-- | An HTTP Live Streaming (HLS) ingest resource configuration.
--
-- /See:/ 'newHlsIngest' smart constructor.
data HlsIngest = HlsIngest'
  { -- | A list of endpoints to which the source stream should be sent.
    HlsIngest -> Maybe [IngestEndpoint]
ingestEndpoints :: Prelude.Maybe [IngestEndpoint]
  }
  deriving (HlsIngest -> HlsIngest -> Bool
(HlsIngest -> HlsIngest -> Bool)
-> (HlsIngest -> HlsIngest -> Bool) -> Eq HlsIngest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HlsIngest -> HlsIngest -> Bool
$c/= :: HlsIngest -> HlsIngest -> Bool
== :: HlsIngest -> HlsIngest -> Bool
$c== :: HlsIngest -> HlsIngest -> Bool
Prelude.Eq, ReadPrec [HlsIngest]
ReadPrec HlsIngest
Int -> ReadS HlsIngest
ReadS [HlsIngest]
(Int -> ReadS HlsIngest)
-> ReadS [HlsIngest]
-> ReadPrec HlsIngest
-> ReadPrec [HlsIngest]
-> Read HlsIngest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HlsIngest]
$creadListPrec :: ReadPrec [HlsIngest]
readPrec :: ReadPrec HlsIngest
$creadPrec :: ReadPrec HlsIngest
readList :: ReadS [HlsIngest]
$creadList :: ReadS [HlsIngest]
readsPrec :: Int -> ReadS HlsIngest
$creadsPrec :: Int -> ReadS HlsIngest
Prelude.Read, Int -> HlsIngest -> ShowS
[HlsIngest] -> ShowS
HlsIngest -> String
(Int -> HlsIngest -> ShowS)
-> (HlsIngest -> String)
-> ([HlsIngest] -> ShowS)
-> Show HlsIngest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HlsIngest] -> ShowS
$cshowList :: [HlsIngest] -> ShowS
show :: HlsIngest -> String
$cshow :: HlsIngest -> String
showsPrec :: Int -> HlsIngest -> ShowS
$cshowsPrec :: Int -> HlsIngest -> ShowS
Prelude.Show, (forall x. HlsIngest -> Rep HlsIngest x)
-> (forall x. Rep HlsIngest x -> HlsIngest) -> Generic HlsIngest
forall x. Rep HlsIngest x -> HlsIngest
forall x. HlsIngest -> Rep HlsIngest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HlsIngest x -> HlsIngest
$cfrom :: forall x. HlsIngest -> Rep HlsIngest x
Prelude.Generic)

-- |
-- Create a value of 'HlsIngest' 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:
--
-- 'ingestEndpoints', 'hlsIngest_ingestEndpoints' - A list of endpoints to which the source stream should be sent.
newHlsIngest ::
  HlsIngest
newHlsIngest :: HlsIngest
newHlsIngest =
  HlsIngest' :: Maybe [IngestEndpoint] -> HlsIngest
HlsIngest' {$sel:ingestEndpoints:HlsIngest' :: Maybe [IngestEndpoint]
ingestEndpoints = Maybe [IngestEndpoint]
forall a. Maybe a
Prelude.Nothing}

-- | A list of endpoints to which the source stream should be sent.
hlsIngest_ingestEndpoints :: Lens.Lens' HlsIngest (Prelude.Maybe [IngestEndpoint])
hlsIngest_ingestEndpoints :: (Maybe [IngestEndpoint] -> f (Maybe [IngestEndpoint]))
-> HlsIngest -> f HlsIngest
hlsIngest_ingestEndpoints = (HlsIngest -> Maybe [IngestEndpoint])
-> (HlsIngest -> Maybe [IngestEndpoint] -> HlsIngest)
-> Lens
     HlsIngest
     HlsIngest
     (Maybe [IngestEndpoint])
     (Maybe [IngestEndpoint])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsIngest' {Maybe [IngestEndpoint]
ingestEndpoints :: Maybe [IngestEndpoint]
$sel:ingestEndpoints:HlsIngest' :: HlsIngest -> Maybe [IngestEndpoint]
ingestEndpoints} -> Maybe [IngestEndpoint]
ingestEndpoints) (\s :: HlsIngest
s@HlsIngest' {} Maybe [IngestEndpoint]
a -> HlsIngest
s {$sel:ingestEndpoints:HlsIngest' :: Maybe [IngestEndpoint]
ingestEndpoints = Maybe [IngestEndpoint]
a} :: HlsIngest) ((Maybe [IngestEndpoint] -> f (Maybe [IngestEndpoint]))
 -> HlsIngest -> f HlsIngest)
-> ((Maybe [IngestEndpoint] -> f (Maybe [IngestEndpoint]))
    -> Maybe [IngestEndpoint] -> f (Maybe [IngestEndpoint]))
-> (Maybe [IngestEndpoint] -> f (Maybe [IngestEndpoint]))
-> HlsIngest
-> f HlsIngest
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [IngestEndpoint] [IngestEndpoint] [IngestEndpoint] [IngestEndpoint]
-> Iso
     (Maybe [IngestEndpoint])
     (Maybe [IngestEndpoint])
     (Maybe [IngestEndpoint])
     (Maybe [IngestEndpoint])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [IngestEndpoint] [IngestEndpoint] [IngestEndpoint] [IngestEndpoint]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON HlsIngest where
  parseJSON :: Value -> Parser HlsIngest
parseJSON =
    String -> (Object -> Parser HlsIngest) -> Value -> Parser HlsIngest
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"HlsIngest"
      ( \Object
x ->
          Maybe [IngestEndpoint] -> HlsIngest
HlsIngest'
            (Maybe [IngestEndpoint] -> HlsIngest)
-> Parser (Maybe [IngestEndpoint]) -> Parser HlsIngest
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [IngestEndpoint]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ingestEndpoints"
                            Parser (Maybe (Maybe [IngestEndpoint]))
-> Maybe [IngestEndpoint] -> Parser (Maybe [IngestEndpoint])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [IngestEndpoint]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable HlsIngest

instance Prelude.NFData HlsIngest