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

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

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

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

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

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

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

instance Prelude.Hashable InputSourceRequest

instance Prelude.NFData InputSourceRequest

instance Core.ToJSON InputSourceRequest where
  toJSON :: InputSourceRequest -> Value
toJSON InputSourceRequest' {Maybe Text
passwordParam :: Maybe Text
username :: Maybe Text
url :: Maybe Text
$sel:passwordParam:InputSourceRequest' :: InputSourceRequest -> Maybe Text
$sel:username:InputSourceRequest' :: InputSourceRequest -> Maybe Text
$sel:url:InputSourceRequest' :: InputSourceRequest -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"url" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
url,
            (Text
"username" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
username,
            (Text
"passwordParam" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
passwordParam
          ]
      )