{-# 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.QuickSight.Types.MySqlParameters where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data MySqlParameters = MySqlParameters'
{
MySqlParameters -> Text
host :: Prelude.Text,
MySqlParameters -> Natural
port :: Prelude.Natural,
MySqlParameters -> Text
database :: Prelude.Text
}
deriving (MySqlParameters -> MySqlParameters -> Bool
(MySqlParameters -> MySqlParameters -> Bool)
-> (MySqlParameters -> MySqlParameters -> Bool)
-> Eq MySqlParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MySqlParameters -> MySqlParameters -> Bool
$c/= :: MySqlParameters -> MySqlParameters -> Bool
== :: MySqlParameters -> MySqlParameters -> Bool
$c== :: MySqlParameters -> MySqlParameters -> Bool
Prelude.Eq, ReadPrec [MySqlParameters]
ReadPrec MySqlParameters
Int -> ReadS MySqlParameters
ReadS [MySqlParameters]
(Int -> ReadS MySqlParameters)
-> ReadS [MySqlParameters]
-> ReadPrec MySqlParameters
-> ReadPrec [MySqlParameters]
-> Read MySqlParameters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MySqlParameters]
$creadListPrec :: ReadPrec [MySqlParameters]
readPrec :: ReadPrec MySqlParameters
$creadPrec :: ReadPrec MySqlParameters
readList :: ReadS [MySqlParameters]
$creadList :: ReadS [MySqlParameters]
readsPrec :: Int -> ReadS MySqlParameters
$creadsPrec :: Int -> ReadS MySqlParameters
Prelude.Read, Int -> MySqlParameters -> ShowS
[MySqlParameters] -> ShowS
MySqlParameters -> String
(Int -> MySqlParameters -> ShowS)
-> (MySqlParameters -> String)
-> ([MySqlParameters] -> ShowS)
-> Show MySqlParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MySqlParameters] -> ShowS
$cshowList :: [MySqlParameters] -> ShowS
show :: MySqlParameters -> String
$cshow :: MySqlParameters -> String
showsPrec :: Int -> MySqlParameters -> ShowS
$cshowsPrec :: Int -> MySqlParameters -> ShowS
Prelude.Show, (forall x. MySqlParameters -> Rep MySqlParameters x)
-> (forall x. Rep MySqlParameters x -> MySqlParameters)
-> Generic MySqlParameters
forall x. Rep MySqlParameters x -> MySqlParameters
forall x. MySqlParameters -> Rep MySqlParameters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MySqlParameters x -> MySqlParameters
$cfrom :: forall x. MySqlParameters -> Rep MySqlParameters x
Prelude.Generic)
newMySqlParameters ::
Prelude.Text ->
Prelude.Natural ->
Prelude.Text ->
MySqlParameters
newMySqlParameters :: Text -> Natural -> Text -> MySqlParameters
newMySqlParameters Text
pHost_ Natural
pPort_ Text
pDatabase_ =
MySqlParameters' :: Text -> Natural -> Text -> MySqlParameters
MySqlParameters'
{ $sel:host:MySqlParameters' :: Text
host = Text
pHost_,
$sel:port:MySqlParameters' :: Natural
port = Natural
pPort_,
$sel:database:MySqlParameters' :: Text
database = Text
pDatabase_
}
mySqlParameters_host :: Lens.Lens' MySqlParameters Prelude.Text
mySqlParameters_host :: (Text -> f Text) -> MySqlParameters -> f MySqlParameters
mySqlParameters_host = (MySqlParameters -> Text)
-> (MySqlParameters -> Text -> MySqlParameters)
-> Lens MySqlParameters MySqlParameters Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MySqlParameters' {Text
host :: Text
$sel:host:MySqlParameters' :: MySqlParameters -> Text
host} -> Text
host) (\s :: MySqlParameters
s@MySqlParameters' {} Text
a -> MySqlParameters
s {$sel:host:MySqlParameters' :: Text
host = Text
a} :: MySqlParameters)
mySqlParameters_port :: Lens.Lens' MySqlParameters Prelude.Natural
mySqlParameters_port :: (Natural -> f Natural) -> MySqlParameters -> f MySqlParameters
mySqlParameters_port = (MySqlParameters -> Natural)
-> (MySqlParameters -> Natural -> MySqlParameters)
-> Lens MySqlParameters MySqlParameters Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MySqlParameters' {Natural
port :: Natural
$sel:port:MySqlParameters' :: MySqlParameters -> Natural
port} -> Natural
port) (\s :: MySqlParameters
s@MySqlParameters' {} Natural
a -> MySqlParameters
s {$sel:port:MySqlParameters' :: Natural
port = Natural
a} :: MySqlParameters)
mySqlParameters_database :: Lens.Lens' MySqlParameters Prelude.Text
mySqlParameters_database :: (Text -> f Text) -> MySqlParameters -> f MySqlParameters
mySqlParameters_database = (MySqlParameters -> Text)
-> (MySqlParameters -> Text -> MySqlParameters)
-> Lens MySqlParameters MySqlParameters Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MySqlParameters' {Text
database :: Text
$sel:database:MySqlParameters' :: MySqlParameters -> Text
database} -> Text
database) (\s :: MySqlParameters
s@MySqlParameters' {} Text
a -> MySqlParameters
s {$sel:database:MySqlParameters' :: Text
database = Text
a} :: MySqlParameters)
instance Core.FromJSON MySqlParameters where
parseJSON :: Value -> Parser MySqlParameters
parseJSON =
String
-> (Object -> Parser MySqlParameters)
-> Value
-> Parser MySqlParameters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"MySqlParameters"
( \Object
x ->
Text -> Natural -> Text -> MySqlParameters
MySqlParameters'
(Text -> Natural -> Text -> MySqlParameters)
-> Parser Text -> Parser (Natural -> Text -> MySqlParameters)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Host")
Parser (Natural -> Text -> MySqlParameters)
-> Parser Natural -> Parser (Text -> MySqlParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Port")
Parser (Text -> MySqlParameters)
-> Parser Text -> Parser MySqlParameters
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
"Database")
)
instance Prelude.Hashable MySqlParameters
instance Prelude.NFData MySqlParameters
instance Core.ToJSON MySqlParameters where
toJSON :: MySqlParameters -> Value
toJSON MySqlParameters' {Natural
Text
database :: Text
port :: Natural
host :: Text
$sel:database:MySqlParameters' :: MySqlParameters -> Text
$sel:port:MySqlParameters' :: MySqlParameters -> Natural
$sel:host:MySqlParameters' :: MySqlParameters -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Host" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
host),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Port" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
port),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Database" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
database)
]
)