{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $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 :: Lens' Condition Text
condition_type = 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 :: Lens' Condition Text
condition_key = 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 :: Lens' Condition Text
condition_value = 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 where
hashWithSalt :: Int -> Condition -> Int
hashWithSalt Int
_salt Condition' {Text
value :: Text
key :: Text
type' :: Text
$sel:value:Condition' :: Condition -> Text
$sel:key:Condition' :: Condition -> Text
$sel:type':Condition' :: Condition -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
type'
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
key
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
value
instance Prelude.NFData Condition where
rnf :: Condition -> ()
rnf Condition' {Text
value :: Text
key :: Text
type' :: Text
$sel:value:Condition' :: Condition -> Text
$sel:key:Condition' :: Condition -> Text
$sel:type':Condition' :: Condition -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
type'
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
key
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
value
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"Type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
type'),
forall a. a -> Maybe a
Prelude.Just (Key
"Key" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
key),
forall a. a -> Maybe a
Prelude.Just (Key
"Value" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
value)
]
)