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