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