{-# 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.SSMIncidents.Types.Condition where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SSMIncidents.Types.AttributeValueList
data Condition = Condition'
{
Condition -> Maybe POSIX
after :: Prelude.Maybe Core.POSIX,
Condition -> Maybe AttributeValueList
equals :: Prelude.Maybe AttributeValueList,
Condition -> Maybe POSIX
before :: Prelude.Maybe Core.POSIX
}
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 ::
Condition
newCondition :: Condition
newCondition =
Condition' :: Maybe POSIX -> Maybe AttributeValueList -> Maybe POSIX -> Condition
Condition'
{ $sel:after:Condition' :: Maybe POSIX
after = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:equals:Condition' :: Maybe AttributeValueList
equals = Maybe AttributeValueList
forall a. Maybe a
Prelude.Nothing,
$sel:before:Condition' :: Maybe POSIX
before = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
}
condition_after :: Lens.Lens' Condition (Prelude.Maybe Prelude.UTCTime)
condition_after :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Condition -> f Condition
condition_after = (Condition -> Maybe POSIX)
-> (Condition -> Maybe POSIX -> Condition)
-> Lens Condition Condition (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Condition' {Maybe POSIX
after :: Maybe POSIX
$sel:after:Condition' :: Condition -> Maybe POSIX
after} -> Maybe POSIX
after) (\s :: Condition
s@Condition' {} Maybe POSIX
a -> Condition
s {$sel:after:Condition' :: Maybe POSIX
after = Maybe POSIX
a} :: Condition) ((Maybe POSIX -> f (Maybe POSIX)) -> Condition -> f Condition)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Condition
-> f Condition
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
condition_equals :: Lens.Lens' Condition (Prelude.Maybe AttributeValueList)
condition_equals :: (Maybe AttributeValueList -> f (Maybe AttributeValueList))
-> Condition -> f Condition
condition_equals = (Condition -> Maybe AttributeValueList)
-> (Condition -> Maybe AttributeValueList -> Condition)
-> Lens
Condition
Condition
(Maybe AttributeValueList)
(Maybe AttributeValueList)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Condition' {Maybe AttributeValueList
equals :: Maybe AttributeValueList
$sel:equals:Condition' :: Condition -> Maybe AttributeValueList
equals} -> Maybe AttributeValueList
equals) (\s :: Condition
s@Condition' {} Maybe AttributeValueList
a -> Condition
s {$sel:equals:Condition' :: Maybe AttributeValueList
equals = Maybe AttributeValueList
a} :: Condition)
condition_before :: Lens.Lens' Condition (Prelude.Maybe Prelude.UTCTime)
condition_before :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Condition -> f Condition
condition_before = (Condition -> Maybe POSIX)
-> (Condition -> Maybe POSIX -> Condition)
-> Lens Condition Condition (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Condition' {Maybe POSIX
before :: Maybe POSIX
$sel:before:Condition' :: Condition -> Maybe POSIX
before} -> Maybe POSIX
before) (\s :: Condition
s@Condition' {} Maybe POSIX
a -> Condition
s {$sel:before:Condition' :: Maybe POSIX
before = Maybe POSIX
a} :: Condition) ((Maybe POSIX -> f (Maybe POSIX)) -> Condition -> f Condition)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Condition
-> f Condition
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
instance Prelude.Hashable Condition
instance Prelude.NFData Condition
instance Core.ToJSON Condition where
toJSON :: Condition -> Value
toJSON Condition' {Maybe POSIX
Maybe AttributeValueList
before :: Maybe POSIX
equals :: Maybe AttributeValueList
after :: Maybe POSIX
$sel:before:Condition' :: Condition -> Maybe POSIX
$sel:equals:Condition' :: Condition -> Maybe AttributeValueList
$sel:after:Condition' :: Condition -> Maybe POSIX
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"after" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
after,
(Text
"equals" Text -> AttributeValueList -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (AttributeValueList -> Pair)
-> Maybe AttributeValueList -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AttributeValueList
equals,
(Text
"before" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
before
]
)