{-# 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.CloudSearch.Types.Expression where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data Expression = Expression'
{ Expression -> Text
expressionName :: Prelude.Text,
Expression -> Text
expressionValue :: Prelude.Text
}
deriving (Expression -> Expression -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Expression -> Expression -> Bool
$c/= :: Expression -> Expression -> Bool
== :: Expression -> Expression -> Bool
$c== :: Expression -> Expression -> Bool
Prelude.Eq, ReadPrec [Expression]
ReadPrec Expression
Int -> ReadS Expression
ReadS [Expression]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Expression]
$creadListPrec :: ReadPrec [Expression]
readPrec :: ReadPrec Expression
$creadPrec :: ReadPrec Expression
readList :: ReadS [Expression]
$creadList :: ReadS [Expression]
readsPrec :: Int -> ReadS Expression
$creadsPrec :: Int -> ReadS Expression
Prelude.Read, Int -> Expression -> ShowS
[Expression] -> ShowS
Expression -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Expression] -> ShowS
$cshowList :: [Expression] -> ShowS
show :: Expression -> String
$cshow :: Expression -> String
showsPrec :: Int -> Expression -> ShowS
$cshowsPrec :: Int -> Expression -> ShowS
Prelude.Show, forall x. Rep Expression x -> Expression
forall x. Expression -> Rep Expression x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Expression x -> Expression
$cfrom :: forall x. Expression -> Rep Expression x
Prelude.Generic)
newExpression ::
Prelude.Text ->
Prelude.Text ->
Expression
newExpression :: Text -> Text -> Expression
newExpression Text
pExpressionName_ Text
pExpressionValue_ =
Expression'
{ $sel:expressionName:Expression' :: Text
expressionName = Text
pExpressionName_,
$sel:expressionValue:Expression' :: Text
expressionValue = Text
pExpressionValue_
}
expression_expressionName :: Lens.Lens' Expression Prelude.Text
expression_expressionName :: Lens' Expression Text
expression_expressionName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Expression' {Text
expressionName :: Text
$sel:expressionName:Expression' :: Expression -> Text
expressionName} -> Text
expressionName) (\s :: Expression
s@Expression' {} Text
a -> Expression
s {$sel:expressionName:Expression' :: Text
expressionName = Text
a} :: Expression)
expression_expressionValue :: Lens.Lens' Expression Prelude.Text
expression_expressionValue :: Lens' Expression Text
expression_expressionValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Expression' {Text
expressionValue :: Text
$sel:expressionValue:Expression' :: Expression -> Text
expressionValue} -> Text
expressionValue) (\s :: Expression
s@Expression' {} Text
a -> Expression
s {$sel:expressionValue:Expression' :: Text
expressionValue = Text
a} :: Expression)
instance Data.FromXML Expression where
parseXML :: [Node] -> Either String Expression
parseXML [Node]
x =
Text -> Text -> Expression
Expression'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"ExpressionName")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"ExpressionValue")
instance Prelude.Hashable Expression where
hashWithSalt :: Int -> Expression -> Int
hashWithSalt Int
_salt Expression' {Text
expressionValue :: Text
expressionName :: Text
$sel:expressionValue:Expression' :: Expression -> Text
$sel:expressionName:Expression' :: Expression -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
expressionName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
expressionValue
instance Prelude.NFData Expression where
rnf :: Expression -> ()
rnf Expression' {Text
expressionValue :: Text
expressionName :: Text
$sel:expressionValue:Expression' :: Expression -> Text
$sel:expressionName:Expression' :: Expression -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
expressionName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
expressionValue
instance Data.ToQuery Expression where
toQuery :: Expression -> QueryString
toQuery Expression' {Text
expressionValue :: Text
expressionName :: Text
$sel:expressionValue:Expression' :: Expression -> Text
$sel:expressionName:Expression' :: Expression -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"ExpressionName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
expressionName,
ByteString
"ExpressionValue" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
expressionValue
]