{-# 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.AssociateMemberAccount
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- (Discontinued) Associates a specified Amazon Web Services account with
-- Amazon Macie Classic as a member account.
module Amazonka.Macie.AssociateMemberAccount
  ( -- * Creating a Request
    AssociateMemberAccount (..),
    newAssociateMemberAccount,

    -- * Request Lenses
    associateMemberAccount_memberAccountId,

    -- * Destructuring the Response
    AssociateMemberAccountResponse (..),
    newAssociateMemberAccountResponse,
  )
where

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

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

-- |
-- Create a value of 'AssociateMemberAccount' 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', 'associateMemberAccount_memberAccountId' - (Discontinued) The ID of the Amazon Web Services account that you want
-- to associate with Amazon Macie Classic as a member account.
newAssociateMemberAccount ::
  -- | 'memberAccountId'
  Prelude.Text ->
  AssociateMemberAccount
newAssociateMemberAccount :: Text -> AssociateMemberAccount
newAssociateMemberAccount Text
pMemberAccountId_ =
  AssociateMemberAccount'
    { $sel:memberAccountId:AssociateMemberAccount' :: Text
memberAccountId =
        Text
pMemberAccountId_
    }

-- | (Discontinued) The ID of the Amazon Web Services account that you want
-- to associate with Amazon Macie Classic as a member account.
associateMemberAccount_memberAccountId :: Lens.Lens' AssociateMemberAccount Prelude.Text
associateMemberAccount_memberAccountId :: Lens' AssociateMemberAccount Text
associateMemberAccount_memberAccountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateMemberAccount' {Text
memberAccountId :: Text
$sel:memberAccountId:AssociateMemberAccount' :: AssociateMemberAccount -> Text
memberAccountId} -> Text
memberAccountId) (\s :: AssociateMemberAccount
s@AssociateMemberAccount' {} Text
a -> AssociateMemberAccount
s {$sel:memberAccountId:AssociateMemberAccount' :: Text
memberAccountId = Text
a} :: AssociateMemberAccount)

instance Core.AWSRequest AssociateMemberAccount where
  type
    AWSResponse AssociateMemberAccount =
      AssociateMemberAccountResponse
  request :: (Service -> Service)
-> AssociateMemberAccount -> Request AssociateMemberAccount
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 AssociateMemberAccount
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse AssociateMemberAccount)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      AssociateMemberAccountResponse
AssociateMemberAccountResponse'

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

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

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

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

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

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

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

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

instance
  Prelude.NFData
    AssociateMemberAccountResponse
  where
  rnf :: AssociateMemberAccountResponse -> ()
rnf AssociateMemberAccountResponse
_ = ()