{-# 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.VirtualNodeSpec where
import Amazonka.AppMesh.Types.Backend
import Amazonka.AppMesh.Types.BackendDefaults
import Amazonka.AppMesh.Types.Listener
import Amazonka.AppMesh.Types.Logging
import Amazonka.AppMesh.Types.ServiceDiscovery
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data VirtualNodeSpec = VirtualNodeSpec'
{
VirtualNodeSpec -> Maybe [Backend]
backends :: Prelude.Maybe [Backend],
VirtualNodeSpec -> Maybe BackendDefaults
backendDefaults :: Prelude.Maybe BackendDefaults,
VirtualNodeSpec -> Maybe ServiceDiscovery
serviceDiscovery :: Prelude.Maybe ServiceDiscovery,
VirtualNodeSpec -> Maybe [Listener]
listeners :: Prelude.Maybe [Listener],
VirtualNodeSpec -> Maybe Logging
logging :: Prelude.Maybe Logging
}
deriving (VirtualNodeSpec -> VirtualNodeSpec -> Bool
(VirtualNodeSpec -> VirtualNodeSpec -> Bool)
-> (VirtualNodeSpec -> VirtualNodeSpec -> Bool)
-> Eq VirtualNodeSpec
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VirtualNodeSpec -> VirtualNodeSpec -> Bool
$c/= :: VirtualNodeSpec -> VirtualNodeSpec -> Bool
== :: VirtualNodeSpec -> VirtualNodeSpec -> Bool
$c== :: VirtualNodeSpec -> VirtualNodeSpec -> Bool
Prelude.Eq, ReadPrec [VirtualNodeSpec]
ReadPrec VirtualNodeSpec
Int -> ReadS VirtualNodeSpec
ReadS [VirtualNodeSpec]
(Int -> ReadS VirtualNodeSpec)
-> ReadS [VirtualNodeSpec]
-> ReadPrec VirtualNodeSpec
-> ReadPrec [VirtualNodeSpec]
-> Read VirtualNodeSpec
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VirtualNodeSpec]
$creadListPrec :: ReadPrec [VirtualNodeSpec]
readPrec :: ReadPrec VirtualNodeSpec
$creadPrec :: ReadPrec VirtualNodeSpec
readList :: ReadS [VirtualNodeSpec]
$creadList :: ReadS [VirtualNodeSpec]
readsPrec :: Int -> ReadS VirtualNodeSpec
$creadsPrec :: Int -> ReadS VirtualNodeSpec
Prelude.Read, Int -> VirtualNodeSpec -> ShowS
[VirtualNodeSpec] -> ShowS
VirtualNodeSpec -> String
(Int -> VirtualNodeSpec -> ShowS)
-> (VirtualNodeSpec -> String)
-> ([VirtualNodeSpec] -> ShowS)
-> Show VirtualNodeSpec
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VirtualNodeSpec] -> ShowS
$cshowList :: [VirtualNodeSpec] -> ShowS
show :: VirtualNodeSpec -> String
$cshow :: VirtualNodeSpec -> String
showsPrec :: Int -> VirtualNodeSpec -> ShowS
$cshowsPrec :: Int -> VirtualNodeSpec -> ShowS
Prelude.Show, (forall x. VirtualNodeSpec -> Rep VirtualNodeSpec x)
-> (forall x. Rep VirtualNodeSpec x -> VirtualNodeSpec)
-> Generic VirtualNodeSpec
forall x. Rep VirtualNodeSpec x -> VirtualNodeSpec
forall x. VirtualNodeSpec -> Rep VirtualNodeSpec x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VirtualNodeSpec x -> VirtualNodeSpec
$cfrom :: forall x. VirtualNodeSpec -> Rep VirtualNodeSpec x
Prelude.Generic)
newVirtualNodeSpec ::
VirtualNodeSpec
newVirtualNodeSpec :: VirtualNodeSpec
newVirtualNodeSpec =
VirtualNodeSpec' :: Maybe [Backend]
-> Maybe BackendDefaults
-> Maybe ServiceDiscovery
-> Maybe [Listener]
-> Maybe Logging
-> VirtualNodeSpec
VirtualNodeSpec'
{ $sel:backends:VirtualNodeSpec' :: Maybe [Backend]
backends = Maybe [Backend]
forall a. Maybe a
Prelude.Nothing,
$sel:backendDefaults:VirtualNodeSpec' :: Maybe BackendDefaults
backendDefaults = Maybe BackendDefaults
forall a. Maybe a
Prelude.Nothing,
$sel:serviceDiscovery:VirtualNodeSpec' :: Maybe ServiceDiscovery
serviceDiscovery = Maybe ServiceDiscovery
forall a. Maybe a
Prelude.Nothing,
$sel:listeners:VirtualNodeSpec' :: Maybe [Listener]
listeners = Maybe [Listener]
forall a. Maybe a
Prelude.Nothing,
$sel:logging:VirtualNodeSpec' :: Maybe Logging
logging = Maybe Logging
forall a. Maybe a
Prelude.Nothing
}
virtualNodeSpec_backends :: Lens.Lens' VirtualNodeSpec (Prelude.Maybe [Backend])
virtualNodeSpec_backends :: (Maybe [Backend] -> f (Maybe [Backend]))
-> VirtualNodeSpec -> f VirtualNodeSpec
virtualNodeSpec_backends = (VirtualNodeSpec -> Maybe [Backend])
-> (VirtualNodeSpec -> Maybe [Backend] -> VirtualNodeSpec)
-> Lens
VirtualNodeSpec VirtualNodeSpec (Maybe [Backend]) (Maybe [Backend])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualNodeSpec' {Maybe [Backend]
backends :: Maybe [Backend]
$sel:backends:VirtualNodeSpec' :: VirtualNodeSpec -> Maybe [Backend]
backends} -> Maybe [Backend]
backends) (\s :: VirtualNodeSpec
s@VirtualNodeSpec' {} Maybe [Backend]
a -> VirtualNodeSpec
s {$sel:backends:VirtualNodeSpec' :: Maybe [Backend]
backends = Maybe [Backend]
a} :: VirtualNodeSpec) ((Maybe [Backend] -> f (Maybe [Backend]))
-> VirtualNodeSpec -> f VirtualNodeSpec)
-> ((Maybe [Backend] -> f (Maybe [Backend]))
-> Maybe [Backend] -> f (Maybe [Backend]))
-> (Maybe [Backend] -> f (Maybe [Backend]))
-> VirtualNodeSpec
-> f VirtualNodeSpec
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Backend] [Backend] [Backend] [Backend]
-> Iso
(Maybe [Backend])
(Maybe [Backend])
(Maybe [Backend])
(Maybe [Backend])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Backend] [Backend] [Backend] [Backend]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
virtualNodeSpec_backendDefaults :: Lens.Lens' VirtualNodeSpec (Prelude.Maybe BackendDefaults)
virtualNodeSpec_backendDefaults :: (Maybe BackendDefaults -> f (Maybe BackendDefaults))
-> VirtualNodeSpec -> f VirtualNodeSpec
virtualNodeSpec_backendDefaults = (VirtualNodeSpec -> Maybe BackendDefaults)
-> (VirtualNodeSpec -> Maybe BackendDefaults -> VirtualNodeSpec)
-> Lens
VirtualNodeSpec
VirtualNodeSpec
(Maybe BackendDefaults)
(Maybe BackendDefaults)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualNodeSpec' {Maybe BackendDefaults
backendDefaults :: Maybe BackendDefaults
$sel:backendDefaults:VirtualNodeSpec' :: VirtualNodeSpec -> Maybe BackendDefaults
backendDefaults} -> Maybe BackendDefaults
backendDefaults) (\s :: VirtualNodeSpec
s@VirtualNodeSpec' {} Maybe BackendDefaults
a -> VirtualNodeSpec
s {$sel:backendDefaults:VirtualNodeSpec' :: Maybe BackendDefaults
backendDefaults = Maybe BackendDefaults
a} :: VirtualNodeSpec)
virtualNodeSpec_serviceDiscovery :: Lens.Lens' VirtualNodeSpec (Prelude.Maybe ServiceDiscovery)
virtualNodeSpec_serviceDiscovery :: (Maybe ServiceDiscovery -> f (Maybe ServiceDiscovery))
-> VirtualNodeSpec -> f VirtualNodeSpec
virtualNodeSpec_serviceDiscovery = (VirtualNodeSpec -> Maybe ServiceDiscovery)
-> (VirtualNodeSpec -> Maybe ServiceDiscovery -> VirtualNodeSpec)
-> Lens
VirtualNodeSpec
VirtualNodeSpec
(Maybe ServiceDiscovery)
(Maybe ServiceDiscovery)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualNodeSpec' {Maybe ServiceDiscovery
serviceDiscovery :: Maybe ServiceDiscovery
$sel:serviceDiscovery:VirtualNodeSpec' :: VirtualNodeSpec -> Maybe ServiceDiscovery
serviceDiscovery} -> Maybe ServiceDiscovery
serviceDiscovery) (\s :: VirtualNodeSpec
s@VirtualNodeSpec' {} Maybe ServiceDiscovery
a -> VirtualNodeSpec
s {$sel:serviceDiscovery:VirtualNodeSpec' :: Maybe ServiceDiscovery
serviceDiscovery = Maybe ServiceDiscovery
a} :: VirtualNodeSpec)
virtualNodeSpec_listeners :: Lens.Lens' VirtualNodeSpec (Prelude.Maybe [Listener])
virtualNodeSpec_listeners :: (Maybe [Listener] -> f (Maybe [Listener]))
-> VirtualNodeSpec -> f VirtualNodeSpec
virtualNodeSpec_listeners = (VirtualNodeSpec -> Maybe [Listener])
-> (VirtualNodeSpec -> Maybe [Listener] -> VirtualNodeSpec)
-> Lens
VirtualNodeSpec
VirtualNodeSpec
(Maybe [Listener])
(Maybe [Listener])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualNodeSpec' {Maybe [Listener]
listeners :: Maybe [Listener]
$sel:listeners:VirtualNodeSpec' :: VirtualNodeSpec -> Maybe [Listener]
listeners} -> Maybe [Listener]
listeners) (\s :: VirtualNodeSpec
s@VirtualNodeSpec' {} Maybe [Listener]
a -> VirtualNodeSpec
s {$sel:listeners:VirtualNodeSpec' :: Maybe [Listener]
listeners = Maybe [Listener]
a} :: VirtualNodeSpec) ((Maybe [Listener] -> f (Maybe [Listener]))
-> VirtualNodeSpec -> f VirtualNodeSpec)
-> ((Maybe [Listener] -> f (Maybe [Listener]))
-> Maybe [Listener] -> f (Maybe [Listener]))
-> (Maybe [Listener] -> f (Maybe [Listener]))
-> VirtualNodeSpec
-> f VirtualNodeSpec
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Listener] [Listener] [Listener] [Listener]
-> Iso
(Maybe [Listener])
(Maybe [Listener])
(Maybe [Listener])
(Maybe [Listener])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Listener] [Listener] [Listener] [Listener]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
virtualNodeSpec_logging :: Lens.Lens' VirtualNodeSpec (Prelude.Maybe Logging)
virtualNodeSpec_logging :: (Maybe Logging -> f (Maybe Logging))
-> VirtualNodeSpec -> f VirtualNodeSpec
virtualNodeSpec_logging = (VirtualNodeSpec -> Maybe Logging)
-> (VirtualNodeSpec -> Maybe Logging -> VirtualNodeSpec)
-> Lens
VirtualNodeSpec VirtualNodeSpec (Maybe Logging) (Maybe Logging)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualNodeSpec' {Maybe Logging
logging :: Maybe Logging
$sel:logging:VirtualNodeSpec' :: VirtualNodeSpec -> Maybe Logging
logging} -> Maybe Logging
logging) (\s :: VirtualNodeSpec
s@VirtualNodeSpec' {} Maybe Logging
a -> VirtualNodeSpec
s {$sel:logging:VirtualNodeSpec' :: Maybe Logging
logging = Maybe Logging
a} :: VirtualNodeSpec)
instance Core.FromJSON VirtualNodeSpec where
parseJSON :: Value -> Parser VirtualNodeSpec
parseJSON =
String
-> (Object -> Parser VirtualNodeSpec)
-> Value
-> Parser VirtualNodeSpec
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"VirtualNodeSpec"
( \Object
x ->
Maybe [Backend]
-> Maybe BackendDefaults
-> Maybe ServiceDiscovery
-> Maybe [Listener]
-> Maybe Logging
-> VirtualNodeSpec
VirtualNodeSpec'
(Maybe [Backend]
-> Maybe BackendDefaults
-> Maybe ServiceDiscovery
-> Maybe [Listener]
-> Maybe Logging
-> VirtualNodeSpec)
-> Parser (Maybe [Backend])
-> Parser
(Maybe BackendDefaults
-> Maybe ServiceDiscovery
-> Maybe [Listener]
-> Maybe Logging
-> VirtualNodeSpec)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Backend]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"backends" Parser (Maybe (Maybe [Backend]))
-> Maybe [Backend] -> Parser (Maybe [Backend])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Backend]
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe BackendDefaults
-> Maybe ServiceDiscovery
-> Maybe [Listener]
-> Maybe Logging
-> VirtualNodeSpec)
-> Parser (Maybe BackendDefaults)
-> Parser
(Maybe ServiceDiscovery
-> Maybe [Listener] -> Maybe Logging -> VirtualNodeSpec)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe BackendDefaults)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"backendDefaults")
Parser
(Maybe ServiceDiscovery
-> Maybe [Listener] -> Maybe Logging -> VirtualNodeSpec)
-> Parser (Maybe ServiceDiscovery)
-> Parser (Maybe [Listener] -> Maybe Logging -> VirtualNodeSpec)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ServiceDiscovery)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"serviceDiscovery")
Parser (Maybe [Listener] -> Maybe Logging -> VirtualNodeSpec)
-> Parser (Maybe [Listener])
-> Parser (Maybe Logging -> VirtualNodeSpec)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Listener]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"listeners" Parser (Maybe (Maybe [Listener]))
-> Maybe [Listener] -> Parser (Maybe [Listener])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Listener]
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe Logging -> VirtualNodeSpec)
-> Parser (Maybe Logging) -> Parser VirtualNodeSpec
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Logging)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"logging")
)
instance Prelude.Hashable VirtualNodeSpec
instance Prelude.NFData VirtualNodeSpec
instance Core.ToJSON VirtualNodeSpec where
toJSON :: VirtualNodeSpec -> Value
toJSON VirtualNodeSpec' {Maybe [Listener]
Maybe [Backend]
Maybe Logging
Maybe ServiceDiscovery
Maybe BackendDefaults
logging :: Maybe Logging
listeners :: Maybe [Listener]
serviceDiscovery :: Maybe ServiceDiscovery
backendDefaults :: Maybe BackendDefaults
backends :: Maybe [Backend]
$sel:logging:VirtualNodeSpec' :: VirtualNodeSpec -> Maybe Logging
$sel:listeners:VirtualNodeSpec' :: VirtualNodeSpec -> Maybe [Listener]
$sel:serviceDiscovery:VirtualNodeSpec' :: VirtualNodeSpec -> Maybe ServiceDiscovery
$sel:backendDefaults:VirtualNodeSpec' :: VirtualNodeSpec -> Maybe BackendDefaults
$sel:backends:VirtualNodeSpec' :: VirtualNodeSpec -> Maybe [Backend]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"backends" Text -> [Backend] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Backend] -> Pair) -> Maybe [Backend] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Backend]
backends,
(Text
"backendDefaults" Text -> BackendDefaults -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(BackendDefaults -> Pair) -> Maybe BackendDefaults -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe BackendDefaults
backendDefaults,
(Text
"serviceDiscovery" Text -> ServiceDiscovery -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(ServiceDiscovery -> Pair) -> Maybe ServiceDiscovery -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ServiceDiscovery
serviceDiscovery,
(Text
"listeners" Text -> [Listener] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Listener] -> Pair) -> Maybe [Listener] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Listener]
listeners,
(Text
"logging" Text -> Logging -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Logging -> Pair) -> Maybe Logging -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Logging
logging
]
)