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