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

-- | Settings for for a PULL type input.
--
-- /See:/ 'newInputSourceRequest' smart constructor.
data InputSourceRequest = InputSourceRequest'
  { -- | The key used to extract the password from EC2 Parameter store.
    InputSourceRequest -> Maybe Text
passwordParam :: Prelude.Maybe Prelude.Text,
    -- | 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
  }
  deriving (InputSourceRequest -> InputSourceRequest -> Bool
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]
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
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. 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:
--
-- 'passwordParam', 'inputSourceRequest_passwordParam' - The key used to extract the password from EC2 Parameter store.
--
-- 'url', 'inputSourceRequest_url' - This represents the customer\'s source URL where stream is pulled from.
--
-- 'username', 'inputSourceRequest_username' - The username for the input source.
newInputSourceRequest ::
  InputSourceRequest
newInputSourceRequest :: InputSourceRequest
newInputSourceRequest =
  InputSourceRequest'
    { $sel:passwordParam:InputSourceRequest' :: Maybe Text
passwordParam =
        forall a. Maybe a
Prelude.Nothing,
      $sel:url:InputSourceRequest' :: Maybe Text
url = forall a. Maybe a
Prelude.Nothing,
      $sel:username:InputSourceRequest' :: Maybe Text
username = forall a. Maybe a
Prelude.Nothing
    }

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

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

instance Prelude.Hashable InputSourceRequest where
  hashWithSalt :: Int -> InputSourceRequest -> Int
hashWithSalt Int
_salt InputSourceRequest' {Maybe Text
username :: Maybe Text
url :: Maybe Text
passwordParam :: Maybe Text
$sel:username:InputSourceRequest' :: InputSourceRequest -> Maybe Text
$sel:url:InputSourceRequest' :: InputSourceRequest -> Maybe Text
$sel:passwordParam:InputSourceRequest' :: InputSourceRequest -> 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 InputSourceRequest where
  rnf :: InputSourceRequest -> ()
rnf InputSourceRequest' {Maybe Text
username :: Maybe Text
url :: Maybe Text
passwordParam :: Maybe Text
$sel:username:InputSourceRequest' :: InputSourceRequest -> Maybe Text
$sel:url:InputSourceRequest' :: InputSourceRequest -> Maybe Text
$sel:passwordParam:InputSourceRequest' :: InputSourceRequest -> 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

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