{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MediaPackage.Types.IngestEndpoint where

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

-- | An endpoint for ingesting source content for a Channel.
--
-- /See:/ 'newIngestEndpoint' smart constructor.
data IngestEndpoint = IngestEndpoint'
  { -- | The system generated unique identifier for the IngestEndpoint
    IngestEndpoint -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The system generated password for ingest authentication.
    IngestEndpoint -> Maybe Text
password :: Prelude.Maybe Prelude.Text,
    -- | 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
  }
  deriving (IngestEndpoint -> IngestEndpoint -> Bool
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]
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
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. 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:
--
-- 'id', 'ingestEndpoint_id' - The system generated unique identifier for the IngestEndpoint
--
-- 'password', 'ingestEndpoint_password' - The system generated password for ingest authentication.
--
-- 'url', 'ingestEndpoint_url' - The ingest URL to which the source stream should be sent.
--
-- 'username', 'ingestEndpoint_username' - The system generated username for ingest authentication.
newIngestEndpoint ::
  IngestEndpoint
newIngestEndpoint :: IngestEndpoint
newIngestEndpoint =
  IngestEndpoint'
    { $sel:id:IngestEndpoint' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:password:IngestEndpoint' :: Maybe Text
password = forall a. Maybe a
Prelude.Nothing,
      $sel:url:IngestEndpoint' :: Maybe Text
url = forall a. Maybe a
Prelude.Nothing,
      $sel:username:IngestEndpoint' :: Maybe Text
username = forall a. Maybe a
Prelude.Nothing
    }

-- | The system generated unique identifier for the IngestEndpoint
ingestEndpoint_id :: Lens.Lens' IngestEndpoint (Prelude.Maybe Prelude.Text)
ingestEndpoint_id :: Lens' IngestEndpoint (Maybe Text)
ingestEndpoint_id = 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)

-- | The system generated password for ingest authentication.
ingestEndpoint_password :: Lens.Lens' IngestEndpoint (Prelude.Maybe Prelude.Text)
ingestEndpoint_password :: Lens' IngestEndpoint (Maybe Text)
ingestEndpoint_password = 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 ingest URL to which the source stream should be sent.
ingestEndpoint_url :: Lens.Lens' IngestEndpoint (Prelude.Maybe Prelude.Text)
ingestEndpoint_url :: Lens' IngestEndpoint (Maybe Text)
ingestEndpoint_url = 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 :: Lens' IngestEndpoint (Maybe Text)
ingestEndpoint_username = 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)

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

instance Prelude.Hashable IngestEndpoint where
  hashWithSalt :: Int -> IngestEndpoint -> Int
hashWithSalt Int
_salt IngestEndpoint' {Maybe Text
username :: Maybe Text
url :: Maybe Text
password :: Maybe Text
id :: Maybe Text
$sel:username:IngestEndpoint' :: IngestEndpoint -> Maybe Text
$sel:url:IngestEndpoint' :: IngestEndpoint -> Maybe Text
$sel:password:IngestEndpoint' :: IngestEndpoint -> Maybe Text
$sel:id:IngestEndpoint' :: IngestEndpoint -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
password
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
url
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
username

instance Prelude.NFData IngestEndpoint where
  rnf :: IngestEndpoint -> ()
rnf IngestEndpoint' {Maybe Text
username :: Maybe Text
url :: Maybe Text
password :: Maybe Text
id :: Maybe Text
$sel:username:IngestEndpoint' :: IngestEndpoint -> Maybe Text
$sel:url:IngestEndpoint' :: IngestEndpoint -> Maybe Text
$sel:password:IngestEndpoint' :: IngestEndpoint -> Maybe Text
$sel:id:IngestEndpoint' :: IngestEndpoint -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
password
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
url
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
username