{-# 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.RAM.Types.Principal where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Principal = Principal'
{
Principal -> Maybe POSIX
creationTime :: Prelude.Maybe Core.POSIX,
Principal -> Maybe Text
resourceShareArn :: Prelude.Maybe Prelude.Text,
Principal -> Maybe POSIX
lastUpdatedTime :: Prelude.Maybe Core.POSIX,
Principal -> Maybe Bool
external :: Prelude.Maybe Prelude.Bool,
Principal -> Maybe Text
id :: Prelude.Maybe Prelude.Text
}
deriving (Principal -> Principal -> Bool
(Principal -> Principal -> Bool)
-> (Principal -> Principal -> Bool) -> Eq Principal
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Principal -> Principal -> Bool
$c/= :: Principal -> Principal -> Bool
== :: Principal -> Principal -> Bool
$c== :: Principal -> Principal -> Bool
Prelude.Eq, ReadPrec [Principal]
ReadPrec Principal
Int -> ReadS Principal
ReadS [Principal]
(Int -> ReadS Principal)
-> ReadS [Principal]
-> ReadPrec Principal
-> ReadPrec [Principal]
-> Read Principal
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Principal]
$creadListPrec :: ReadPrec [Principal]
readPrec :: ReadPrec Principal
$creadPrec :: ReadPrec Principal
readList :: ReadS [Principal]
$creadList :: ReadS [Principal]
readsPrec :: Int -> ReadS Principal
$creadsPrec :: Int -> ReadS Principal
Prelude.Read, Int -> Principal -> ShowS
[Principal] -> ShowS
Principal -> String
(Int -> Principal -> ShowS)
-> (Principal -> String)
-> ([Principal] -> ShowS)
-> Show Principal
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Principal] -> ShowS
$cshowList :: [Principal] -> ShowS
show :: Principal -> String
$cshow :: Principal -> String
showsPrec :: Int -> Principal -> ShowS
$cshowsPrec :: Int -> Principal -> ShowS
Prelude.Show, (forall x. Principal -> Rep Principal x)
-> (forall x. Rep Principal x -> Principal) -> Generic Principal
forall x. Rep Principal x -> Principal
forall x. Principal -> Rep Principal x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Principal x -> Principal
$cfrom :: forall x. Principal -> Rep Principal x
Prelude.Generic)
newPrincipal ::
Principal
newPrincipal :: Principal
newPrincipal =
Principal' :: Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe Bool
-> Maybe Text
-> Principal
Principal'
{ $sel:creationTime:Principal' :: Maybe POSIX
creationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:resourceShareArn:Principal' :: Maybe Text
resourceShareArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:lastUpdatedTime:Principal' :: Maybe POSIX
lastUpdatedTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:external:Principal' :: Maybe Bool
external = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:id:Principal' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
principal_creationTime :: Lens.Lens' Principal (Prelude.Maybe Prelude.UTCTime)
principal_creationTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Principal -> f Principal
principal_creationTime = (Principal -> Maybe POSIX)
-> (Principal -> Maybe POSIX -> Principal)
-> Lens Principal Principal (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Principal' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:Principal' :: Principal -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: Principal
s@Principal' {} Maybe POSIX
a -> Principal
s {$sel:creationTime:Principal' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: Principal) ((Maybe POSIX -> f (Maybe POSIX)) -> Principal -> f Principal)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Principal
-> f Principal
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
principal_resourceShareArn :: Lens.Lens' Principal (Prelude.Maybe Prelude.Text)
principal_resourceShareArn :: (Maybe Text -> f (Maybe Text)) -> Principal -> f Principal
principal_resourceShareArn = (Principal -> Maybe Text)
-> (Principal -> Maybe Text -> Principal)
-> Lens Principal Principal (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Principal' {Maybe Text
resourceShareArn :: Maybe Text
$sel:resourceShareArn:Principal' :: Principal -> Maybe Text
resourceShareArn} -> Maybe Text
resourceShareArn) (\s :: Principal
s@Principal' {} Maybe Text
a -> Principal
s {$sel:resourceShareArn:Principal' :: Maybe Text
resourceShareArn = Maybe Text
a} :: Principal)
principal_lastUpdatedTime :: Lens.Lens' Principal (Prelude.Maybe Prelude.UTCTime)
principal_lastUpdatedTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Principal -> f Principal
principal_lastUpdatedTime = (Principal -> Maybe POSIX)
-> (Principal -> Maybe POSIX -> Principal)
-> Lens Principal Principal (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Principal' {Maybe POSIX
lastUpdatedTime :: Maybe POSIX
$sel:lastUpdatedTime:Principal' :: Principal -> Maybe POSIX
lastUpdatedTime} -> Maybe POSIX
lastUpdatedTime) (\s :: Principal
s@Principal' {} Maybe POSIX
a -> Principal
s {$sel:lastUpdatedTime:Principal' :: Maybe POSIX
lastUpdatedTime = Maybe POSIX
a} :: Principal) ((Maybe POSIX -> f (Maybe POSIX)) -> Principal -> f Principal)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Principal
-> f Principal
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
principal_external :: Lens.Lens' Principal (Prelude.Maybe Prelude.Bool)
principal_external :: (Maybe Bool -> f (Maybe Bool)) -> Principal -> f Principal
principal_external = (Principal -> Maybe Bool)
-> (Principal -> Maybe Bool -> Principal)
-> Lens Principal Principal (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Principal' {Maybe Bool
external :: Maybe Bool
$sel:external:Principal' :: Principal -> Maybe Bool
external} -> Maybe Bool
external) (\s :: Principal
s@Principal' {} Maybe Bool
a -> Principal
s {$sel:external:Principal' :: Maybe Bool
external = Maybe Bool
a} :: Principal)
principal_id :: Lens.Lens' Principal (Prelude.Maybe Prelude.Text)
principal_id :: (Maybe Text -> f (Maybe Text)) -> Principal -> f Principal
principal_id = (Principal -> Maybe Text)
-> (Principal -> Maybe Text -> Principal)
-> Lens Principal Principal (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Principal' {Maybe Text
id :: Maybe Text
$sel:id:Principal' :: Principal -> Maybe Text
id} -> Maybe Text
id) (\s :: Principal
s@Principal' {} Maybe Text
a -> Principal
s {$sel:id:Principal' :: Maybe Text
id = Maybe Text
a} :: Principal)
instance Core.FromJSON Principal where
parseJSON :: Value -> Parser Principal
parseJSON =
String -> (Object -> Parser Principal) -> Value -> Parser Principal
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Principal"
( \Object
x ->
Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe Bool
-> Maybe Text
-> Principal
Principal'
(Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe Bool
-> Maybe Text
-> Principal)
-> Parser (Maybe POSIX)
-> Parser
(Maybe Text
-> Maybe POSIX -> Maybe Bool -> Maybe Text -> Principal)
forall (f :: * -> *) a b. Functor 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
"creationTime")
Parser
(Maybe Text
-> Maybe POSIX -> Maybe Bool -> Maybe Text -> Principal)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Maybe Bool -> Maybe Text -> Principal)
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
"resourceShareArn")
Parser (Maybe POSIX -> Maybe Bool -> Maybe Text -> Principal)
-> Parser (Maybe POSIX)
-> Parser (Maybe Bool -> Maybe Text -> Principal)
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
"lastUpdatedTime")
Parser (Maybe Bool -> Maybe Text -> Principal)
-> Parser (Maybe Bool) -> Parser (Maybe Text -> Principal)
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
"external")
Parser (Maybe Text -> Principal)
-> Parser (Maybe Text) -> Parser Principal
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
"id")
)
instance Prelude.Hashable Principal
instance Prelude.NFData Principal