{-# 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.Organizations.Types.EffectivePolicy where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Organizations.Types.EffectivePolicyType
import qualified Amazonka.Prelude as Prelude
data EffectivePolicy = EffectivePolicy'
{
EffectivePolicy -> Maybe Text
targetId :: Prelude.Maybe Prelude.Text,
EffectivePolicy -> Maybe EffectivePolicyType
policyType :: Prelude.Maybe EffectivePolicyType,
EffectivePolicy -> Maybe POSIX
lastUpdatedTimestamp :: Prelude.Maybe Core.POSIX,
EffectivePolicy -> Maybe Text
policyContent :: Prelude.Maybe Prelude.Text
}
deriving (EffectivePolicy -> EffectivePolicy -> Bool
(EffectivePolicy -> EffectivePolicy -> Bool)
-> (EffectivePolicy -> EffectivePolicy -> Bool)
-> Eq EffectivePolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EffectivePolicy -> EffectivePolicy -> Bool
$c/= :: EffectivePolicy -> EffectivePolicy -> Bool
== :: EffectivePolicy -> EffectivePolicy -> Bool
$c== :: EffectivePolicy -> EffectivePolicy -> Bool
Prelude.Eq, ReadPrec [EffectivePolicy]
ReadPrec EffectivePolicy
Int -> ReadS EffectivePolicy
ReadS [EffectivePolicy]
(Int -> ReadS EffectivePolicy)
-> ReadS [EffectivePolicy]
-> ReadPrec EffectivePolicy
-> ReadPrec [EffectivePolicy]
-> Read EffectivePolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EffectivePolicy]
$creadListPrec :: ReadPrec [EffectivePolicy]
readPrec :: ReadPrec EffectivePolicy
$creadPrec :: ReadPrec EffectivePolicy
readList :: ReadS [EffectivePolicy]
$creadList :: ReadS [EffectivePolicy]
readsPrec :: Int -> ReadS EffectivePolicy
$creadsPrec :: Int -> ReadS EffectivePolicy
Prelude.Read, Int -> EffectivePolicy -> ShowS
[EffectivePolicy] -> ShowS
EffectivePolicy -> String
(Int -> EffectivePolicy -> ShowS)
-> (EffectivePolicy -> String)
-> ([EffectivePolicy] -> ShowS)
-> Show EffectivePolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EffectivePolicy] -> ShowS
$cshowList :: [EffectivePolicy] -> ShowS
show :: EffectivePolicy -> String
$cshow :: EffectivePolicy -> String
showsPrec :: Int -> EffectivePolicy -> ShowS
$cshowsPrec :: Int -> EffectivePolicy -> ShowS
Prelude.Show, (forall x. EffectivePolicy -> Rep EffectivePolicy x)
-> (forall x. Rep EffectivePolicy x -> EffectivePolicy)
-> Generic EffectivePolicy
forall x. Rep EffectivePolicy x -> EffectivePolicy
forall x. EffectivePolicy -> Rep EffectivePolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EffectivePolicy x -> EffectivePolicy
$cfrom :: forall x. EffectivePolicy -> Rep EffectivePolicy x
Prelude.Generic)
newEffectivePolicy ::
EffectivePolicy
newEffectivePolicy :: EffectivePolicy
newEffectivePolicy =
EffectivePolicy' :: Maybe Text
-> Maybe EffectivePolicyType
-> Maybe POSIX
-> Maybe Text
-> EffectivePolicy
EffectivePolicy'
{ $sel:targetId:EffectivePolicy' :: Maybe Text
targetId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:policyType:EffectivePolicy' :: Maybe EffectivePolicyType
policyType = Maybe EffectivePolicyType
forall a. Maybe a
Prelude.Nothing,
$sel:lastUpdatedTimestamp:EffectivePolicy' :: Maybe POSIX
lastUpdatedTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:policyContent:EffectivePolicy' :: Maybe Text
policyContent = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
effectivePolicy_targetId :: Lens.Lens' EffectivePolicy (Prelude.Maybe Prelude.Text)
effectivePolicy_targetId :: (Maybe Text -> f (Maybe Text))
-> EffectivePolicy -> f EffectivePolicy
effectivePolicy_targetId = (EffectivePolicy -> Maybe Text)
-> (EffectivePolicy -> Maybe Text -> EffectivePolicy)
-> Lens EffectivePolicy EffectivePolicy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EffectivePolicy' {Maybe Text
targetId :: Maybe Text
$sel:targetId:EffectivePolicy' :: EffectivePolicy -> Maybe Text
targetId} -> Maybe Text
targetId) (\s :: EffectivePolicy
s@EffectivePolicy' {} Maybe Text
a -> EffectivePolicy
s {$sel:targetId:EffectivePolicy' :: Maybe Text
targetId = Maybe Text
a} :: EffectivePolicy)
effectivePolicy_policyType :: Lens.Lens' EffectivePolicy (Prelude.Maybe EffectivePolicyType)
effectivePolicy_policyType :: (Maybe EffectivePolicyType -> f (Maybe EffectivePolicyType))
-> EffectivePolicy -> f EffectivePolicy
effectivePolicy_policyType = (EffectivePolicy -> Maybe EffectivePolicyType)
-> (EffectivePolicy
-> Maybe EffectivePolicyType -> EffectivePolicy)
-> Lens
EffectivePolicy
EffectivePolicy
(Maybe EffectivePolicyType)
(Maybe EffectivePolicyType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EffectivePolicy' {Maybe EffectivePolicyType
policyType :: Maybe EffectivePolicyType
$sel:policyType:EffectivePolicy' :: EffectivePolicy -> Maybe EffectivePolicyType
policyType} -> Maybe EffectivePolicyType
policyType) (\s :: EffectivePolicy
s@EffectivePolicy' {} Maybe EffectivePolicyType
a -> EffectivePolicy
s {$sel:policyType:EffectivePolicy' :: Maybe EffectivePolicyType
policyType = Maybe EffectivePolicyType
a} :: EffectivePolicy)
effectivePolicy_lastUpdatedTimestamp :: Lens.Lens' EffectivePolicy (Prelude.Maybe Prelude.UTCTime)
effectivePolicy_lastUpdatedTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> EffectivePolicy -> f EffectivePolicy
effectivePolicy_lastUpdatedTimestamp = (EffectivePolicy -> Maybe POSIX)
-> (EffectivePolicy -> Maybe POSIX -> EffectivePolicy)
-> Lens EffectivePolicy EffectivePolicy (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EffectivePolicy' {Maybe POSIX
lastUpdatedTimestamp :: Maybe POSIX
$sel:lastUpdatedTimestamp:EffectivePolicy' :: EffectivePolicy -> Maybe POSIX
lastUpdatedTimestamp} -> Maybe POSIX
lastUpdatedTimestamp) (\s :: EffectivePolicy
s@EffectivePolicy' {} Maybe POSIX
a -> EffectivePolicy
s {$sel:lastUpdatedTimestamp:EffectivePolicy' :: Maybe POSIX
lastUpdatedTimestamp = Maybe POSIX
a} :: EffectivePolicy) ((Maybe POSIX -> f (Maybe POSIX))
-> EffectivePolicy -> f EffectivePolicy)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> EffectivePolicy
-> f EffectivePolicy
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
effectivePolicy_policyContent :: Lens.Lens' EffectivePolicy (Prelude.Maybe Prelude.Text)
effectivePolicy_policyContent :: (Maybe Text -> f (Maybe Text))
-> EffectivePolicy -> f EffectivePolicy
effectivePolicy_policyContent = (EffectivePolicy -> Maybe Text)
-> (EffectivePolicy -> Maybe Text -> EffectivePolicy)
-> Lens EffectivePolicy EffectivePolicy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EffectivePolicy' {Maybe Text
policyContent :: Maybe Text
$sel:policyContent:EffectivePolicy' :: EffectivePolicy -> Maybe Text
policyContent} -> Maybe Text
policyContent) (\s :: EffectivePolicy
s@EffectivePolicy' {} Maybe Text
a -> EffectivePolicy
s {$sel:policyContent:EffectivePolicy' :: Maybe Text
policyContent = Maybe Text
a} :: EffectivePolicy)
instance Core.FromJSON EffectivePolicy where
parseJSON :: Value -> Parser EffectivePolicy
parseJSON =
String
-> (Object -> Parser EffectivePolicy)
-> Value
-> Parser EffectivePolicy
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"EffectivePolicy"
( \Object
x ->
Maybe Text
-> Maybe EffectivePolicyType
-> Maybe POSIX
-> Maybe Text
-> EffectivePolicy
EffectivePolicy'
(Maybe Text
-> Maybe EffectivePolicyType
-> Maybe POSIX
-> Maybe Text
-> EffectivePolicy)
-> Parser (Maybe Text)
-> Parser
(Maybe EffectivePolicyType
-> Maybe POSIX -> Maybe Text -> EffectivePolicy)
forall (f :: * -> *) a b. Functor 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
"TargetId")
Parser
(Maybe EffectivePolicyType
-> Maybe POSIX -> Maybe Text -> EffectivePolicy)
-> Parser (Maybe EffectivePolicyType)
-> Parser (Maybe POSIX -> Maybe Text -> EffectivePolicy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EffectivePolicyType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PolicyType")
Parser (Maybe POSIX -> Maybe Text -> EffectivePolicy)
-> Parser (Maybe POSIX) -> Parser (Maybe Text -> EffectivePolicy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LastUpdatedTimestamp")
Parser (Maybe Text -> EffectivePolicy)
-> Parser (Maybe Text) -> Parser EffectivePolicy
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
"PolicyContent")
)
instance Prelude.Hashable EffectivePolicy
instance Prelude.NFData EffectivePolicy