{-# 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.Route53RecoveryControlConfig.Types.AssertionRule where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Route53RecoveryControlConfig.Types.RuleConfig
import Amazonka.Route53RecoveryControlConfig.Types.Status
data AssertionRule = AssertionRule'
{
AssertionRule -> Status
status :: Status,
AssertionRule -> Text
controlPanelArn :: Prelude.Text,
AssertionRule -> Text
safetyRuleArn :: Prelude.Text,
AssertionRule -> [Text]
assertedControls :: [Prelude.Text],
AssertionRule -> RuleConfig
ruleConfig :: RuleConfig,
AssertionRule -> Int
waitPeriodMs :: Prelude.Int,
AssertionRule -> Text
name :: Prelude.Text
}
deriving (AssertionRule -> AssertionRule -> Bool
(AssertionRule -> AssertionRule -> Bool)
-> (AssertionRule -> AssertionRule -> Bool) -> Eq AssertionRule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssertionRule -> AssertionRule -> Bool
$c/= :: AssertionRule -> AssertionRule -> Bool
== :: AssertionRule -> AssertionRule -> Bool
$c== :: AssertionRule -> AssertionRule -> Bool
Prelude.Eq, ReadPrec [AssertionRule]
ReadPrec AssertionRule
Int -> ReadS AssertionRule
ReadS [AssertionRule]
(Int -> ReadS AssertionRule)
-> ReadS [AssertionRule]
-> ReadPrec AssertionRule
-> ReadPrec [AssertionRule]
-> Read AssertionRule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssertionRule]
$creadListPrec :: ReadPrec [AssertionRule]
readPrec :: ReadPrec AssertionRule
$creadPrec :: ReadPrec AssertionRule
readList :: ReadS [AssertionRule]
$creadList :: ReadS [AssertionRule]
readsPrec :: Int -> ReadS AssertionRule
$creadsPrec :: Int -> ReadS AssertionRule
Prelude.Read, Int -> AssertionRule -> ShowS
[AssertionRule] -> ShowS
AssertionRule -> String
(Int -> AssertionRule -> ShowS)
-> (AssertionRule -> String)
-> ([AssertionRule] -> ShowS)
-> Show AssertionRule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssertionRule] -> ShowS
$cshowList :: [AssertionRule] -> ShowS
show :: AssertionRule -> String
$cshow :: AssertionRule -> String
showsPrec :: Int -> AssertionRule -> ShowS
$cshowsPrec :: Int -> AssertionRule -> ShowS
Prelude.Show, (forall x. AssertionRule -> Rep AssertionRule x)
-> (forall x. Rep AssertionRule x -> AssertionRule)
-> Generic AssertionRule
forall x. Rep AssertionRule x -> AssertionRule
forall x. AssertionRule -> Rep AssertionRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssertionRule x -> AssertionRule
$cfrom :: forall x. AssertionRule -> Rep AssertionRule x
Prelude.Generic)
newAssertionRule ::
Status ->
Prelude.Text ->
Prelude.Text ->
RuleConfig ->
Prelude.Int ->
Prelude.Text ->
AssertionRule
newAssertionRule :: Status
-> Text -> Text -> RuleConfig -> Int -> Text -> AssertionRule
newAssertionRule
Status
pStatus_
Text
pControlPanelArn_
Text
pSafetyRuleArn_
RuleConfig
pRuleConfig_
Int
pWaitPeriodMs_
Text
pName_ =
AssertionRule' :: Status
-> Text
-> Text
-> [Text]
-> RuleConfig
-> Int
-> Text
-> AssertionRule
AssertionRule'
{ $sel:status:AssertionRule' :: Status
status = Status
pStatus_,
$sel:controlPanelArn:AssertionRule' :: Text
controlPanelArn = Text
pControlPanelArn_,
$sel:safetyRuleArn:AssertionRule' :: Text
safetyRuleArn = Text
pSafetyRuleArn_,
$sel:assertedControls:AssertionRule' :: [Text]
assertedControls = [Text]
forall a. Monoid a => a
Prelude.mempty,
$sel:ruleConfig:AssertionRule' :: RuleConfig
ruleConfig = RuleConfig
pRuleConfig_,
$sel:waitPeriodMs:AssertionRule' :: Int
waitPeriodMs = Int
pWaitPeriodMs_,
$sel:name:AssertionRule' :: Text
name = Text
pName_
}
assertionRule_status :: Lens.Lens' AssertionRule Status
assertionRule_status :: (Status -> f Status) -> AssertionRule -> f AssertionRule
assertionRule_status = (AssertionRule -> Status)
-> (AssertionRule -> Status -> AssertionRule)
-> Lens AssertionRule AssertionRule Status Status
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssertionRule' {Status
status :: Status
$sel:status:AssertionRule' :: AssertionRule -> Status
status} -> Status
status) (\s :: AssertionRule
s@AssertionRule' {} Status
a -> AssertionRule
s {$sel:status:AssertionRule' :: Status
status = Status
a} :: AssertionRule)
assertionRule_controlPanelArn :: Lens.Lens' AssertionRule Prelude.Text
assertionRule_controlPanelArn :: (Text -> f Text) -> AssertionRule -> f AssertionRule
assertionRule_controlPanelArn = (AssertionRule -> Text)
-> (AssertionRule -> Text -> AssertionRule)
-> Lens AssertionRule AssertionRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssertionRule' {Text
controlPanelArn :: Text
$sel:controlPanelArn:AssertionRule' :: AssertionRule -> Text
controlPanelArn} -> Text
controlPanelArn) (\s :: AssertionRule
s@AssertionRule' {} Text
a -> AssertionRule
s {$sel:controlPanelArn:AssertionRule' :: Text
controlPanelArn = Text
a} :: AssertionRule)
assertionRule_safetyRuleArn :: Lens.Lens' AssertionRule Prelude.Text
assertionRule_safetyRuleArn :: (Text -> f Text) -> AssertionRule -> f AssertionRule
assertionRule_safetyRuleArn = (AssertionRule -> Text)
-> (AssertionRule -> Text -> AssertionRule)
-> Lens AssertionRule AssertionRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssertionRule' {Text
safetyRuleArn :: Text
$sel:safetyRuleArn:AssertionRule' :: AssertionRule -> Text
safetyRuleArn} -> Text
safetyRuleArn) (\s :: AssertionRule
s@AssertionRule' {} Text
a -> AssertionRule
s {$sel:safetyRuleArn:AssertionRule' :: Text
safetyRuleArn = Text
a} :: AssertionRule)
assertionRule_assertedControls :: Lens.Lens' AssertionRule [Prelude.Text]
assertionRule_assertedControls :: ([Text] -> f [Text]) -> AssertionRule -> f AssertionRule
assertionRule_assertedControls = (AssertionRule -> [Text])
-> (AssertionRule -> [Text] -> AssertionRule)
-> Lens AssertionRule AssertionRule [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssertionRule' {[Text]
assertedControls :: [Text]
$sel:assertedControls:AssertionRule' :: AssertionRule -> [Text]
assertedControls} -> [Text]
assertedControls) (\s :: AssertionRule
s@AssertionRule' {} [Text]
a -> AssertionRule
s {$sel:assertedControls:AssertionRule' :: [Text]
assertedControls = [Text]
a} :: AssertionRule) (([Text] -> f [Text]) -> AssertionRule -> f AssertionRule)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> AssertionRule
-> f AssertionRule
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
assertionRule_ruleConfig :: Lens.Lens' AssertionRule RuleConfig
assertionRule_ruleConfig :: (RuleConfig -> f RuleConfig) -> AssertionRule -> f AssertionRule
assertionRule_ruleConfig = (AssertionRule -> RuleConfig)
-> (AssertionRule -> RuleConfig -> AssertionRule)
-> Lens AssertionRule AssertionRule RuleConfig RuleConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssertionRule' {RuleConfig
ruleConfig :: RuleConfig
$sel:ruleConfig:AssertionRule' :: AssertionRule -> RuleConfig
ruleConfig} -> RuleConfig
ruleConfig) (\s :: AssertionRule
s@AssertionRule' {} RuleConfig
a -> AssertionRule
s {$sel:ruleConfig:AssertionRule' :: RuleConfig
ruleConfig = RuleConfig
a} :: AssertionRule)
assertionRule_waitPeriodMs :: Lens.Lens' AssertionRule Prelude.Int
assertionRule_waitPeriodMs :: (Int -> f Int) -> AssertionRule -> f AssertionRule
assertionRule_waitPeriodMs = (AssertionRule -> Int)
-> (AssertionRule -> Int -> AssertionRule)
-> Lens AssertionRule AssertionRule Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssertionRule' {Int
waitPeriodMs :: Int
$sel:waitPeriodMs:AssertionRule' :: AssertionRule -> Int
waitPeriodMs} -> Int
waitPeriodMs) (\s :: AssertionRule
s@AssertionRule' {} Int
a -> AssertionRule
s {$sel:waitPeriodMs:AssertionRule' :: Int
waitPeriodMs = Int
a} :: AssertionRule)
assertionRule_name :: Lens.Lens' AssertionRule Prelude.Text
assertionRule_name :: (Text -> f Text) -> AssertionRule -> f AssertionRule
assertionRule_name = (AssertionRule -> Text)
-> (AssertionRule -> Text -> AssertionRule)
-> Lens AssertionRule AssertionRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssertionRule' {Text
name :: Text
$sel:name:AssertionRule' :: AssertionRule -> Text
name} -> Text
name) (\s :: AssertionRule
s@AssertionRule' {} Text
a -> AssertionRule
s {$sel:name:AssertionRule' :: Text
name = Text
a} :: AssertionRule)
instance Core.FromJSON AssertionRule where
parseJSON :: Value -> Parser AssertionRule
parseJSON =
String
-> (Object -> Parser AssertionRule)
-> Value
-> Parser AssertionRule
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AssertionRule"
( \Object
x ->
Status
-> Text
-> Text
-> [Text]
-> RuleConfig
-> Int
-> Text
-> AssertionRule
AssertionRule'
(Status
-> Text
-> Text
-> [Text]
-> RuleConfig
-> Int
-> Text
-> AssertionRule)
-> Parser Status
-> Parser
(Text
-> Text -> [Text] -> RuleConfig -> Int -> Text -> AssertionRule)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Status
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Status")
Parser
(Text
-> Text -> [Text] -> RuleConfig -> Int -> Text -> AssertionRule)
-> Parser Text
-> Parser
(Text -> [Text] -> RuleConfig -> Int -> Text -> AssertionRule)
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
"ControlPanelArn")
Parser
(Text -> [Text] -> RuleConfig -> Int -> Text -> AssertionRule)
-> Parser Text
-> Parser ([Text] -> RuleConfig -> Int -> Text -> AssertionRule)
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
"SafetyRuleArn")
Parser ([Text] -> RuleConfig -> Int -> Text -> AssertionRule)
-> Parser [Text]
-> Parser (RuleConfig -> Int -> Text -> AssertionRule)
forall (f :: * -> *) a b. Applicative f => 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
"AssertedControls"
Parser (Maybe [Text]) -> [Text] -> Parser [Text]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Text]
forall a. Monoid a => a
Prelude.mempty
)
Parser (RuleConfig -> Int -> Text -> AssertionRule)
-> Parser RuleConfig -> Parser (Int -> Text -> AssertionRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser RuleConfig
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"RuleConfig")
Parser (Int -> Text -> AssertionRule)
-> Parser Int -> Parser (Text -> AssertionRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Int
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"WaitPeriodMs")
Parser (Text -> AssertionRule)
-> Parser Text -> Parser AssertionRule
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
"Name")
)
instance Prelude.Hashable AssertionRule
instance Prelude.NFData AssertionRule