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

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

-- | The settings for a PULL type input.
--
-- /See:/ 'newInputSource' smart constructor.
data InputSource = InputSource'
  { -- | 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,
    -- | The key used to extract the password from EC2 Parameter store.
    InputSource -> Maybe Text
passwordParam :: Prelude.Maybe Prelude.Text
  }
  deriving (InputSource -> InputSource -> Bool
(InputSource -> InputSource -> Bool)
-> (InputSource -> InputSource -> Bool) -> Eq InputSource
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]
(Int -> ReadS InputSource)
-> ReadS [InputSource]
-> ReadPrec InputSource
-> ReadPrec [InputSource]
-> Read 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
(Int -> InputSource -> ShowS)
-> (InputSource -> String)
-> ([InputSource] -> ShowS)
-> Show InputSource
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. InputSource -> Rep InputSource x)
-> (forall x. Rep InputSource x -> InputSource)
-> Generic InputSource
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:
--
-- 'url', 'inputSource_url' - This represents the customer\'s source URL where stream is pulled from.
--
-- 'username', 'inputSource_username' - The username for the input source.
--
-- 'passwordParam', 'inputSource_passwordParam' - The key used to extract the password from EC2 Parameter store.
newInputSource ::
  InputSource
newInputSource :: InputSource
newInputSource =
  InputSource' :: Maybe Text -> Maybe Text -> Maybe Text -> InputSource
InputSource'
    { $sel:url:InputSource' :: Maybe Text
url = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:username:InputSource' :: Maybe Text
username = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:passwordParam:InputSource' :: Maybe Text
passwordParam = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | This represents the customer\'s source URL where stream is pulled from.
inputSource_url :: Lens.Lens' InputSource (Prelude.Maybe Prelude.Text)
inputSource_url :: (Maybe Text -> f (Maybe Text)) -> InputSource -> f InputSource
inputSource_url = (InputSource -> Maybe Text)
-> (InputSource -> Maybe Text -> InputSource)
-> Lens InputSource InputSource (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text)) -> InputSource -> f InputSource
inputSource_username = (InputSource -> Maybe Text)
-> (InputSource -> Maybe Text -> InputSource)
-> Lens InputSource InputSource (Maybe Text) (Maybe Text)
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)

-- | The key used to extract the password from EC2 Parameter store.
inputSource_passwordParam :: Lens.Lens' InputSource (Prelude.Maybe Prelude.Text)
inputSource_passwordParam :: (Maybe Text -> f (Maybe Text)) -> InputSource -> f InputSource
inputSource_passwordParam = (InputSource -> Maybe Text)
-> (InputSource -> Maybe Text -> InputSource)
-> Lens InputSource InputSource (Maybe Text) (Maybe Text)
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)

instance Core.FromJSON InputSource where
  parseJSON :: Value -> Parser InputSource
parseJSON =
    String
-> (Object -> Parser InputSource) -> Value -> Parser InputSource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"InputSource"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> InputSource
InputSource'
            (Maybe Text -> Maybe Text -> Maybe Text -> InputSource)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> InputSource)
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 -> InputSource)
-> Parser (Maybe Text) -> Parser (Maybe Text -> InputSource)
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 -> InputSource)
-> Parser (Maybe Text) -> Parser InputSource
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
"passwordParam")
      )

instance Prelude.Hashable InputSource

instance Prelude.NFData InputSource