{-# 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.NetworkManager.Types.Location 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 Location = Location'
{
Location -> Maybe Text
address :: Prelude.Maybe Prelude.Text,
Location -> Maybe Text
latitude :: Prelude.Maybe Prelude.Text,
Location -> Maybe Text
longitude :: Prelude.Maybe Prelude.Text
}
deriving (Location -> Location -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Location -> Location -> Bool
$c/= :: Location -> Location -> Bool
== :: Location -> Location -> Bool
$c== :: Location -> Location -> Bool
Prelude.Eq, Int -> Location -> ShowS
[Location] -> ShowS
Location -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Location] -> ShowS
$cshowList :: [Location] -> ShowS
show :: Location -> String
$cshow :: Location -> String
showsPrec :: Int -> Location -> ShowS
$cshowsPrec :: Int -> Location -> ShowS
Prelude.Show, forall x. Rep Location x -> Location
forall x. Location -> Rep Location x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Location x -> Location
$cfrom :: forall x. Location -> Rep Location x
Prelude.Generic)
newLocation ::
Location
newLocation :: Location
newLocation =
Location'
{ $sel:address:Location' :: Maybe Text
address = forall a. Maybe a
Prelude.Nothing,
$sel:latitude:Location' :: Maybe Text
latitude = forall a. Maybe a
Prelude.Nothing,
$sel:longitude:Location' :: Maybe Text
longitude = forall a. Maybe a
Prelude.Nothing
}
location_address :: Lens.Lens' Location (Prelude.Maybe Prelude.Text)
location_address :: Lens' Location (Maybe Text)
location_address = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Location' {Maybe Text
address :: Maybe Text
$sel:address:Location' :: Location -> Maybe Text
address} -> Maybe Text
address) (\s :: Location
s@Location' {} Maybe Text
a -> Location
s {$sel:address:Location' :: Maybe Text
address = Maybe Text
a} :: Location)
location_latitude :: Lens.Lens' Location (Prelude.Maybe Prelude.Text)
location_latitude :: Lens' Location (Maybe Text)
location_latitude = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Location' {Maybe Text
latitude :: Maybe Text
$sel:latitude:Location' :: Location -> Maybe Text
latitude} -> Maybe Text
latitude) (\s :: Location
s@Location' {} Maybe Text
a -> Location
s {$sel:latitude:Location' :: Maybe Text
latitude = Maybe Text
a} :: Location)
location_longitude :: Lens.Lens' Location (Prelude.Maybe Prelude.Text)
location_longitude :: Lens' Location (Maybe Text)
location_longitude = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Location' {Maybe Text
longitude :: Maybe Text
$sel:longitude:Location' :: Location -> Maybe Text
longitude} -> Maybe Text
longitude) (\s :: Location
s@Location' {} Maybe Text
a -> Location
s {$sel:longitude:Location' :: Maybe Text
longitude = Maybe Text
a} :: Location)
instance Data.FromJSON Location where
parseJSON :: Value -> Parser Location
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Location"
( \Object
x ->
Maybe Text -> Maybe Text -> Maybe Text -> Location
Location'
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
"Address")
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")
)
instance Prelude.Hashable Location where
hashWithSalt :: Int -> Location -> Int
hashWithSalt Int
_salt Location' {Maybe Text
longitude :: Maybe Text
latitude :: Maybe Text
address :: Maybe Text
$sel:longitude:Location' :: Location -> Maybe Text
$sel:latitude:Location' :: Location -> Maybe Text
$sel:address:Location' :: Location -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
address
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
latitude
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
longitude
instance Prelude.NFData Location where
rnf :: Location -> ()
rnf Location' {Maybe Text
longitude :: Maybe Text
latitude :: Maybe Text
address :: Maybe Text
$sel:longitude:Location' :: Location -> Maybe Text
$sel:latitude:Location' :: Location -> Maybe Text
$sel:address:Location' :: Location -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
address
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
latitude
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
longitude
instance Data.ToJSON Location where
toJSON :: Location -> Value
toJSON Location' {Maybe Text
longitude :: Maybe Text
latitude :: Maybe Text
address :: Maybe Text
$sel:longitude:Location' :: Location -> Maybe Text
$sel:latitude:Location' :: Location -> Maybe Text
$sel:address:Location' :: Location -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Address" 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
address,
(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 Text
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 Text
longitude
]
)