{-# 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.Rule 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
import Amazonka.Route53RecoveryControlConfig.Types.AssertionRule
import Amazonka.Route53RecoveryControlConfig.Types.GatingRule
data Rule = Rule'
{
Rule -> Maybe AssertionRule
assertion :: Prelude.Maybe AssertionRule,
Rule -> Maybe GatingRule
gating :: Prelude.Maybe GatingRule
}
deriving (Rule -> Rule -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Rule -> Rule -> Bool
$c/= :: Rule -> Rule -> Bool
== :: Rule -> Rule -> Bool
$c== :: Rule -> Rule -> Bool
Prelude.Eq, ReadPrec [Rule]
ReadPrec Rule
Int -> ReadS Rule
ReadS [Rule]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Rule]
$creadListPrec :: ReadPrec [Rule]
readPrec :: ReadPrec Rule
$creadPrec :: ReadPrec Rule
readList :: ReadS [Rule]
$creadList :: ReadS [Rule]
readsPrec :: Int -> ReadS Rule
$creadsPrec :: Int -> ReadS Rule
Prelude.Read, Int -> Rule -> ShowS
[Rule] -> ShowS
Rule -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Rule] -> ShowS
$cshowList :: [Rule] -> ShowS
show :: Rule -> String
$cshow :: Rule -> String
showsPrec :: Int -> Rule -> ShowS
$cshowsPrec :: Int -> Rule -> ShowS
Prelude.Show, forall x. Rep Rule x -> Rule
forall x. Rule -> Rep Rule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Rule x -> Rule
$cfrom :: forall x. Rule -> Rep Rule x
Prelude.Generic)
newRule ::
Rule
newRule :: Rule
newRule =
Rule'
{ $sel:assertion:Rule' :: Maybe AssertionRule
assertion = forall a. Maybe a
Prelude.Nothing,
$sel:gating:Rule' :: Maybe GatingRule
gating = forall a. Maybe a
Prelude.Nothing
}
rule_assertion :: Lens.Lens' Rule (Prelude.Maybe AssertionRule)
rule_assertion :: Lens' Rule (Maybe AssertionRule)
rule_assertion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Rule' {Maybe AssertionRule
assertion :: Maybe AssertionRule
$sel:assertion:Rule' :: Rule -> Maybe AssertionRule
assertion} -> Maybe AssertionRule
assertion) (\s :: Rule
s@Rule' {} Maybe AssertionRule
a -> Rule
s {$sel:assertion:Rule' :: Maybe AssertionRule
assertion = Maybe AssertionRule
a} :: Rule)
rule_gating :: Lens.Lens' Rule (Prelude.Maybe GatingRule)
rule_gating :: Lens' Rule (Maybe GatingRule)
rule_gating = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Rule' {Maybe GatingRule
gating :: Maybe GatingRule
$sel:gating:Rule' :: Rule -> Maybe GatingRule
gating} -> Maybe GatingRule
gating) (\s :: Rule
s@Rule' {} Maybe GatingRule
a -> Rule
s {$sel:gating:Rule' :: Maybe GatingRule
gating = Maybe GatingRule
a} :: Rule)
instance Data.FromJSON Rule where
parseJSON :: Value -> Parser Rule
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Rule"
( \Object
x ->
Maybe AssertionRule -> Maybe GatingRule -> Rule
Rule'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ASSERTION")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"GATING")
)
instance Prelude.Hashable Rule where
hashWithSalt :: Int -> Rule -> Int
hashWithSalt Int
_salt Rule' {Maybe GatingRule
Maybe AssertionRule
gating :: Maybe GatingRule
assertion :: Maybe AssertionRule
$sel:gating:Rule' :: Rule -> Maybe GatingRule
$sel:assertion:Rule' :: Rule -> Maybe AssertionRule
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AssertionRule
assertion
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe GatingRule
gating
instance Prelude.NFData Rule where
rnf :: Rule -> ()
rnf Rule' {Maybe GatingRule
Maybe AssertionRule
gating :: Maybe GatingRule
assertion :: Maybe AssertionRule
$sel:gating:Rule' :: Rule -> Maybe GatingRule
$sel:assertion:Rule' :: Rule -> Maybe AssertionRule
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe AssertionRule
assertion
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe GatingRule
gating