{-# 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.CodeStar.Types.TeamMember
-- 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.CodeStar.Types.TeamMember where

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

-- | Information about a team member in a project.
--
-- /See:/ 'newTeamMember' smart constructor.
data TeamMember = TeamMember'
  { -- | Whether the user is allowed to remotely access project resources using
    -- an SSH public\/private key pair.
    TeamMember -> Maybe Bool
remoteAccessAllowed :: Prelude.Maybe Prelude.Bool,
    -- | The Amazon Resource Name (ARN) of the user in IAM.
    TeamMember -> Text
userArn :: Prelude.Text,
    -- | The role assigned to the user in the project. Project roles have
    -- different levels of access. For more information, see
    -- <http://docs.aws.amazon.com/codestar/latest/userguide/working-with-teams.html Working with Teams>
    -- in the /AWS CodeStar User Guide/.
    TeamMember -> Text
projectRole :: Prelude.Text
  }
  deriving (TeamMember -> TeamMember -> Bool
(TeamMember -> TeamMember -> Bool)
-> (TeamMember -> TeamMember -> Bool) -> Eq TeamMember
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TeamMember -> TeamMember -> Bool
$c/= :: TeamMember -> TeamMember -> Bool
== :: TeamMember -> TeamMember -> Bool
$c== :: TeamMember -> TeamMember -> Bool
Prelude.Eq, ReadPrec [TeamMember]
ReadPrec TeamMember
Int -> ReadS TeamMember
ReadS [TeamMember]
(Int -> ReadS TeamMember)
-> ReadS [TeamMember]
-> ReadPrec TeamMember
-> ReadPrec [TeamMember]
-> Read TeamMember
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TeamMember]
$creadListPrec :: ReadPrec [TeamMember]
readPrec :: ReadPrec TeamMember
$creadPrec :: ReadPrec TeamMember
readList :: ReadS [TeamMember]
$creadList :: ReadS [TeamMember]
readsPrec :: Int -> ReadS TeamMember
$creadsPrec :: Int -> ReadS TeamMember
Prelude.Read, Int -> TeamMember -> ShowS
[TeamMember] -> ShowS
TeamMember -> String
(Int -> TeamMember -> ShowS)
-> (TeamMember -> String)
-> ([TeamMember] -> ShowS)
-> Show TeamMember
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TeamMember] -> ShowS
$cshowList :: [TeamMember] -> ShowS
show :: TeamMember -> String
$cshow :: TeamMember -> String
showsPrec :: Int -> TeamMember -> ShowS
$cshowsPrec :: Int -> TeamMember -> ShowS
Prelude.Show, (forall x. TeamMember -> Rep TeamMember x)
-> (forall x. Rep TeamMember x -> TeamMember) -> Generic TeamMember
forall x. Rep TeamMember x -> TeamMember
forall x. TeamMember -> Rep TeamMember x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TeamMember x -> TeamMember
$cfrom :: forall x. TeamMember -> Rep TeamMember x
Prelude.Generic)

-- |
-- Create a value of 'TeamMember' 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:
--
-- 'remoteAccessAllowed', 'teamMember_remoteAccessAllowed' - Whether the user is allowed to remotely access project resources using
-- an SSH public\/private key pair.
--
-- 'userArn', 'teamMember_userArn' - The Amazon Resource Name (ARN) of the user in IAM.
--
-- 'projectRole', 'teamMember_projectRole' - The role assigned to the user in the project. Project roles have
-- different levels of access. For more information, see
-- <http://docs.aws.amazon.com/codestar/latest/userguide/working-with-teams.html Working with Teams>
-- in the /AWS CodeStar User Guide/.
newTeamMember ::
  -- | 'userArn'
  Prelude.Text ->
  -- | 'projectRole'
  Prelude.Text ->
  TeamMember
newTeamMember :: Text -> Text -> TeamMember
newTeamMember Text
pUserArn_ Text
pProjectRole_ =
  TeamMember' :: Maybe Bool -> Text -> Text -> TeamMember
TeamMember'
    { $sel:remoteAccessAllowed:TeamMember' :: Maybe Bool
remoteAccessAllowed = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:userArn:TeamMember' :: Text
userArn = Text
pUserArn_,
      $sel:projectRole:TeamMember' :: Text
projectRole = Text
pProjectRole_
    }

-- | Whether the user is allowed to remotely access project resources using
-- an SSH public\/private key pair.
teamMember_remoteAccessAllowed :: Lens.Lens' TeamMember (Prelude.Maybe Prelude.Bool)
teamMember_remoteAccessAllowed :: (Maybe Bool -> f (Maybe Bool)) -> TeamMember -> f TeamMember
teamMember_remoteAccessAllowed = (TeamMember -> Maybe Bool)
-> (TeamMember -> Maybe Bool -> TeamMember)
-> Lens TeamMember TeamMember (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TeamMember' {Maybe Bool
remoteAccessAllowed :: Maybe Bool
$sel:remoteAccessAllowed:TeamMember' :: TeamMember -> Maybe Bool
remoteAccessAllowed} -> Maybe Bool
remoteAccessAllowed) (\s :: TeamMember
s@TeamMember' {} Maybe Bool
a -> TeamMember
s {$sel:remoteAccessAllowed:TeamMember' :: Maybe Bool
remoteAccessAllowed = Maybe Bool
a} :: TeamMember)

-- | The Amazon Resource Name (ARN) of the user in IAM.
teamMember_userArn :: Lens.Lens' TeamMember Prelude.Text
teamMember_userArn :: (Text -> f Text) -> TeamMember -> f TeamMember
teamMember_userArn = (TeamMember -> Text)
-> (TeamMember -> Text -> TeamMember)
-> Lens TeamMember TeamMember Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TeamMember' {Text
userArn :: Text
$sel:userArn:TeamMember' :: TeamMember -> Text
userArn} -> Text
userArn) (\s :: TeamMember
s@TeamMember' {} Text
a -> TeamMember
s {$sel:userArn:TeamMember' :: Text
userArn = Text
a} :: TeamMember)

-- | The role assigned to the user in the project. Project roles have
-- different levels of access. For more information, see
-- <http://docs.aws.amazon.com/codestar/latest/userguide/working-with-teams.html Working with Teams>
-- in the /AWS CodeStar User Guide/.
teamMember_projectRole :: Lens.Lens' TeamMember Prelude.Text
teamMember_projectRole :: (Text -> f Text) -> TeamMember -> f TeamMember
teamMember_projectRole = (TeamMember -> Text)
-> (TeamMember -> Text -> TeamMember)
-> Lens TeamMember TeamMember Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TeamMember' {Text
projectRole :: Text
$sel:projectRole:TeamMember' :: TeamMember -> Text
projectRole} -> Text
projectRole) (\s :: TeamMember
s@TeamMember' {} Text
a -> TeamMember
s {$sel:projectRole:TeamMember' :: Text
projectRole = Text
a} :: TeamMember)

instance Core.FromJSON TeamMember where
  parseJSON :: Value -> Parser TeamMember
parseJSON =
    String
-> (Object -> Parser TeamMember) -> Value -> Parser TeamMember
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TeamMember"
      ( \Object
x ->
          Maybe Bool -> Text -> Text -> TeamMember
TeamMember'
            (Maybe Bool -> Text -> Text -> TeamMember)
-> Parser (Maybe Bool) -> Parser (Text -> Text -> TeamMember)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"remoteAccessAllowed")
            Parser (Text -> Text -> TeamMember)
-> Parser Text -> Parser (Text -> TeamMember)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"userArn")
            Parser (Text -> TeamMember) -> Parser Text -> Parser TeamMember
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"projectRole")
      )

instance Prelude.Hashable TeamMember

instance Prelude.NFData TeamMember