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