{-# 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-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 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.Lens as Lens
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 identifier for the specified control.
    DeleteControl -> Text
controlId :: Prelude.Text
  }
  deriving (DeleteControl -> DeleteControl -> Bool
(DeleteControl -> DeleteControl -> Bool)
-> (DeleteControl -> DeleteControl -> Bool) -> Eq DeleteControl
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]
(Int -> ReadS DeleteControl)
-> ReadS [DeleteControl]
-> ReadPrec DeleteControl
-> ReadPrec [DeleteControl]
-> Read 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
(Int -> DeleteControl -> ShowS)
-> (DeleteControl -> String)
-> ([DeleteControl] -> ShowS)
-> Show DeleteControl
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. DeleteControl -> Rep DeleteControl x)
-> (forall x. Rep DeleteControl x -> DeleteControl)
-> Generic DeleteControl
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 identifier for the specified control.
newDeleteControl ::
  -- | 'controlId'
  Prelude.Text ->
  DeleteControl
newDeleteControl :: Text -> DeleteControl
newDeleteControl Text
pControlId_ =
  DeleteControl' :: Text -> DeleteControl
DeleteControl' {$sel:controlId:DeleteControl' :: Text
controlId = Text
pControlId_}

-- | The identifier for the specified control.
deleteControl_controlId :: Lens.Lens' DeleteControl Prelude.Text
deleteControl_controlId :: (Text -> f Text) -> DeleteControl -> f DeleteControl
deleteControl_controlId = (DeleteControl -> Text)
-> (DeleteControl -> Text -> DeleteControl)
-> Lens DeleteControl DeleteControl Text Text
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 :: DeleteControl -> Request DeleteControl
request = Service -> DeleteControl -> Request DeleteControl
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteControl
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteControl)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteControl))
-> Logger
-> Service
-> Proxy DeleteControl
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteControl)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteControlResponse
DeleteControlResponse'
            (Int -> DeleteControlResponse)
-> Either String Int -> Either String DeleteControlResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteControl

instance Prelude.NFData DeleteControl

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

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

instance Core.ToQuery DeleteControl where
  toQuery :: DeleteControl -> QueryString
toQuery = QueryString -> DeleteControl -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DeleteControlResponse -> DeleteControlResponse -> Bool)
-> (DeleteControlResponse -> DeleteControlResponse -> Bool)
-> Eq DeleteControlResponse
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]
(Int -> ReadS DeleteControlResponse)
-> ReadS [DeleteControlResponse]
-> ReadPrec DeleteControlResponse
-> ReadPrec [DeleteControlResponse]
-> Read 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
(Int -> DeleteControlResponse -> ShowS)
-> (DeleteControlResponse -> String)
-> ([DeleteControlResponse] -> ShowS)
-> Show DeleteControlResponse
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. DeleteControlResponse -> Rep DeleteControlResponse x)
-> (forall x. Rep DeleteControlResponse x -> DeleteControlResponse)
-> Generic DeleteControlResponse
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' :: Int -> DeleteControlResponse
DeleteControlResponse' {$sel:httpStatus:DeleteControlResponse' :: Int
httpStatus = Int
pHttpStatus_}

-- | The response's http status code.
deleteControlResponse_httpStatus :: Lens.Lens' DeleteControlResponse Prelude.Int
deleteControlResponse_httpStatus :: (Int -> f Int) -> DeleteControlResponse -> f DeleteControlResponse
deleteControlResponse_httpStatus = (DeleteControlResponse -> Int)
-> (DeleteControlResponse -> Int -> DeleteControlResponse)
-> Lens DeleteControlResponse DeleteControlResponse Int Int
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