{-# 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.HttpRouteHeader 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 (HttpRouteHeader -> HttpRouteHeader -> Bool
(HttpRouteHeader -> HttpRouteHeader -> Bool)
-> (HttpRouteHeader -> HttpRouteHeader -> Bool)
-> Eq HttpRouteHeader
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HttpRouteHeader -> HttpRouteHeader -> Bool
$c/= :: HttpRouteHeader -> HttpRouteHeader -> Bool
== :: HttpRouteHeader -> HttpRouteHeader -> Bool
$c== :: HttpRouteHeader -> HttpRouteHeader -> Bool
Prelude.Eq, ReadPrec [HttpRouteHeader]
ReadPrec HttpRouteHeader
Int -> ReadS HttpRouteHeader
ReadS [HttpRouteHeader]
(Int -> ReadS HttpRouteHeader)
-> ReadS [HttpRouteHeader]
-> ReadPrec HttpRouteHeader
-> ReadPrec [HttpRouteHeader]
-> Read HttpRouteHeader
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HttpRouteHeader]
$creadListPrec :: ReadPrec [HttpRouteHeader]
readPrec :: ReadPrec HttpRouteHeader
$creadPrec :: ReadPrec HttpRouteHeader
readList :: ReadS [HttpRouteHeader]
$creadList :: ReadS [HttpRouteHeader]
readsPrec :: Int -> ReadS HttpRouteHeader
$creadsPrec :: Int -> ReadS HttpRouteHeader
Prelude.Read, Int -> HttpRouteHeader -> ShowS
[HttpRouteHeader] -> ShowS
HttpRouteHeader -> String
(Int -> HttpRouteHeader -> ShowS)
-> (HttpRouteHeader -> String)
-> ([HttpRouteHeader] -> ShowS)
-> Show HttpRouteHeader
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HttpRouteHeader] -> ShowS
$cshowList :: [HttpRouteHeader] -> ShowS
show :: HttpRouteHeader -> String
$cshow :: HttpRouteHeader -> String
showsPrec :: Int -> HttpRouteHeader -> ShowS
$cshowsPrec :: Int -> HttpRouteHeader -> ShowS
Prelude.Show, (forall x. HttpRouteHeader -> Rep HttpRouteHeader x)
-> (forall x. Rep HttpRouteHeader x -> HttpRouteHeader)
-> Generic HttpRouteHeader
forall x. Rep HttpRouteHeader x -> HttpRouteHeader
forall x. HttpRouteHeader -> Rep HttpRouteHeader x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HttpRouteHeader x -> HttpRouteHeader
$cfrom :: forall x. HttpRouteHeader -> Rep HttpRouteHeader x
Prelude.Generic)
newHttpRouteHeader ::
Prelude.Text ->
HttpRouteHeader
Text
pName_ =
HttpRouteHeader' :: Maybe Bool -> Maybe HeaderMatchMethod -> Text -> HttpRouteHeader
HttpRouteHeader'
{ $sel:invert:HttpRouteHeader' :: Maybe Bool
invert = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:match:HttpRouteHeader' :: Maybe HeaderMatchMethod
match = Maybe HeaderMatchMethod
forall a. Maybe a
Prelude.Nothing,
$sel:name:HttpRouteHeader' :: Text
name = Text
pName_
}
httpRouteHeader_invert :: Lens.Lens' HttpRouteHeader (Prelude.Maybe Prelude.Bool)
= (HttpRouteHeader -> Maybe Bool)
-> (HttpRouteHeader -> Maybe Bool -> HttpRouteHeader)
-> Lens HttpRouteHeader HttpRouteHeader (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HttpRouteHeader' {Maybe Bool
invert :: Maybe Bool
$sel:invert:HttpRouteHeader' :: HttpRouteHeader -> Maybe Bool
invert} -> Maybe Bool
invert) (\s :: HttpRouteHeader
s@HttpRouteHeader' {} Maybe Bool
a -> HttpRouteHeader
s {$sel:invert:HttpRouteHeader' :: Maybe Bool
invert = Maybe Bool
a} :: HttpRouteHeader)
httpRouteHeader_match :: Lens.Lens' HttpRouteHeader (Prelude.Maybe HeaderMatchMethod)
= (HttpRouteHeader -> Maybe HeaderMatchMethod)
-> (HttpRouteHeader -> Maybe HeaderMatchMethod -> HttpRouteHeader)
-> Lens
HttpRouteHeader
HttpRouteHeader
(Maybe HeaderMatchMethod)
(Maybe HeaderMatchMethod)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HttpRouteHeader' {Maybe HeaderMatchMethod
match :: Maybe HeaderMatchMethod
$sel:match:HttpRouteHeader' :: HttpRouteHeader -> Maybe HeaderMatchMethod
match} -> Maybe HeaderMatchMethod
match) (\s :: HttpRouteHeader
s@HttpRouteHeader' {} Maybe HeaderMatchMethod
a -> HttpRouteHeader
s {$sel:match:HttpRouteHeader' :: Maybe HeaderMatchMethod
match = Maybe HeaderMatchMethod
a} :: HttpRouteHeader)
httpRouteHeader_name :: Lens.Lens' HttpRouteHeader Prelude.Text
= (HttpRouteHeader -> Text)
-> (HttpRouteHeader -> Text -> HttpRouteHeader)
-> Lens HttpRouteHeader HttpRouteHeader Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HttpRouteHeader' {Text
name :: Text
$sel:name:HttpRouteHeader' :: HttpRouteHeader -> Text
name} -> Text
name) (\s :: HttpRouteHeader
s@HttpRouteHeader' {} Text
a -> HttpRouteHeader
s {$sel:name:HttpRouteHeader' :: Text
name = Text
a} :: HttpRouteHeader)
instance Core.FromJSON HttpRouteHeader where
parseJSON :: Value -> Parser HttpRouteHeader
parseJSON =
String
-> (Object -> Parser HttpRouteHeader)
-> Value
-> Parser HttpRouteHeader
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"HttpRouteHeader"
( \Object
x ->
Maybe Bool -> Maybe HeaderMatchMethod -> Text -> HttpRouteHeader
HttpRouteHeader'
(Maybe Bool -> Maybe HeaderMatchMethod -> Text -> HttpRouteHeader)
-> Parser (Maybe Bool)
-> Parser (Maybe HeaderMatchMethod -> Text -> HttpRouteHeader)
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 -> HttpRouteHeader)
-> Parser (Maybe HeaderMatchMethod)
-> Parser (Text -> HttpRouteHeader)
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 -> HttpRouteHeader)
-> Parser Text -> Parser HttpRouteHeader
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 HttpRouteHeader
instance Prelude.NFData HttpRouteHeader
instance Core.ToJSON HttpRouteHeader where
toJSON :: HttpRouteHeader -> Value
toJSON HttpRouteHeader' {Maybe Bool
Maybe HeaderMatchMethod
Text
name :: Text
match :: Maybe HeaderMatchMethod
invert :: Maybe Bool
$sel:name:HttpRouteHeader' :: HttpRouteHeader -> Text
$sel:match:HttpRouteHeader' :: HttpRouteHeader -> Maybe HeaderMatchMethod
$sel:invert:HttpRouteHeader' :: HttpRouteHeader -> 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)
]
)