{-# 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.GatingRule 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 GatingRule = GatingRule'
{
GatingRule -> Status
status :: Status,
GatingRule -> [Text]
targetControls :: [Prelude.Text],
GatingRule -> Text
controlPanelArn :: Prelude.Text,
GatingRule -> Text
safetyRuleArn :: Prelude.Text,
GatingRule -> [Text]
gatingControls :: [Prelude.Text],
GatingRule -> RuleConfig
ruleConfig :: RuleConfig,
GatingRule -> Int
waitPeriodMs :: Prelude.Int,
GatingRule -> Text
name :: Prelude.Text
}
deriving (GatingRule -> GatingRule -> Bool
(GatingRule -> GatingRule -> Bool)
-> (GatingRule -> GatingRule -> Bool) -> Eq GatingRule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GatingRule -> GatingRule -> Bool
$c/= :: GatingRule -> GatingRule -> Bool
== :: GatingRule -> GatingRule -> Bool
$c== :: GatingRule -> GatingRule -> Bool
Prelude.Eq, ReadPrec [GatingRule]
ReadPrec GatingRule
Int -> ReadS GatingRule
ReadS [GatingRule]
(Int -> ReadS GatingRule)
-> ReadS [GatingRule]
-> ReadPrec GatingRule
-> ReadPrec [GatingRule]
-> Read GatingRule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GatingRule]
$creadListPrec :: ReadPrec [GatingRule]
readPrec :: ReadPrec GatingRule
$creadPrec :: ReadPrec GatingRule
readList :: ReadS [GatingRule]
$creadList :: ReadS [GatingRule]
readsPrec :: Int -> ReadS GatingRule
$creadsPrec :: Int -> ReadS GatingRule
Prelude.Read, Int -> GatingRule -> ShowS
[GatingRule] -> ShowS
GatingRule -> String
(Int -> GatingRule -> ShowS)
-> (GatingRule -> String)
-> ([GatingRule] -> ShowS)
-> Show GatingRule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GatingRule] -> ShowS
$cshowList :: [GatingRule] -> ShowS
show :: GatingRule -> String
$cshow :: GatingRule -> String
showsPrec :: Int -> GatingRule -> ShowS
$cshowsPrec :: Int -> GatingRule -> ShowS
Prelude.Show, (forall x. GatingRule -> Rep GatingRule x)
-> (forall x. Rep GatingRule x -> GatingRule) -> Generic GatingRule
forall x. Rep GatingRule x -> GatingRule
forall x. GatingRule -> Rep GatingRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GatingRule x -> GatingRule
$cfrom :: forall x. GatingRule -> Rep GatingRule x
Prelude.Generic)
newGatingRule ::
Status ->
Prelude.Text ->
Prelude.Text ->
RuleConfig ->
Prelude.Int ->
Prelude.Text ->
GatingRule
newGatingRule :: Status -> Text -> Text -> RuleConfig -> Int -> Text -> GatingRule
newGatingRule
Status
pStatus_
Text
pControlPanelArn_
Text
pSafetyRuleArn_
RuleConfig
pRuleConfig_
Int
pWaitPeriodMs_
Text
pName_ =
GatingRule' :: Status
-> [Text]
-> Text
-> Text
-> [Text]
-> RuleConfig
-> Int
-> Text
-> GatingRule
GatingRule'
{ $sel:status:GatingRule' :: Status
status = Status
pStatus_,
$sel:targetControls:GatingRule' :: [Text]
targetControls = [Text]
forall a. Monoid a => a
Prelude.mempty,
$sel:controlPanelArn:GatingRule' :: Text
controlPanelArn = Text
pControlPanelArn_,
$sel:safetyRuleArn:GatingRule' :: Text
safetyRuleArn = Text
pSafetyRuleArn_,
$sel:gatingControls:GatingRule' :: [Text]
gatingControls = [Text]
forall a. Monoid a => a
Prelude.mempty,
$sel:ruleConfig:GatingRule' :: RuleConfig
ruleConfig = RuleConfig
pRuleConfig_,
$sel:waitPeriodMs:GatingRule' :: Int
waitPeriodMs = Int
pWaitPeriodMs_,
$sel:name:GatingRule' :: Text
name = Text
pName_
}
gatingRule_status :: Lens.Lens' GatingRule Status
gatingRule_status :: (Status -> f Status) -> GatingRule -> f GatingRule
gatingRule_status = (GatingRule -> Status)
-> (GatingRule -> Status -> GatingRule)
-> Lens GatingRule GatingRule Status Status
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GatingRule' {Status
status :: Status
$sel:status:GatingRule' :: GatingRule -> Status
status} -> Status
status) (\s :: GatingRule
s@GatingRule' {} Status
a -> GatingRule
s {$sel:status:GatingRule' :: Status
status = Status
a} :: GatingRule)
gatingRule_targetControls :: Lens.Lens' GatingRule [Prelude.Text]
gatingRule_targetControls :: ([Text] -> f [Text]) -> GatingRule -> f GatingRule
gatingRule_targetControls = (GatingRule -> [Text])
-> (GatingRule -> [Text] -> GatingRule)
-> Lens GatingRule GatingRule [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GatingRule' {[Text]
targetControls :: [Text]
$sel:targetControls:GatingRule' :: GatingRule -> [Text]
targetControls} -> [Text]
targetControls) (\s :: GatingRule
s@GatingRule' {} [Text]
a -> GatingRule
s {$sel:targetControls:GatingRule' :: [Text]
targetControls = [Text]
a} :: GatingRule) (([Text] -> f [Text]) -> GatingRule -> f GatingRule)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> GatingRule
-> f GatingRule
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
gatingRule_controlPanelArn :: Lens.Lens' GatingRule Prelude.Text
gatingRule_controlPanelArn :: (Text -> f Text) -> GatingRule -> f GatingRule
gatingRule_controlPanelArn = (GatingRule -> Text)
-> (GatingRule -> Text -> GatingRule)
-> Lens GatingRule GatingRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GatingRule' {Text
controlPanelArn :: Text
$sel:controlPanelArn:GatingRule' :: GatingRule -> Text
controlPanelArn} -> Text
controlPanelArn) (\s :: GatingRule
s@GatingRule' {} Text
a -> GatingRule
s {$sel:controlPanelArn:GatingRule' :: Text
controlPanelArn = Text
a} :: GatingRule)
gatingRule_safetyRuleArn :: Lens.Lens' GatingRule Prelude.Text
gatingRule_safetyRuleArn :: (Text -> f Text) -> GatingRule -> f GatingRule
gatingRule_safetyRuleArn = (GatingRule -> Text)
-> (GatingRule -> Text -> GatingRule)
-> Lens GatingRule GatingRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GatingRule' {Text
safetyRuleArn :: Text
$sel:safetyRuleArn:GatingRule' :: GatingRule -> Text
safetyRuleArn} -> Text
safetyRuleArn) (\s :: GatingRule
s@GatingRule' {} Text
a -> GatingRule
s {$sel:safetyRuleArn:GatingRule' :: Text
safetyRuleArn = Text
a} :: GatingRule)
gatingRule_gatingControls :: Lens.Lens' GatingRule [Prelude.Text]
gatingRule_gatingControls :: ([Text] -> f [Text]) -> GatingRule -> f GatingRule
gatingRule_gatingControls = (GatingRule -> [Text])
-> (GatingRule -> [Text] -> GatingRule)
-> Lens GatingRule GatingRule [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GatingRule' {[Text]
gatingControls :: [Text]
$sel:gatingControls:GatingRule' :: GatingRule -> [Text]
gatingControls} -> [Text]
gatingControls) (\s :: GatingRule
s@GatingRule' {} [Text]
a -> GatingRule
s {$sel:gatingControls:GatingRule' :: [Text]
gatingControls = [Text]
a} :: GatingRule) (([Text] -> f [Text]) -> GatingRule -> f GatingRule)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> GatingRule
-> f GatingRule
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
gatingRule_ruleConfig :: Lens.Lens' GatingRule RuleConfig
gatingRule_ruleConfig :: (RuleConfig -> f RuleConfig) -> GatingRule -> f GatingRule
gatingRule_ruleConfig = (GatingRule -> RuleConfig)
-> (GatingRule -> RuleConfig -> GatingRule)
-> Lens GatingRule GatingRule RuleConfig RuleConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GatingRule' {RuleConfig
ruleConfig :: RuleConfig
$sel:ruleConfig:GatingRule' :: GatingRule -> RuleConfig
ruleConfig} -> RuleConfig
ruleConfig) (\s :: GatingRule
s@GatingRule' {} RuleConfig
a -> GatingRule
s {$sel:ruleConfig:GatingRule' :: RuleConfig
ruleConfig = RuleConfig
a} :: GatingRule)
gatingRule_waitPeriodMs :: Lens.Lens' GatingRule Prelude.Int
gatingRule_waitPeriodMs :: (Int -> f Int) -> GatingRule -> f GatingRule
gatingRule_waitPeriodMs = (GatingRule -> Int)
-> (GatingRule -> Int -> GatingRule)
-> Lens GatingRule GatingRule Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GatingRule' {Int
waitPeriodMs :: Int
$sel:waitPeriodMs:GatingRule' :: GatingRule -> Int
waitPeriodMs} -> Int
waitPeriodMs) (\s :: GatingRule
s@GatingRule' {} Int
a -> GatingRule
s {$sel:waitPeriodMs:GatingRule' :: Int
waitPeriodMs = Int
a} :: GatingRule)
gatingRule_name :: Lens.Lens' GatingRule Prelude.Text
gatingRule_name :: (Text -> f Text) -> GatingRule -> f GatingRule
gatingRule_name = (GatingRule -> Text)
-> (GatingRule -> Text -> GatingRule)
-> Lens GatingRule GatingRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GatingRule' {Text
name :: Text
$sel:name:GatingRule' :: GatingRule -> Text
name} -> Text
name) (\s :: GatingRule
s@GatingRule' {} Text
a -> GatingRule
s {$sel:name:GatingRule' :: Text
name = Text
a} :: GatingRule)
instance Core.FromJSON GatingRule where
parseJSON :: Value -> Parser GatingRule
parseJSON =
String
-> (Object -> Parser GatingRule) -> Value -> Parser GatingRule
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"GatingRule"
( \Object
x ->
Status
-> [Text]
-> Text
-> Text
-> [Text]
-> RuleConfig
-> Int
-> Text
-> GatingRule
GatingRule'
(Status
-> [Text]
-> Text
-> Text
-> [Text]
-> RuleConfig
-> Int
-> Text
-> GatingRule)
-> Parser Status
-> Parser
([Text]
-> Text
-> Text
-> [Text]
-> RuleConfig
-> Int
-> Text
-> GatingRule)
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
-> [Text]
-> RuleConfig
-> Int
-> Text
-> GatingRule)
-> Parser [Text]
-> Parser
(Text -> Text -> [Text] -> RuleConfig -> Int -> Text -> GatingRule)
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
"TargetControls" Parser (Maybe [Text]) -> [Text] -> Parser [Text]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Text]
forall a. Monoid a => a
Prelude.mempty)
Parser
(Text -> Text -> [Text] -> RuleConfig -> Int -> Text -> GatingRule)
-> Parser Text
-> Parser
(Text -> [Text] -> RuleConfig -> Int -> Text -> GatingRule)
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 -> GatingRule)
-> Parser Text
-> Parser ([Text] -> RuleConfig -> Int -> Text -> GatingRule)
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 -> GatingRule)
-> Parser [Text]
-> Parser (RuleConfig -> Int -> Text -> GatingRule)
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
"GatingControls" 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 -> GatingRule)
-> Parser RuleConfig -> Parser (Int -> Text -> GatingRule)
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 -> GatingRule)
-> Parser Int -> Parser (Text -> GatingRule)
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 -> GatingRule) -> Parser Text -> Parser GatingRule
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 GatingRule
instance Prelude.NFData GatingRule