{-# 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.MacieV2.Types.IpAddressDetails where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MacieV2.Types.IpCity
import Amazonka.MacieV2.Types.IpCountry
import Amazonka.MacieV2.Types.IpGeoLocation
import Amazonka.MacieV2.Types.IpOwner
import qualified Amazonka.Prelude as Prelude
data IpAddressDetails = IpAddressDetails'
{
IpAddressDetails -> Maybe IpCity
ipCity :: Prelude.Maybe IpCity,
IpAddressDetails -> Maybe IpGeoLocation
ipGeoLocation :: Prelude.Maybe IpGeoLocation,
IpAddressDetails -> Maybe Text
ipAddressV4 :: Prelude.Maybe Prelude.Text,
IpAddressDetails -> Maybe IpOwner
ipOwner :: Prelude.Maybe IpOwner,
IpAddressDetails -> Maybe IpCountry
ipCountry :: Prelude.Maybe IpCountry
}
deriving (IpAddressDetails -> IpAddressDetails -> Bool
(IpAddressDetails -> IpAddressDetails -> Bool)
-> (IpAddressDetails -> IpAddressDetails -> Bool)
-> Eq IpAddressDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IpAddressDetails -> IpAddressDetails -> Bool
$c/= :: IpAddressDetails -> IpAddressDetails -> Bool
== :: IpAddressDetails -> IpAddressDetails -> Bool
$c== :: IpAddressDetails -> IpAddressDetails -> Bool
Prelude.Eq, ReadPrec [IpAddressDetails]
ReadPrec IpAddressDetails
Int -> ReadS IpAddressDetails
ReadS [IpAddressDetails]
(Int -> ReadS IpAddressDetails)
-> ReadS [IpAddressDetails]
-> ReadPrec IpAddressDetails
-> ReadPrec [IpAddressDetails]
-> Read IpAddressDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IpAddressDetails]
$creadListPrec :: ReadPrec [IpAddressDetails]
readPrec :: ReadPrec IpAddressDetails
$creadPrec :: ReadPrec IpAddressDetails
readList :: ReadS [IpAddressDetails]
$creadList :: ReadS [IpAddressDetails]
readsPrec :: Int -> ReadS IpAddressDetails
$creadsPrec :: Int -> ReadS IpAddressDetails
Prelude.Read, Int -> IpAddressDetails -> ShowS
[IpAddressDetails] -> ShowS
IpAddressDetails -> String
(Int -> IpAddressDetails -> ShowS)
-> (IpAddressDetails -> String)
-> ([IpAddressDetails] -> ShowS)
-> Show IpAddressDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IpAddressDetails] -> ShowS
$cshowList :: [IpAddressDetails] -> ShowS
show :: IpAddressDetails -> String
$cshow :: IpAddressDetails -> String
showsPrec :: Int -> IpAddressDetails -> ShowS
$cshowsPrec :: Int -> IpAddressDetails -> ShowS
Prelude.Show, (forall x. IpAddressDetails -> Rep IpAddressDetails x)
-> (forall x. Rep IpAddressDetails x -> IpAddressDetails)
-> Generic IpAddressDetails
forall x. Rep IpAddressDetails x -> IpAddressDetails
forall x. IpAddressDetails -> Rep IpAddressDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IpAddressDetails x -> IpAddressDetails
$cfrom :: forall x. IpAddressDetails -> Rep IpAddressDetails x
Prelude.Generic)
newIpAddressDetails ::
IpAddressDetails
newIpAddressDetails :: IpAddressDetails
newIpAddressDetails =
IpAddressDetails' :: Maybe IpCity
-> Maybe IpGeoLocation
-> Maybe Text
-> Maybe IpOwner
-> Maybe IpCountry
-> IpAddressDetails
IpAddressDetails'
{ $sel:ipCity:IpAddressDetails' :: Maybe IpCity
ipCity = Maybe IpCity
forall a. Maybe a
Prelude.Nothing,
$sel:ipGeoLocation:IpAddressDetails' :: Maybe IpGeoLocation
ipGeoLocation = Maybe IpGeoLocation
forall a. Maybe a
Prelude.Nothing,
$sel:ipAddressV4:IpAddressDetails' :: Maybe Text
ipAddressV4 = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:ipOwner:IpAddressDetails' :: Maybe IpOwner
ipOwner = Maybe IpOwner
forall a. Maybe a
Prelude.Nothing,
$sel:ipCountry:IpAddressDetails' :: Maybe IpCountry
ipCountry = Maybe IpCountry
forall a. Maybe a
Prelude.Nothing
}
ipAddressDetails_ipCity :: Lens.Lens' IpAddressDetails (Prelude.Maybe IpCity)
ipAddressDetails_ipCity :: (Maybe IpCity -> f (Maybe IpCity))
-> IpAddressDetails -> f IpAddressDetails
ipAddressDetails_ipCity = (IpAddressDetails -> Maybe IpCity)
-> (IpAddressDetails -> Maybe IpCity -> IpAddressDetails)
-> Lens
IpAddressDetails IpAddressDetails (Maybe IpCity) (Maybe IpCity)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IpAddressDetails' {Maybe IpCity
ipCity :: Maybe IpCity
$sel:ipCity:IpAddressDetails' :: IpAddressDetails -> Maybe IpCity
ipCity} -> Maybe IpCity
ipCity) (\s :: IpAddressDetails
s@IpAddressDetails' {} Maybe IpCity
a -> IpAddressDetails
s {$sel:ipCity:IpAddressDetails' :: Maybe IpCity
ipCity = Maybe IpCity
a} :: IpAddressDetails)
ipAddressDetails_ipGeoLocation :: Lens.Lens' IpAddressDetails (Prelude.Maybe IpGeoLocation)
ipAddressDetails_ipGeoLocation :: (Maybe IpGeoLocation -> f (Maybe IpGeoLocation))
-> IpAddressDetails -> f IpAddressDetails
ipAddressDetails_ipGeoLocation = (IpAddressDetails -> Maybe IpGeoLocation)
-> (IpAddressDetails -> Maybe IpGeoLocation -> IpAddressDetails)
-> Lens
IpAddressDetails
IpAddressDetails
(Maybe IpGeoLocation)
(Maybe IpGeoLocation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IpAddressDetails' {Maybe IpGeoLocation
ipGeoLocation :: Maybe IpGeoLocation
$sel:ipGeoLocation:IpAddressDetails' :: IpAddressDetails -> Maybe IpGeoLocation
ipGeoLocation} -> Maybe IpGeoLocation
ipGeoLocation) (\s :: IpAddressDetails
s@IpAddressDetails' {} Maybe IpGeoLocation
a -> IpAddressDetails
s {$sel:ipGeoLocation:IpAddressDetails' :: Maybe IpGeoLocation
ipGeoLocation = Maybe IpGeoLocation
a} :: IpAddressDetails)
ipAddressDetails_ipAddressV4 :: Lens.Lens' IpAddressDetails (Prelude.Maybe Prelude.Text)
ipAddressDetails_ipAddressV4 :: (Maybe Text -> f (Maybe Text))
-> IpAddressDetails -> f IpAddressDetails
ipAddressDetails_ipAddressV4 = (IpAddressDetails -> Maybe Text)
-> (IpAddressDetails -> Maybe Text -> IpAddressDetails)
-> Lens IpAddressDetails IpAddressDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IpAddressDetails' {Maybe Text
ipAddressV4 :: Maybe Text
$sel:ipAddressV4:IpAddressDetails' :: IpAddressDetails -> Maybe Text
ipAddressV4} -> Maybe Text
ipAddressV4) (\s :: IpAddressDetails
s@IpAddressDetails' {} Maybe Text
a -> IpAddressDetails
s {$sel:ipAddressV4:IpAddressDetails' :: Maybe Text
ipAddressV4 = Maybe Text
a} :: IpAddressDetails)
ipAddressDetails_ipOwner :: Lens.Lens' IpAddressDetails (Prelude.Maybe IpOwner)
ipAddressDetails_ipOwner :: (Maybe IpOwner -> f (Maybe IpOwner))
-> IpAddressDetails -> f IpAddressDetails
ipAddressDetails_ipOwner = (IpAddressDetails -> Maybe IpOwner)
-> (IpAddressDetails -> Maybe IpOwner -> IpAddressDetails)
-> Lens
IpAddressDetails IpAddressDetails (Maybe IpOwner) (Maybe IpOwner)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IpAddressDetails' {Maybe IpOwner
ipOwner :: Maybe IpOwner
$sel:ipOwner:IpAddressDetails' :: IpAddressDetails -> Maybe IpOwner
ipOwner} -> Maybe IpOwner
ipOwner) (\s :: IpAddressDetails
s@IpAddressDetails' {} Maybe IpOwner
a -> IpAddressDetails
s {$sel:ipOwner:IpAddressDetails' :: Maybe IpOwner
ipOwner = Maybe IpOwner
a} :: IpAddressDetails)
ipAddressDetails_ipCountry :: Lens.Lens' IpAddressDetails (Prelude.Maybe IpCountry)
ipAddressDetails_ipCountry :: (Maybe IpCountry -> f (Maybe IpCountry))
-> IpAddressDetails -> f IpAddressDetails
ipAddressDetails_ipCountry = (IpAddressDetails -> Maybe IpCountry)
-> (IpAddressDetails -> Maybe IpCountry -> IpAddressDetails)
-> Lens
IpAddressDetails
IpAddressDetails
(Maybe IpCountry)
(Maybe IpCountry)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IpAddressDetails' {Maybe IpCountry
ipCountry :: Maybe IpCountry
$sel:ipCountry:IpAddressDetails' :: IpAddressDetails -> Maybe IpCountry
ipCountry} -> Maybe IpCountry
ipCountry) (\s :: IpAddressDetails
s@IpAddressDetails' {} Maybe IpCountry
a -> IpAddressDetails
s {$sel:ipCountry:IpAddressDetails' :: Maybe IpCountry
ipCountry = Maybe IpCountry
a} :: IpAddressDetails)
instance Core.FromJSON IpAddressDetails where
parseJSON :: Value -> Parser IpAddressDetails
parseJSON =
String
-> (Object -> Parser IpAddressDetails)
-> Value
-> Parser IpAddressDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"IpAddressDetails"
( \Object
x ->
Maybe IpCity
-> Maybe IpGeoLocation
-> Maybe Text
-> Maybe IpOwner
-> Maybe IpCountry
-> IpAddressDetails
IpAddressDetails'
(Maybe IpCity
-> Maybe IpGeoLocation
-> Maybe Text
-> Maybe IpOwner
-> Maybe IpCountry
-> IpAddressDetails)
-> Parser (Maybe IpCity)
-> Parser
(Maybe IpGeoLocation
-> Maybe Text
-> Maybe IpOwner
-> Maybe IpCountry
-> IpAddressDetails)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe IpCity)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ipCity")
Parser
(Maybe IpGeoLocation
-> Maybe Text
-> Maybe IpOwner
-> Maybe IpCountry
-> IpAddressDetails)
-> Parser (Maybe IpGeoLocation)
-> Parser
(Maybe Text
-> Maybe IpOwner -> Maybe IpCountry -> IpAddressDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe IpGeoLocation)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ipGeoLocation")
Parser
(Maybe Text
-> Maybe IpOwner -> Maybe IpCountry -> IpAddressDetails)
-> Parser (Maybe Text)
-> Parser (Maybe IpOwner -> Maybe IpCountry -> IpAddressDetails)
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
"ipAddressV4")
Parser (Maybe IpOwner -> Maybe IpCountry -> IpAddressDetails)
-> Parser (Maybe IpOwner)
-> Parser (Maybe IpCountry -> IpAddressDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe IpOwner)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ipOwner")
Parser (Maybe IpCountry -> IpAddressDetails)
-> Parser (Maybe IpCountry) -> Parser IpAddressDetails
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe IpCountry)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ipCountry")
)
instance Prelude.Hashable IpAddressDetails
instance Prelude.NFData IpAddressDetails