{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.EMR.Types.SessionMappingDetail
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.EMR.Types.SessionMappingDetail where

import qualified Amazonka.Core as Core
import Amazonka.EMR.Types.IdentityType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Details for an Amazon EMR Studio session mapping including creation
-- time, user or group ID, Studio ID, and so on.
--
-- /See:/ 'newSessionMappingDetail' smart constructor.
data SessionMappingDetail = SessionMappingDetail'
  { -- | The time the session mapping was created.
    SessionMappingDetail -> Maybe POSIX
creationTime :: Prelude.Maybe Core.POSIX,
    -- | The ID of the Amazon EMR Studio.
    SessionMappingDetail -> Maybe Text
studioId :: Prelude.Maybe Prelude.Text,
    -- | The time the session mapping was last modified.
    SessionMappingDetail -> Maybe POSIX
lastModifiedTime :: Prelude.Maybe Core.POSIX,
    -- | Specifies whether the identity mapped to the Amazon EMR Studio is a user
    -- or a group.
    SessionMappingDetail -> Maybe IdentityType
identityType :: Prelude.Maybe IdentityType,
    -- | The globally unique identifier (GUID) of the user or group.
    SessionMappingDetail -> Maybe Text
identityId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the session policy associated with the
    -- user or group.
    SessionMappingDetail -> Maybe Text
sessionPolicyArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the user or group. For more information, see
    -- <https://docs.aws.amazon.com/singlesignon/latest/IdentityStoreAPIReference/API_User.html#singlesignon-Type-User-UserName UserName>
    -- and
    -- <https://docs.aws.amazon.com/singlesignon/latest/IdentityStoreAPIReference/API_Group.html#singlesignon-Type-Group-DisplayName DisplayName>
    -- in the /Amazon Web Services SSO Identity Store API Reference/.
    SessionMappingDetail -> Maybe Text
identityName :: Prelude.Maybe Prelude.Text
  }
  deriving (SessionMappingDetail -> SessionMappingDetail -> Bool
(SessionMappingDetail -> SessionMappingDetail -> Bool)
-> (SessionMappingDetail -> SessionMappingDetail -> Bool)
-> Eq SessionMappingDetail
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SessionMappingDetail -> SessionMappingDetail -> Bool
$c/= :: SessionMappingDetail -> SessionMappingDetail -> Bool
== :: SessionMappingDetail -> SessionMappingDetail -> Bool
$c== :: SessionMappingDetail -> SessionMappingDetail -> Bool
Prelude.Eq, ReadPrec [SessionMappingDetail]
ReadPrec SessionMappingDetail
Int -> ReadS SessionMappingDetail
ReadS [SessionMappingDetail]
(Int -> ReadS SessionMappingDetail)
-> ReadS [SessionMappingDetail]
-> ReadPrec SessionMappingDetail
-> ReadPrec [SessionMappingDetail]
-> Read SessionMappingDetail
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SessionMappingDetail]
$creadListPrec :: ReadPrec [SessionMappingDetail]
readPrec :: ReadPrec SessionMappingDetail
$creadPrec :: ReadPrec SessionMappingDetail
readList :: ReadS [SessionMappingDetail]
$creadList :: ReadS [SessionMappingDetail]
readsPrec :: Int -> ReadS SessionMappingDetail
$creadsPrec :: Int -> ReadS SessionMappingDetail
Prelude.Read, Int -> SessionMappingDetail -> ShowS
[SessionMappingDetail] -> ShowS
SessionMappingDetail -> String
(Int -> SessionMappingDetail -> ShowS)
-> (SessionMappingDetail -> String)
-> ([SessionMappingDetail] -> ShowS)
-> Show SessionMappingDetail
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SessionMappingDetail] -> ShowS
$cshowList :: [SessionMappingDetail] -> ShowS
show :: SessionMappingDetail -> String
$cshow :: SessionMappingDetail -> String
showsPrec :: Int -> SessionMappingDetail -> ShowS
$cshowsPrec :: Int -> SessionMappingDetail -> ShowS
Prelude.Show, (forall x. SessionMappingDetail -> Rep SessionMappingDetail x)
-> (forall x. Rep SessionMappingDetail x -> SessionMappingDetail)
-> Generic SessionMappingDetail
forall x. Rep SessionMappingDetail x -> SessionMappingDetail
forall x. SessionMappingDetail -> Rep SessionMappingDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SessionMappingDetail x -> SessionMappingDetail
$cfrom :: forall x. SessionMappingDetail -> Rep SessionMappingDetail x
Prelude.Generic)

-- |
-- Create a value of 'SessionMappingDetail' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'creationTime', 'sessionMappingDetail_creationTime' - The time the session mapping was created.
--
-- 'studioId', 'sessionMappingDetail_studioId' - The ID of the Amazon EMR Studio.
--
-- 'lastModifiedTime', 'sessionMappingDetail_lastModifiedTime' - The time the session mapping was last modified.
--
-- 'identityType', 'sessionMappingDetail_identityType' - Specifies whether the identity mapped to the Amazon EMR Studio is a user
-- or a group.
--
-- 'identityId', 'sessionMappingDetail_identityId' - The globally unique identifier (GUID) of the user or group.
--
-- 'sessionPolicyArn', 'sessionMappingDetail_sessionPolicyArn' - The Amazon Resource Name (ARN) of the session policy associated with the
-- user or group.
--
-- 'identityName', 'sessionMappingDetail_identityName' - The name of the user or group. For more information, see
-- <https://docs.aws.amazon.com/singlesignon/latest/IdentityStoreAPIReference/API_User.html#singlesignon-Type-User-UserName UserName>
-- and
-- <https://docs.aws.amazon.com/singlesignon/latest/IdentityStoreAPIReference/API_Group.html#singlesignon-Type-Group-DisplayName DisplayName>
-- in the /Amazon Web Services SSO Identity Store API Reference/.
newSessionMappingDetail ::
  SessionMappingDetail
newSessionMappingDetail :: SessionMappingDetail
newSessionMappingDetail =
  SessionMappingDetail' :: Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe IdentityType
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> SessionMappingDetail
SessionMappingDetail'
    { $sel:creationTime:SessionMappingDetail' :: Maybe POSIX
creationTime =
        Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:studioId:SessionMappingDetail' :: Maybe Text
studioId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastModifiedTime:SessionMappingDetail' :: Maybe POSIX
lastModifiedTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:identityType:SessionMappingDetail' :: Maybe IdentityType
identityType = Maybe IdentityType
forall a. Maybe a
Prelude.Nothing,
      $sel:identityId:SessionMappingDetail' :: Maybe Text
identityId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sessionPolicyArn:SessionMappingDetail' :: Maybe Text
sessionPolicyArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:identityName:SessionMappingDetail' :: Maybe Text
identityName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The time the session mapping was created.
sessionMappingDetail_creationTime :: Lens.Lens' SessionMappingDetail (Prelude.Maybe Prelude.UTCTime)
sessionMappingDetail_creationTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> SessionMappingDetail -> f SessionMappingDetail
sessionMappingDetail_creationTime = (SessionMappingDetail -> Maybe POSIX)
-> (SessionMappingDetail -> Maybe POSIX -> SessionMappingDetail)
-> Lens
     SessionMappingDetail
     SessionMappingDetail
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SessionMappingDetail' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:SessionMappingDetail' :: SessionMappingDetail -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: SessionMappingDetail
s@SessionMappingDetail' {} Maybe POSIX
a -> SessionMappingDetail
s {$sel:creationTime:SessionMappingDetail' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: SessionMappingDetail) ((Maybe POSIX -> f (Maybe POSIX))
 -> SessionMappingDetail -> f SessionMappingDetail)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> SessionMappingDetail
-> f SessionMappingDetail
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

-- | The ID of the Amazon EMR Studio.
sessionMappingDetail_studioId :: Lens.Lens' SessionMappingDetail (Prelude.Maybe Prelude.Text)
sessionMappingDetail_studioId :: (Maybe Text -> f (Maybe Text))
-> SessionMappingDetail -> f SessionMappingDetail
sessionMappingDetail_studioId = (SessionMappingDetail -> Maybe Text)
-> (SessionMappingDetail -> Maybe Text -> SessionMappingDetail)
-> Lens
     SessionMappingDetail SessionMappingDetail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SessionMappingDetail' {Maybe Text
studioId :: Maybe Text
$sel:studioId:SessionMappingDetail' :: SessionMappingDetail -> Maybe Text
studioId} -> Maybe Text
studioId) (\s :: SessionMappingDetail
s@SessionMappingDetail' {} Maybe Text
a -> SessionMappingDetail
s {$sel:studioId:SessionMappingDetail' :: Maybe Text
studioId = Maybe Text
a} :: SessionMappingDetail)

-- | The time the session mapping was last modified.
sessionMappingDetail_lastModifiedTime :: Lens.Lens' SessionMappingDetail (Prelude.Maybe Prelude.UTCTime)
sessionMappingDetail_lastModifiedTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> SessionMappingDetail -> f SessionMappingDetail
sessionMappingDetail_lastModifiedTime = (SessionMappingDetail -> Maybe POSIX)
-> (SessionMappingDetail -> Maybe POSIX -> SessionMappingDetail)
-> Lens
     SessionMappingDetail
     SessionMappingDetail
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SessionMappingDetail' {Maybe POSIX
lastModifiedTime :: Maybe POSIX
$sel:lastModifiedTime:SessionMappingDetail' :: SessionMappingDetail -> Maybe POSIX
lastModifiedTime} -> Maybe POSIX
lastModifiedTime) (\s :: SessionMappingDetail
s@SessionMappingDetail' {} Maybe POSIX
a -> SessionMappingDetail
s {$sel:lastModifiedTime:SessionMappingDetail' :: Maybe POSIX
lastModifiedTime = Maybe POSIX
a} :: SessionMappingDetail) ((Maybe POSIX -> f (Maybe POSIX))
 -> SessionMappingDetail -> f SessionMappingDetail)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> SessionMappingDetail
-> f SessionMappingDetail
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

-- | Specifies whether the identity mapped to the Amazon EMR Studio is a user
-- or a group.
sessionMappingDetail_identityType :: Lens.Lens' SessionMappingDetail (Prelude.Maybe IdentityType)
sessionMappingDetail_identityType :: (Maybe IdentityType -> f (Maybe IdentityType))
-> SessionMappingDetail -> f SessionMappingDetail
sessionMappingDetail_identityType = (SessionMappingDetail -> Maybe IdentityType)
-> (SessionMappingDetail
    -> Maybe IdentityType -> SessionMappingDetail)
-> Lens
     SessionMappingDetail
     SessionMappingDetail
     (Maybe IdentityType)
     (Maybe IdentityType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SessionMappingDetail' {Maybe IdentityType
identityType :: Maybe IdentityType
$sel:identityType:SessionMappingDetail' :: SessionMappingDetail -> Maybe IdentityType
identityType} -> Maybe IdentityType
identityType) (\s :: SessionMappingDetail
s@SessionMappingDetail' {} Maybe IdentityType
a -> SessionMappingDetail
s {$sel:identityType:SessionMappingDetail' :: Maybe IdentityType
identityType = Maybe IdentityType
a} :: SessionMappingDetail)

-- | The globally unique identifier (GUID) of the user or group.
sessionMappingDetail_identityId :: Lens.Lens' SessionMappingDetail (Prelude.Maybe Prelude.Text)
sessionMappingDetail_identityId :: (Maybe Text -> f (Maybe Text))
-> SessionMappingDetail -> f SessionMappingDetail
sessionMappingDetail_identityId = (SessionMappingDetail -> Maybe Text)
-> (SessionMappingDetail -> Maybe Text -> SessionMappingDetail)
-> Lens
     SessionMappingDetail SessionMappingDetail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SessionMappingDetail' {Maybe Text
identityId :: Maybe Text
$sel:identityId:SessionMappingDetail' :: SessionMappingDetail -> Maybe Text
identityId} -> Maybe Text
identityId) (\s :: SessionMappingDetail
s@SessionMappingDetail' {} Maybe Text
a -> SessionMappingDetail
s {$sel:identityId:SessionMappingDetail' :: Maybe Text
identityId = Maybe Text
a} :: SessionMappingDetail)

-- | The Amazon Resource Name (ARN) of the session policy associated with the
-- user or group.
sessionMappingDetail_sessionPolicyArn :: Lens.Lens' SessionMappingDetail (Prelude.Maybe Prelude.Text)
sessionMappingDetail_sessionPolicyArn :: (Maybe Text -> f (Maybe Text))
-> SessionMappingDetail -> f SessionMappingDetail
sessionMappingDetail_sessionPolicyArn = (SessionMappingDetail -> Maybe Text)
-> (SessionMappingDetail -> Maybe Text -> SessionMappingDetail)
-> Lens
     SessionMappingDetail SessionMappingDetail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SessionMappingDetail' {Maybe Text
sessionPolicyArn :: Maybe Text
$sel:sessionPolicyArn:SessionMappingDetail' :: SessionMappingDetail -> Maybe Text
sessionPolicyArn} -> Maybe Text
sessionPolicyArn) (\s :: SessionMappingDetail
s@SessionMappingDetail' {} Maybe Text
a -> SessionMappingDetail
s {$sel:sessionPolicyArn:SessionMappingDetail' :: Maybe Text
sessionPolicyArn = Maybe Text
a} :: SessionMappingDetail)

-- | The name of the user or group. For more information, see
-- <https://docs.aws.amazon.com/singlesignon/latest/IdentityStoreAPIReference/API_User.html#singlesignon-Type-User-UserName UserName>
-- and
-- <https://docs.aws.amazon.com/singlesignon/latest/IdentityStoreAPIReference/API_Group.html#singlesignon-Type-Group-DisplayName DisplayName>
-- in the /Amazon Web Services SSO Identity Store API Reference/.
sessionMappingDetail_identityName :: Lens.Lens' SessionMappingDetail (Prelude.Maybe Prelude.Text)
sessionMappingDetail_identityName :: (Maybe Text -> f (Maybe Text))
-> SessionMappingDetail -> f SessionMappingDetail
sessionMappingDetail_identityName = (SessionMappingDetail -> Maybe Text)
-> (SessionMappingDetail -> Maybe Text -> SessionMappingDetail)
-> Lens
     SessionMappingDetail SessionMappingDetail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SessionMappingDetail' {Maybe Text
identityName :: Maybe Text
$sel:identityName:SessionMappingDetail' :: SessionMappingDetail -> Maybe Text
identityName} -> Maybe Text
identityName) (\s :: SessionMappingDetail
s@SessionMappingDetail' {} Maybe Text
a -> SessionMappingDetail
s {$sel:identityName:SessionMappingDetail' :: Maybe Text
identityName = Maybe Text
a} :: SessionMappingDetail)

instance Core.FromJSON SessionMappingDetail where
  parseJSON :: Value -> Parser SessionMappingDetail
parseJSON =
    String
-> (Object -> Parser SessionMappingDetail)
-> Value
-> Parser SessionMappingDetail
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SessionMappingDetail"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe IdentityType
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> SessionMappingDetail
SessionMappingDetail'
            (Maybe POSIX
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe IdentityType
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> SessionMappingDetail)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe IdentityType
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> SessionMappingDetail)
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 IdentityType
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> SessionMappingDetail)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe IdentityType
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> SessionMappingDetail)
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
"StudioId")
            Parser
  (Maybe POSIX
   -> Maybe IdentityType
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> SessionMappingDetail)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe IdentityType
      -> Maybe Text -> Maybe Text -> Maybe Text -> SessionMappingDetail)
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
"LastModifiedTime")
            Parser
  (Maybe IdentityType
   -> Maybe Text -> Maybe Text -> Maybe Text -> SessionMappingDetail)
-> Parser (Maybe IdentityType)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> SessionMappingDetail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe IdentityType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IdentityType")
            Parser
  (Maybe Text -> Maybe Text -> Maybe Text -> SessionMappingDetail)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> SessionMappingDetail)
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
"IdentityId")
            Parser (Maybe Text -> Maybe Text -> SessionMappingDetail)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> SessionMappingDetail)
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
"SessionPolicyArn")
            Parser (Maybe Text -> SessionMappingDetail)
-> Parser (Maybe Text) -> Parser SessionMappingDetail
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
"IdentityName")
      )

instance Prelude.Hashable SessionMappingDetail

instance Prelude.NFData SessionMappingDetail