{-# 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.IoT.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 POSIX
createDate :: Prelude.Maybe Core.POSIX,
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 POSIX -> Maybe Bool -> PolicyVersion
PolicyVersion'
{ $sel:versionId:PolicyVersion' :: Maybe Text
versionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:createDate:PolicyVersion' :: Maybe POSIX
createDate = Maybe POSIX
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 POSIX)
-> (PolicyVersion -> Maybe POSIX -> PolicyVersion)
-> Lens PolicyVersion PolicyVersion (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicyVersion' {Maybe POSIX
createDate :: Maybe POSIX
$sel:createDate:PolicyVersion' :: PolicyVersion -> Maybe POSIX
createDate} -> Maybe POSIX
createDate) (\s :: PolicyVersion
s@PolicyVersion' {} Maybe POSIX
a -> PolicyVersion
s {$sel:createDate:PolicyVersion' :: Maybe POSIX
createDate = Maybe POSIX
a} :: PolicyVersion) ((Maybe POSIX -> f (Maybe POSIX))
-> PolicyVersion -> f PolicyVersion)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> PolicyVersion
-> f PolicyVersion
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
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.FromJSON PolicyVersion where
parseJSON :: Value -> Parser PolicyVersion
parseJSON =
String
-> (Object -> Parser PolicyVersion)
-> Value
-> Parser PolicyVersion
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"PolicyVersion"
( \Object
x ->
Maybe Text -> Maybe POSIX -> Maybe Bool -> PolicyVersion
PolicyVersion'
(Maybe Text -> Maybe POSIX -> Maybe Bool -> PolicyVersion)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Maybe Bool -> PolicyVersion)
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 POSIX -> Maybe Bool -> PolicyVersion)
-> Parser (Maybe POSIX) -> Parser (Maybe Bool -> PolicyVersion)
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
"createDate")
Parser (Maybe Bool -> PolicyVersion)
-> Parser (Maybe Bool) -> Parser PolicyVersion
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 PolicyVersion
instance Prelude.NFData PolicyVersion