{-# 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.AuditManager.DeleteControl
-- 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 a custom control in Audit Manager.
module Amazonka.AuditManager.DeleteControl
  ( -- * Creating a Request
    DeleteControl (..),
    newDeleteControl,

    -- * Request Lenses
    deleteControl_controlId,

    -- * Destructuring the Response
    DeleteControlResponse (..),
    newDeleteControlResponse,

    -- * Response Lenses
    deleteControlResponse_httpStatus,
  )
where

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

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

-- |
-- Create a value of 'DeleteControl' 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:
--
-- 'controlId', 'deleteControl_controlId' - The unique identifier for the control.
newDeleteControl ::
  -- | 'controlId'
  Prelude.Text ->
  DeleteControl
newDeleteControl :: Text -> DeleteControl
newDeleteControl Text
pControlId_ =
  DeleteControl' {$sel:controlId:DeleteControl' :: Text
controlId = Text
pControlId_}

-- | The unique identifier for the control.
deleteControl_controlId :: Lens.Lens' DeleteControl Prelude.Text
deleteControl_controlId :: Lens' DeleteControl Text
deleteControl_controlId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteControl' {Text
controlId :: Text
$sel:controlId:DeleteControl' :: DeleteControl -> Text
controlId} -> Text
controlId) (\s :: DeleteControl
s@DeleteControl' {} Text
a -> DeleteControl
s {$sel:controlId:DeleteControl' :: Text
controlId = Text
a} :: DeleteControl)

instance Core.AWSRequest DeleteControl where
  type
    AWSResponse DeleteControl =
      DeleteControlResponse
  request :: (Service -> Service) -> DeleteControl -> Request DeleteControl
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 DeleteControl
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteControl)))
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 -> DeleteControlResponse
DeleteControlResponse'
            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 DeleteControl where
  hashWithSalt :: Int -> DeleteControl -> Int
hashWithSalt Int
_salt DeleteControl' {Text
controlId :: Text
$sel:controlId:DeleteControl' :: DeleteControl -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
controlId

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

instance Data.ToHeaders DeleteControl where
  toHeaders :: DeleteControl -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToPath DeleteControl where
  toPath :: DeleteControl -> ByteString
toPath DeleteControl' {Text
controlId :: Text
$sel:controlId:DeleteControl' :: DeleteControl -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/controls/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
controlId]

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

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

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

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

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