{-# 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.IngestEndpoint
-- 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.IngestEndpoint where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An endpoint for ingesting source content for a Channel.
--
-- /See:/ 'newIngestEndpoint' smart constructor.
data IngestEndpoint = IngestEndpoint'
  { -- | The ingest URL to which the source stream should be sent.
    IngestEndpoint -> Maybe Text
url :: Prelude.Maybe Prelude.Text,
    -- | The system generated username for ingest authentication.
    IngestEndpoint -> Maybe Text
username :: Prelude.Maybe Prelude.Text,
    -- | The system generated password for ingest authentication.
    IngestEndpoint -> Maybe Text
password :: Prelude.Maybe Prelude.Text,
    -- | The system generated unique identifier for the IngestEndpoint
    IngestEndpoint -> Maybe Text
id :: Prelude.Maybe Prelude.Text
  }
  deriving (IngestEndpoint -> IngestEndpoint -> Bool
(IngestEndpoint -> IngestEndpoint -> Bool)
-> (IngestEndpoint -> IngestEndpoint -> Bool) -> Eq IngestEndpoint
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IngestEndpoint -> IngestEndpoint -> Bool
$c/= :: IngestEndpoint -> IngestEndpoint -> Bool
== :: IngestEndpoint -> IngestEndpoint -> Bool
$c== :: IngestEndpoint -> IngestEndpoint -> Bool
Prelude.Eq, ReadPrec [IngestEndpoint]
ReadPrec IngestEndpoint
Int -> ReadS IngestEndpoint
ReadS [IngestEndpoint]
(Int -> ReadS IngestEndpoint)
-> ReadS [IngestEndpoint]
-> ReadPrec IngestEndpoint
-> ReadPrec [IngestEndpoint]
-> Read IngestEndpoint
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IngestEndpoint]
$creadListPrec :: ReadPrec [IngestEndpoint]
readPrec :: ReadPrec IngestEndpoint
$creadPrec :: ReadPrec IngestEndpoint
readList :: ReadS [IngestEndpoint]
$creadList :: ReadS [IngestEndpoint]
readsPrec :: Int -> ReadS IngestEndpoint
$creadsPrec :: Int -> ReadS IngestEndpoint
Prelude.Read, Int -> IngestEndpoint -> ShowS
[IngestEndpoint] -> ShowS
IngestEndpoint -> String
(Int -> IngestEndpoint -> ShowS)
-> (IngestEndpoint -> String)
-> ([IngestEndpoint] -> ShowS)
-> Show IngestEndpoint
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IngestEndpoint] -> ShowS
$cshowList :: [IngestEndpoint] -> ShowS
show :: IngestEndpoint -> String
$cshow :: IngestEndpoint -> String
showsPrec :: Int -> IngestEndpoint -> ShowS
$cshowsPrec :: Int -> IngestEndpoint -> ShowS
Prelude.Show, (forall x. IngestEndpoint -> Rep IngestEndpoint x)
-> (forall x. Rep IngestEndpoint x -> IngestEndpoint)
-> Generic IngestEndpoint
forall x. Rep IngestEndpoint x -> IngestEndpoint
forall x. IngestEndpoint -> Rep IngestEndpoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IngestEndpoint x -> IngestEndpoint
$cfrom :: forall x. IngestEndpoint -> Rep IngestEndpoint x
Prelude.Generic)

-- |
-- Create a value of 'IngestEndpoint' 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:
--
-- 'url', 'ingestEndpoint_url' - The ingest URL to which the source stream should be sent.
--
-- 'username', 'ingestEndpoint_username' - The system generated username for ingest authentication.
--
-- 'password', 'ingestEndpoint_password' - The system generated password for ingest authentication.
--
-- 'id', 'ingestEndpoint_id' - The system generated unique identifier for the IngestEndpoint
newIngestEndpoint ::
  IngestEndpoint
newIngestEndpoint :: IngestEndpoint
newIngestEndpoint =
  IngestEndpoint' :: Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> IngestEndpoint
IngestEndpoint'
    { $sel:url:IngestEndpoint' :: Maybe Text
url = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:username:IngestEndpoint' :: Maybe Text
username = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:password:IngestEndpoint' :: Maybe Text
password = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:IngestEndpoint' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The ingest URL to which the source stream should be sent.
ingestEndpoint_url :: Lens.Lens' IngestEndpoint (Prelude.Maybe Prelude.Text)
ingestEndpoint_url :: (Maybe Text -> f (Maybe Text))
-> IngestEndpoint -> f IngestEndpoint
ingestEndpoint_url = (IngestEndpoint -> Maybe Text)
-> (IngestEndpoint -> Maybe Text -> IngestEndpoint)
-> Lens IngestEndpoint IngestEndpoint (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IngestEndpoint' {Maybe Text
url :: Maybe Text
$sel:url:IngestEndpoint' :: IngestEndpoint -> Maybe Text
url} -> Maybe Text
url) (\s :: IngestEndpoint
s@IngestEndpoint' {} Maybe Text
a -> IngestEndpoint
s {$sel:url:IngestEndpoint' :: Maybe Text
url = Maybe Text
a} :: IngestEndpoint)

-- | The system generated username for ingest authentication.
ingestEndpoint_username :: Lens.Lens' IngestEndpoint (Prelude.Maybe Prelude.Text)
ingestEndpoint_username :: (Maybe Text -> f (Maybe Text))
-> IngestEndpoint -> f IngestEndpoint
ingestEndpoint_username = (IngestEndpoint -> Maybe Text)
-> (IngestEndpoint -> Maybe Text -> IngestEndpoint)
-> Lens IngestEndpoint IngestEndpoint (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IngestEndpoint' {Maybe Text
username :: Maybe Text
$sel:username:IngestEndpoint' :: IngestEndpoint -> Maybe Text
username} -> Maybe Text
username) (\s :: IngestEndpoint
s@IngestEndpoint' {} Maybe Text
a -> IngestEndpoint
s {$sel:username:IngestEndpoint' :: Maybe Text
username = Maybe Text
a} :: IngestEndpoint)

-- | The system generated password for ingest authentication.
ingestEndpoint_password :: Lens.Lens' IngestEndpoint (Prelude.Maybe Prelude.Text)
ingestEndpoint_password :: (Maybe Text -> f (Maybe Text))
-> IngestEndpoint -> f IngestEndpoint
ingestEndpoint_password = (IngestEndpoint -> Maybe Text)
-> (IngestEndpoint -> Maybe Text -> IngestEndpoint)
-> Lens IngestEndpoint IngestEndpoint (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IngestEndpoint' {Maybe Text
password :: Maybe Text
$sel:password:IngestEndpoint' :: IngestEndpoint -> Maybe Text
password} -> Maybe Text
password) (\s :: IngestEndpoint
s@IngestEndpoint' {} Maybe Text
a -> IngestEndpoint
s {$sel:password:IngestEndpoint' :: Maybe Text
password = Maybe Text
a} :: IngestEndpoint)

-- | The system generated unique identifier for the IngestEndpoint
ingestEndpoint_id :: Lens.Lens' IngestEndpoint (Prelude.Maybe Prelude.Text)
ingestEndpoint_id :: (Maybe Text -> f (Maybe Text))
-> IngestEndpoint -> f IngestEndpoint
ingestEndpoint_id = (IngestEndpoint -> Maybe Text)
-> (IngestEndpoint -> Maybe Text -> IngestEndpoint)
-> Lens IngestEndpoint IngestEndpoint (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IngestEndpoint' {Maybe Text
id :: Maybe Text
$sel:id:IngestEndpoint' :: IngestEndpoint -> Maybe Text
id} -> Maybe Text
id) (\s :: IngestEndpoint
s@IngestEndpoint' {} Maybe Text
a -> IngestEndpoint
s {$sel:id:IngestEndpoint' :: Maybe Text
id = Maybe Text
a} :: IngestEndpoint)

instance Core.FromJSON IngestEndpoint where
  parseJSON :: Value -> Parser IngestEndpoint
parseJSON =
    String
-> (Object -> Parser IngestEndpoint)
-> Value
-> Parser IngestEndpoint
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"IngestEndpoint"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> IngestEndpoint
IngestEndpoint'
            (Maybe Text
 -> Maybe Text -> Maybe Text -> Maybe Text -> IngestEndpoint)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> IngestEndpoint)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"url")
            Parser (Maybe Text -> Maybe Text -> Maybe Text -> IngestEndpoint)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> IngestEndpoint)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"username")
            Parser (Maybe Text -> Maybe Text -> IngestEndpoint)
-> Parser (Maybe Text) -> Parser (Maybe Text -> IngestEndpoint)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"password")
            Parser (Maybe Text -> IngestEndpoint)
-> Parser (Maybe Text) -> Parser IngestEndpoint
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"id")
      )

instance Prelude.Hashable IngestEndpoint

instance Prelude.NFData IngestEndpoint