{-# 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.GuardDuty.Types.Country 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 Country = Country'
{
Country -> Maybe Text
countryCode :: Prelude.Maybe Prelude.Text,
Country -> Maybe Text
countryName :: Prelude.Maybe Prelude.Text
}
deriving (Country -> Country -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Country -> Country -> Bool
$c/= :: Country -> Country -> Bool
== :: Country -> Country -> Bool
$c== :: Country -> Country -> Bool
Prelude.Eq, ReadPrec [Country]
ReadPrec Country
Int -> ReadS Country
ReadS [Country]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Country]
$creadListPrec :: ReadPrec [Country]
readPrec :: ReadPrec Country
$creadPrec :: ReadPrec Country
readList :: ReadS [Country]
$creadList :: ReadS [Country]
readsPrec :: Int -> ReadS Country
$creadsPrec :: Int -> ReadS Country
Prelude.Read, Int -> Country -> ShowS
[Country] -> ShowS
Country -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Country] -> ShowS
$cshowList :: [Country] -> ShowS
show :: Country -> String
$cshow :: Country -> String
showsPrec :: Int -> Country -> ShowS
$cshowsPrec :: Int -> Country -> ShowS
Prelude.Show, forall x. Rep Country x -> Country
forall x. Country -> Rep Country x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Country x -> Country
$cfrom :: forall x. Country -> Rep Country x
Prelude.Generic)
newCountry ::
Country
newCountry :: Country
newCountry =
Country'
{ $sel:countryCode:Country' :: Maybe Text
countryCode = forall a. Maybe a
Prelude.Nothing,
$sel:countryName:Country' :: Maybe Text
countryName = forall a. Maybe a
Prelude.Nothing
}
country_countryCode :: Lens.Lens' Country (Prelude.Maybe Prelude.Text)
country_countryCode :: Lens' Country (Maybe Text)
country_countryCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Country' {Maybe Text
countryCode :: Maybe Text
$sel:countryCode:Country' :: Country -> Maybe Text
countryCode} -> Maybe Text
countryCode) (\s :: Country
s@Country' {} Maybe Text
a -> Country
s {$sel:countryCode:Country' :: Maybe Text
countryCode = Maybe Text
a} :: Country)
country_countryName :: Lens.Lens' Country (Prelude.Maybe Prelude.Text)
country_countryName :: Lens' Country (Maybe Text)
country_countryName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Country' {Maybe Text
countryName :: Maybe Text
$sel:countryName:Country' :: Country -> Maybe Text
countryName} -> Maybe Text
countryName) (\s :: Country
s@Country' {} Maybe Text
a -> Country
s {$sel:countryName:Country' :: Maybe Text
countryName = Maybe Text
a} :: Country)
instance Data.FromJSON Country where
parseJSON :: Value -> Parser Country
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Country"
( \Object
x ->
Maybe Text -> Maybe Text -> Country
Country'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"countryCode")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"countryName")
)
instance Prelude.Hashable Country where
hashWithSalt :: Int -> Country -> Int
hashWithSalt Int
_salt Country' {Maybe Text
countryName :: Maybe Text
countryCode :: Maybe Text
$sel:countryName:Country' :: Country -> Maybe Text
$sel:countryCode:Country' :: Country -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
countryCode
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
countryName
instance Prelude.NFData Country where
rnf :: Country -> ()
rnf Country' {Maybe Text
countryName :: Maybe Text
countryCode :: Maybe Text
$sel:countryName:Country' :: Country -> Maybe Text
$sel:countryCode:Country' :: Country -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
countryCode
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
countryName