{-# 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.MacieV2.DisassociateMember
-- 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)
--
-- Disassociates an Amazon Macie administrator account from a member
-- account.
module Amazonka.MacieV2.DisassociateMember
  ( -- * Creating a Request
    DisassociateMember (..),
    newDisassociateMember,

    -- * Request Lenses
    disassociateMember_id,

    -- * Destructuring the Response
    DisassociateMemberResponse (..),
    newDisassociateMemberResponse,

    -- * Response Lenses
    disassociateMemberResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDisassociateMember' smart constructor.
data DisassociateMember = DisassociateMember'
  { -- | The unique identifier for the Amazon Macie resource or account that the
    -- request applies to.
    DisassociateMember -> Text
id :: Prelude.Text
  }
  deriving (DisassociateMember -> DisassociateMember -> Bool
(DisassociateMember -> DisassociateMember -> Bool)
-> (DisassociateMember -> DisassociateMember -> Bool)
-> Eq DisassociateMember
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisassociateMember -> DisassociateMember -> Bool
$c/= :: DisassociateMember -> DisassociateMember -> Bool
== :: DisassociateMember -> DisassociateMember -> Bool
$c== :: DisassociateMember -> DisassociateMember -> Bool
Prelude.Eq, ReadPrec [DisassociateMember]
ReadPrec DisassociateMember
Int -> ReadS DisassociateMember
ReadS [DisassociateMember]
(Int -> ReadS DisassociateMember)
-> ReadS [DisassociateMember]
-> ReadPrec DisassociateMember
-> ReadPrec [DisassociateMember]
-> Read DisassociateMember
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisassociateMember]
$creadListPrec :: ReadPrec [DisassociateMember]
readPrec :: ReadPrec DisassociateMember
$creadPrec :: ReadPrec DisassociateMember
readList :: ReadS [DisassociateMember]
$creadList :: ReadS [DisassociateMember]
readsPrec :: Int -> ReadS DisassociateMember
$creadsPrec :: Int -> ReadS DisassociateMember
Prelude.Read, Int -> DisassociateMember -> ShowS
[DisassociateMember] -> ShowS
DisassociateMember -> String
(Int -> DisassociateMember -> ShowS)
-> (DisassociateMember -> String)
-> ([DisassociateMember] -> ShowS)
-> Show DisassociateMember
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisassociateMember] -> ShowS
$cshowList :: [DisassociateMember] -> ShowS
show :: DisassociateMember -> String
$cshow :: DisassociateMember -> String
showsPrec :: Int -> DisassociateMember -> ShowS
$cshowsPrec :: Int -> DisassociateMember -> ShowS
Prelude.Show, (forall x. DisassociateMember -> Rep DisassociateMember x)
-> (forall x. Rep DisassociateMember x -> DisassociateMember)
-> Generic DisassociateMember
forall x. Rep DisassociateMember x -> DisassociateMember
forall x. DisassociateMember -> Rep DisassociateMember x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DisassociateMember x -> DisassociateMember
$cfrom :: forall x. DisassociateMember -> Rep DisassociateMember x
Prelude.Generic)

-- |
-- Create a value of 'DisassociateMember' 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:
--
-- 'id', 'disassociateMember_id' - The unique identifier for the Amazon Macie resource or account that the
-- request applies to.
newDisassociateMember ::
  -- | 'id'
  Prelude.Text ->
  DisassociateMember
newDisassociateMember :: Text -> DisassociateMember
newDisassociateMember Text
pId_ =
  DisassociateMember' :: Text -> DisassociateMember
DisassociateMember' {$sel:id:DisassociateMember' :: Text
id = Text
pId_}

-- | The unique identifier for the Amazon Macie resource or account that the
-- request applies to.
disassociateMember_id :: Lens.Lens' DisassociateMember Prelude.Text
disassociateMember_id :: (Text -> f Text) -> DisassociateMember -> f DisassociateMember
disassociateMember_id = (DisassociateMember -> Text)
-> (DisassociateMember -> Text -> DisassociateMember)
-> Lens DisassociateMember DisassociateMember Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateMember' {Text
id :: Text
$sel:id:DisassociateMember' :: DisassociateMember -> Text
id} -> Text
id) (\s :: DisassociateMember
s@DisassociateMember' {} Text
a -> DisassociateMember
s {$sel:id:DisassociateMember' :: Text
id = Text
a} :: DisassociateMember)

instance Core.AWSRequest DisassociateMember where
  type
    AWSResponse DisassociateMember =
      DisassociateMemberResponse
  request :: DisassociateMember -> Request DisassociateMember
request = Service -> DisassociateMember -> Request DisassociateMember
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DisassociateMember
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DisassociateMember)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DisassociateMember))
-> Logger
-> Service
-> Proxy DisassociateMember
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DisassociateMember)))
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 -> DisassociateMemberResponse
DisassociateMemberResponse'
            (Int -> DisassociateMemberResponse)
-> Either String Int -> Either String DisassociateMemberResponse
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 DisassociateMember

instance Prelude.NFData DisassociateMember

instance Core.ToHeaders DisassociateMember where
  toHeaders :: DisassociateMember -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DisassociateMember -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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 DisassociateMember where
  toJSON :: DisassociateMember -> Value
toJSON = Value -> DisassociateMember -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)

instance Core.ToPath DisassociateMember where
  toPath :: DisassociateMember -> ByteString
toPath DisassociateMember' {Text
id :: Text
$sel:id:DisassociateMember' :: DisassociateMember -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/members/disassociate/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
id]

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

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

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

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

instance Prelude.NFData DisassociateMemberResponse