{-# 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.NetworkFirewall.Types.Address where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Address = Address'
{
Address -> Text
addressDefinition :: Prelude.Text
}
deriving (Address -> Address -> Bool
(Address -> Address -> Bool)
-> (Address -> Address -> Bool) -> Eq Address
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Address -> Address -> Bool
$c/= :: Address -> Address -> Bool
== :: Address -> Address -> Bool
$c== :: Address -> Address -> Bool
Prelude.Eq, ReadPrec [Address]
ReadPrec Address
Int -> ReadS Address
ReadS [Address]
(Int -> ReadS Address)
-> ReadS [Address]
-> ReadPrec Address
-> ReadPrec [Address]
-> Read Address
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Address]
$creadListPrec :: ReadPrec [Address]
readPrec :: ReadPrec Address
$creadPrec :: ReadPrec Address
readList :: ReadS [Address]
$creadList :: ReadS [Address]
readsPrec :: Int -> ReadS Address
$creadsPrec :: Int -> ReadS Address
Prelude.Read, Int -> Address -> ShowS
[Address] -> ShowS
Address -> String
(Int -> Address -> ShowS)
-> (Address -> String) -> ([Address] -> ShowS) -> Show Address
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Address] -> ShowS
$cshowList :: [Address] -> ShowS
show :: Address -> String
$cshow :: Address -> String
showsPrec :: Int -> Address -> ShowS
$cshowsPrec :: Int -> Address -> ShowS
Prelude.Show, (forall x. Address -> Rep Address x)
-> (forall x. Rep Address x -> Address) -> Generic Address
forall x. Rep Address x -> Address
forall x. Address -> Rep Address x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Address x -> Address
$cfrom :: forall x. Address -> Rep Address x
Prelude.Generic)
newAddress ::
Prelude.Text ->
Address
newAddress :: Text -> Address
newAddress Text
pAddressDefinition_ =
Address' :: Text -> Address
Address' {$sel:addressDefinition:Address' :: Text
addressDefinition = Text
pAddressDefinition_}
address_addressDefinition :: Lens.Lens' Address Prelude.Text
address_addressDefinition :: (Text -> f Text) -> Address -> f Address
address_addressDefinition = (Address -> Text)
-> (Address -> Text -> Address) -> Lens Address Address Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Address' {Text
addressDefinition :: Text
$sel:addressDefinition:Address' :: Address -> Text
addressDefinition} -> Text
addressDefinition) (\s :: Address
s@Address' {} Text
a -> Address
s {$sel:addressDefinition:Address' :: Text
addressDefinition = Text
a} :: Address)
instance Core.FromJSON Address where
parseJSON :: Value -> Parser Address
parseJSON =
String -> (Object -> Parser Address) -> Value -> Parser Address
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Address"
( \Object
x ->
Text -> Address
Address' (Text -> Address) -> Parser Text -> Parser Address
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
"AddressDefinition")
)
instance Prelude.Hashable Address
instance Prelude.NFData Address
instance Core.ToJSON Address where
toJSON :: Address -> Value
toJSON Address' {Text
addressDefinition :: Text
$sel:addressDefinition:Address' :: Address -> 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
"AddressDefinition" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
addressDefinition)
]
)