{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:awsCloudMap:ServiceDiscovery' :: Maybe AwsCloudMapServiceDiscovery
awsCloudMap = forall a. Maybe a
Prelude.Nothing,
$sel:dns:ServiceDiscovery' :: Maybe DnsServiceDiscovery
dns = forall a. Maybe a
Prelude.Nothing
}
serviceDiscovery_awsCloudMap :: Lens.Lens' ServiceDiscovery (Prelude.Maybe AwsCloudMapServiceDiscovery)
serviceDiscovery_awsCloudMap :: Lens' ServiceDiscovery (Maybe AwsCloudMapServiceDiscovery)
serviceDiscovery_awsCloudMap = 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 :: Lens' ServiceDiscovery (Maybe DnsServiceDiscovery)
serviceDiscovery_dns = 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 Data.FromJSON ServiceDiscovery where
parseJSON :: Value -> Parser ServiceDiscovery
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"ServiceDiscovery"
( \Object
x ->
Maybe AwsCloudMapServiceDiscovery
-> Maybe DnsServiceDiscovery -> ServiceDiscovery
ServiceDiscovery'
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
"awsCloudMap")
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
"dns")
)
instance Prelude.Hashable ServiceDiscovery where
hashWithSalt :: Int -> ServiceDiscovery -> Int
hashWithSalt Int
_salt ServiceDiscovery' {Maybe DnsServiceDiscovery
Maybe AwsCloudMapServiceDiscovery
dns :: Maybe DnsServiceDiscovery
awsCloudMap :: Maybe AwsCloudMapServiceDiscovery
$sel:dns:ServiceDiscovery' :: ServiceDiscovery -> Maybe DnsServiceDiscovery
$sel:awsCloudMap:ServiceDiscovery' :: ServiceDiscovery -> Maybe AwsCloudMapServiceDiscovery
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AwsCloudMapServiceDiscovery
awsCloudMap
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DnsServiceDiscovery
dns
instance Prelude.NFData ServiceDiscovery where
rnf :: ServiceDiscovery -> ()
rnf ServiceDiscovery' {Maybe DnsServiceDiscovery
Maybe AwsCloudMapServiceDiscovery
dns :: Maybe DnsServiceDiscovery
awsCloudMap :: Maybe AwsCloudMapServiceDiscovery
$sel:dns:ServiceDiscovery' :: ServiceDiscovery -> Maybe DnsServiceDiscovery
$sel:awsCloudMap:ServiceDiscovery' :: ServiceDiscovery -> Maybe AwsCloudMapServiceDiscovery
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe AwsCloudMapServiceDiscovery
awsCloudMap
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DnsServiceDiscovery
dns
instance Data.ToJSON ServiceDiscovery where
toJSON :: ServiceDiscovery -> Value
toJSON ServiceDiscovery' {Maybe DnsServiceDiscovery
Maybe AwsCloudMapServiceDiscovery
dns :: Maybe DnsServiceDiscovery
awsCloudMap :: Maybe AwsCloudMapServiceDiscovery
$sel:dns:ServiceDiscovery' :: ServiceDiscovery -> Maybe DnsServiceDiscovery
$sel:awsCloudMap:ServiceDiscovery' :: ServiceDiscovery -> Maybe AwsCloudMapServiceDiscovery
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"awsCloudMap" 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 AwsCloudMapServiceDiscovery
awsCloudMap,
(Key
"dns" 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 DnsServiceDiscovery
dns
]
)