{-# 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.Policy where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Organizations.Types.PolicySummary
import qualified Amazonka.Prelude as Prelude
data Policy = Policy'
{
Policy -> Maybe Text
content :: Prelude.Maybe Prelude.Text,
Policy -> Maybe PolicySummary
policySummary :: Prelude.Maybe PolicySummary
}
deriving (Policy -> Policy -> Bool
(Policy -> Policy -> Bool)
-> (Policy -> Policy -> Bool) -> Eq Policy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Policy -> Policy -> Bool
$c/= :: Policy -> Policy -> Bool
== :: Policy -> Policy -> Bool
$c== :: Policy -> Policy -> Bool
Prelude.Eq, ReadPrec [Policy]
ReadPrec Policy
Int -> ReadS Policy
ReadS [Policy]
(Int -> ReadS Policy)
-> ReadS [Policy]
-> ReadPrec Policy
-> ReadPrec [Policy]
-> Read Policy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Policy]
$creadListPrec :: ReadPrec [Policy]
readPrec :: ReadPrec Policy
$creadPrec :: ReadPrec Policy
readList :: ReadS [Policy]
$creadList :: ReadS [Policy]
readsPrec :: Int -> ReadS Policy
$creadsPrec :: Int -> ReadS Policy
Prelude.Read, Int -> Policy -> ShowS
[Policy] -> ShowS
Policy -> String
(Int -> Policy -> ShowS)
-> (Policy -> String) -> ([Policy] -> ShowS) -> Show Policy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Policy] -> ShowS
$cshowList :: [Policy] -> ShowS
show :: Policy -> String
$cshow :: Policy -> String
showsPrec :: Int -> Policy -> ShowS
$cshowsPrec :: Int -> Policy -> ShowS
Prelude.Show, (forall x. Policy -> Rep Policy x)
-> (forall x. Rep Policy x -> Policy) -> Generic Policy
forall x. Rep Policy x -> Policy
forall x. Policy -> Rep Policy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Policy x -> Policy
$cfrom :: forall x. Policy -> Rep Policy x
Prelude.Generic)
newPolicy ::
Policy
newPolicy :: Policy
newPolicy =
Policy' :: Maybe Text -> Maybe PolicySummary -> Policy
Policy'
{ $sel:content:Policy' :: Maybe Text
content = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:policySummary:Policy' :: Maybe PolicySummary
policySummary = Maybe PolicySummary
forall a. Maybe a
Prelude.Nothing
}
policy_content :: Lens.Lens' Policy (Prelude.Maybe Prelude.Text)
policy_content :: (Maybe Text -> f (Maybe Text)) -> Policy -> f Policy
policy_content = (Policy -> Maybe Text)
-> (Policy -> Maybe Text -> Policy)
-> Lens Policy Policy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Policy' {Maybe Text
content :: Maybe Text
$sel:content:Policy' :: Policy -> Maybe Text
content} -> Maybe Text
content) (\s :: Policy
s@Policy' {} Maybe Text
a -> Policy
s {$sel:content:Policy' :: Maybe Text
content = Maybe Text
a} :: Policy)
policy_policySummary :: Lens.Lens' Policy (Prelude.Maybe PolicySummary)
policy_policySummary :: (Maybe PolicySummary -> f (Maybe PolicySummary))
-> Policy -> f Policy
policy_policySummary = (Policy -> Maybe PolicySummary)
-> (Policy -> Maybe PolicySummary -> Policy)
-> Lens Policy Policy (Maybe PolicySummary) (Maybe PolicySummary)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Policy' {Maybe PolicySummary
policySummary :: Maybe PolicySummary
$sel:policySummary:Policy' :: Policy -> Maybe PolicySummary
policySummary} -> Maybe PolicySummary
policySummary) (\s :: Policy
s@Policy' {} Maybe PolicySummary
a -> Policy
s {$sel:policySummary:Policy' :: Maybe PolicySummary
policySummary = Maybe PolicySummary
a} :: Policy)
instance Core.FromJSON Policy where
parseJSON :: Value -> Parser Policy
parseJSON =
String -> (Object -> Parser Policy) -> Value -> Parser Policy
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Policy"
( \Object
x ->
Maybe Text -> Maybe PolicySummary -> Policy
Policy'
(Maybe Text -> Maybe PolicySummary -> Policy)
-> Parser (Maybe Text) -> Parser (Maybe PolicySummary -> Policy)
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
"Content")
Parser (Maybe PolicySummary -> Policy)
-> Parser (Maybe PolicySummary) -> Parser Policy
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe PolicySummary)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PolicySummary")
)
instance Prelude.Hashable Policy
instance Prelude.NFData Policy