{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.DisassociateTeamMember
-- 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)
--
-- Removes a user from a project. Removing a user from a project also
-- removes the IAM policies from that user that allowed access to the
-- project and its resources. Disassociating a team member does not remove
-- that user\'s profile from AWS CodeStar. It does not remove the user from
-- IAM.
module Amazonka.CodeStar.DisassociateTeamMember
  ( -- * Creating a Request
    DisassociateTeamMember (..),
    newDisassociateTeamMember,

    -- * Request Lenses
    disassociateTeamMember_projectId,
    disassociateTeamMember_userArn,

    -- * Destructuring the Response
    DisassociateTeamMemberResponse (..),
    newDisassociateTeamMemberResponse,

    -- * Response Lenses
    disassociateTeamMemberResponse_httpStatus,
  )
where

import Amazonka.CodeStar.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDisassociateTeamMember' smart constructor.
data DisassociateTeamMember = DisassociateTeamMember'
  { -- | The ID of the AWS CodeStar project from which you want to remove a team
    -- member.
    DisassociateTeamMember -> Text
projectId :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the IAM user or group whom you want to
    -- remove from the project.
    DisassociateTeamMember -> Text
userArn :: Prelude.Text
  }
  deriving (DisassociateTeamMember -> DisassociateTeamMember -> Bool
(DisassociateTeamMember -> DisassociateTeamMember -> Bool)
-> (DisassociateTeamMember -> DisassociateTeamMember -> Bool)
-> Eq DisassociateTeamMember
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisassociateTeamMember -> DisassociateTeamMember -> Bool
$c/= :: DisassociateTeamMember -> DisassociateTeamMember -> Bool
== :: DisassociateTeamMember -> DisassociateTeamMember -> Bool
$c== :: DisassociateTeamMember -> DisassociateTeamMember -> Bool
Prelude.Eq, ReadPrec [DisassociateTeamMember]
ReadPrec DisassociateTeamMember
Int -> ReadS DisassociateTeamMember
ReadS [DisassociateTeamMember]
(Int -> ReadS DisassociateTeamMember)
-> ReadS [DisassociateTeamMember]
-> ReadPrec DisassociateTeamMember
-> ReadPrec [DisassociateTeamMember]
-> Read DisassociateTeamMember
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisassociateTeamMember]
$creadListPrec :: ReadPrec [DisassociateTeamMember]
readPrec :: ReadPrec DisassociateTeamMember
$creadPrec :: ReadPrec DisassociateTeamMember
readList :: ReadS [DisassociateTeamMember]
$creadList :: ReadS [DisassociateTeamMember]
readsPrec :: Int -> ReadS DisassociateTeamMember
$creadsPrec :: Int -> ReadS DisassociateTeamMember
Prelude.Read, Int -> DisassociateTeamMember -> ShowS
[DisassociateTeamMember] -> ShowS
DisassociateTeamMember -> String
(Int -> DisassociateTeamMember -> ShowS)
-> (DisassociateTeamMember -> String)
-> ([DisassociateTeamMember] -> ShowS)
-> Show DisassociateTeamMember
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisassociateTeamMember] -> ShowS
$cshowList :: [DisassociateTeamMember] -> ShowS
show :: DisassociateTeamMember -> String
$cshow :: DisassociateTeamMember -> String
showsPrec :: Int -> DisassociateTeamMember -> ShowS
$cshowsPrec :: Int -> DisassociateTeamMember -> ShowS
Prelude.Show, (forall x. DisassociateTeamMember -> Rep DisassociateTeamMember x)
-> (forall x.
    Rep DisassociateTeamMember x -> DisassociateTeamMember)
-> Generic DisassociateTeamMember
forall x. Rep DisassociateTeamMember x -> DisassociateTeamMember
forall x. DisassociateTeamMember -> Rep DisassociateTeamMember x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DisassociateTeamMember x -> DisassociateTeamMember
$cfrom :: forall x. DisassociateTeamMember -> Rep DisassociateTeamMember x
Prelude.Generic)

-- |
-- Create a value of 'DisassociateTeamMember' 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:
--
-- 'projectId', 'disassociateTeamMember_projectId' - The ID of the AWS CodeStar project from which you want to remove a team
-- member.
--
-- 'userArn', 'disassociateTeamMember_userArn' - The Amazon Resource Name (ARN) of the IAM user or group whom you want to
-- remove from the project.
newDisassociateTeamMember ::
  -- | 'projectId'
  Prelude.Text ->
  -- | 'userArn'
  Prelude.Text ->
  DisassociateTeamMember
newDisassociateTeamMember :: Text -> Text -> DisassociateTeamMember
newDisassociateTeamMember Text
pProjectId_ Text
pUserArn_ =
  DisassociateTeamMember' :: Text -> Text -> DisassociateTeamMember
DisassociateTeamMember'
    { $sel:projectId:DisassociateTeamMember' :: Text
projectId = Text
pProjectId_,
      $sel:userArn:DisassociateTeamMember' :: Text
userArn = Text
pUserArn_
    }

-- | The ID of the AWS CodeStar project from which you want to remove a team
-- member.
disassociateTeamMember_projectId :: Lens.Lens' DisassociateTeamMember Prelude.Text
disassociateTeamMember_projectId :: (Text -> f Text)
-> DisassociateTeamMember -> f DisassociateTeamMember
disassociateTeamMember_projectId = (DisassociateTeamMember -> Text)
-> (DisassociateTeamMember -> Text -> DisassociateTeamMember)
-> Lens DisassociateTeamMember DisassociateTeamMember Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateTeamMember' {Text
projectId :: Text
$sel:projectId:DisassociateTeamMember' :: DisassociateTeamMember -> Text
projectId} -> Text
projectId) (\s :: DisassociateTeamMember
s@DisassociateTeamMember' {} Text
a -> DisassociateTeamMember
s {$sel:projectId:DisassociateTeamMember' :: Text
projectId = Text
a} :: DisassociateTeamMember)

-- | The Amazon Resource Name (ARN) of the IAM user or group whom you want to
-- remove from the project.
disassociateTeamMember_userArn :: Lens.Lens' DisassociateTeamMember Prelude.Text
disassociateTeamMember_userArn :: (Text -> f Text)
-> DisassociateTeamMember -> f DisassociateTeamMember
disassociateTeamMember_userArn = (DisassociateTeamMember -> Text)
-> (DisassociateTeamMember -> Text -> DisassociateTeamMember)
-> Lens DisassociateTeamMember DisassociateTeamMember Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateTeamMember' {Text
userArn :: Text
$sel:userArn:DisassociateTeamMember' :: DisassociateTeamMember -> Text
userArn} -> Text
userArn) (\s :: DisassociateTeamMember
s@DisassociateTeamMember' {} Text
a -> DisassociateTeamMember
s {$sel:userArn:DisassociateTeamMember' :: Text
userArn = Text
a} :: DisassociateTeamMember)

instance Core.AWSRequest DisassociateTeamMember where
  type
    AWSResponse DisassociateTeamMember =
      DisassociateTeamMemberResponse
  request :: DisassociateTeamMember -> Request DisassociateTeamMember
request = Service -> DisassociateTeamMember -> Request DisassociateTeamMember
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DisassociateTeamMember
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DisassociateTeamMember)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DisassociateTeamMember))
-> Logger
-> Service
-> Proxy DisassociateTeamMember
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DisassociateTeamMember)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DisassociateTeamMemberResponse
DisassociateTeamMemberResponse'
            (Int -> DisassociateTeamMemberResponse)
-> Either String Int
-> Either String DisassociateTeamMemberResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DisassociateTeamMember

instance Prelude.NFData DisassociateTeamMember

instance Core.ToHeaders DisassociateTeamMember where
  toHeaders :: DisassociateTeamMember -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DisassociateTeamMember -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"CodeStar_20170419.DisassociateTeamMember" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON DisassociateTeamMember where
  toJSON :: DisassociateTeamMember -> Value
toJSON DisassociateTeamMember' {Text
userArn :: Text
projectId :: Text
$sel:userArn:DisassociateTeamMember' :: DisassociateTeamMember -> Text
$sel:projectId:DisassociateTeamMember' :: DisassociateTeamMember -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"projectId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
projectId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"userArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
userArn)
          ]
      )

instance Core.ToPath DisassociateTeamMember where
  toPath :: DisassociateTeamMember -> ByteString
toPath = ByteString -> DisassociateTeamMember -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery DisassociateTeamMember where
  toQuery :: DisassociateTeamMember -> QueryString
toQuery = QueryString -> DisassociateTeamMember -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newDisassociateTeamMemberResponse' smart constructor.
data DisassociateTeamMemberResponse = DisassociateTeamMemberResponse'
  { -- | The response's http status code.
    DisassociateTeamMemberResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DisassociateTeamMemberResponse
-> DisassociateTeamMemberResponse -> Bool
(DisassociateTeamMemberResponse
 -> DisassociateTeamMemberResponse -> Bool)
-> (DisassociateTeamMemberResponse
    -> DisassociateTeamMemberResponse -> Bool)
-> Eq DisassociateTeamMemberResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisassociateTeamMemberResponse
-> DisassociateTeamMemberResponse -> Bool
$c/= :: DisassociateTeamMemberResponse
-> DisassociateTeamMemberResponse -> Bool
== :: DisassociateTeamMemberResponse
-> DisassociateTeamMemberResponse -> Bool
$c== :: DisassociateTeamMemberResponse
-> DisassociateTeamMemberResponse -> Bool
Prelude.Eq, ReadPrec [DisassociateTeamMemberResponse]
ReadPrec DisassociateTeamMemberResponse
Int -> ReadS DisassociateTeamMemberResponse
ReadS [DisassociateTeamMemberResponse]
(Int -> ReadS DisassociateTeamMemberResponse)
-> ReadS [DisassociateTeamMemberResponse]
-> ReadPrec DisassociateTeamMemberResponse
-> ReadPrec [DisassociateTeamMemberResponse]
-> Read DisassociateTeamMemberResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisassociateTeamMemberResponse]
$creadListPrec :: ReadPrec [DisassociateTeamMemberResponse]
readPrec :: ReadPrec DisassociateTeamMemberResponse
$creadPrec :: ReadPrec DisassociateTeamMemberResponse
readList :: ReadS [DisassociateTeamMemberResponse]
$creadList :: ReadS [DisassociateTeamMemberResponse]
readsPrec :: Int -> ReadS DisassociateTeamMemberResponse
$creadsPrec :: Int -> ReadS DisassociateTeamMemberResponse
Prelude.Read, Int -> DisassociateTeamMemberResponse -> ShowS
[DisassociateTeamMemberResponse] -> ShowS
DisassociateTeamMemberResponse -> String
(Int -> DisassociateTeamMemberResponse -> ShowS)
-> (DisassociateTeamMemberResponse -> String)
-> ([DisassociateTeamMemberResponse] -> ShowS)
-> Show DisassociateTeamMemberResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisassociateTeamMemberResponse] -> ShowS
$cshowList :: [DisassociateTeamMemberResponse] -> ShowS
show :: DisassociateTeamMemberResponse -> String
$cshow :: DisassociateTeamMemberResponse -> String
showsPrec :: Int -> DisassociateTeamMemberResponse -> ShowS
$cshowsPrec :: Int -> DisassociateTeamMemberResponse -> ShowS
Prelude.Show, (forall x.
 DisassociateTeamMemberResponse
 -> Rep DisassociateTeamMemberResponse x)
-> (forall x.
    Rep DisassociateTeamMemberResponse x
    -> DisassociateTeamMemberResponse)
-> Generic DisassociateTeamMemberResponse
forall x.
Rep DisassociateTeamMemberResponse x
-> DisassociateTeamMemberResponse
forall x.
DisassociateTeamMemberResponse
-> Rep DisassociateTeamMemberResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DisassociateTeamMemberResponse x
-> DisassociateTeamMemberResponse
$cfrom :: forall x.
DisassociateTeamMemberResponse
-> Rep DisassociateTeamMemberResponse x
Prelude.Generic)

-- |
-- Create a value of 'DisassociateTeamMemberResponse' 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:
--
-- 'httpStatus', 'disassociateTeamMemberResponse_httpStatus' - The response's http status code.
newDisassociateTeamMemberResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DisassociateTeamMemberResponse
newDisassociateTeamMemberResponse :: Int -> DisassociateTeamMemberResponse
newDisassociateTeamMemberResponse Int
pHttpStatus_ =
  DisassociateTeamMemberResponse' :: Int -> DisassociateTeamMemberResponse
DisassociateTeamMemberResponse'
    { $sel:httpStatus:DisassociateTeamMemberResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
disassociateTeamMemberResponse_httpStatus :: Lens.Lens' DisassociateTeamMemberResponse Prelude.Int
disassociateTeamMemberResponse_httpStatus :: (Int -> f Int)
-> DisassociateTeamMemberResponse
-> f DisassociateTeamMemberResponse
disassociateTeamMemberResponse_httpStatus = (DisassociateTeamMemberResponse -> Int)
-> (DisassociateTeamMemberResponse
    -> Int -> DisassociateTeamMemberResponse)
-> Lens
     DisassociateTeamMemberResponse
     DisassociateTeamMemberResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateTeamMemberResponse' {Int
httpStatus :: Int
$sel:httpStatus:DisassociateTeamMemberResponse' :: DisassociateTeamMemberResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DisassociateTeamMemberResponse
s@DisassociateTeamMemberResponse' {} Int
a -> DisassociateTeamMemberResponse
s {$sel:httpStatus:DisassociateTeamMemberResponse' :: Int
httpStatus = Int
a} :: DisassociateTeamMemberResponse)

instance
  Prelude.NFData
    DisassociateTeamMemberResponse