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