{-# 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.Pinpoint.Types.EndpointLocation 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 EndpointLocation = EndpointLocation'
{
EndpointLocation -> Maybe Text
city :: Prelude.Maybe Prelude.Text,
EndpointLocation -> Maybe Text
country :: Prelude.Maybe Prelude.Text,
EndpointLocation -> Maybe Double
latitude :: Prelude.Maybe Prelude.Double,
EndpointLocation -> Maybe Double
longitude :: Prelude.Maybe Prelude.Double,
EndpointLocation -> Maybe Text
postalCode :: Prelude.Maybe Prelude.Text,
EndpointLocation -> Maybe Text
region :: Prelude.Maybe Prelude.Text
}
deriving (EndpointLocation -> EndpointLocation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EndpointLocation -> EndpointLocation -> Bool
$c/= :: EndpointLocation -> EndpointLocation -> Bool
== :: EndpointLocation -> EndpointLocation -> Bool
$c== :: EndpointLocation -> EndpointLocation -> Bool
Prelude.Eq, ReadPrec [EndpointLocation]
ReadPrec EndpointLocation
Int -> ReadS EndpointLocation
ReadS [EndpointLocation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EndpointLocation]
$creadListPrec :: ReadPrec [EndpointLocation]
readPrec :: ReadPrec EndpointLocation
$creadPrec :: ReadPrec EndpointLocation
readList :: ReadS [EndpointLocation]
$creadList :: ReadS [EndpointLocation]
readsPrec :: Int -> ReadS EndpointLocation
$creadsPrec :: Int -> ReadS EndpointLocation
Prelude.Read, Int -> EndpointLocation -> ShowS
[EndpointLocation] -> ShowS
EndpointLocation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EndpointLocation] -> ShowS
$cshowList :: [EndpointLocation] -> ShowS
show :: EndpointLocation -> String
$cshow :: EndpointLocation -> String
showsPrec :: Int -> EndpointLocation -> ShowS
$cshowsPrec :: Int -> EndpointLocation -> ShowS
Prelude.Show, forall x. Rep EndpointLocation x -> EndpointLocation
forall x. EndpointLocation -> Rep EndpointLocation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EndpointLocation x -> EndpointLocation
$cfrom :: forall x. EndpointLocation -> Rep EndpointLocation x
Prelude.Generic)
newEndpointLocation ::
EndpointLocation
newEndpointLocation :: EndpointLocation
newEndpointLocation =
EndpointLocation'
{ $sel:city:EndpointLocation' :: Maybe Text
city = forall a. Maybe a
Prelude.Nothing,
$sel:country:EndpointLocation' :: Maybe Text
country = forall a. Maybe a
Prelude.Nothing,
$sel:latitude:EndpointLocation' :: Maybe Double
latitude = forall a. Maybe a
Prelude.Nothing,
$sel:longitude:EndpointLocation' :: Maybe Double
longitude = forall a. Maybe a
Prelude.Nothing,
$sel:postalCode:EndpointLocation' :: Maybe Text
postalCode = forall a. Maybe a
Prelude.Nothing,
$sel:region:EndpointLocation' :: Maybe Text
region = forall a. Maybe a
Prelude.Nothing
}
endpointLocation_city :: Lens.Lens' EndpointLocation (Prelude.Maybe Prelude.Text)
endpointLocation_city :: Lens' EndpointLocation (Maybe Text)
endpointLocation_city = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointLocation' {Maybe Text
city :: Maybe Text
$sel:city:EndpointLocation' :: EndpointLocation -> Maybe Text
city} -> Maybe Text
city) (\s :: EndpointLocation
s@EndpointLocation' {} Maybe Text
a -> EndpointLocation
s {$sel:city:EndpointLocation' :: Maybe Text
city = Maybe Text
a} :: EndpointLocation)
endpointLocation_country :: Lens.Lens' EndpointLocation (Prelude.Maybe Prelude.Text)
endpointLocation_country :: Lens' EndpointLocation (Maybe Text)
endpointLocation_country = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointLocation' {Maybe Text
country :: Maybe Text
$sel:country:EndpointLocation' :: EndpointLocation -> Maybe Text
country} -> Maybe Text
country) (\s :: EndpointLocation
s@EndpointLocation' {} Maybe Text
a -> EndpointLocation
s {$sel:country:EndpointLocation' :: Maybe Text
country = Maybe Text
a} :: EndpointLocation)
endpointLocation_latitude :: Lens.Lens' EndpointLocation (Prelude.Maybe Prelude.Double)
endpointLocation_latitude :: Lens' EndpointLocation (Maybe Double)
endpointLocation_latitude = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointLocation' {Maybe Double
latitude :: Maybe Double
$sel:latitude:EndpointLocation' :: EndpointLocation -> Maybe Double
latitude} -> Maybe Double
latitude) (\s :: EndpointLocation
s@EndpointLocation' {} Maybe Double
a -> EndpointLocation
s {$sel:latitude:EndpointLocation' :: Maybe Double
latitude = Maybe Double
a} :: EndpointLocation)
endpointLocation_longitude :: Lens.Lens' EndpointLocation (Prelude.Maybe Prelude.Double)
endpointLocation_longitude :: Lens' EndpointLocation (Maybe Double)
endpointLocation_longitude = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointLocation' {Maybe Double
longitude :: Maybe Double
$sel:longitude:EndpointLocation' :: EndpointLocation -> Maybe Double
longitude} -> Maybe Double
longitude) (\s :: EndpointLocation
s@EndpointLocation' {} Maybe Double
a -> EndpointLocation
s {$sel:longitude:EndpointLocation' :: Maybe Double
longitude = Maybe Double
a} :: EndpointLocation)
endpointLocation_postalCode :: Lens.Lens' EndpointLocation (Prelude.Maybe Prelude.Text)
endpointLocation_postalCode :: Lens' EndpointLocation (Maybe Text)
endpointLocation_postalCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointLocation' {Maybe Text
postalCode :: Maybe Text
$sel:postalCode:EndpointLocation' :: EndpointLocation -> Maybe Text
postalCode} -> Maybe Text
postalCode) (\s :: EndpointLocation
s@EndpointLocation' {} Maybe Text
a -> EndpointLocation
s {$sel:postalCode:EndpointLocation' :: Maybe Text
postalCode = Maybe Text
a} :: EndpointLocation)
endpointLocation_region :: Lens.Lens' EndpointLocation (Prelude.Maybe Prelude.Text)
endpointLocation_region :: Lens' EndpointLocation (Maybe Text)
endpointLocation_region = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointLocation' {Maybe Text
region :: Maybe Text
$sel:region:EndpointLocation' :: EndpointLocation -> Maybe Text
region} -> Maybe Text
region) (\s :: EndpointLocation
s@EndpointLocation' {} Maybe Text
a -> EndpointLocation
s {$sel:region:EndpointLocation' :: Maybe Text
region = Maybe Text
a} :: EndpointLocation)
instance Data.FromJSON EndpointLocation where
parseJSON :: Value -> Parser EndpointLocation
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"EndpointLocation"
( \Object
x ->
Maybe Text
-> Maybe Text
-> Maybe Double
-> Maybe Double
-> Maybe Text
-> Maybe Text
-> EndpointLocation
EndpointLocation'
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
"City")
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
"Country")
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
"Latitude")
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
"Longitude")
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
"PostalCode")
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
"Region")
)
instance Prelude.Hashable EndpointLocation where
hashWithSalt :: Int -> EndpointLocation -> Int
hashWithSalt Int
_salt EndpointLocation' {Maybe Double
Maybe Text
region :: Maybe Text
postalCode :: Maybe Text
longitude :: Maybe Double
latitude :: Maybe Double
country :: Maybe Text
city :: Maybe Text
$sel:region:EndpointLocation' :: EndpointLocation -> Maybe Text
$sel:postalCode:EndpointLocation' :: EndpointLocation -> Maybe Text
$sel:longitude:EndpointLocation' :: EndpointLocation -> Maybe Double
$sel:latitude:EndpointLocation' :: EndpointLocation -> Maybe Double
$sel:country:EndpointLocation' :: EndpointLocation -> Maybe Text
$sel:city:EndpointLocation' :: EndpointLocation -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
city
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
country
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
latitude
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
longitude
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
postalCode
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
region
instance Prelude.NFData EndpointLocation where
rnf :: EndpointLocation -> ()
rnf EndpointLocation' {Maybe Double
Maybe Text
region :: Maybe Text
postalCode :: Maybe Text
longitude :: Maybe Double
latitude :: Maybe Double
country :: Maybe Text
city :: Maybe Text
$sel:region:EndpointLocation' :: EndpointLocation -> Maybe Text
$sel:postalCode:EndpointLocation' :: EndpointLocation -> Maybe Text
$sel:longitude:EndpointLocation' :: EndpointLocation -> Maybe Double
$sel:latitude:EndpointLocation' :: EndpointLocation -> Maybe Double
$sel:country:EndpointLocation' :: EndpointLocation -> Maybe Text
$sel:city:EndpointLocation' :: EndpointLocation -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
city
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
country
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
latitude
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
longitude
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
postalCode
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
region
instance Data.ToJSON EndpointLocation where
toJSON :: EndpointLocation -> Value
toJSON EndpointLocation' {Maybe Double
Maybe Text
region :: Maybe Text
postalCode :: Maybe Text
longitude :: Maybe Double
latitude :: Maybe Double
country :: Maybe Text
city :: Maybe Text
$sel:region:EndpointLocation' :: EndpointLocation -> Maybe Text
$sel:postalCode:EndpointLocation' :: EndpointLocation -> Maybe Text
$sel:longitude:EndpointLocation' :: EndpointLocation -> Maybe Double
$sel:latitude:EndpointLocation' :: EndpointLocation -> Maybe Double
$sel:country:EndpointLocation' :: EndpointLocation -> Maybe Text
$sel:city:EndpointLocation' :: EndpointLocation -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"City" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
city,
(Key
"Country" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
country,
(Key
"Latitude" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
latitude,
(Key
"Longitude" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
longitude,
(Key
"PostalCode" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
postalCode,
(Key
"Region" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
region
]
)