{-# 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.IpCountry where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data IpCountry = IpCountry'
{
IpCountry -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
IpCountry -> Maybe Text
code :: Prelude.Maybe Prelude.Text
}
deriving (IpCountry -> IpCountry -> Bool
(IpCountry -> IpCountry -> Bool)
-> (IpCountry -> IpCountry -> Bool) -> Eq IpCountry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IpCountry -> IpCountry -> Bool
$c/= :: IpCountry -> IpCountry -> Bool
== :: IpCountry -> IpCountry -> Bool
$c== :: IpCountry -> IpCountry -> Bool
Prelude.Eq, ReadPrec [IpCountry]
ReadPrec IpCountry
Int -> ReadS IpCountry
ReadS [IpCountry]
(Int -> ReadS IpCountry)
-> ReadS [IpCountry]
-> ReadPrec IpCountry
-> ReadPrec [IpCountry]
-> Read IpCountry
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IpCountry]
$creadListPrec :: ReadPrec [IpCountry]
readPrec :: ReadPrec IpCountry
$creadPrec :: ReadPrec IpCountry
readList :: ReadS [IpCountry]
$creadList :: ReadS [IpCountry]
readsPrec :: Int -> ReadS IpCountry
$creadsPrec :: Int -> ReadS IpCountry
Prelude.Read, Int -> IpCountry -> ShowS
[IpCountry] -> ShowS
IpCountry -> String
(Int -> IpCountry -> ShowS)
-> (IpCountry -> String)
-> ([IpCountry] -> ShowS)
-> Show IpCountry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IpCountry] -> ShowS
$cshowList :: [IpCountry] -> ShowS
show :: IpCountry -> String
$cshow :: IpCountry -> String
showsPrec :: Int -> IpCountry -> ShowS
$cshowsPrec :: Int -> IpCountry -> ShowS
Prelude.Show, (forall x. IpCountry -> Rep IpCountry x)
-> (forall x. Rep IpCountry x -> IpCountry) -> Generic IpCountry
forall x. Rep IpCountry x -> IpCountry
forall x. IpCountry -> Rep IpCountry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IpCountry x -> IpCountry
$cfrom :: forall x. IpCountry -> Rep IpCountry x
Prelude.Generic)
newIpCountry ::
IpCountry
newIpCountry :: IpCountry
newIpCountry =
IpCountry' :: Maybe Text -> Maybe Text -> IpCountry
IpCountry'
{ $sel:name:IpCountry' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:code:IpCountry' :: Maybe Text
code = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
ipCountry_name :: Lens.Lens' IpCountry (Prelude.Maybe Prelude.Text)
ipCountry_name :: (Maybe Text -> f (Maybe Text)) -> IpCountry -> f IpCountry
ipCountry_name = (IpCountry -> Maybe Text)
-> (IpCountry -> Maybe Text -> IpCountry)
-> Lens IpCountry IpCountry (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IpCountry' {Maybe Text
name :: Maybe Text
$sel:name:IpCountry' :: IpCountry -> Maybe Text
name} -> Maybe Text
name) (\s :: IpCountry
s@IpCountry' {} Maybe Text
a -> IpCountry
s {$sel:name:IpCountry' :: Maybe Text
name = Maybe Text
a} :: IpCountry)
ipCountry_code :: Lens.Lens' IpCountry (Prelude.Maybe Prelude.Text)
ipCountry_code :: (Maybe Text -> f (Maybe Text)) -> IpCountry -> f IpCountry
ipCountry_code = (IpCountry -> Maybe Text)
-> (IpCountry -> Maybe Text -> IpCountry)
-> Lens IpCountry IpCountry (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IpCountry' {Maybe Text
code :: Maybe Text
$sel:code:IpCountry' :: IpCountry -> Maybe Text
code} -> Maybe Text
code) (\s :: IpCountry
s@IpCountry' {} Maybe Text
a -> IpCountry
s {$sel:code:IpCountry' :: Maybe Text
code = Maybe Text
a} :: IpCountry)
instance Core.FromJSON IpCountry where
parseJSON :: Value -> Parser IpCountry
parseJSON =
String -> (Object -> Parser IpCountry) -> Value -> Parser IpCountry
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"IpCountry"
( \Object
x ->
Maybe Text -> Maybe Text -> IpCountry
IpCountry'
(Maybe Text -> Maybe Text -> IpCountry)
-> Parser (Maybe Text) -> Parser (Maybe Text -> IpCountry)
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
"name") Parser (Maybe Text -> IpCountry)
-> Parser (Maybe Text) -> Parser IpCountry
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
"code")
)
instance Prelude.Hashable IpCountry
instance Prelude.NFData IpCountry