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