{-# 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.GrpcRouteMatch where
import Amazonka.AppMesh.Types.GrpcRouteMetadata
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data GrpcRouteMatch = GrpcRouteMatch'
{
GrpcRouteMatch -> Maybe Text
methodName :: Prelude.Maybe Prelude.Text,
GrpcRouteMatch -> Maybe Text
serviceName :: Prelude.Maybe Prelude.Text,
GrpcRouteMatch -> Maybe (NonEmpty GrpcRouteMetadata)
metadata :: Prelude.Maybe (Prelude.NonEmpty GrpcRouteMetadata)
}
deriving (GrpcRouteMatch -> GrpcRouteMatch -> Bool
(GrpcRouteMatch -> GrpcRouteMatch -> Bool)
-> (GrpcRouteMatch -> GrpcRouteMatch -> Bool) -> Eq GrpcRouteMatch
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GrpcRouteMatch -> GrpcRouteMatch -> Bool
$c/= :: GrpcRouteMatch -> GrpcRouteMatch -> Bool
== :: GrpcRouteMatch -> GrpcRouteMatch -> Bool
$c== :: GrpcRouteMatch -> GrpcRouteMatch -> Bool
Prelude.Eq, ReadPrec [GrpcRouteMatch]
ReadPrec GrpcRouteMatch
Int -> ReadS GrpcRouteMatch
ReadS [GrpcRouteMatch]
(Int -> ReadS GrpcRouteMatch)
-> ReadS [GrpcRouteMatch]
-> ReadPrec GrpcRouteMatch
-> ReadPrec [GrpcRouteMatch]
-> Read GrpcRouteMatch
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GrpcRouteMatch]
$creadListPrec :: ReadPrec [GrpcRouteMatch]
readPrec :: ReadPrec GrpcRouteMatch
$creadPrec :: ReadPrec GrpcRouteMatch
readList :: ReadS [GrpcRouteMatch]
$creadList :: ReadS [GrpcRouteMatch]
readsPrec :: Int -> ReadS GrpcRouteMatch
$creadsPrec :: Int -> ReadS GrpcRouteMatch
Prelude.Read, Int -> GrpcRouteMatch -> ShowS
[GrpcRouteMatch] -> ShowS
GrpcRouteMatch -> String
(Int -> GrpcRouteMatch -> ShowS)
-> (GrpcRouteMatch -> String)
-> ([GrpcRouteMatch] -> ShowS)
-> Show GrpcRouteMatch
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GrpcRouteMatch] -> ShowS
$cshowList :: [GrpcRouteMatch] -> ShowS
show :: GrpcRouteMatch -> String
$cshow :: GrpcRouteMatch -> String
showsPrec :: Int -> GrpcRouteMatch -> ShowS
$cshowsPrec :: Int -> GrpcRouteMatch -> ShowS
Prelude.Show, (forall x. GrpcRouteMatch -> Rep GrpcRouteMatch x)
-> (forall x. Rep GrpcRouteMatch x -> GrpcRouteMatch)
-> Generic GrpcRouteMatch
forall x. Rep GrpcRouteMatch x -> GrpcRouteMatch
forall x. GrpcRouteMatch -> Rep GrpcRouteMatch x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GrpcRouteMatch x -> GrpcRouteMatch
$cfrom :: forall x. GrpcRouteMatch -> Rep GrpcRouteMatch x
Prelude.Generic)
newGrpcRouteMatch ::
GrpcRouteMatch
newGrpcRouteMatch :: GrpcRouteMatch
newGrpcRouteMatch =
GrpcRouteMatch' :: Maybe Text
-> Maybe Text
-> Maybe (NonEmpty GrpcRouteMetadata)
-> GrpcRouteMatch
GrpcRouteMatch'
{ $sel:methodName:GrpcRouteMatch' :: Maybe Text
methodName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:serviceName:GrpcRouteMatch' :: Maybe Text
serviceName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:metadata:GrpcRouteMatch' :: Maybe (NonEmpty GrpcRouteMetadata)
metadata = Maybe (NonEmpty GrpcRouteMetadata)
forall a. Maybe a
Prelude.Nothing
}
grpcRouteMatch_methodName :: Lens.Lens' GrpcRouteMatch (Prelude.Maybe Prelude.Text)
grpcRouteMatch_methodName :: (Maybe Text -> f (Maybe Text))
-> GrpcRouteMatch -> f GrpcRouteMatch
grpcRouteMatch_methodName = (GrpcRouteMatch -> Maybe Text)
-> (GrpcRouteMatch -> Maybe Text -> GrpcRouteMatch)
-> Lens GrpcRouteMatch GrpcRouteMatch (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrpcRouteMatch' {Maybe Text
methodName :: Maybe Text
$sel:methodName:GrpcRouteMatch' :: GrpcRouteMatch -> Maybe Text
methodName} -> Maybe Text
methodName) (\s :: GrpcRouteMatch
s@GrpcRouteMatch' {} Maybe Text
a -> GrpcRouteMatch
s {$sel:methodName:GrpcRouteMatch' :: Maybe Text
methodName = Maybe Text
a} :: GrpcRouteMatch)
grpcRouteMatch_serviceName :: Lens.Lens' GrpcRouteMatch (Prelude.Maybe Prelude.Text)
grpcRouteMatch_serviceName :: (Maybe Text -> f (Maybe Text))
-> GrpcRouteMatch -> f GrpcRouteMatch
grpcRouteMatch_serviceName = (GrpcRouteMatch -> Maybe Text)
-> (GrpcRouteMatch -> Maybe Text -> GrpcRouteMatch)
-> Lens GrpcRouteMatch GrpcRouteMatch (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrpcRouteMatch' {Maybe Text
serviceName :: Maybe Text
$sel:serviceName:GrpcRouteMatch' :: GrpcRouteMatch -> Maybe Text
serviceName} -> Maybe Text
serviceName) (\s :: GrpcRouteMatch
s@GrpcRouteMatch' {} Maybe Text
a -> GrpcRouteMatch
s {$sel:serviceName:GrpcRouteMatch' :: Maybe Text
serviceName = Maybe Text
a} :: GrpcRouteMatch)
grpcRouteMatch_metadata :: Lens.Lens' GrpcRouteMatch (Prelude.Maybe (Prelude.NonEmpty GrpcRouteMetadata))
grpcRouteMatch_metadata :: (Maybe (NonEmpty GrpcRouteMetadata)
-> f (Maybe (NonEmpty GrpcRouteMetadata)))
-> GrpcRouteMatch -> f GrpcRouteMatch
grpcRouteMatch_metadata = (GrpcRouteMatch -> Maybe (NonEmpty GrpcRouteMetadata))
-> (GrpcRouteMatch
-> Maybe (NonEmpty GrpcRouteMetadata) -> GrpcRouteMatch)
-> Lens
GrpcRouteMatch
GrpcRouteMatch
(Maybe (NonEmpty GrpcRouteMetadata))
(Maybe (NonEmpty GrpcRouteMetadata))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrpcRouteMatch' {Maybe (NonEmpty GrpcRouteMetadata)
metadata :: Maybe (NonEmpty GrpcRouteMetadata)
$sel:metadata:GrpcRouteMatch' :: GrpcRouteMatch -> Maybe (NonEmpty GrpcRouteMetadata)
metadata} -> Maybe (NonEmpty GrpcRouteMetadata)
metadata) (\s :: GrpcRouteMatch
s@GrpcRouteMatch' {} Maybe (NonEmpty GrpcRouteMetadata)
a -> GrpcRouteMatch
s {$sel:metadata:GrpcRouteMatch' :: Maybe (NonEmpty GrpcRouteMetadata)
metadata = Maybe (NonEmpty GrpcRouteMetadata)
a} :: GrpcRouteMatch) ((Maybe (NonEmpty GrpcRouteMetadata)
-> f (Maybe (NonEmpty GrpcRouteMetadata)))
-> GrpcRouteMatch -> f GrpcRouteMatch)
-> ((Maybe (NonEmpty GrpcRouteMetadata)
-> f (Maybe (NonEmpty GrpcRouteMetadata)))
-> Maybe (NonEmpty GrpcRouteMetadata)
-> f (Maybe (NonEmpty GrpcRouteMetadata)))
-> (Maybe (NonEmpty GrpcRouteMetadata)
-> f (Maybe (NonEmpty GrpcRouteMetadata)))
-> GrpcRouteMatch
-> f GrpcRouteMatch
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(NonEmpty GrpcRouteMetadata)
(NonEmpty GrpcRouteMetadata)
(NonEmpty GrpcRouteMetadata)
(NonEmpty GrpcRouteMetadata)
-> Iso
(Maybe (NonEmpty GrpcRouteMetadata))
(Maybe (NonEmpty GrpcRouteMetadata))
(Maybe (NonEmpty GrpcRouteMetadata))
(Maybe (NonEmpty GrpcRouteMetadata))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(NonEmpty GrpcRouteMetadata)
(NonEmpty GrpcRouteMetadata)
(NonEmpty GrpcRouteMetadata)
(NonEmpty GrpcRouteMetadata)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON GrpcRouteMatch where
parseJSON :: Value -> Parser GrpcRouteMatch
parseJSON =
String
-> (Object -> Parser GrpcRouteMatch)
-> Value
-> Parser GrpcRouteMatch
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"GrpcRouteMatch"
( \Object
x ->
Maybe Text
-> Maybe Text
-> Maybe (NonEmpty GrpcRouteMetadata)
-> GrpcRouteMatch
GrpcRouteMatch'
(Maybe Text
-> Maybe Text
-> Maybe (NonEmpty GrpcRouteMetadata)
-> GrpcRouteMatch)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe (NonEmpty GrpcRouteMetadata) -> GrpcRouteMatch)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"methodName")
Parser
(Maybe Text
-> Maybe (NonEmpty GrpcRouteMetadata) -> GrpcRouteMatch)
-> Parser (Maybe Text)
-> Parser (Maybe (NonEmpty GrpcRouteMetadata) -> GrpcRouteMatch)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"serviceName")
Parser (Maybe (NonEmpty GrpcRouteMetadata) -> GrpcRouteMatch)
-> Parser (Maybe (NonEmpty GrpcRouteMetadata))
-> Parser GrpcRouteMatch
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (NonEmpty GrpcRouteMetadata))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"metadata")
)
instance Prelude.Hashable GrpcRouteMatch
instance Prelude.NFData GrpcRouteMatch
instance Core.ToJSON GrpcRouteMatch where
toJSON :: GrpcRouteMatch -> Value
toJSON GrpcRouteMatch' {Maybe (NonEmpty GrpcRouteMetadata)
Maybe Text
metadata :: Maybe (NonEmpty GrpcRouteMetadata)
serviceName :: Maybe Text
methodName :: Maybe Text
$sel:metadata:GrpcRouteMatch' :: GrpcRouteMatch -> Maybe (NonEmpty GrpcRouteMetadata)
$sel:serviceName:GrpcRouteMatch' :: GrpcRouteMatch -> Maybe Text
$sel:methodName:GrpcRouteMatch' :: GrpcRouteMatch -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"methodName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
methodName,
(Text
"serviceName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
serviceName,
(Text
"metadata" Text -> NonEmpty GrpcRouteMetadata -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty GrpcRouteMetadata -> Pair)
-> Maybe (NonEmpty GrpcRouteMetadata) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty GrpcRouteMetadata)
metadata
]
)