{-# 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.Route53.Types.GeoLocation where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Route53.Internal
data GeoLocation = GeoLocation'
{
GeoLocation -> Maybe Text
subdivisionCode :: Prelude.Maybe Prelude.Text,
GeoLocation -> Maybe Text
countryCode :: Prelude.Maybe Prelude.Text,
GeoLocation -> Maybe Text
continentCode :: Prelude.Maybe Prelude.Text
}
deriving (GeoLocation -> GeoLocation -> Bool
(GeoLocation -> GeoLocation -> Bool)
-> (GeoLocation -> GeoLocation -> Bool) -> Eq GeoLocation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GeoLocation -> GeoLocation -> Bool
$c/= :: GeoLocation -> GeoLocation -> Bool
== :: GeoLocation -> GeoLocation -> Bool
$c== :: GeoLocation -> GeoLocation -> Bool
Prelude.Eq, ReadPrec [GeoLocation]
ReadPrec GeoLocation
Int -> ReadS GeoLocation
ReadS [GeoLocation]
(Int -> ReadS GeoLocation)
-> ReadS [GeoLocation]
-> ReadPrec GeoLocation
-> ReadPrec [GeoLocation]
-> Read GeoLocation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GeoLocation]
$creadListPrec :: ReadPrec [GeoLocation]
readPrec :: ReadPrec GeoLocation
$creadPrec :: ReadPrec GeoLocation
readList :: ReadS [GeoLocation]
$creadList :: ReadS [GeoLocation]
readsPrec :: Int -> ReadS GeoLocation
$creadsPrec :: Int -> ReadS GeoLocation
Prelude.Read, Int -> GeoLocation -> ShowS
[GeoLocation] -> ShowS
GeoLocation -> String
(Int -> GeoLocation -> ShowS)
-> (GeoLocation -> String)
-> ([GeoLocation] -> ShowS)
-> Show GeoLocation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GeoLocation] -> ShowS
$cshowList :: [GeoLocation] -> ShowS
show :: GeoLocation -> String
$cshow :: GeoLocation -> String
showsPrec :: Int -> GeoLocation -> ShowS
$cshowsPrec :: Int -> GeoLocation -> ShowS
Prelude.Show, (forall x. GeoLocation -> Rep GeoLocation x)
-> (forall x. Rep GeoLocation x -> GeoLocation)
-> Generic GeoLocation
forall x. Rep GeoLocation x -> GeoLocation
forall x. GeoLocation -> Rep GeoLocation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GeoLocation x -> GeoLocation
$cfrom :: forall x. GeoLocation -> Rep GeoLocation x
Prelude.Generic)
newGeoLocation ::
GeoLocation
newGeoLocation :: GeoLocation
newGeoLocation =
GeoLocation' :: Maybe Text -> Maybe Text -> Maybe Text -> GeoLocation
GeoLocation'
{ $sel:subdivisionCode:GeoLocation' :: Maybe Text
subdivisionCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:countryCode:GeoLocation' :: Maybe Text
countryCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:continentCode:GeoLocation' :: Maybe Text
continentCode = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
geoLocation_subdivisionCode :: Lens.Lens' GeoLocation (Prelude.Maybe Prelude.Text)
geoLocation_subdivisionCode :: (Maybe Text -> f (Maybe Text)) -> GeoLocation -> f GeoLocation
geoLocation_subdivisionCode = (GeoLocation -> Maybe Text)
-> (GeoLocation -> Maybe Text -> GeoLocation)
-> Lens GeoLocation GeoLocation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeoLocation' {Maybe Text
subdivisionCode :: Maybe Text
$sel:subdivisionCode:GeoLocation' :: GeoLocation -> Maybe Text
subdivisionCode} -> Maybe Text
subdivisionCode) (\s :: GeoLocation
s@GeoLocation' {} Maybe Text
a -> GeoLocation
s {$sel:subdivisionCode:GeoLocation' :: Maybe Text
subdivisionCode = Maybe Text
a} :: GeoLocation)
geoLocation_countryCode :: Lens.Lens' GeoLocation (Prelude.Maybe Prelude.Text)
geoLocation_countryCode :: (Maybe Text -> f (Maybe Text)) -> GeoLocation -> f GeoLocation
geoLocation_countryCode = (GeoLocation -> Maybe Text)
-> (GeoLocation -> Maybe Text -> GeoLocation)
-> Lens GeoLocation GeoLocation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeoLocation' {Maybe Text
countryCode :: Maybe Text
$sel:countryCode:GeoLocation' :: GeoLocation -> Maybe Text
countryCode} -> Maybe Text
countryCode) (\s :: GeoLocation
s@GeoLocation' {} Maybe Text
a -> GeoLocation
s {$sel:countryCode:GeoLocation' :: Maybe Text
countryCode = Maybe Text
a} :: GeoLocation)
geoLocation_continentCode :: Lens.Lens' GeoLocation (Prelude.Maybe Prelude.Text)
geoLocation_continentCode :: (Maybe Text -> f (Maybe Text)) -> GeoLocation -> f GeoLocation
geoLocation_continentCode = (GeoLocation -> Maybe Text)
-> (GeoLocation -> Maybe Text -> GeoLocation)
-> Lens GeoLocation GeoLocation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeoLocation' {Maybe Text
continentCode :: Maybe Text
$sel:continentCode:GeoLocation' :: GeoLocation -> Maybe Text
continentCode} -> Maybe Text
continentCode) (\s :: GeoLocation
s@GeoLocation' {} Maybe Text
a -> GeoLocation
s {$sel:continentCode:GeoLocation' :: Maybe Text
continentCode = Maybe Text
a} :: GeoLocation)
instance Core.FromXML GeoLocation where
parseXML :: [Node] -> Either String GeoLocation
parseXML [Node]
x =
Maybe Text -> Maybe Text -> Maybe Text -> GeoLocation
GeoLocation'
(Maybe Text -> Maybe Text -> Maybe Text -> GeoLocation)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Maybe Text -> GeoLocation)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"SubdivisionCode")
Either String (Maybe Text -> Maybe Text -> GeoLocation)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> GeoLocation)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"CountryCode")
Either String (Maybe Text -> GeoLocation)
-> Either String (Maybe Text) -> Either String GeoLocation
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ContinentCode")
instance Prelude.Hashable GeoLocation
instance Prelude.NFData GeoLocation
instance Core.ToXML GeoLocation where
toXML :: GeoLocation -> XML
toXML GeoLocation' {Maybe Text
continentCode :: Maybe Text
countryCode :: Maybe Text
subdivisionCode :: Maybe Text
$sel:continentCode:GeoLocation' :: GeoLocation -> Maybe Text
$sel:countryCode:GeoLocation' :: GeoLocation -> Maybe Text
$sel:subdivisionCode:GeoLocation' :: GeoLocation -> Maybe Text
..} =
[XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"SubdivisionCode" Name -> Maybe Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Text
subdivisionCode,
Name
"CountryCode" Name -> Maybe Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Text
countryCode,
Name
"ContinentCode" Name -> Maybe Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Text
continentCode
]