{-# 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.MacieV2.Types.AssumedRole where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MacieV2.Types.SessionContext
import qualified Amazonka.Prelude as Prelude
data AssumedRole = AssumedRole'
{
AssumedRole -> Maybe Text
principalId :: Prelude.Maybe Prelude.Text,
AssumedRole -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
AssumedRole -> Maybe SessionContext
sessionContext :: Prelude.Maybe SessionContext,
AssumedRole -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
AssumedRole -> Maybe Text
accessKeyId :: Prelude.Maybe Prelude.Text
}
deriving (AssumedRole -> AssumedRole -> Bool
(AssumedRole -> AssumedRole -> Bool)
-> (AssumedRole -> AssumedRole -> Bool) -> Eq AssumedRole
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssumedRole -> AssumedRole -> Bool
$c/= :: AssumedRole -> AssumedRole -> Bool
== :: AssumedRole -> AssumedRole -> Bool
$c== :: AssumedRole -> AssumedRole -> Bool
Prelude.Eq, ReadPrec [AssumedRole]
ReadPrec AssumedRole
Int -> ReadS AssumedRole
ReadS [AssumedRole]
(Int -> ReadS AssumedRole)
-> ReadS [AssumedRole]
-> ReadPrec AssumedRole
-> ReadPrec [AssumedRole]
-> Read AssumedRole
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssumedRole]
$creadListPrec :: ReadPrec [AssumedRole]
readPrec :: ReadPrec AssumedRole
$creadPrec :: ReadPrec AssumedRole
readList :: ReadS [AssumedRole]
$creadList :: ReadS [AssumedRole]
readsPrec :: Int -> ReadS AssumedRole
$creadsPrec :: Int -> ReadS AssumedRole
Prelude.Read, Int -> AssumedRole -> ShowS
[AssumedRole] -> ShowS
AssumedRole -> String
(Int -> AssumedRole -> ShowS)
-> (AssumedRole -> String)
-> ([AssumedRole] -> ShowS)
-> Show AssumedRole
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssumedRole] -> ShowS
$cshowList :: [AssumedRole] -> ShowS
show :: AssumedRole -> String
$cshow :: AssumedRole -> String
showsPrec :: Int -> AssumedRole -> ShowS
$cshowsPrec :: Int -> AssumedRole -> ShowS
Prelude.Show, (forall x. AssumedRole -> Rep AssumedRole x)
-> (forall x. Rep AssumedRole x -> AssumedRole)
-> Generic AssumedRole
forall x. Rep AssumedRole x -> AssumedRole
forall x. AssumedRole -> Rep AssumedRole x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssumedRole x -> AssumedRole
$cfrom :: forall x. AssumedRole -> Rep AssumedRole x
Prelude.Generic)
newAssumedRole ::
AssumedRole
newAssumedRole :: AssumedRole
newAssumedRole =
AssumedRole' :: Maybe Text
-> Maybe Text
-> Maybe SessionContext
-> Maybe Text
-> Maybe Text
-> AssumedRole
AssumedRole'
{ $sel:principalId:AssumedRole' :: Maybe Text
principalId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:arn:AssumedRole' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:sessionContext:AssumedRole' :: Maybe SessionContext
sessionContext = Maybe SessionContext
forall a. Maybe a
Prelude.Nothing,
$sel:accountId:AssumedRole' :: Maybe Text
accountId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:accessKeyId:AssumedRole' :: Maybe Text
accessKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
assumedRole_principalId :: Lens.Lens' AssumedRole (Prelude.Maybe Prelude.Text)
assumedRole_principalId :: (Maybe Text -> f (Maybe Text)) -> AssumedRole -> f AssumedRole
assumedRole_principalId = (AssumedRole -> Maybe Text)
-> (AssumedRole -> Maybe Text -> AssumedRole)
-> Lens AssumedRole AssumedRole (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssumedRole' {Maybe Text
principalId :: Maybe Text
$sel:principalId:AssumedRole' :: AssumedRole -> Maybe Text
principalId} -> Maybe Text
principalId) (\s :: AssumedRole
s@AssumedRole' {} Maybe Text
a -> AssumedRole
s {$sel:principalId:AssumedRole' :: Maybe Text
principalId = Maybe Text
a} :: AssumedRole)
assumedRole_arn :: Lens.Lens' AssumedRole (Prelude.Maybe Prelude.Text)
assumedRole_arn :: (Maybe Text -> f (Maybe Text)) -> AssumedRole -> f AssumedRole
assumedRole_arn = (AssumedRole -> Maybe Text)
-> (AssumedRole -> Maybe Text -> AssumedRole)
-> Lens AssumedRole AssumedRole (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssumedRole' {Maybe Text
arn :: Maybe Text
$sel:arn:AssumedRole' :: AssumedRole -> Maybe Text
arn} -> Maybe Text
arn) (\s :: AssumedRole
s@AssumedRole' {} Maybe Text
a -> AssumedRole
s {$sel:arn:AssumedRole' :: Maybe Text
arn = Maybe Text
a} :: AssumedRole)
assumedRole_sessionContext :: Lens.Lens' AssumedRole (Prelude.Maybe SessionContext)
assumedRole_sessionContext :: (Maybe SessionContext -> f (Maybe SessionContext))
-> AssumedRole -> f AssumedRole
assumedRole_sessionContext = (AssumedRole -> Maybe SessionContext)
-> (AssumedRole -> Maybe SessionContext -> AssumedRole)
-> Lens
AssumedRole
AssumedRole
(Maybe SessionContext)
(Maybe SessionContext)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssumedRole' {Maybe SessionContext
sessionContext :: Maybe SessionContext
$sel:sessionContext:AssumedRole' :: AssumedRole -> Maybe SessionContext
sessionContext} -> Maybe SessionContext
sessionContext) (\s :: AssumedRole
s@AssumedRole' {} Maybe SessionContext
a -> AssumedRole
s {$sel:sessionContext:AssumedRole' :: Maybe SessionContext
sessionContext = Maybe SessionContext
a} :: AssumedRole)
assumedRole_accountId :: Lens.Lens' AssumedRole (Prelude.Maybe Prelude.Text)
assumedRole_accountId :: (Maybe Text -> f (Maybe Text)) -> AssumedRole -> f AssumedRole
assumedRole_accountId = (AssumedRole -> Maybe Text)
-> (AssumedRole -> Maybe Text -> AssumedRole)
-> Lens AssumedRole AssumedRole (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssumedRole' {Maybe Text
accountId :: Maybe Text
$sel:accountId:AssumedRole' :: AssumedRole -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: AssumedRole
s@AssumedRole' {} Maybe Text
a -> AssumedRole
s {$sel:accountId:AssumedRole' :: Maybe Text
accountId = Maybe Text
a} :: AssumedRole)
assumedRole_accessKeyId :: Lens.Lens' AssumedRole (Prelude.Maybe Prelude.Text)
assumedRole_accessKeyId :: (Maybe Text -> f (Maybe Text)) -> AssumedRole -> f AssumedRole
assumedRole_accessKeyId = (AssumedRole -> Maybe Text)
-> (AssumedRole -> Maybe Text -> AssumedRole)
-> Lens AssumedRole AssumedRole (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssumedRole' {Maybe Text
accessKeyId :: Maybe Text
$sel:accessKeyId:AssumedRole' :: AssumedRole -> Maybe Text
accessKeyId} -> Maybe Text
accessKeyId) (\s :: AssumedRole
s@AssumedRole' {} Maybe Text
a -> AssumedRole
s {$sel:accessKeyId:AssumedRole' :: Maybe Text
accessKeyId = Maybe Text
a} :: AssumedRole)
instance Core.FromJSON AssumedRole where
parseJSON :: Value -> Parser AssumedRole
parseJSON =
String
-> (Object -> Parser AssumedRole) -> Value -> Parser AssumedRole
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AssumedRole"
( \Object
x ->
Maybe Text
-> Maybe Text
-> Maybe SessionContext
-> Maybe Text
-> Maybe Text
-> AssumedRole
AssumedRole'
(Maybe Text
-> Maybe Text
-> Maybe SessionContext
-> Maybe Text
-> Maybe Text
-> AssumedRole)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe SessionContext -> Maybe Text -> Maybe Text -> AssumedRole)
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
"principalId")
Parser
(Maybe Text
-> Maybe SessionContext -> Maybe Text -> Maybe Text -> AssumedRole)
-> Parser (Maybe Text)
-> Parser
(Maybe SessionContext -> Maybe Text -> Maybe Text -> AssumedRole)
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
"arn")
Parser
(Maybe SessionContext -> Maybe Text -> Maybe Text -> AssumedRole)
-> Parser (Maybe SessionContext)
-> Parser (Maybe Text -> Maybe Text -> AssumedRole)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SessionContext)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"sessionContext")
Parser (Maybe Text -> Maybe Text -> AssumedRole)
-> Parser (Maybe Text) -> Parser (Maybe Text -> AssumedRole)
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
"accountId")
Parser (Maybe Text -> AssumedRole)
-> Parser (Maybe Text) -> Parser AssumedRole
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
"accessKeyId")
)
instance Prelude.Hashable AssumedRole
instance Prelude.NFData AssumedRole