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