{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.EMR.Types.SessionMappingDetail where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EMR.Types.IdentityType
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 Data.POSIX,
    -- | The globally unique identifier (GUID) of the user or group.
    SessionMappingDetail -> Maybe Text
identityId :: 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 /IAM Identity Center Identity Store API Reference/.
    SessionMappingDetail -> Maybe Text
identityName :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether the identity mapped to the Amazon EMR Studio is a user
    -- or a group.
    SessionMappingDetail -> Maybe IdentityType
identityType :: Prelude.Maybe IdentityType,
    -- | The time the session mapping was last modified.
    SessionMappingDetail -> Maybe POSIX
lastModifiedTime :: Prelude.Maybe Data.POSIX,
    -- | The Amazon Resource Name (ARN) of the session policy associated with the
    -- user or group.
    SessionMappingDetail -> Maybe Text
sessionPolicyArn :: Prelude.Maybe Prelude.Text,
    -- | The ID of the Amazon EMR Studio.
    SessionMappingDetail -> Maybe Text
studioId :: Prelude.Maybe Prelude.Text
  }
  deriving (SessionMappingDetail -> SessionMappingDetail -> Bool
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]
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
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. 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.
--
-- 'identityId', 'sessionMappingDetail_identityId' - The globally unique identifier (GUID) of 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 /IAM Identity Center Identity Store API Reference/.
--
-- 'identityType', 'sessionMappingDetail_identityType' - Specifies whether the identity mapped to the Amazon EMR Studio is a user
-- or a group.
--
-- 'lastModifiedTime', 'sessionMappingDetail_lastModifiedTime' - The time the session mapping was last modified.
--
-- 'sessionPolicyArn', 'sessionMappingDetail_sessionPolicyArn' - The Amazon Resource Name (ARN) of the session policy associated with the
-- user or group.
--
-- 'studioId', 'sessionMappingDetail_studioId' - The ID of the Amazon EMR Studio.
newSessionMappingDetail ::
  SessionMappingDetail
newSessionMappingDetail :: SessionMappingDetail
newSessionMappingDetail =
  SessionMappingDetail'
    { $sel:creationTime:SessionMappingDetail' :: Maybe POSIX
creationTime =
        forall a. Maybe a
Prelude.Nothing,
      $sel:identityId:SessionMappingDetail' :: Maybe Text
identityId = forall a. Maybe a
Prelude.Nothing,
      $sel:identityName:SessionMappingDetail' :: Maybe Text
identityName = forall a. Maybe a
Prelude.Nothing,
      $sel:identityType:SessionMappingDetail' :: Maybe IdentityType
identityType = forall a. Maybe a
Prelude.Nothing,
      $sel:lastModifiedTime:SessionMappingDetail' :: Maybe POSIX
lastModifiedTime = forall a. Maybe a
Prelude.Nothing,
      $sel:sessionPolicyArn:SessionMappingDetail' :: Maybe Text
sessionPolicyArn = forall a. Maybe a
Prelude.Nothing,
      $sel:studioId:SessionMappingDetail' :: Maybe Text
studioId = forall a. Maybe a
Prelude.Nothing
    }

-- | The time the session mapping was created.
sessionMappingDetail_creationTime :: Lens.Lens' SessionMappingDetail (Prelude.Maybe Prelude.UTCTime)
sessionMappingDetail_creationTime :: Lens' SessionMappingDetail (Maybe UTCTime)
sessionMappingDetail_creationTime = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The globally unique identifier (GUID) of the user or group.
sessionMappingDetail_identityId :: Lens.Lens' SessionMappingDetail (Prelude.Maybe Prelude.Text)
sessionMappingDetail_identityId :: Lens' SessionMappingDetail (Maybe Text)
sessionMappingDetail_identityId = 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 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 /IAM Identity Center Identity Store API Reference/.
sessionMappingDetail_identityName :: Lens.Lens' SessionMappingDetail (Prelude.Maybe Prelude.Text)
sessionMappingDetail_identityName :: Lens' SessionMappingDetail (Maybe Text)
sessionMappingDetail_identityName = 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)

-- | 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 :: Lens' SessionMappingDetail (Maybe IdentityType)
sessionMappingDetail_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 time the session mapping was last modified.
sessionMappingDetail_lastModifiedTime :: Lens.Lens' SessionMappingDetail (Prelude.Maybe Prelude.UTCTime)
sessionMappingDetail_lastModifiedTime :: Lens' SessionMappingDetail (Maybe UTCTime)
sessionMappingDetail_lastModifiedTime = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | 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 :: Lens' SessionMappingDetail (Maybe Text)
sessionMappingDetail_sessionPolicyArn = 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 ID of the Amazon EMR Studio.
sessionMappingDetail_studioId :: Lens.Lens' SessionMappingDetail (Prelude.Maybe Prelude.Text)
sessionMappingDetail_studioId :: Lens' SessionMappingDetail (Maybe Text)
sessionMappingDetail_studioId = 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)

instance Data.FromJSON SessionMappingDetail where
  parseJSON :: Value -> Parser SessionMappingDetail
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SessionMappingDetail"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe IdentityType
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> SessionMappingDetail
SessionMappingDetail'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"CreationTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"IdentityId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"IdentityName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"IdentityType")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"LastModifiedTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SessionPolicyArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"StudioId")
      )

instance Prelude.Hashable SessionMappingDetail where
  hashWithSalt :: Int -> SessionMappingDetail -> Int
hashWithSalt Int
_salt SessionMappingDetail' {Maybe Text
Maybe POSIX
Maybe IdentityType
studioId :: Maybe Text
sessionPolicyArn :: Maybe Text
lastModifiedTime :: Maybe POSIX
identityType :: Maybe IdentityType
identityName :: Maybe Text
identityId :: Maybe Text
creationTime :: Maybe POSIX
$sel:studioId:SessionMappingDetail' :: SessionMappingDetail -> Maybe Text
$sel:sessionPolicyArn:SessionMappingDetail' :: SessionMappingDetail -> Maybe Text
$sel:lastModifiedTime:SessionMappingDetail' :: SessionMappingDetail -> Maybe POSIX
$sel:identityType:SessionMappingDetail' :: SessionMappingDetail -> Maybe IdentityType
$sel:identityName:SessionMappingDetail' :: SessionMappingDetail -> Maybe Text
$sel:identityId:SessionMappingDetail' :: SessionMappingDetail -> Maybe Text
$sel:creationTime:SessionMappingDetail' :: SessionMappingDetail -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
identityId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
identityName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe IdentityType
identityType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastModifiedTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sessionPolicyArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
studioId

instance Prelude.NFData SessionMappingDetail where
  rnf :: SessionMappingDetail -> ()
rnf SessionMappingDetail' {Maybe Text
Maybe POSIX
Maybe IdentityType
studioId :: Maybe Text
sessionPolicyArn :: Maybe Text
lastModifiedTime :: Maybe POSIX
identityType :: Maybe IdentityType
identityName :: Maybe Text
identityId :: Maybe Text
creationTime :: Maybe POSIX
$sel:studioId:SessionMappingDetail' :: SessionMappingDetail -> Maybe Text
$sel:sessionPolicyArn:SessionMappingDetail' :: SessionMappingDetail -> Maybe Text
$sel:lastModifiedTime:SessionMappingDetail' :: SessionMappingDetail -> Maybe POSIX
$sel:identityType:SessionMappingDetail' :: SessionMappingDetail -> Maybe IdentityType
$sel:identityName:SessionMappingDetail' :: SessionMappingDetail -> Maybe Text
$sel:identityId:SessionMappingDetail' :: SessionMappingDetail -> Maybe Text
$sel:creationTime:SessionMappingDetail' :: SessionMappingDetail -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
identityId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
identityName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe IdentityType
identityType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastModifiedTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sessionPolicyArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
studioId