{-# 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.IAM.Types.PolicyVersion where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data PolicyVersion = PolicyVersion'
{
PolicyVersion -> Maybe Text
versionId :: Prelude.Maybe Prelude.Text,
PolicyVersion -> Maybe ISO8601
createDate :: Prelude.Maybe Core.ISO8601,
PolicyVersion -> Maybe Text
document :: Prelude.Maybe Prelude.Text,
PolicyVersion -> Maybe Bool
isDefaultVersion :: Prelude.Maybe Prelude.Bool
}
deriving (PolicyVersion -> PolicyVersion -> Bool
(PolicyVersion -> PolicyVersion -> Bool)
-> (PolicyVersion -> PolicyVersion -> Bool) -> Eq PolicyVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PolicyVersion -> PolicyVersion -> Bool
$c/= :: PolicyVersion -> PolicyVersion -> Bool
== :: PolicyVersion -> PolicyVersion -> Bool
$c== :: PolicyVersion -> PolicyVersion -> Bool
Prelude.Eq, ReadPrec [PolicyVersion]
ReadPrec PolicyVersion
Int -> ReadS PolicyVersion
ReadS [PolicyVersion]
(Int -> ReadS PolicyVersion)
-> ReadS [PolicyVersion]
-> ReadPrec PolicyVersion
-> ReadPrec [PolicyVersion]
-> Read PolicyVersion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PolicyVersion]
$creadListPrec :: ReadPrec [PolicyVersion]
readPrec :: ReadPrec PolicyVersion
$creadPrec :: ReadPrec PolicyVersion
readList :: ReadS [PolicyVersion]
$creadList :: ReadS [PolicyVersion]
readsPrec :: Int -> ReadS PolicyVersion
$creadsPrec :: Int -> ReadS PolicyVersion
Prelude.Read, Int -> PolicyVersion -> ShowS
[PolicyVersion] -> ShowS
PolicyVersion -> String
(Int -> PolicyVersion -> ShowS)
-> (PolicyVersion -> String)
-> ([PolicyVersion] -> ShowS)
-> Show PolicyVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PolicyVersion] -> ShowS
$cshowList :: [PolicyVersion] -> ShowS
show :: PolicyVersion -> String
$cshow :: PolicyVersion -> String
showsPrec :: Int -> PolicyVersion -> ShowS
$cshowsPrec :: Int -> PolicyVersion -> ShowS
Prelude.Show, (forall x. PolicyVersion -> Rep PolicyVersion x)
-> (forall x. Rep PolicyVersion x -> PolicyVersion)
-> Generic PolicyVersion
forall x. Rep PolicyVersion x -> PolicyVersion
forall x. PolicyVersion -> Rep PolicyVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PolicyVersion x -> PolicyVersion
$cfrom :: forall x. PolicyVersion -> Rep PolicyVersion x
Prelude.Generic)
newPolicyVersion ::
PolicyVersion
newPolicyVersion :: PolicyVersion
newPolicyVersion =
PolicyVersion' :: Maybe Text
-> Maybe ISO8601 -> Maybe Text -> Maybe Bool -> PolicyVersion
PolicyVersion'
{ $sel:versionId:PolicyVersion' :: Maybe Text
versionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:createDate:PolicyVersion' :: Maybe ISO8601
createDate = Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
$sel:document:PolicyVersion' :: Maybe Text
document = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:isDefaultVersion:PolicyVersion' :: Maybe Bool
isDefaultVersion = Maybe Bool
forall a. Maybe a
Prelude.Nothing
}
policyVersion_versionId :: Lens.Lens' PolicyVersion (Prelude.Maybe Prelude.Text)
policyVersion_versionId :: (Maybe Text -> f (Maybe Text)) -> PolicyVersion -> f PolicyVersion
policyVersion_versionId = (PolicyVersion -> Maybe Text)
-> (PolicyVersion -> Maybe Text -> PolicyVersion)
-> Lens PolicyVersion PolicyVersion (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicyVersion' {Maybe Text
versionId :: Maybe Text
$sel:versionId:PolicyVersion' :: PolicyVersion -> Maybe Text
versionId} -> Maybe Text
versionId) (\s :: PolicyVersion
s@PolicyVersion' {} Maybe Text
a -> PolicyVersion
s {$sel:versionId:PolicyVersion' :: Maybe Text
versionId = Maybe Text
a} :: PolicyVersion)
policyVersion_createDate :: Lens.Lens' PolicyVersion (Prelude.Maybe Prelude.UTCTime)
policyVersion_createDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> PolicyVersion -> f PolicyVersion
policyVersion_createDate = (PolicyVersion -> Maybe ISO8601)
-> (PolicyVersion -> Maybe ISO8601 -> PolicyVersion)
-> Lens PolicyVersion PolicyVersion (Maybe ISO8601) (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicyVersion' {Maybe ISO8601
createDate :: Maybe ISO8601
$sel:createDate:PolicyVersion' :: PolicyVersion -> Maybe ISO8601
createDate} -> Maybe ISO8601
createDate) (\s :: PolicyVersion
s@PolicyVersion' {} Maybe ISO8601
a -> PolicyVersion
s {$sel:createDate:PolicyVersion' :: Maybe ISO8601
createDate = Maybe ISO8601
a} :: PolicyVersion) ((Maybe ISO8601 -> f (Maybe ISO8601))
-> PolicyVersion -> f PolicyVersion)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> PolicyVersion
-> f PolicyVersion
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
(Maybe ISO8601) (Maybe ISO8601) (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 ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
policyVersion_document :: Lens.Lens' PolicyVersion (Prelude.Maybe Prelude.Text)
policyVersion_document :: (Maybe Text -> f (Maybe Text)) -> PolicyVersion -> f PolicyVersion
policyVersion_document = (PolicyVersion -> Maybe Text)
-> (PolicyVersion -> Maybe Text -> PolicyVersion)
-> Lens PolicyVersion PolicyVersion (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicyVersion' {Maybe Text
document :: Maybe Text
$sel:document:PolicyVersion' :: PolicyVersion -> Maybe Text
document} -> Maybe Text
document) (\s :: PolicyVersion
s@PolicyVersion' {} Maybe Text
a -> PolicyVersion
s {$sel:document:PolicyVersion' :: Maybe Text
document = Maybe Text
a} :: PolicyVersion)
policyVersion_isDefaultVersion :: Lens.Lens' PolicyVersion (Prelude.Maybe Prelude.Bool)
policyVersion_isDefaultVersion :: (Maybe Bool -> f (Maybe Bool)) -> PolicyVersion -> f PolicyVersion
policyVersion_isDefaultVersion = (PolicyVersion -> Maybe Bool)
-> (PolicyVersion -> Maybe Bool -> PolicyVersion)
-> Lens PolicyVersion PolicyVersion (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicyVersion' {Maybe Bool
isDefaultVersion :: Maybe Bool
$sel:isDefaultVersion:PolicyVersion' :: PolicyVersion -> Maybe Bool
isDefaultVersion} -> Maybe Bool
isDefaultVersion) (\s :: PolicyVersion
s@PolicyVersion' {} Maybe Bool
a -> PolicyVersion
s {$sel:isDefaultVersion:PolicyVersion' :: Maybe Bool
isDefaultVersion = Maybe Bool
a} :: PolicyVersion)
instance Core.FromXML PolicyVersion where
parseXML :: [Node] -> Either String PolicyVersion
parseXML [Node]
x =
Maybe Text
-> Maybe ISO8601 -> Maybe Text -> Maybe Bool -> PolicyVersion
PolicyVersion'
(Maybe Text
-> Maybe ISO8601 -> Maybe Text -> Maybe Bool -> PolicyVersion)
-> Either String (Maybe Text)
-> Either
String (Maybe ISO8601 -> Maybe Text -> Maybe Bool -> PolicyVersion)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"VersionId")
Either
String (Maybe ISO8601 -> Maybe Text -> Maybe Bool -> PolicyVersion)
-> Either String (Maybe ISO8601)
-> Either String (Maybe Text -> Maybe Bool -> PolicyVersion)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ISO8601)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"CreateDate")
Either String (Maybe Text -> Maybe Bool -> PolicyVersion)
-> Either String (Maybe Text)
-> Either String (Maybe Bool -> PolicyVersion)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Document")
Either String (Maybe Bool -> PolicyVersion)
-> Either String (Maybe Bool) -> Either String PolicyVersion
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"IsDefaultVersion")
instance Prelude.Hashable PolicyVersion
instance Prelude.NFData PolicyVersion