{-# 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.FMS.Types.App 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
data App = App'
{
App -> Text
appName :: Prelude.Text,
App -> Text
protocol :: Prelude.Text,
App -> Natural
port :: Prelude.Natural
}
deriving (App -> App -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: App -> App -> Bool
$c/= :: App -> App -> Bool
== :: App -> App -> Bool
$c== :: App -> App -> Bool
Prelude.Eq, ReadPrec [App]
ReadPrec App
Int -> ReadS App
ReadS [App]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [App]
$creadListPrec :: ReadPrec [App]
readPrec :: ReadPrec App
$creadPrec :: ReadPrec App
readList :: ReadS [App]
$creadList :: ReadS [App]
readsPrec :: Int -> ReadS App
$creadsPrec :: Int -> ReadS App
Prelude.Read, Int -> App -> ShowS
[App] -> ShowS
App -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [App] -> ShowS
$cshowList :: [App] -> ShowS
show :: App -> String
$cshow :: App -> String
showsPrec :: Int -> App -> ShowS
$cshowsPrec :: Int -> App -> ShowS
Prelude.Show, forall x. Rep App x -> App
forall x. App -> Rep App x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep App x -> App
$cfrom :: forall x. App -> Rep App x
Prelude.Generic)
newApp ::
Prelude.Text ->
Prelude.Text ->
Prelude.Natural ->
App
newApp :: Text -> Text -> Natural -> App
newApp Text
pAppName_ Text
pProtocol_ Natural
pPort_ =
App'
{ $sel:appName:App' :: Text
appName = Text
pAppName_,
$sel:protocol:App' :: Text
protocol = Text
pProtocol_,
$sel:port:App' :: Natural
port = Natural
pPort_
}
app_appName :: Lens.Lens' App Prelude.Text
app_appName :: Lens' App Text
app_appName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\App' {Text
appName :: Text
$sel:appName:App' :: App -> Text
appName} -> Text
appName) (\s :: App
s@App' {} Text
a -> App
s {$sel:appName:App' :: Text
appName = Text
a} :: App)
app_protocol :: Lens.Lens' App Prelude.Text
app_protocol :: Lens' App Text
app_protocol = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\App' {Text
protocol :: Text
$sel:protocol:App' :: App -> Text
protocol} -> Text
protocol) (\s :: App
s@App' {} Text
a -> App
s {$sel:protocol:App' :: Text
protocol = Text
a} :: App)
app_port :: Lens.Lens' App Prelude.Natural
app_port :: Lens' App Natural
app_port = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\App' {Natural
port :: Natural
$sel:port:App' :: App -> Natural
port} -> Natural
port) (\s :: App
s@App' {} Natural
a -> App
s {$sel:port:App' :: Natural
port = Natural
a} :: App)
instance Data.FromJSON App where
parseJSON :: Value -> Parser App
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"App"
( \Object
x ->
Text -> Text -> Natural -> App
App'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"AppName")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Protocol")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Port")
)
instance Prelude.Hashable App where
hashWithSalt :: Int -> App -> Int
hashWithSalt Int
_salt App' {Natural
Text
port :: Natural
protocol :: Text
appName :: Text
$sel:port:App' :: App -> Natural
$sel:protocol:App' :: App -> Text
$sel:appName:App' :: App -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
appName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
protocol
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
port
instance Prelude.NFData App where
rnf :: App -> ()
rnf App' {Natural
Text
port :: Natural
protocol :: Text
appName :: Text
$sel:port:App' :: App -> Natural
$sel:protocol:App' :: App -> Text
$sel:appName:App' :: App -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
appName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
protocol
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
port
instance Data.ToJSON App where
toJSON :: App -> Value
toJSON App' {Natural
Text
port :: Natural
protocol :: Text
appName :: Text
$sel:port:App' :: App -> Natural
$sel:protocol:App' :: App -> Text
$sel:appName:App' :: App -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"AppName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
appName),
forall a. a -> Maybe a
Prelude.Just (Key
"Protocol" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
protocol),
forall a. a -> Maybe a
Prelude.Just (Key
"Port" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
port)
]
)