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