{-# 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-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)
--
-- 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.Lens as Lens
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
(DeleteOrganization -> DeleteOrganization -> Bool)
-> (DeleteOrganization -> DeleteOrganization -> Bool)
-> Eq DeleteOrganization
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]
(Int -> ReadS DeleteOrganization)
-> ReadS [DeleteOrganization]
-> ReadPrec DeleteOrganization
-> ReadPrec [DeleteOrganization]
-> Read 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
(Int -> DeleteOrganization -> ShowS)
-> (DeleteOrganization -> String)
-> ([DeleteOrganization] -> ShowS)
-> Show DeleteOrganization
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. DeleteOrganization -> Rep DeleteOrganization x)
-> (forall x. Rep DeleteOrganization x -> DeleteOrganization)
-> Generic DeleteOrganization
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 :: DeleteOrganization -> Request DeleteOrganization
request = Service -> DeleteOrganization -> Request DeleteOrganization
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteOrganization
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteOrganization)))
response =
    AWSResponse DeleteOrganization
-> Logger
-> Service
-> Proxy DeleteOrganization
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteOrganization)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeleteOrganization
DeleteOrganizationResponse
DeleteOrganizationResponse'

instance Prelude.Hashable DeleteOrganization

instance Prelude.NFData DeleteOrganization

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

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

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

-- | /See:/ 'newDeleteOrganizationResponse' smart constructor.
data DeleteOrganizationResponse = DeleteOrganizationResponse'
  {
  }
  deriving (DeleteOrganizationResponse -> DeleteOrganizationResponse -> Bool
(DeleteOrganizationResponse -> DeleteOrganizationResponse -> Bool)
-> (DeleteOrganizationResponse
    -> DeleteOrganizationResponse -> Bool)
-> Eq DeleteOrganizationResponse
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]
(Int -> ReadS DeleteOrganizationResponse)
-> ReadS [DeleteOrganizationResponse]
-> ReadPrec DeleteOrganizationResponse
-> ReadPrec [DeleteOrganizationResponse]
-> Read 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
(Int -> DeleteOrganizationResponse -> ShowS)
-> (DeleteOrganizationResponse -> String)
-> ([DeleteOrganizationResponse] -> ShowS)
-> Show DeleteOrganizationResponse
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.
 DeleteOrganizationResponse -> Rep DeleteOrganizationResponse x)
-> (forall x.
    Rep DeleteOrganizationResponse x -> DeleteOrganizationResponse)
-> Generic DeleteOrganizationResponse
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