{-# 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.Config.DeleteOrganizationConformancePack
-- 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 specified organization conformance pack and all of the
-- config rules and remediation actions from all member accounts in that
-- organization.
--
-- Only a master account or a delegated administrator account can delete an
-- organization conformance pack. When calling this API with a delegated
-- administrator, you must ensure Organizations
-- @ListDelegatedAdministrator@ permissions are added.
--
-- Config sets the state of a conformance pack to DELETE_IN_PROGRESS until
-- the deletion is complete. You cannot update a conformance pack while it
-- is in this state.
module Amazonka.Config.DeleteOrganizationConformancePack
  ( -- * Creating a Request
    DeleteOrganizationConformancePack (..),
    newDeleteOrganizationConformancePack,

    -- * Request Lenses
    deleteOrganizationConformancePack_organizationConformancePackName,

    -- * Destructuring the Response
    DeleteOrganizationConformancePackResponse (..),
    newDeleteOrganizationConformancePackResponse,
  )
where

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

-- | /See:/ 'newDeleteOrganizationConformancePack' smart constructor.
data DeleteOrganizationConformancePack = DeleteOrganizationConformancePack'
  { -- | The name of organization conformance pack that you want to delete.
    DeleteOrganizationConformancePack -> Text
organizationConformancePackName :: Prelude.Text
  }
  deriving (DeleteOrganizationConformancePack
-> DeleteOrganizationConformancePack -> Bool
(DeleteOrganizationConformancePack
 -> DeleteOrganizationConformancePack -> Bool)
-> (DeleteOrganizationConformancePack
    -> DeleteOrganizationConformancePack -> Bool)
-> Eq DeleteOrganizationConformancePack
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteOrganizationConformancePack
-> DeleteOrganizationConformancePack -> Bool
$c/= :: DeleteOrganizationConformancePack
-> DeleteOrganizationConformancePack -> Bool
== :: DeleteOrganizationConformancePack
-> DeleteOrganizationConformancePack -> Bool
$c== :: DeleteOrganizationConformancePack
-> DeleteOrganizationConformancePack -> Bool
Prelude.Eq, ReadPrec [DeleteOrganizationConformancePack]
ReadPrec DeleteOrganizationConformancePack
Int -> ReadS DeleteOrganizationConformancePack
ReadS [DeleteOrganizationConformancePack]
(Int -> ReadS DeleteOrganizationConformancePack)
-> ReadS [DeleteOrganizationConformancePack]
-> ReadPrec DeleteOrganizationConformancePack
-> ReadPrec [DeleteOrganizationConformancePack]
-> Read DeleteOrganizationConformancePack
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteOrganizationConformancePack]
$creadListPrec :: ReadPrec [DeleteOrganizationConformancePack]
readPrec :: ReadPrec DeleteOrganizationConformancePack
$creadPrec :: ReadPrec DeleteOrganizationConformancePack
readList :: ReadS [DeleteOrganizationConformancePack]
$creadList :: ReadS [DeleteOrganizationConformancePack]
readsPrec :: Int -> ReadS DeleteOrganizationConformancePack
$creadsPrec :: Int -> ReadS DeleteOrganizationConformancePack
Prelude.Read, Int -> DeleteOrganizationConformancePack -> ShowS
[DeleteOrganizationConformancePack] -> ShowS
DeleteOrganizationConformancePack -> String
(Int -> DeleteOrganizationConformancePack -> ShowS)
-> (DeleteOrganizationConformancePack -> String)
-> ([DeleteOrganizationConformancePack] -> ShowS)
-> Show DeleteOrganizationConformancePack
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteOrganizationConformancePack] -> ShowS
$cshowList :: [DeleteOrganizationConformancePack] -> ShowS
show :: DeleteOrganizationConformancePack -> String
$cshow :: DeleteOrganizationConformancePack -> String
showsPrec :: Int -> DeleteOrganizationConformancePack -> ShowS
$cshowsPrec :: Int -> DeleteOrganizationConformancePack -> ShowS
Prelude.Show, (forall x.
 DeleteOrganizationConformancePack
 -> Rep DeleteOrganizationConformancePack x)
-> (forall x.
    Rep DeleteOrganizationConformancePack x
    -> DeleteOrganizationConformancePack)
-> Generic DeleteOrganizationConformancePack
forall x.
Rep DeleteOrganizationConformancePack x
-> DeleteOrganizationConformancePack
forall x.
DeleteOrganizationConformancePack
-> Rep DeleteOrganizationConformancePack x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteOrganizationConformancePack x
-> DeleteOrganizationConformancePack
$cfrom :: forall x.
DeleteOrganizationConformancePack
-> Rep DeleteOrganizationConformancePack x
Prelude.Generic)

-- |
-- Create a value of 'DeleteOrganizationConformancePack' 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:
--
-- 'organizationConformancePackName', 'deleteOrganizationConformancePack_organizationConformancePackName' - The name of organization conformance pack that you want to delete.
newDeleteOrganizationConformancePack ::
  -- | 'organizationConformancePackName'
  Prelude.Text ->
  DeleteOrganizationConformancePack
newDeleteOrganizationConformancePack :: Text -> DeleteOrganizationConformancePack
newDeleteOrganizationConformancePack
  Text
pOrganizationConformancePackName_ =
    DeleteOrganizationConformancePack' :: Text -> DeleteOrganizationConformancePack
DeleteOrganizationConformancePack'
      { $sel:organizationConformancePackName:DeleteOrganizationConformancePack' :: Text
organizationConformancePackName =
          Text
pOrganizationConformancePackName_
      }

-- | The name of organization conformance pack that you want to delete.
deleteOrganizationConformancePack_organizationConformancePackName :: Lens.Lens' DeleteOrganizationConformancePack Prelude.Text
deleteOrganizationConformancePack_organizationConformancePackName :: (Text -> f Text)
-> DeleteOrganizationConformancePack
-> f DeleteOrganizationConformancePack
deleteOrganizationConformancePack_organizationConformancePackName = (DeleteOrganizationConformancePack -> Text)
-> (DeleteOrganizationConformancePack
    -> Text -> DeleteOrganizationConformancePack)
-> Lens
     DeleteOrganizationConformancePack
     DeleteOrganizationConformancePack
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteOrganizationConformancePack' {Text
organizationConformancePackName :: Text
$sel:organizationConformancePackName:DeleteOrganizationConformancePack' :: DeleteOrganizationConformancePack -> Text
organizationConformancePackName} -> Text
organizationConformancePackName) (\s :: DeleteOrganizationConformancePack
s@DeleteOrganizationConformancePack' {} Text
a -> DeleteOrganizationConformancePack
s {$sel:organizationConformancePackName:DeleteOrganizationConformancePack' :: Text
organizationConformancePackName = Text
a} :: DeleteOrganizationConformancePack)

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

instance
  Prelude.Hashable
    DeleteOrganizationConformancePack

instance
  Prelude.NFData
    DeleteOrganizationConformancePack

instance
  Core.ToHeaders
    DeleteOrganizationConformancePack
  where
  toHeaders :: DeleteOrganizationConformancePack -> [Header]
toHeaders =
    [Header] -> DeleteOrganizationConformancePack -> [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
"StarlingDoveService.DeleteOrganizationConformancePack" ::
                          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
    DeleteOrganizationConformancePack
  where
  toJSON :: DeleteOrganizationConformancePack -> Value
toJSON DeleteOrganizationConformancePack' {Text
organizationConformancePackName :: Text
$sel:organizationConformancePackName:DeleteOrganizationConformancePack' :: DeleteOrganizationConformancePack -> 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
"OrganizationConformancePackName"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
organizationConformancePackName
              )
          ]
      )

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

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

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

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

instance
  Prelude.NFData
    DeleteOrganizationConformancePackResponse