{-# 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.ManagedBlockChain.Types.ApprovalThresholdPolicy where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.ManagedBlockChain.Types.ThresholdComparator
import qualified Amazonka.Prelude as Prelude
data ApprovalThresholdPolicy = ApprovalThresholdPolicy'
{
ApprovalThresholdPolicy -> Maybe Natural
thresholdPercentage :: Prelude.Maybe Prelude.Natural,
ApprovalThresholdPolicy -> Maybe ThresholdComparator
thresholdComparator :: Prelude.Maybe ThresholdComparator,
ApprovalThresholdPolicy -> Maybe Natural
proposalDurationInHours :: Prelude.Maybe Prelude.Natural
}
deriving (ApprovalThresholdPolicy -> ApprovalThresholdPolicy -> Bool
(ApprovalThresholdPolicy -> ApprovalThresholdPolicy -> Bool)
-> (ApprovalThresholdPolicy -> ApprovalThresholdPolicy -> Bool)
-> Eq ApprovalThresholdPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ApprovalThresholdPolicy -> ApprovalThresholdPolicy -> Bool
$c/= :: ApprovalThresholdPolicy -> ApprovalThresholdPolicy -> Bool
== :: ApprovalThresholdPolicy -> ApprovalThresholdPolicy -> Bool
$c== :: ApprovalThresholdPolicy -> ApprovalThresholdPolicy -> Bool
Prelude.Eq, ReadPrec [ApprovalThresholdPolicy]
ReadPrec ApprovalThresholdPolicy
Int -> ReadS ApprovalThresholdPolicy
ReadS [ApprovalThresholdPolicy]
(Int -> ReadS ApprovalThresholdPolicy)
-> ReadS [ApprovalThresholdPolicy]
-> ReadPrec ApprovalThresholdPolicy
-> ReadPrec [ApprovalThresholdPolicy]
-> Read ApprovalThresholdPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ApprovalThresholdPolicy]
$creadListPrec :: ReadPrec [ApprovalThresholdPolicy]
readPrec :: ReadPrec ApprovalThresholdPolicy
$creadPrec :: ReadPrec ApprovalThresholdPolicy
readList :: ReadS [ApprovalThresholdPolicy]
$creadList :: ReadS [ApprovalThresholdPolicy]
readsPrec :: Int -> ReadS ApprovalThresholdPolicy
$creadsPrec :: Int -> ReadS ApprovalThresholdPolicy
Prelude.Read, Int -> ApprovalThresholdPolicy -> ShowS
[ApprovalThresholdPolicy] -> ShowS
ApprovalThresholdPolicy -> String
(Int -> ApprovalThresholdPolicy -> ShowS)
-> (ApprovalThresholdPolicy -> String)
-> ([ApprovalThresholdPolicy] -> ShowS)
-> Show ApprovalThresholdPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ApprovalThresholdPolicy] -> ShowS
$cshowList :: [ApprovalThresholdPolicy] -> ShowS
show :: ApprovalThresholdPolicy -> String
$cshow :: ApprovalThresholdPolicy -> String
showsPrec :: Int -> ApprovalThresholdPolicy -> ShowS
$cshowsPrec :: Int -> ApprovalThresholdPolicy -> ShowS
Prelude.Show, (forall x.
ApprovalThresholdPolicy -> Rep ApprovalThresholdPolicy x)
-> (forall x.
Rep ApprovalThresholdPolicy x -> ApprovalThresholdPolicy)
-> Generic ApprovalThresholdPolicy
forall x. Rep ApprovalThresholdPolicy x -> ApprovalThresholdPolicy
forall x. ApprovalThresholdPolicy -> Rep ApprovalThresholdPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ApprovalThresholdPolicy x -> ApprovalThresholdPolicy
$cfrom :: forall x. ApprovalThresholdPolicy -> Rep ApprovalThresholdPolicy x
Prelude.Generic)
newApprovalThresholdPolicy ::
ApprovalThresholdPolicy
newApprovalThresholdPolicy :: ApprovalThresholdPolicy
newApprovalThresholdPolicy =
ApprovalThresholdPolicy' :: Maybe Natural
-> Maybe ThresholdComparator
-> Maybe Natural
-> ApprovalThresholdPolicy
ApprovalThresholdPolicy'
{ $sel:thresholdPercentage:ApprovalThresholdPolicy' :: Maybe Natural
thresholdPercentage =
Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:thresholdComparator:ApprovalThresholdPolicy' :: Maybe ThresholdComparator
thresholdComparator = Maybe ThresholdComparator
forall a. Maybe a
Prelude.Nothing,
$sel:proposalDurationInHours:ApprovalThresholdPolicy' :: Maybe Natural
proposalDurationInHours = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
approvalThresholdPolicy_thresholdPercentage :: Lens.Lens' ApprovalThresholdPolicy (Prelude.Maybe Prelude.Natural)
approvalThresholdPolicy_thresholdPercentage :: (Maybe Natural -> f (Maybe Natural))
-> ApprovalThresholdPolicy -> f ApprovalThresholdPolicy
approvalThresholdPolicy_thresholdPercentage = (ApprovalThresholdPolicy -> Maybe Natural)
-> (ApprovalThresholdPolicy
-> Maybe Natural -> ApprovalThresholdPolicy)
-> Lens
ApprovalThresholdPolicy
ApprovalThresholdPolicy
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApprovalThresholdPolicy' {Maybe Natural
thresholdPercentage :: Maybe Natural
$sel:thresholdPercentage:ApprovalThresholdPolicy' :: ApprovalThresholdPolicy -> Maybe Natural
thresholdPercentage} -> Maybe Natural
thresholdPercentage) (\s :: ApprovalThresholdPolicy
s@ApprovalThresholdPolicy' {} Maybe Natural
a -> ApprovalThresholdPolicy
s {$sel:thresholdPercentage:ApprovalThresholdPolicy' :: Maybe Natural
thresholdPercentage = Maybe Natural
a} :: ApprovalThresholdPolicy)
approvalThresholdPolicy_thresholdComparator :: Lens.Lens' ApprovalThresholdPolicy (Prelude.Maybe ThresholdComparator)
approvalThresholdPolicy_thresholdComparator :: (Maybe ThresholdComparator -> f (Maybe ThresholdComparator))
-> ApprovalThresholdPolicy -> f ApprovalThresholdPolicy
approvalThresholdPolicy_thresholdComparator = (ApprovalThresholdPolicy -> Maybe ThresholdComparator)
-> (ApprovalThresholdPolicy
-> Maybe ThresholdComparator -> ApprovalThresholdPolicy)
-> Lens
ApprovalThresholdPolicy
ApprovalThresholdPolicy
(Maybe ThresholdComparator)
(Maybe ThresholdComparator)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApprovalThresholdPolicy' {Maybe ThresholdComparator
thresholdComparator :: Maybe ThresholdComparator
$sel:thresholdComparator:ApprovalThresholdPolicy' :: ApprovalThresholdPolicy -> Maybe ThresholdComparator
thresholdComparator} -> Maybe ThresholdComparator
thresholdComparator) (\s :: ApprovalThresholdPolicy
s@ApprovalThresholdPolicy' {} Maybe ThresholdComparator
a -> ApprovalThresholdPolicy
s {$sel:thresholdComparator:ApprovalThresholdPolicy' :: Maybe ThresholdComparator
thresholdComparator = Maybe ThresholdComparator
a} :: ApprovalThresholdPolicy)
approvalThresholdPolicy_proposalDurationInHours :: Lens.Lens' ApprovalThresholdPolicy (Prelude.Maybe Prelude.Natural)
approvalThresholdPolicy_proposalDurationInHours :: (Maybe Natural -> f (Maybe Natural))
-> ApprovalThresholdPolicy -> f ApprovalThresholdPolicy
approvalThresholdPolicy_proposalDurationInHours = (ApprovalThresholdPolicy -> Maybe Natural)
-> (ApprovalThresholdPolicy
-> Maybe Natural -> ApprovalThresholdPolicy)
-> Lens
ApprovalThresholdPolicy
ApprovalThresholdPolicy
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApprovalThresholdPolicy' {Maybe Natural
proposalDurationInHours :: Maybe Natural
$sel:proposalDurationInHours:ApprovalThresholdPolicy' :: ApprovalThresholdPolicy -> Maybe Natural
proposalDurationInHours} -> Maybe Natural
proposalDurationInHours) (\s :: ApprovalThresholdPolicy
s@ApprovalThresholdPolicy' {} Maybe Natural
a -> ApprovalThresholdPolicy
s {$sel:proposalDurationInHours:ApprovalThresholdPolicy' :: Maybe Natural
proposalDurationInHours = Maybe Natural
a} :: ApprovalThresholdPolicy)
instance Core.FromJSON ApprovalThresholdPolicy where
parseJSON :: Value -> Parser ApprovalThresholdPolicy
parseJSON =
String
-> (Object -> Parser ApprovalThresholdPolicy)
-> Value
-> Parser ApprovalThresholdPolicy
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ApprovalThresholdPolicy"
( \Object
x ->
Maybe Natural
-> Maybe ThresholdComparator
-> Maybe Natural
-> ApprovalThresholdPolicy
ApprovalThresholdPolicy'
(Maybe Natural
-> Maybe ThresholdComparator
-> Maybe Natural
-> ApprovalThresholdPolicy)
-> Parser (Maybe Natural)
-> Parser
(Maybe ThresholdComparator
-> Maybe Natural -> ApprovalThresholdPolicy)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ThresholdPercentage")
Parser
(Maybe ThresholdComparator
-> Maybe Natural -> ApprovalThresholdPolicy)
-> Parser (Maybe ThresholdComparator)
-> Parser (Maybe Natural -> ApprovalThresholdPolicy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ThresholdComparator)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ThresholdComparator")
Parser (Maybe Natural -> ApprovalThresholdPolicy)
-> Parser (Maybe Natural) -> Parser ApprovalThresholdPolicy
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ProposalDurationInHours")
)
instance Prelude.Hashable ApprovalThresholdPolicy
instance Prelude.NFData ApprovalThresholdPolicy
instance Core.ToJSON ApprovalThresholdPolicy where
toJSON :: ApprovalThresholdPolicy -> Value
toJSON ApprovalThresholdPolicy' {Maybe Natural
Maybe ThresholdComparator
proposalDurationInHours :: Maybe Natural
thresholdComparator :: Maybe ThresholdComparator
thresholdPercentage :: Maybe Natural
$sel:proposalDurationInHours:ApprovalThresholdPolicy' :: ApprovalThresholdPolicy -> Maybe Natural
$sel:thresholdComparator:ApprovalThresholdPolicy' :: ApprovalThresholdPolicy -> Maybe ThresholdComparator
$sel:thresholdPercentage:ApprovalThresholdPolicy' :: ApprovalThresholdPolicy -> Maybe Natural
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ThresholdPercentage" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
thresholdPercentage,
(Text
"ThresholdComparator" Text -> ThresholdComparator -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(ThresholdComparator -> Pair)
-> Maybe ThresholdComparator -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ThresholdComparator
thresholdComparator,
(Text
"ProposalDurationInHours" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
proposalDurationInHours
]
)