{-# 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.SageMaker.Types.UserContext
-- 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.SageMaker.Types.UserContext where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Information about the user who created or modified an experiment, trial,
-- trial component, lineage group, project, or model card.
--
-- /See:/ 'newUserContext' smart constructor.
data UserContext = UserContext'
  { -- | The domain associated with the user.
    UserContext -> Maybe Text
domainId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the user\'s profile.
    UserContext -> Maybe Text
userProfileArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the user\'s profile.
    UserContext -> Maybe Text
userProfileName :: Prelude.Maybe Prelude.Text
  }
  deriving (UserContext -> UserContext -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UserContext -> UserContext -> Bool
$c/= :: UserContext -> UserContext -> Bool
== :: UserContext -> UserContext -> Bool
$c== :: UserContext -> UserContext -> Bool
Prelude.Eq, ReadPrec [UserContext]
ReadPrec UserContext
Int -> ReadS UserContext
ReadS [UserContext]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UserContext]
$creadListPrec :: ReadPrec [UserContext]
readPrec :: ReadPrec UserContext
$creadPrec :: ReadPrec UserContext
readList :: ReadS [UserContext]
$creadList :: ReadS [UserContext]
readsPrec :: Int -> ReadS UserContext
$creadsPrec :: Int -> ReadS UserContext
Prelude.Read, Int -> UserContext -> ShowS
[UserContext] -> ShowS
UserContext -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UserContext] -> ShowS
$cshowList :: [UserContext] -> ShowS
show :: UserContext -> String
$cshow :: UserContext -> String
showsPrec :: Int -> UserContext -> ShowS
$cshowsPrec :: Int -> UserContext -> ShowS
Prelude.Show, forall x. Rep UserContext x -> UserContext
forall x. UserContext -> Rep UserContext x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UserContext x -> UserContext
$cfrom :: forall x. UserContext -> Rep UserContext x
Prelude.Generic)

-- |
-- Create a value of 'UserContext' 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:
--
-- 'domainId', 'userContext_domainId' - The domain associated with the user.
--
-- 'userProfileArn', 'userContext_userProfileArn' - The Amazon Resource Name (ARN) of the user\'s profile.
--
-- 'userProfileName', 'userContext_userProfileName' - The name of the user\'s profile.
newUserContext ::
  UserContext
newUserContext :: UserContext
newUserContext =
  UserContext'
    { $sel:domainId:UserContext' :: Maybe Text
domainId = forall a. Maybe a
Prelude.Nothing,
      $sel:userProfileArn:UserContext' :: Maybe Text
userProfileArn = forall a. Maybe a
Prelude.Nothing,
      $sel:userProfileName:UserContext' :: Maybe Text
userProfileName = forall a. Maybe a
Prelude.Nothing
    }

-- | The domain associated with the user.
userContext_domainId :: Lens.Lens' UserContext (Prelude.Maybe Prelude.Text)
userContext_domainId :: Lens' UserContext (Maybe Text)
userContext_domainId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserContext' {Maybe Text
domainId :: Maybe Text
$sel:domainId:UserContext' :: UserContext -> Maybe Text
domainId} -> Maybe Text
domainId) (\s :: UserContext
s@UserContext' {} Maybe Text
a -> UserContext
s {$sel:domainId:UserContext' :: Maybe Text
domainId = Maybe Text
a} :: UserContext)

-- | The Amazon Resource Name (ARN) of the user\'s profile.
userContext_userProfileArn :: Lens.Lens' UserContext (Prelude.Maybe Prelude.Text)
userContext_userProfileArn :: Lens' UserContext (Maybe Text)
userContext_userProfileArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserContext' {Maybe Text
userProfileArn :: Maybe Text
$sel:userProfileArn:UserContext' :: UserContext -> Maybe Text
userProfileArn} -> Maybe Text
userProfileArn) (\s :: UserContext
s@UserContext' {} Maybe Text
a -> UserContext
s {$sel:userProfileArn:UserContext' :: Maybe Text
userProfileArn = Maybe Text
a} :: UserContext)

-- | The name of the user\'s profile.
userContext_userProfileName :: Lens.Lens' UserContext (Prelude.Maybe Prelude.Text)
userContext_userProfileName :: Lens' UserContext (Maybe Text)
userContext_userProfileName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserContext' {Maybe Text
userProfileName :: Maybe Text
$sel:userProfileName:UserContext' :: UserContext -> Maybe Text
userProfileName} -> Maybe Text
userProfileName) (\s :: UserContext
s@UserContext' {} Maybe Text
a -> UserContext
s {$sel:userProfileName:UserContext' :: Maybe Text
userProfileName = Maybe Text
a} :: UserContext)

instance Data.FromJSON UserContext where
  parseJSON :: Value -> Parser UserContext
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"UserContext"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> UserContext
UserContext'
            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
"DomainId")
            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
"UserProfileArn")
            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
"UserProfileName")
      )

instance Prelude.Hashable UserContext where
  hashWithSalt :: Int -> UserContext -> Int
hashWithSalt Int
_salt UserContext' {Maybe Text
userProfileName :: Maybe Text
userProfileArn :: Maybe Text
domainId :: Maybe Text
$sel:userProfileName:UserContext' :: UserContext -> Maybe Text
$sel:userProfileArn:UserContext' :: UserContext -> Maybe Text
$sel:domainId:UserContext' :: UserContext -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
domainId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
userProfileArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
userProfileName

instance Prelude.NFData UserContext where
  rnf :: UserContext -> ()
rnf UserContext' {Maybe Text
userProfileName :: Maybe Text
userProfileArn :: Maybe Text
domainId :: Maybe Text
$sel:userProfileName:UserContext' :: UserContext -> Maybe Text
$sel:userProfileArn:UserContext' :: UserContext -> Maybe Text
$sel:domainId:UserContext' :: UserContext -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
domainId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
userProfileArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
userProfileName