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

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

-- | Information about the user who created or modified an experiment, trial,
-- trial component, or project.
--
-- /See:/ 'newUserContext' smart constructor.
data UserContext = UserContext'
  { -- | The name of the user\'s profile.
    UserContext -> Maybe Text
userProfileName :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the user\'s profile.
    UserContext -> Maybe Text
userProfileArn :: Prelude.Maybe Prelude.Text,
    -- | The domain associated with the user.
    UserContext -> Maybe Text
domainId :: Prelude.Maybe Prelude.Text
  }
  deriving (UserContext -> UserContext -> Bool
(UserContext -> UserContext -> Bool)
-> (UserContext -> UserContext -> Bool) -> Eq UserContext
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]
(Int -> ReadS UserContext)
-> ReadS [UserContext]
-> ReadPrec UserContext
-> ReadPrec [UserContext]
-> Read 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
(Int -> UserContext -> ShowS)
-> (UserContext -> String)
-> ([UserContext] -> ShowS)
-> Show UserContext
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. UserContext -> Rep UserContext x)
-> (forall x. Rep UserContext x -> UserContext)
-> Generic UserContext
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:
--
-- 'userProfileName', 'userContext_userProfileName' - The name of the user\'s profile.
--
-- 'userProfileArn', 'userContext_userProfileArn' - The Amazon Resource Name (ARN) of the user\'s profile.
--
-- 'domainId', 'userContext_domainId' - The domain associated with the user.
newUserContext ::
  UserContext
newUserContext :: UserContext
newUserContext =
  UserContext' :: Maybe Text -> Maybe Text -> Maybe Text -> UserContext
UserContext'
    { $sel:userProfileName:UserContext' :: Maybe Text
userProfileName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:userProfileArn:UserContext' :: Maybe Text
userProfileArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:domainId:UserContext' :: Maybe Text
domainId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the user\'s profile.
userContext_userProfileName :: Lens.Lens' UserContext (Prelude.Maybe Prelude.Text)
userContext_userProfileName :: (Maybe Text -> f (Maybe Text)) -> UserContext -> f UserContext
userContext_userProfileName = (UserContext -> Maybe Text)
-> (UserContext -> Maybe Text -> UserContext)
-> Lens UserContext UserContext (Maybe Text) (Maybe Text)
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)

-- | The Amazon Resource Name (ARN) of the user\'s profile.
userContext_userProfileArn :: Lens.Lens' UserContext (Prelude.Maybe Prelude.Text)
userContext_userProfileArn :: (Maybe Text -> f (Maybe Text)) -> UserContext -> f UserContext
userContext_userProfileArn = (UserContext -> Maybe Text)
-> (UserContext -> Maybe Text -> UserContext)
-> Lens UserContext UserContext (Maybe Text) (Maybe Text)
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 domain associated with the user.
userContext_domainId :: Lens.Lens' UserContext (Prelude.Maybe Prelude.Text)
userContext_domainId :: (Maybe Text -> f (Maybe Text)) -> UserContext -> f UserContext
userContext_domainId = (UserContext -> Maybe Text)
-> (UserContext -> Maybe Text -> UserContext)
-> Lens UserContext UserContext (Maybe Text) (Maybe Text)
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)

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

instance Prelude.Hashable UserContext

instance Prelude.NFData UserContext