{-# 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 #-}
module Amazonka.MediaLive.Types.InputLocation where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data InputLocation = InputLocation'
{
InputLocation -> Maybe Text
username :: Prelude.Maybe Prelude.Text,
InputLocation -> Maybe Text
passwordParam :: Prelude.Maybe Prelude.Text,
InputLocation -> Text
uri :: Prelude.Text
}
deriving (InputLocation -> InputLocation -> Bool
(InputLocation -> InputLocation -> Bool)
-> (InputLocation -> InputLocation -> Bool) -> Eq InputLocation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InputLocation -> InputLocation -> Bool
$c/= :: InputLocation -> InputLocation -> Bool
== :: InputLocation -> InputLocation -> Bool
$c== :: InputLocation -> InputLocation -> Bool
Prelude.Eq, ReadPrec [InputLocation]
ReadPrec InputLocation
Int -> ReadS InputLocation
ReadS [InputLocation]
(Int -> ReadS InputLocation)
-> ReadS [InputLocation]
-> ReadPrec InputLocation
-> ReadPrec [InputLocation]
-> Read InputLocation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InputLocation]
$creadListPrec :: ReadPrec [InputLocation]
readPrec :: ReadPrec InputLocation
$creadPrec :: ReadPrec InputLocation
readList :: ReadS [InputLocation]
$creadList :: ReadS [InputLocation]
readsPrec :: Int -> ReadS InputLocation
$creadsPrec :: Int -> ReadS InputLocation
Prelude.Read, Int -> InputLocation -> ShowS
[InputLocation] -> ShowS
InputLocation -> String
(Int -> InputLocation -> ShowS)
-> (InputLocation -> String)
-> ([InputLocation] -> ShowS)
-> Show InputLocation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InputLocation] -> ShowS
$cshowList :: [InputLocation] -> ShowS
show :: InputLocation -> String
$cshow :: InputLocation -> String
showsPrec :: Int -> InputLocation -> ShowS
$cshowsPrec :: Int -> InputLocation -> ShowS
Prelude.Show, (forall x. InputLocation -> Rep InputLocation x)
-> (forall x. Rep InputLocation x -> InputLocation)
-> Generic InputLocation
forall x. Rep InputLocation x -> InputLocation
forall x. InputLocation -> Rep InputLocation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InputLocation x -> InputLocation
$cfrom :: forall x. InputLocation -> Rep InputLocation x
Prelude.Generic)
newInputLocation ::
Prelude.Text ->
InputLocation
newInputLocation :: Text -> InputLocation
newInputLocation Text
pUri_ =
InputLocation' :: Maybe Text -> Maybe Text -> Text -> InputLocation
InputLocation'
{ $sel:username:InputLocation' :: Maybe Text
username = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:passwordParam:InputLocation' :: Maybe Text
passwordParam = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:uri:InputLocation' :: Text
uri = Text
pUri_
}
inputLocation_username :: Lens.Lens' InputLocation (Prelude.Maybe Prelude.Text)
inputLocation_username :: (Maybe Text -> f (Maybe Text)) -> InputLocation -> f InputLocation
inputLocation_username = (InputLocation -> Maybe Text)
-> (InputLocation -> Maybe Text -> InputLocation)
-> Lens InputLocation InputLocation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputLocation' {Maybe Text
username :: Maybe Text
$sel:username:InputLocation' :: InputLocation -> Maybe Text
username} -> Maybe Text
username) (\s :: InputLocation
s@InputLocation' {} Maybe Text
a -> InputLocation
s {$sel:username:InputLocation' :: Maybe Text
username = Maybe Text
a} :: InputLocation)
inputLocation_passwordParam :: Lens.Lens' InputLocation (Prelude.Maybe Prelude.Text)
inputLocation_passwordParam :: (Maybe Text -> f (Maybe Text)) -> InputLocation -> f InputLocation
inputLocation_passwordParam = (InputLocation -> Maybe Text)
-> (InputLocation -> Maybe Text -> InputLocation)
-> Lens InputLocation InputLocation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputLocation' {Maybe Text
passwordParam :: Maybe Text
$sel:passwordParam:InputLocation' :: InputLocation -> Maybe Text
passwordParam} -> Maybe Text
passwordParam) (\s :: InputLocation
s@InputLocation' {} Maybe Text
a -> InputLocation
s {$sel:passwordParam:InputLocation' :: Maybe Text
passwordParam = Maybe Text
a} :: InputLocation)
inputLocation_uri :: Lens.Lens' InputLocation Prelude.Text
inputLocation_uri :: (Text -> f Text) -> InputLocation -> f InputLocation
inputLocation_uri = (InputLocation -> Text)
-> (InputLocation -> Text -> InputLocation)
-> Lens InputLocation InputLocation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputLocation' {Text
uri :: Text
$sel:uri:InputLocation' :: InputLocation -> Text
uri} -> Text
uri) (\s :: InputLocation
s@InputLocation' {} Text
a -> InputLocation
s {$sel:uri:InputLocation' :: Text
uri = Text
a} :: InputLocation)
instance Core.FromJSON InputLocation where
parseJSON :: Value -> Parser InputLocation
parseJSON =
String
-> (Object -> Parser InputLocation)
-> Value
-> Parser InputLocation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"InputLocation"
( \Object
x ->
Maybe Text -> Maybe Text -> Text -> InputLocation
InputLocation'
(Maybe Text -> Maybe Text -> Text -> InputLocation)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Text -> InputLocation)
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
"username")
Parser (Maybe Text -> Text -> InputLocation)
-> Parser (Maybe Text) -> Parser (Text -> InputLocation)
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")
Parser (Text -> InputLocation)
-> Parser Text -> Parser InputLocation
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"uri")
)
instance Prelude.Hashable InputLocation
instance Prelude.NFData InputLocation
instance Core.ToJSON InputLocation where
toJSON :: InputLocation -> Value
toJSON InputLocation' {Maybe Text
Text
uri :: Text
passwordParam :: Maybe Text
username :: Maybe Text
$sel:uri:InputLocation' :: InputLocation -> Text
$sel:passwordParam:InputLocation' :: InputLocation -> Maybe Text
$sel:username:InputLocation' :: InputLocation -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (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,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"uri" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
uri)
]
)