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