{-# 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.SessionMappingSummary
-- 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.SessionMappingSummary 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. The details do not
-- include the time the session mapping was last modified.
--
-- /See:/ 'newSessionMappingSummary' smart constructor.
data SessionMappingSummary = SessionMappingSummary'
  { -- | The time the session mapping was created.
    SessionMappingSummary -> Maybe POSIX
creationTime :: Prelude.Maybe Core.POSIX,
    -- | The ID of the Amazon EMR Studio.
    SessionMappingSummary -> Maybe Text
studioId :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether the identity mapped to the Amazon EMR Studio is a user
    -- or a group.
    SessionMappingSummary -> Maybe IdentityType
identityType :: Prelude.Maybe IdentityType,
    -- | The globally unique identifier (GUID) of the user or group from the
    -- Amazon Web Services SSO Identity Store.
    SessionMappingSummary -> Maybe Text
identityId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the session policy associated with the
    -- user or group.
    SessionMappingSummary -> 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/.
    SessionMappingSummary -> Maybe Text
identityName :: Prelude.Maybe Prelude.Text
  }
  deriving (SessionMappingSummary -> SessionMappingSummary -> Bool
(SessionMappingSummary -> SessionMappingSummary -> Bool)
-> (SessionMappingSummary -> SessionMappingSummary -> Bool)
-> Eq SessionMappingSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SessionMappingSummary -> SessionMappingSummary -> Bool
$c/= :: SessionMappingSummary -> SessionMappingSummary -> Bool
== :: SessionMappingSummary -> SessionMappingSummary -> Bool
$c== :: SessionMappingSummary -> SessionMappingSummary -> Bool
Prelude.Eq, ReadPrec [SessionMappingSummary]
ReadPrec SessionMappingSummary
Int -> ReadS SessionMappingSummary
ReadS [SessionMappingSummary]
(Int -> ReadS SessionMappingSummary)
-> ReadS [SessionMappingSummary]
-> ReadPrec SessionMappingSummary
-> ReadPrec [SessionMappingSummary]
-> Read SessionMappingSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SessionMappingSummary]
$creadListPrec :: ReadPrec [SessionMappingSummary]
readPrec :: ReadPrec SessionMappingSummary
$creadPrec :: ReadPrec SessionMappingSummary
readList :: ReadS [SessionMappingSummary]
$creadList :: ReadS [SessionMappingSummary]
readsPrec :: Int -> ReadS SessionMappingSummary
$creadsPrec :: Int -> ReadS SessionMappingSummary
Prelude.Read, Int -> SessionMappingSummary -> ShowS
[SessionMappingSummary] -> ShowS
SessionMappingSummary -> String
(Int -> SessionMappingSummary -> ShowS)
-> (SessionMappingSummary -> String)
-> ([SessionMappingSummary] -> ShowS)
-> Show SessionMappingSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SessionMappingSummary] -> ShowS
$cshowList :: [SessionMappingSummary] -> ShowS
show :: SessionMappingSummary -> String
$cshow :: SessionMappingSummary -> String
showsPrec :: Int -> SessionMappingSummary -> ShowS
$cshowsPrec :: Int -> SessionMappingSummary -> ShowS
Prelude.Show, (forall x. SessionMappingSummary -> Rep SessionMappingSummary x)
-> (forall x. Rep SessionMappingSummary x -> SessionMappingSummary)
-> Generic SessionMappingSummary
forall x. Rep SessionMappingSummary x -> SessionMappingSummary
forall x. SessionMappingSummary -> Rep SessionMappingSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SessionMappingSummary x -> SessionMappingSummary
$cfrom :: forall x. SessionMappingSummary -> Rep SessionMappingSummary x
Prelude.Generic)

-- |
-- Create a value of 'SessionMappingSummary' 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', 'sessionMappingSummary_creationTime' - The time the session mapping was created.
--
-- 'studioId', 'sessionMappingSummary_studioId' - The ID of the Amazon EMR Studio.
--
-- 'identityType', 'sessionMappingSummary_identityType' - Specifies whether the identity mapped to the Amazon EMR Studio is a user
-- or a group.
--
-- 'identityId', 'sessionMappingSummary_identityId' - The globally unique identifier (GUID) of the user or group from the
-- Amazon Web Services SSO Identity Store.
--
-- 'sessionPolicyArn', 'sessionMappingSummary_sessionPolicyArn' - The Amazon Resource Name (ARN) of the session policy associated with the
-- user or group.
--
-- 'identityName', 'sessionMappingSummary_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/.
newSessionMappingSummary ::
  SessionMappingSummary
newSessionMappingSummary :: SessionMappingSummary
newSessionMappingSummary =
  SessionMappingSummary' :: Maybe POSIX
-> Maybe Text
-> Maybe IdentityType
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> SessionMappingSummary
SessionMappingSummary'
    { $sel:creationTime:SessionMappingSummary' :: Maybe POSIX
creationTime =
        Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:studioId:SessionMappingSummary' :: Maybe Text
studioId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:identityType:SessionMappingSummary' :: Maybe IdentityType
identityType = Maybe IdentityType
forall a. Maybe a
Prelude.Nothing,
      $sel:identityId:SessionMappingSummary' :: Maybe Text
identityId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sessionPolicyArn:SessionMappingSummary' :: Maybe Text
sessionPolicyArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:identityName:SessionMappingSummary' :: Maybe Text
identityName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

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

-- | The globally unique identifier (GUID) of the user or group from the
-- Amazon Web Services SSO Identity Store.
sessionMappingSummary_identityId :: Lens.Lens' SessionMappingSummary (Prelude.Maybe Prelude.Text)
sessionMappingSummary_identityId :: (Maybe Text -> f (Maybe Text))
-> SessionMappingSummary -> f SessionMappingSummary
sessionMappingSummary_identityId = (SessionMappingSummary -> Maybe Text)
-> (SessionMappingSummary -> Maybe Text -> SessionMappingSummary)
-> Lens
     SessionMappingSummary
     SessionMappingSummary
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SessionMappingSummary' {Maybe Text
identityId :: Maybe Text
$sel:identityId:SessionMappingSummary' :: SessionMappingSummary -> Maybe Text
identityId} -> Maybe Text
identityId) (\s :: SessionMappingSummary
s@SessionMappingSummary' {} Maybe Text
a -> SessionMappingSummary
s {$sel:identityId:SessionMappingSummary' :: Maybe Text
identityId = Maybe Text
a} :: SessionMappingSummary)

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

-- | 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/.
sessionMappingSummary_identityName :: Lens.Lens' SessionMappingSummary (Prelude.Maybe Prelude.Text)
sessionMappingSummary_identityName :: (Maybe Text -> f (Maybe Text))
-> SessionMappingSummary -> f SessionMappingSummary
sessionMappingSummary_identityName = (SessionMappingSummary -> Maybe Text)
-> (SessionMappingSummary -> Maybe Text -> SessionMappingSummary)
-> Lens
     SessionMappingSummary
     SessionMappingSummary
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SessionMappingSummary' {Maybe Text
identityName :: Maybe Text
$sel:identityName:SessionMappingSummary' :: SessionMappingSummary -> Maybe Text
identityName} -> Maybe Text
identityName) (\s :: SessionMappingSummary
s@SessionMappingSummary' {} Maybe Text
a -> SessionMappingSummary
s {$sel:identityName:SessionMappingSummary' :: Maybe Text
identityName = Maybe Text
a} :: SessionMappingSummary)

instance Core.FromJSON SessionMappingSummary where
  parseJSON :: Value -> Parser SessionMappingSummary
parseJSON =
    String
-> (Object -> Parser SessionMappingSummary)
-> Value
-> Parser SessionMappingSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SessionMappingSummary"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe IdentityType
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> SessionMappingSummary
SessionMappingSummary'
            (Maybe POSIX
 -> Maybe Text
 -> Maybe IdentityType
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> SessionMappingSummary)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe IdentityType
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> SessionMappingSummary)
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 IdentityType
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> SessionMappingSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe IdentityType
      -> Maybe Text -> Maybe Text -> Maybe Text -> SessionMappingSummary)
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 IdentityType
   -> Maybe Text -> Maybe Text -> Maybe Text -> SessionMappingSummary)
-> Parser (Maybe IdentityType)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> SessionMappingSummary)
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 -> SessionMappingSummary)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> SessionMappingSummary)
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 -> SessionMappingSummary)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> SessionMappingSummary)
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 -> SessionMappingSummary)
-> Parser (Maybe Text) -> Parser SessionMappingSummary
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 SessionMappingSummary

instance Prelude.NFData SessionMappingSummary