{-# 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.Organizations.DeleteOrganization
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes the organization. You can delete an organization only by using
-- credentials from the management account. The organization must be empty
-- of member accounts.
module Amazonka.Organizations.DeleteOrganization
  ( -- * Creating a Request
    DeleteOrganization (..),
    newDeleteOrganization,

    -- * Destructuring the Response
    DeleteOrganizationResponse (..),
    newDeleteOrganizationResponse,
  )
where

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

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

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

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

instance Prelude.Hashable DeleteOrganization where
  hashWithSalt :: Int -> DeleteOrganization -> Int
hashWithSalt Int
_salt DeleteOrganization
_ =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ()

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

instance Data.ToHeaders DeleteOrganization where
  toHeaders :: DeleteOrganization -> [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
"AWSOrganizationsV20161128.DeleteOrganization" ::
                          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 DeleteOrganization where
  toJSON :: DeleteOrganization -> Value
toJSON = forall a b. a -> b -> a
Prelude.const (Object -> Value
Data.Object forall a. Monoid a => a
Prelude.mempty)

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

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

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

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

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