{-# 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.GrpcGatewayRouteAction where
import Amazonka.AppMesh.Types.GatewayRouteTarget
import Amazonka.AppMesh.Types.GrpcGatewayRouteRewrite
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data GrpcGatewayRouteAction = GrpcGatewayRouteAction'
{
GrpcGatewayRouteAction -> Maybe GrpcGatewayRouteRewrite
rewrite :: Prelude.Maybe GrpcGatewayRouteRewrite,
GrpcGatewayRouteAction -> GatewayRouteTarget
target :: GatewayRouteTarget
}
deriving (GrpcGatewayRouteAction -> GrpcGatewayRouteAction -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GrpcGatewayRouteAction -> GrpcGatewayRouteAction -> Bool
$c/= :: GrpcGatewayRouteAction -> GrpcGatewayRouteAction -> Bool
== :: GrpcGatewayRouteAction -> GrpcGatewayRouteAction -> Bool
$c== :: GrpcGatewayRouteAction -> GrpcGatewayRouteAction -> Bool
Prelude.Eq, ReadPrec [GrpcGatewayRouteAction]
ReadPrec GrpcGatewayRouteAction
Int -> ReadS GrpcGatewayRouteAction
ReadS [GrpcGatewayRouteAction]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GrpcGatewayRouteAction]
$creadListPrec :: ReadPrec [GrpcGatewayRouteAction]
readPrec :: ReadPrec GrpcGatewayRouteAction
$creadPrec :: ReadPrec GrpcGatewayRouteAction
readList :: ReadS [GrpcGatewayRouteAction]
$creadList :: ReadS [GrpcGatewayRouteAction]
readsPrec :: Int -> ReadS GrpcGatewayRouteAction
$creadsPrec :: Int -> ReadS GrpcGatewayRouteAction
Prelude.Read, Int -> GrpcGatewayRouteAction -> ShowS
[GrpcGatewayRouteAction] -> ShowS
GrpcGatewayRouteAction -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GrpcGatewayRouteAction] -> ShowS
$cshowList :: [GrpcGatewayRouteAction] -> ShowS
show :: GrpcGatewayRouteAction -> String
$cshow :: GrpcGatewayRouteAction -> String
showsPrec :: Int -> GrpcGatewayRouteAction -> ShowS
$cshowsPrec :: Int -> GrpcGatewayRouteAction -> ShowS
Prelude.Show, forall x. Rep GrpcGatewayRouteAction x -> GrpcGatewayRouteAction
forall x. GrpcGatewayRouteAction -> Rep GrpcGatewayRouteAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GrpcGatewayRouteAction x -> GrpcGatewayRouteAction
$cfrom :: forall x. GrpcGatewayRouteAction -> Rep GrpcGatewayRouteAction x
Prelude.Generic)
newGrpcGatewayRouteAction ::
GatewayRouteTarget ->
GrpcGatewayRouteAction
newGrpcGatewayRouteAction :: GatewayRouteTarget -> GrpcGatewayRouteAction
newGrpcGatewayRouteAction GatewayRouteTarget
pTarget_ =
GrpcGatewayRouteAction'
{ $sel:rewrite:GrpcGatewayRouteAction' :: Maybe GrpcGatewayRouteRewrite
rewrite = forall a. Maybe a
Prelude.Nothing,
$sel:target:GrpcGatewayRouteAction' :: GatewayRouteTarget
target = GatewayRouteTarget
pTarget_
}
grpcGatewayRouteAction_rewrite :: Lens.Lens' GrpcGatewayRouteAction (Prelude.Maybe GrpcGatewayRouteRewrite)
grpcGatewayRouteAction_rewrite :: Lens' GrpcGatewayRouteAction (Maybe GrpcGatewayRouteRewrite)
grpcGatewayRouteAction_rewrite = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrpcGatewayRouteAction' {Maybe GrpcGatewayRouteRewrite
rewrite :: Maybe GrpcGatewayRouteRewrite
$sel:rewrite:GrpcGatewayRouteAction' :: GrpcGatewayRouteAction -> Maybe GrpcGatewayRouteRewrite
rewrite} -> Maybe GrpcGatewayRouteRewrite
rewrite) (\s :: GrpcGatewayRouteAction
s@GrpcGatewayRouteAction' {} Maybe GrpcGatewayRouteRewrite
a -> GrpcGatewayRouteAction
s {$sel:rewrite:GrpcGatewayRouteAction' :: Maybe GrpcGatewayRouteRewrite
rewrite = Maybe GrpcGatewayRouteRewrite
a} :: GrpcGatewayRouteAction)
grpcGatewayRouteAction_target :: Lens.Lens' GrpcGatewayRouteAction GatewayRouteTarget
grpcGatewayRouteAction_target :: Lens' GrpcGatewayRouteAction GatewayRouteTarget
grpcGatewayRouteAction_target = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrpcGatewayRouteAction' {GatewayRouteTarget
target :: GatewayRouteTarget
$sel:target:GrpcGatewayRouteAction' :: GrpcGatewayRouteAction -> GatewayRouteTarget
target} -> GatewayRouteTarget
target) (\s :: GrpcGatewayRouteAction
s@GrpcGatewayRouteAction' {} GatewayRouteTarget
a -> GrpcGatewayRouteAction
s {$sel:target:GrpcGatewayRouteAction' :: GatewayRouteTarget
target = GatewayRouteTarget
a} :: GrpcGatewayRouteAction)
instance Data.FromJSON GrpcGatewayRouteAction where
parseJSON :: Value -> Parser GrpcGatewayRouteAction
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"GrpcGatewayRouteAction"
( \Object
x ->
Maybe GrpcGatewayRouteRewrite
-> GatewayRouteTarget -> GrpcGatewayRouteAction
GrpcGatewayRouteAction'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"rewrite")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"target")
)
instance Prelude.Hashable GrpcGatewayRouteAction where
hashWithSalt :: Int -> GrpcGatewayRouteAction -> Int
hashWithSalt Int
_salt GrpcGatewayRouteAction' {Maybe GrpcGatewayRouteRewrite
GatewayRouteTarget
target :: GatewayRouteTarget
rewrite :: Maybe GrpcGatewayRouteRewrite
$sel:target:GrpcGatewayRouteAction' :: GrpcGatewayRouteAction -> GatewayRouteTarget
$sel:rewrite:GrpcGatewayRouteAction' :: GrpcGatewayRouteAction -> Maybe GrpcGatewayRouteRewrite
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe GrpcGatewayRouteRewrite
rewrite
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` GatewayRouteTarget
target
instance Prelude.NFData GrpcGatewayRouteAction where
rnf :: GrpcGatewayRouteAction -> ()
rnf GrpcGatewayRouteAction' {Maybe GrpcGatewayRouteRewrite
GatewayRouteTarget
target :: GatewayRouteTarget
rewrite :: Maybe GrpcGatewayRouteRewrite
$sel:target:GrpcGatewayRouteAction' :: GrpcGatewayRouteAction -> GatewayRouteTarget
$sel:rewrite:GrpcGatewayRouteAction' :: GrpcGatewayRouteAction -> Maybe GrpcGatewayRouteRewrite
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe GrpcGatewayRouteRewrite
rewrite
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf GatewayRouteTarget
target
instance Data.ToJSON GrpcGatewayRouteAction where
toJSON :: GrpcGatewayRouteAction -> Value
toJSON GrpcGatewayRouteAction' {Maybe GrpcGatewayRouteRewrite
GatewayRouteTarget
target :: GatewayRouteTarget
rewrite :: Maybe GrpcGatewayRouteRewrite
$sel:target:GrpcGatewayRouteAction' :: GrpcGatewayRouteAction -> GatewayRouteTarget
$sel:rewrite:GrpcGatewayRouteAction' :: GrpcGatewayRouteAction -> Maybe GrpcGatewayRouteRewrite
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"rewrite" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe GrpcGatewayRouteRewrite
rewrite,
forall a. a -> Maybe a
Prelude.Just (Key
"target" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= GatewayRouteTarget
target)
]
)