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