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