{-# 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.CloudWatchEvents.Types.Condition where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Condition = Condition'
{
Condition -> Text
type' :: Prelude.Text,
Condition -> Text
key :: Prelude.Text,
Condition -> Text
value :: Prelude.Text
}
deriving (Condition -> Condition -> Bool
(Condition -> Condition -> Bool)
-> (Condition -> Condition -> Bool) -> Eq Condition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Condition -> Condition -> Bool
$c/= :: Condition -> Condition -> Bool
== :: Condition -> Condition -> Bool
$c== :: Condition -> Condition -> Bool
Prelude.Eq, ReadPrec [Condition]
ReadPrec Condition
Int -> ReadS Condition
ReadS [Condition]
(Int -> ReadS Condition)
-> ReadS [Condition]
-> ReadPrec Condition
-> ReadPrec [Condition]
-> Read Condition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Condition]
$creadListPrec :: ReadPrec [Condition]
readPrec :: ReadPrec Condition
$creadPrec :: ReadPrec Condition
readList :: ReadS [Condition]
$creadList :: ReadS [Condition]
readsPrec :: Int -> ReadS Condition
$creadsPrec :: Int -> ReadS Condition
Prelude.Read, Int -> Condition -> ShowS
[Condition] -> ShowS
Condition -> String
(Int -> Condition -> ShowS)
-> (Condition -> String)
-> ([Condition] -> ShowS)
-> Show Condition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Condition] -> ShowS
$cshowList :: [Condition] -> ShowS
show :: Condition -> String
$cshow :: Condition -> String
showsPrec :: Int -> Condition -> ShowS
$cshowsPrec :: Int -> Condition -> ShowS
Prelude.Show, (forall x. Condition -> Rep Condition x)
-> (forall x. Rep Condition x -> Condition) -> Generic Condition
forall x. Rep Condition x -> Condition
forall x. Condition -> Rep Condition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Condition x -> Condition
$cfrom :: forall x. Condition -> Rep Condition x
Prelude.Generic)
newCondition ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Condition
newCondition :: Text -> Text -> Text -> Condition
newCondition Text
pType_ Text
pKey_ Text
pValue_ =
Condition' :: Text -> Text -> Text -> Condition
Condition'
{ $sel:type':Condition' :: Text
type' = Text
pType_,
$sel:key:Condition' :: Text
key = Text
pKey_,
$sel:value:Condition' :: Text
value = Text
pValue_
}
condition_type :: Lens.Lens' Condition Prelude.Text
condition_type :: (Text -> f Text) -> Condition -> f Condition
condition_type = (Condition -> Text)
-> (Condition -> Text -> Condition)
-> Lens Condition Condition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Condition' {Text
type' :: Text
$sel:type':Condition' :: Condition -> Text
type'} -> Text
type') (\s :: Condition
s@Condition' {} Text
a -> Condition
s {$sel:type':Condition' :: Text
type' = Text
a} :: Condition)
condition_key :: Lens.Lens' Condition Prelude.Text
condition_key :: (Text -> f Text) -> Condition -> f Condition
condition_key = (Condition -> Text)
-> (Condition -> Text -> Condition)
-> Lens Condition Condition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Condition' {Text
key :: Text
$sel:key:Condition' :: Condition -> Text
key} -> Text
key) (\s :: Condition
s@Condition' {} Text
a -> Condition
s {$sel:key:Condition' :: Text
key = Text
a} :: Condition)
condition_value :: Lens.Lens' Condition Prelude.Text
condition_value :: (Text -> f Text) -> Condition -> f Condition
condition_value = (Condition -> Text)
-> (Condition -> Text -> Condition)
-> Lens Condition Condition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Condition' {Text
value :: Text
$sel:value:Condition' :: Condition -> Text
value} -> Text
value) (\s :: Condition
s@Condition' {} Text
a -> Condition
s {$sel:value:Condition' :: Text
value = Text
a} :: Condition)
instance Prelude.Hashable Condition
instance Prelude.NFData Condition
instance Core.ToJSON Condition where
toJSON :: Condition -> Value
toJSON Condition' {Text
value :: Text
key :: Text
type' :: Text
$sel:value:Condition' :: Condition -> Text
$sel:key:Condition' :: Condition -> Text
$sel:type':Condition' :: Condition -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Type" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
type'),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Key" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
key),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Value" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
value)
]
)