{-# 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.InputSource
-- 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.MediaLive.Types.InputSource 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

-- | The settings for a PULL type input.
--
-- /See:/ 'newInputSource' smart constructor.
data InputSource = InputSource'
  { -- | The key used to extract the password from EC2 Parameter store.
    InputSource -> Maybe Text
passwordParam :: Prelude.Maybe Prelude.Text,
    -- | This represents the customer\'s source URL where stream is pulled from.
    InputSource -> Maybe Text
url :: Prelude.Maybe Prelude.Text,
    -- | The username for the input source.
    InputSource -> Maybe Text
username :: Prelude.Maybe Prelude.Text
  }
  deriving (InputSource -> InputSource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InputSource -> InputSource -> Bool
$c/= :: InputSource -> InputSource -> Bool
== :: InputSource -> InputSource -> Bool
$c== :: InputSource -> InputSource -> Bool
Prelude.Eq, ReadPrec [InputSource]
ReadPrec InputSource
Int -> ReadS InputSource
ReadS [InputSource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InputSource]
$creadListPrec :: ReadPrec [InputSource]
readPrec :: ReadPrec InputSource
$creadPrec :: ReadPrec InputSource
readList :: ReadS [InputSource]
$creadList :: ReadS [InputSource]
readsPrec :: Int -> ReadS InputSource
$creadsPrec :: Int -> ReadS InputSource
Prelude.Read, Int -> InputSource -> ShowS
[InputSource] -> ShowS
InputSource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InputSource] -> ShowS
$cshowList :: [InputSource] -> ShowS
show :: InputSource -> String
$cshow :: InputSource -> String
showsPrec :: Int -> InputSource -> ShowS
$cshowsPrec :: Int -> InputSource -> ShowS
Prelude.Show, forall x. Rep InputSource x -> InputSource
forall x. InputSource -> Rep InputSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InputSource x -> InputSource
$cfrom :: forall x. InputSource -> Rep InputSource x
Prelude.Generic)

-- |
-- Create a value of 'InputSource' 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:
--
-- 'passwordParam', 'inputSource_passwordParam' - The key used to extract the password from EC2 Parameter store.
--
-- 'url', 'inputSource_url' - This represents the customer\'s source URL where stream is pulled from.
--
-- 'username', 'inputSource_username' - The username for the input source.
newInputSource ::
  InputSource
newInputSource :: InputSource
newInputSource =
  InputSource'
    { $sel:passwordParam:InputSource' :: Maybe Text
passwordParam = forall a. Maybe a
Prelude.Nothing,
      $sel:url:InputSource' :: Maybe Text
url = forall a. Maybe a
Prelude.Nothing,
      $sel:username:InputSource' :: Maybe Text
username = forall a. Maybe a
Prelude.Nothing
    }

-- | The key used to extract the password from EC2 Parameter store.
inputSource_passwordParam :: Lens.Lens' InputSource (Prelude.Maybe Prelude.Text)
inputSource_passwordParam :: Lens' InputSource (Maybe Text)
inputSource_passwordParam = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputSource' {Maybe Text
passwordParam :: Maybe Text
$sel:passwordParam:InputSource' :: InputSource -> Maybe Text
passwordParam} -> Maybe Text
passwordParam) (\s :: InputSource
s@InputSource' {} Maybe Text
a -> InputSource
s {$sel:passwordParam:InputSource' :: Maybe Text
passwordParam = Maybe Text
a} :: InputSource)

-- | This represents the customer\'s source URL where stream is pulled from.
inputSource_url :: Lens.Lens' InputSource (Prelude.Maybe Prelude.Text)
inputSource_url :: Lens' InputSource (Maybe Text)
inputSource_url = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputSource' {Maybe Text
url :: Maybe Text
$sel:url:InputSource' :: InputSource -> Maybe Text
url} -> Maybe Text
url) (\s :: InputSource
s@InputSource' {} Maybe Text
a -> InputSource
s {$sel:url:InputSource' :: Maybe Text
url = Maybe Text
a} :: InputSource)

-- | The username for the input source.
inputSource_username :: Lens.Lens' InputSource (Prelude.Maybe Prelude.Text)
inputSource_username :: Lens' InputSource (Maybe Text)
inputSource_username = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputSource' {Maybe Text
username :: Maybe Text
$sel:username:InputSource' :: InputSource -> Maybe Text
username} -> Maybe Text
username) (\s :: InputSource
s@InputSource' {} Maybe Text
a -> InputSource
s {$sel:username:InputSource' :: Maybe Text
username = Maybe Text
a} :: InputSource)

instance Data.FromJSON InputSource where
  parseJSON :: Value -> Parser InputSource
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"InputSource"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> InputSource
InputSource'
            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
"passwordParam")
            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 InputSource where
  hashWithSalt :: Int -> InputSource -> Int
hashWithSalt Int
_salt InputSource' {Maybe Text
username :: Maybe Text
url :: Maybe Text
passwordParam :: Maybe Text
$sel:username:InputSource' :: InputSource -> Maybe Text
$sel:url:InputSource' :: InputSource -> Maybe Text
$sel:passwordParam:InputSource' :: InputSource -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
passwordParam
      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 InputSource where
  rnf :: InputSource -> ()
rnf InputSource' {Maybe Text
username :: Maybe Text
url :: Maybe Text
passwordParam :: Maybe Text
$sel:username:InputSource' :: InputSource -> Maybe Text
$sel:url:InputSource' :: InputSource -> Maybe Text
$sel:passwordParam:InputSource' :: InputSource -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
passwordParam
      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