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