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