{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 that the request
    -- applies to.
    DisassociateMember -> Text
id :: Prelude.Text
  }
  deriving (DisassociateMember -> DisassociateMember -> Bool
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]
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
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. 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 that the request
-- applies to.
newDisassociateMember ::
  -- | 'id'
  Prelude.Text ->
  DisassociateMember
newDisassociateMember :: Text -> DisassociateMember
newDisassociateMember Text
pId_ =
  DisassociateMember' {$sel:id:DisassociateMember' :: Text
id = Text
pId_}

-- | The unique identifier for the Amazon Macie resource that the request
-- applies to.
disassociateMember_id :: Lens.Lens' DisassociateMember Prelude.Text
disassociateMember_id :: Lens' DisassociateMember Text
disassociateMember_id = 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 :: (Service -> Service)
-> DisassociateMember -> Request DisassociateMember
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DisassociateMember
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DisassociateMember)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DisassociateMemberResponse
DisassociateMemberResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DisassociateMember where
  hashWithSalt :: Int -> DisassociateMember -> Int
hashWithSalt Int
_salt DisassociateMember' {Text
id :: Text
$sel:id:DisassociateMember' :: DisassociateMember -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id

instance Prelude.NFData DisassociateMember where
  rnf :: DisassociateMember -> ()
rnf DisassociateMember' {Text
id :: Text
$sel:id:DisassociateMember' :: DisassociateMember -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
id

instance Data.ToHeaders DisassociateMember where
  toHeaders :: DisassociateMember -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON DisassociateMember where
  toJSON :: DisassociateMember -> Value
toJSON = forall a b. a -> b -> a
Prelude.const (Object -> Value
Data.Object forall a. Monoid a => a
Prelude.mempty)

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

instance Data.ToQuery DisassociateMember where
  toQuery :: DisassociateMember -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
    { $sel:httpStatus:DisassociateMemberResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
disassociateMemberResponse_httpStatus :: Lens.Lens' DisassociateMemberResponse Prelude.Int
disassociateMemberResponse_httpStatus :: Lens' DisassociateMemberResponse Int
disassociateMemberResponse_httpStatus = 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 where
  rnf :: DisassociateMemberResponse -> ()
rnf DisassociateMemberResponse' {Int
httpStatus :: Int
$sel:httpStatus:DisassociateMemberResponse' :: DisassociateMemberResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus