{-# 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.IoTWireless.DisassociateAwsAccountFromPartnerAccount
-- 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 your AWS account from a partner account. If
-- @PartnerAccountId@ and @PartnerType@ are @null@, disassociates your AWS
-- account from all partner accounts.
module Amazonka.IoTWireless.DisassociateAwsAccountFromPartnerAccount
  ( -- * Creating a Request
    DisassociateAwsAccountFromPartnerAccount (..),
    newDisassociateAwsAccountFromPartnerAccount,

    -- * Request Lenses
    disassociateAwsAccountFromPartnerAccount_partnerAccountId,
    disassociateAwsAccountFromPartnerAccount_partnerType,

    -- * Destructuring the Response
    DisassociateAwsAccountFromPartnerAccountResponse (..),
    newDisassociateAwsAccountFromPartnerAccountResponse,

    -- * Response Lenses
    disassociateAwsAccountFromPartnerAccountResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDisassociateAwsAccountFromPartnerAccount' smart constructor.
data DisassociateAwsAccountFromPartnerAccount = DisassociateAwsAccountFromPartnerAccount'
  { -- | The partner account ID to disassociate from the AWS account.
    DisassociateAwsAccountFromPartnerAccount -> Text
partnerAccountId :: Prelude.Text,
    -- | The partner type.
    DisassociateAwsAccountFromPartnerAccount -> PartnerType
partnerType :: PartnerType
  }
  deriving (DisassociateAwsAccountFromPartnerAccount
-> DisassociateAwsAccountFromPartnerAccount -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisassociateAwsAccountFromPartnerAccount
-> DisassociateAwsAccountFromPartnerAccount -> Bool
$c/= :: DisassociateAwsAccountFromPartnerAccount
-> DisassociateAwsAccountFromPartnerAccount -> Bool
== :: DisassociateAwsAccountFromPartnerAccount
-> DisassociateAwsAccountFromPartnerAccount -> Bool
$c== :: DisassociateAwsAccountFromPartnerAccount
-> DisassociateAwsAccountFromPartnerAccount -> Bool
Prelude.Eq, ReadPrec [DisassociateAwsAccountFromPartnerAccount]
ReadPrec DisassociateAwsAccountFromPartnerAccount
Int -> ReadS DisassociateAwsAccountFromPartnerAccount
ReadS [DisassociateAwsAccountFromPartnerAccount]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisassociateAwsAccountFromPartnerAccount]
$creadListPrec :: ReadPrec [DisassociateAwsAccountFromPartnerAccount]
readPrec :: ReadPrec DisassociateAwsAccountFromPartnerAccount
$creadPrec :: ReadPrec DisassociateAwsAccountFromPartnerAccount
readList :: ReadS [DisassociateAwsAccountFromPartnerAccount]
$creadList :: ReadS [DisassociateAwsAccountFromPartnerAccount]
readsPrec :: Int -> ReadS DisassociateAwsAccountFromPartnerAccount
$creadsPrec :: Int -> ReadS DisassociateAwsAccountFromPartnerAccount
Prelude.Read, Int -> DisassociateAwsAccountFromPartnerAccount -> ShowS
[DisassociateAwsAccountFromPartnerAccount] -> ShowS
DisassociateAwsAccountFromPartnerAccount -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisassociateAwsAccountFromPartnerAccount] -> ShowS
$cshowList :: [DisassociateAwsAccountFromPartnerAccount] -> ShowS
show :: DisassociateAwsAccountFromPartnerAccount -> String
$cshow :: DisassociateAwsAccountFromPartnerAccount -> String
showsPrec :: Int -> DisassociateAwsAccountFromPartnerAccount -> ShowS
$cshowsPrec :: Int -> DisassociateAwsAccountFromPartnerAccount -> ShowS
Prelude.Show, forall x.
Rep DisassociateAwsAccountFromPartnerAccount x
-> DisassociateAwsAccountFromPartnerAccount
forall x.
DisassociateAwsAccountFromPartnerAccount
-> Rep DisassociateAwsAccountFromPartnerAccount x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DisassociateAwsAccountFromPartnerAccount x
-> DisassociateAwsAccountFromPartnerAccount
$cfrom :: forall x.
DisassociateAwsAccountFromPartnerAccount
-> Rep DisassociateAwsAccountFromPartnerAccount x
Prelude.Generic)

-- |
-- Create a value of 'DisassociateAwsAccountFromPartnerAccount' 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:
--
-- 'partnerAccountId', 'disassociateAwsAccountFromPartnerAccount_partnerAccountId' - The partner account ID to disassociate from the AWS account.
--
-- 'partnerType', 'disassociateAwsAccountFromPartnerAccount_partnerType' - The partner type.
newDisassociateAwsAccountFromPartnerAccount ::
  -- | 'partnerAccountId'
  Prelude.Text ->
  -- | 'partnerType'
  PartnerType ->
  DisassociateAwsAccountFromPartnerAccount
newDisassociateAwsAccountFromPartnerAccount :: Text -> PartnerType -> DisassociateAwsAccountFromPartnerAccount
newDisassociateAwsAccountFromPartnerAccount
  Text
pPartnerAccountId_
  PartnerType
pPartnerType_ =
    DisassociateAwsAccountFromPartnerAccount'
      { $sel:partnerAccountId:DisassociateAwsAccountFromPartnerAccount' :: Text
partnerAccountId =
          Text
pPartnerAccountId_,
        $sel:partnerType:DisassociateAwsAccountFromPartnerAccount' :: PartnerType
partnerType = PartnerType
pPartnerType_
      }

-- | The partner account ID to disassociate from the AWS account.
disassociateAwsAccountFromPartnerAccount_partnerAccountId :: Lens.Lens' DisassociateAwsAccountFromPartnerAccount Prelude.Text
disassociateAwsAccountFromPartnerAccount_partnerAccountId :: Lens' DisassociateAwsAccountFromPartnerAccount Text
disassociateAwsAccountFromPartnerAccount_partnerAccountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateAwsAccountFromPartnerAccount' {Text
partnerAccountId :: Text
$sel:partnerAccountId:DisassociateAwsAccountFromPartnerAccount' :: DisassociateAwsAccountFromPartnerAccount -> Text
partnerAccountId} -> Text
partnerAccountId) (\s :: DisassociateAwsAccountFromPartnerAccount
s@DisassociateAwsAccountFromPartnerAccount' {} Text
a -> DisassociateAwsAccountFromPartnerAccount
s {$sel:partnerAccountId:DisassociateAwsAccountFromPartnerAccount' :: Text
partnerAccountId = Text
a} :: DisassociateAwsAccountFromPartnerAccount)

-- | The partner type.
disassociateAwsAccountFromPartnerAccount_partnerType :: Lens.Lens' DisassociateAwsAccountFromPartnerAccount PartnerType
disassociateAwsAccountFromPartnerAccount_partnerType :: Lens' DisassociateAwsAccountFromPartnerAccount PartnerType
disassociateAwsAccountFromPartnerAccount_partnerType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateAwsAccountFromPartnerAccount' {PartnerType
partnerType :: PartnerType
$sel:partnerType:DisassociateAwsAccountFromPartnerAccount' :: DisassociateAwsAccountFromPartnerAccount -> PartnerType
partnerType} -> PartnerType
partnerType) (\s :: DisassociateAwsAccountFromPartnerAccount
s@DisassociateAwsAccountFromPartnerAccount' {} PartnerType
a -> DisassociateAwsAccountFromPartnerAccount
s {$sel:partnerType:DisassociateAwsAccountFromPartnerAccount' :: PartnerType
partnerType = PartnerType
a} :: DisassociateAwsAccountFromPartnerAccount)

instance
  Core.AWSRequest
    DisassociateAwsAccountFromPartnerAccount
  where
  type
    AWSResponse
      DisassociateAwsAccountFromPartnerAccount =
      DisassociateAwsAccountFromPartnerAccountResponse
  request :: (Service -> Service)
-> DisassociateAwsAccountFromPartnerAccount
-> Request DisassociateAwsAccountFromPartnerAccount
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.delete (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DisassociateAwsAccountFromPartnerAccount
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse DisassociateAwsAccountFromPartnerAccount)))
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 -> DisassociateAwsAccountFromPartnerAccountResponse
DisassociateAwsAccountFromPartnerAccountResponse'
            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
    DisassociateAwsAccountFromPartnerAccount
  where
  hashWithSalt :: Int -> DisassociateAwsAccountFromPartnerAccount -> Int
hashWithSalt
    Int
_salt
    DisassociateAwsAccountFromPartnerAccount' {Text
PartnerType
partnerType :: PartnerType
partnerAccountId :: Text
$sel:partnerType:DisassociateAwsAccountFromPartnerAccount' :: DisassociateAwsAccountFromPartnerAccount -> PartnerType
$sel:partnerAccountId:DisassociateAwsAccountFromPartnerAccount' :: DisassociateAwsAccountFromPartnerAccount -> Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
partnerAccountId
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` PartnerType
partnerType

instance
  Prelude.NFData
    DisassociateAwsAccountFromPartnerAccount
  where
  rnf :: DisassociateAwsAccountFromPartnerAccount -> ()
rnf DisassociateAwsAccountFromPartnerAccount' {Text
PartnerType
partnerType :: PartnerType
partnerAccountId :: Text
$sel:partnerType:DisassociateAwsAccountFromPartnerAccount' :: DisassociateAwsAccountFromPartnerAccount -> PartnerType
$sel:partnerAccountId:DisassociateAwsAccountFromPartnerAccount' :: DisassociateAwsAccountFromPartnerAccount -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
partnerAccountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf PartnerType
partnerType

instance
  Data.ToHeaders
    DisassociateAwsAccountFromPartnerAccount
  where
  toHeaders :: DisassociateAwsAccountFromPartnerAccount -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance
  Data.ToPath
    DisassociateAwsAccountFromPartnerAccount
  where
  toPath :: DisassociateAwsAccountFromPartnerAccount -> ByteString
toPath DisassociateAwsAccountFromPartnerAccount' {Text
PartnerType
partnerType :: PartnerType
partnerAccountId :: Text
$sel:partnerType:DisassociateAwsAccountFromPartnerAccount' :: DisassociateAwsAccountFromPartnerAccount -> PartnerType
$sel:partnerAccountId:DisassociateAwsAccountFromPartnerAccount' :: DisassociateAwsAccountFromPartnerAccount -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/partner-accounts/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
partnerAccountId]

instance
  Data.ToQuery
    DisassociateAwsAccountFromPartnerAccount
  where
  toQuery :: DisassociateAwsAccountFromPartnerAccount -> QueryString
toQuery DisassociateAwsAccountFromPartnerAccount' {Text
PartnerType
partnerType :: PartnerType
partnerAccountId :: Text
$sel:partnerType:DisassociateAwsAccountFromPartnerAccount' :: DisassociateAwsAccountFromPartnerAccount -> PartnerType
$sel:partnerAccountId:DisassociateAwsAccountFromPartnerAccount' :: DisassociateAwsAccountFromPartnerAccount -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"partnerType" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: PartnerType
partnerType]

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

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

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

instance
  Prelude.NFData
    DisassociateAwsAccountFromPartnerAccountResponse
  where
  rnf :: DisassociateAwsAccountFromPartnerAccountResponse -> ()
rnf
    DisassociateAwsAccountFromPartnerAccountResponse' {Int
httpStatus :: Int
$sel:httpStatus:DisassociateAwsAccountFromPartnerAccountResponse' :: DisassociateAwsAccountFromPartnerAccountResponse -> Int
..} =
      forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus