{-# 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.Macie.DisassociateMemberAccount
-- 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 the specified member account from Amazon Macie Classic.
module Amazonka.Macie.DisassociateMemberAccount
  ( -- * Creating a Request
    DisassociateMemberAccount (..),
    newDisassociateMemberAccount,

    -- * Request Lenses
    disassociateMemberAccount_memberAccountId,

    -- * Destructuring the Response
    DisassociateMemberAccountResponse (..),
    newDisassociateMemberAccountResponse,
  )
where

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

-- | /See:/ 'newDisassociateMemberAccount' smart constructor.
data DisassociateMemberAccount = DisassociateMemberAccount'
  { -- | The ID of the member account that you want to remove from Amazon Macie
    -- Classic.
    DisassociateMemberAccount -> Text
memberAccountId :: Prelude.Text
  }
  deriving (DisassociateMemberAccount -> DisassociateMemberAccount -> Bool
(DisassociateMemberAccount -> DisassociateMemberAccount -> Bool)
-> (DisassociateMemberAccount -> DisassociateMemberAccount -> Bool)
-> Eq DisassociateMemberAccount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisassociateMemberAccount -> DisassociateMemberAccount -> Bool
$c/= :: DisassociateMemberAccount -> DisassociateMemberAccount -> Bool
== :: DisassociateMemberAccount -> DisassociateMemberAccount -> Bool
$c== :: DisassociateMemberAccount -> DisassociateMemberAccount -> Bool
Prelude.Eq, ReadPrec [DisassociateMemberAccount]
ReadPrec DisassociateMemberAccount
Int -> ReadS DisassociateMemberAccount
ReadS [DisassociateMemberAccount]
(Int -> ReadS DisassociateMemberAccount)
-> ReadS [DisassociateMemberAccount]
-> ReadPrec DisassociateMemberAccount
-> ReadPrec [DisassociateMemberAccount]
-> Read DisassociateMemberAccount
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisassociateMemberAccount]
$creadListPrec :: ReadPrec [DisassociateMemberAccount]
readPrec :: ReadPrec DisassociateMemberAccount
$creadPrec :: ReadPrec DisassociateMemberAccount
readList :: ReadS [DisassociateMemberAccount]
$creadList :: ReadS [DisassociateMemberAccount]
readsPrec :: Int -> ReadS DisassociateMemberAccount
$creadsPrec :: Int -> ReadS DisassociateMemberAccount
Prelude.Read, Int -> DisassociateMemberAccount -> ShowS
[DisassociateMemberAccount] -> ShowS
DisassociateMemberAccount -> String
(Int -> DisassociateMemberAccount -> ShowS)
-> (DisassociateMemberAccount -> String)
-> ([DisassociateMemberAccount] -> ShowS)
-> Show DisassociateMemberAccount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisassociateMemberAccount] -> ShowS
$cshowList :: [DisassociateMemberAccount] -> ShowS
show :: DisassociateMemberAccount -> String
$cshow :: DisassociateMemberAccount -> String
showsPrec :: Int -> DisassociateMemberAccount -> ShowS
$cshowsPrec :: Int -> DisassociateMemberAccount -> ShowS
Prelude.Show, (forall x.
 DisassociateMemberAccount -> Rep DisassociateMemberAccount x)
-> (forall x.
    Rep DisassociateMemberAccount x -> DisassociateMemberAccount)
-> Generic DisassociateMemberAccount
forall x.
Rep DisassociateMemberAccount x -> DisassociateMemberAccount
forall x.
DisassociateMemberAccount -> Rep DisassociateMemberAccount x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DisassociateMemberAccount x -> DisassociateMemberAccount
$cfrom :: forall x.
DisassociateMemberAccount -> Rep DisassociateMemberAccount x
Prelude.Generic)

-- |
-- Create a value of 'DisassociateMemberAccount' 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:
--
-- 'memberAccountId', 'disassociateMemberAccount_memberAccountId' - The ID of the member account that you want to remove from Amazon Macie
-- Classic.
newDisassociateMemberAccount ::
  -- | 'memberAccountId'
  Prelude.Text ->
  DisassociateMemberAccount
newDisassociateMemberAccount :: Text -> DisassociateMemberAccount
newDisassociateMemberAccount Text
pMemberAccountId_ =
  DisassociateMemberAccount' :: Text -> DisassociateMemberAccount
DisassociateMemberAccount'
    { $sel:memberAccountId:DisassociateMemberAccount' :: Text
memberAccountId =
        Text
pMemberAccountId_
    }

-- | The ID of the member account that you want to remove from Amazon Macie
-- Classic.
disassociateMemberAccount_memberAccountId :: Lens.Lens' DisassociateMemberAccount Prelude.Text
disassociateMemberAccount_memberAccountId :: (Text -> f Text)
-> DisassociateMemberAccount -> f DisassociateMemberAccount
disassociateMemberAccount_memberAccountId = (DisassociateMemberAccount -> Text)
-> (DisassociateMemberAccount -> Text -> DisassociateMemberAccount)
-> Lens
     DisassociateMemberAccount DisassociateMemberAccount Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateMemberAccount' {Text
memberAccountId :: Text
$sel:memberAccountId:DisassociateMemberAccount' :: DisassociateMemberAccount -> Text
memberAccountId} -> Text
memberAccountId) (\s :: DisassociateMemberAccount
s@DisassociateMemberAccount' {} Text
a -> DisassociateMemberAccount
s {$sel:memberAccountId:DisassociateMemberAccount' :: Text
memberAccountId = Text
a} :: DisassociateMemberAccount)

instance Core.AWSRequest DisassociateMemberAccount where
  type
    AWSResponse DisassociateMemberAccount =
      DisassociateMemberAccountResponse
  request :: DisassociateMemberAccount -> Request DisassociateMemberAccount
request = Service
-> DisassociateMemberAccount -> Request DisassociateMemberAccount
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DisassociateMemberAccount
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DisassociateMemberAccount)))
response =
    AWSResponse DisassociateMemberAccount
-> Logger
-> Service
-> Proxy DisassociateMemberAccount
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DisassociateMemberAccount)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      AWSResponse DisassociateMemberAccount
DisassociateMemberAccountResponse
DisassociateMemberAccountResponse'

instance Prelude.Hashable DisassociateMemberAccount

instance Prelude.NFData DisassociateMemberAccount

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

instance Core.ToJSON DisassociateMemberAccount where
  toJSON :: DisassociateMemberAccount -> Value
toJSON DisassociateMemberAccount' {Text
memberAccountId :: Text
$sel:memberAccountId:DisassociateMemberAccount' :: DisassociateMemberAccount -> 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
"memberAccountId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
memberAccountId)
          ]
      )

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

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

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

-- |
-- Create a value of 'DisassociateMemberAccountResponse' 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.
newDisassociateMemberAccountResponse ::
  DisassociateMemberAccountResponse
newDisassociateMemberAccountResponse :: DisassociateMemberAccountResponse
newDisassociateMemberAccountResponse =
  DisassociateMemberAccountResponse
DisassociateMemberAccountResponse'

instance
  Prelude.NFData
    DisassociateMemberAccountResponse