{-# 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.AWSLocation where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data AWSLocation = AWSLocation'
{
AWSLocation -> Maybe Text
zone :: Prelude.Maybe Prelude.Text,
AWSLocation -> Maybe Text
subnetArn :: Prelude.Maybe Prelude.Text
}
deriving (AWSLocation -> AWSLocation -> Bool
(AWSLocation -> AWSLocation -> Bool)
-> (AWSLocation -> AWSLocation -> Bool) -> Eq AWSLocation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AWSLocation -> AWSLocation -> Bool
$c/= :: AWSLocation -> AWSLocation -> Bool
== :: AWSLocation -> AWSLocation -> Bool
$c== :: AWSLocation -> AWSLocation -> Bool
Prelude.Eq, ReadPrec [AWSLocation]
ReadPrec AWSLocation
Int -> ReadS AWSLocation
ReadS [AWSLocation]
(Int -> ReadS AWSLocation)
-> ReadS [AWSLocation]
-> ReadPrec AWSLocation
-> ReadPrec [AWSLocation]
-> Read AWSLocation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AWSLocation]
$creadListPrec :: ReadPrec [AWSLocation]
readPrec :: ReadPrec AWSLocation
$creadPrec :: ReadPrec AWSLocation
readList :: ReadS [AWSLocation]
$creadList :: ReadS [AWSLocation]
readsPrec :: Int -> ReadS AWSLocation
$creadsPrec :: Int -> ReadS AWSLocation
Prelude.Read, Int -> AWSLocation -> ShowS
[AWSLocation] -> ShowS
AWSLocation -> String
(Int -> AWSLocation -> ShowS)
-> (AWSLocation -> String)
-> ([AWSLocation] -> ShowS)
-> Show AWSLocation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AWSLocation] -> ShowS
$cshowList :: [AWSLocation] -> ShowS
show :: AWSLocation -> String
$cshow :: AWSLocation -> String
showsPrec :: Int -> AWSLocation -> ShowS
$cshowsPrec :: Int -> AWSLocation -> ShowS
Prelude.Show, (forall x. AWSLocation -> Rep AWSLocation x)
-> (forall x. Rep AWSLocation x -> AWSLocation)
-> Generic AWSLocation
forall x. Rep AWSLocation x -> AWSLocation
forall x. AWSLocation -> Rep AWSLocation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AWSLocation x -> AWSLocation
$cfrom :: forall x. AWSLocation -> Rep AWSLocation x
Prelude.Generic)
newAWSLocation ::
AWSLocation
newAWSLocation :: AWSLocation
newAWSLocation =
AWSLocation' :: Maybe Text -> Maybe Text -> AWSLocation
AWSLocation'
{ $sel:zone:AWSLocation' :: Maybe Text
zone = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:subnetArn:AWSLocation' :: Maybe Text
subnetArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
aWSLocation_zone :: Lens.Lens' AWSLocation (Prelude.Maybe Prelude.Text)
aWSLocation_zone :: (Maybe Text -> f (Maybe Text)) -> AWSLocation -> f AWSLocation
aWSLocation_zone = (AWSLocation -> Maybe Text)
-> (AWSLocation -> Maybe Text -> AWSLocation)
-> Lens AWSLocation AWSLocation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AWSLocation' {Maybe Text
zone :: Maybe Text
$sel:zone:AWSLocation' :: AWSLocation -> Maybe Text
zone} -> Maybe Text
zone) (\s :: AWSLocation
s@AWSLocation' {} Maybe Text
a -> AWSLocation
s {$sel:zone:AWSLocation' :: Maybe Text
zone = Maybe Text
a} :: AWSLocation)
aWSLocation_subnetArn :: Lens.Lens' AWSLocation (Prelude.Maybe Prelude.Text)
aWSLocation_subnetArn :: (Maybe Text -> f (Maybe Text)) -> AWSLocation -> f AWSLocation
aWSLocation_subnetArn = (AWSLocation -> Maybe Text)
-> (AWSLocation -> Maybe Text -> AWSLocation)
-> Lens AWSLocation AWSLocation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AWSLocation' {Maybe Text
subnetArn :: Maybe Text
$sel:subnetArn:AWSLocation' :: AWSLocation -> Maybe Text
subnetArn} -> Maybe Text
subnetArn) (\s :: AWSLocation
s@AWSLocation' {} Maybe Text
a -> AWSLocation
s {$sel:subnetArn:AWSLocation' :: Maybe Text
subnetArn = Maybe Text
a} :: AWSLocation)
instance Core.FromJSON AWSLocation where
parseJSON :: Value -> Parser AWSLocation
parseJSON =
String
-> (Object -> Parser AWSLocation) -> Value -> Parser AWSLocation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AWSLocation"
( \Object
x ->
Maybe Text -> Maybe Text -> AWSLocation
AWSLocation'
(Maybe Text -> Maybe Text -> AWSLocation)
-> Parser (Maybe Text) -> Parser (Maybe Text -> AWSLocation)
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
"Zone")
Parser (Maybe Text -> AWSLocation)
-> Parser (Maybe Text) -> Parser AWSLocation
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
"SubnetArn")
)
instance Prelude.Hashable AWSLocation
instance Prelude.NFData AWSLocation
instance Core.ToJSON AWSLocation where
toJSON :: AWSLocation -> Value
toJSON AWSLocation' {Maybe Text
subnetArn :: Maybe Text
zone :: Maybe Text
$sel:subnetArn:AWSLocation' :: AWSLocation -> Maybe Text
$sel:zone:AWSLocation' :: AWSLocation -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Zone" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
zone,
(Text
"SubnetArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
subnetArn
]
)