{-# 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.DataBrew.Types.ConditionExpression where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ConditionExpression = ConditionExpression'
{
ConditionExpression -> Maybe Text
value :: Prelude.Maybe Prelude.Text,
ConditionExpression -> Text
condition :: Prelude.Text,
ConditionExpression -> Text
targetColumn :: Prelude.Text
}
deriving (ConditionExpression -> ConditionExpression -> Bool
(ConditionExpression -> ConditionExpression -> Bool)
-> (ConditionExpression -> ConditionExpression -> Bool)
-> Eq ConditionExpression
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConditionExpression -> ConditionExpression -> Bool
$c/= :: ConditionExpression -> ConditionExpression -> Bool
== :: ConditionExpression -> ConditionExpression -> Bool
$c== :: ConditionExpression -> ConditionExpression -> Bool
Prelude.Eq, ReadPrec [ConditionExpression]
ReadPrec ConditionExpression
Int -> ReadS ConditionExpression
ReadS [ConditionExpression]
(Int -> ReadS ConditionExpression)
-> ReadS [ConditionExpression]
-> ReadPrec ConditionExpression
-> ReadPrec [ConditionExpression]
-> Read ConditionExpression
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConditionExpression]
$creadListPrec :: ReadPrec [ConditionExpression]
readPrec :: ReadPrec ConditionExpression
$creadPrec :: ReadPrec ConditionExpression
readList :: ReadS [ConditionExpression]
$creadList :: ReadS [ConditionExpression]
readsPrec :: Int -> ReadS ConditionExpression
$creadsPrec :: Int -> ReadS ConditionExpression
Prelude.Read, Int -> ConditionExpression -> ShowS
[ConditionExpression] -> ShowS
ConditionExpression -> String
(Int -> ConditionExpression -> ShowS)
-> (ConditionExpression -> String)
-> ([ConditionExpression] -> ShowS)
-> Show ConditionExpression
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConditionExpression] -> ShowS
$cshowList :: [ConditionExpression] -> ShowS
show :: ConditionExpression -> String
$cshow :: ConditionExpression -> String
showsPrec :: Int -> ConditionExpression -> ShowS
$cshowsPrec :: Int -> ConditionExpression -> ShowS
Prelude.Show, (forall x. ConditionExpression -> Rep ConditionExpression x)
-> (forall x. Rep ConditionExpression x -> ConditionExpression)
-> Generic ConditionExpression
forall x. Rep ConditionExpression x -> ConditionExpression
forall x. ConditionExpression -> Rep ConditionExpression x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConditionExpression x -> ConditionExpression
$cfrom :: forall x. ConditionExpression -> Rep ConditionExpression x
Prelude.Generic)
newConditionExpression ::
Prelude.Text ->
Prelude.Text ->
ConditionExpression
newConditionExpression :: Text -> Text -> ConditionExpression
newConditionExpression Text
pCondition_ Text
pTargetColumn_ =
ConditionExpression' :: Maybe Text -> Text -> Text -> ConditionExpression
ConditionExpression'
{ $sel:value:ConditionExpression' :: Maybe Text
value = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:condition:ConditionExpression' :: Text
condition = Text
pCondition_,
$sel:targetColumn:ConditionExpression' :: Text
targetColumn = Text
pTargetColumn_
}
conditionExpression_value :: Lens.Lens' ConditionExpression (Prelude.Maybe Prelude.Text)
conditionExpression_value :: (Maybe Text -> f (Maybe Text))
-> ConditionExpression -> f ConditionExpression
conditionExpression_value = (ConditionExpression -> Maybe Text)
-> (ConditionExpression -> Maybe Text -> ConditionExpression)
-> Lens
ConditionExpression ConditionExpression (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConditionExpression' {Maybe Text
value :: Maybe Text
$sel:value:ConditionExpression' :: ConditionExpression -> Maybe Text
value} -> Maybe Text
value) (\s :: ConditionExpression
s@ConditionExpression' {} Maybe Text
a -> ConditionExpression
s {$sel:value:ConditionExpression' :: Maybe Text
value = Maybe Text
a} :: ConditionExpression)
conditionExpression_condition :: Lens.Lens' ConditionExpression Prelude.Text
conditionExpression_condition :: (Text -> f Text) -> ConditionExpression -> f ConditionExpression
conditionExpression_condition = (ConditionExpression -> Text)
-> (ConditionExpression -> Text -> ConditionExpression)
-> Lens ConditionExpression ConditionExpression Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConditionExpression' {Text
condition :: Text
$sel:condition:ConditionExpression' :: ConditionExpression -> Text
condition} -> Text
condition) (\s :: ConditionExpression
s@ConditionExpression' {} Text
a -> ConditionExpression
s {$sel:condition:ConditionExpression' :: Text
condition = Text
a} :: ConditionExpression)
conditionExpression_targetColumn :: Lens.Lens' ConditionExpression Prelude.Text
conditionExpression_targetColumn :: (Text -> f Text) -> ConditionExpression -> f ConditionExpression
conditionExpression_targetColumn = (ConditionExpression -> Text)
-> (ConditionExpression -> Text -> ConditionExpression)
-> Lens ConditionExpression ConditionExpression Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConditionExpression' {Text
targetColumn :: Text
$sel:targetColumn:ConditionExpression' :: ConditionExpression -> Text
targetColumn} -> Text
targetColumn) (\s :: ConditionExpression
s@ConditionExpression' {} Text
a -> ConditionExpression
s {$sel:targetColumn:ConditionExpression' :: Text
targetColumn = Text
a} :: ConditionExpression)
instance Core.FromJSON ConditionExpression where
parseJSON :: Value -> Parser ConditionExpression
parseJSON =
String
-> (Object -> Parser ConditionExpression)
-> Value
-> Parser ConditionExpression
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ConditionExpression"
( \Object
x ->
Maybe Text -> Text -> Text -> ConditionExpression
ConditionExpression'
(Maybe Text -> Text -> Text -> ConditionExpression)
-> Parser (Maybe Text)
-> Parser (Text -> Text -> ConditionExpression)
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
"Value")
Parser (Text -> Text -> ConditionExpression)
-> Parser Text -> Parser (Text -> ConditionExpression)
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
"Condition")
Parser (Text -> ConditionExpression)
-> Parser Text -> Parser ConditionExpression
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
"TargetColumn")
)
instance Prelude.Hashable ConditionExpression
instance Prelude.NFData ConditionExpression
instance Core.ToJSON ConditionExpression where
toJSON :: ConditionExpression -> Value
toJSON ConditionExpression' {Maybe Text
Text
targetColumn :: Text
condition :: Text
value :: Maybe Text
$sel:targetColumn:ConditionExpression' :: ConditionExpression -> Text
$sel:condition:ConditionExpression' :: ConditionExpression -> Text
$sel:value:ConditionExpression' :: ConditionExpression -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Value" 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
value,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Condition" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
condition),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TargetColumn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
targetColumn)
]
)