{-# 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.DeleteAssessment
-- 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 an assessment in Audit Manager.
module Amazonka.AuditManager.DeleteAssessment
  ( -- * Creating a Request
    DeleteAssessment (..),
    newDeleteAssessment,

    -- * Request Lenses
    deleteAssessment_assessmentId,

    -- * Destructuring the Response
    DeleteAssessmentResponse (..),
    newDeleteAssessmentResponse,

    -- * Response Lenses
    deleteAssessmentResponse_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:/ 'newDeleteAssessment' smart constructor.
data DeleteAssessment = DeleteAssessment'
  { -- | The identifier for the specified assessment.
    DeleteAssessment -> Text
assessmentId :: Prelude.Text
  }
  deriving (DeleteAssessment -> DeleteAssessment -> Bool
(DeleteAssessment -> DeleteAssessment -> Bool)
-> (DeleteAssessment -> DeleteAssessment -> Bool)
-> Eq DeleteAssessment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteAssessment -> DeleteAssessment -> Bool
$c/= :: DeleteAssessment -> DeleteAssessment -> Bool
== :: DeleteAssessment -> DeleteAssessment -> Bool
$c== :: DeleteAssessment -> DeleteAssessment -> Bool
Prelude.Eq, ReadPrec [DeleteAssessment]
ReadPrec DeleteAssessment
Int -> ReadS DeleteAssessment
ReadS [DeleteAssessment]
(Int -> ReadS DeleteAssessment)
-> ReadS [DeleteAssessment]
-> ReadPrec DeleteAssessment
-> ReadPrec [DeleteAssessment]
-> Read DeleteAssessment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteAssessment]
$creadListPrec :: ReadPrec [DeleteAssessment]
readPrec :: ReadPrec DeleteAssessment
$creadPrec :: ReadPrec DeleteAssessment
readList :: ReadS [DeleteAssessment]
$creadList :: ReadS [DeleteAssessment]
readsPrec :: Int -> ReadS DeleteAssessment
$creadsPrec :: Int -> ReadS DeleteAssessment
Prelude.Read, Int -> DeleteAssessment -> ShowS
[DeleteAssessment] -> ShowS
DeleteAssessment -> String
(Int -> DeleteAssessment -> ShowS)
-> (DeleteAssessment -> String)
-> ([DeleteAssessment] -> ShowS)
-> Show DeleteAssessment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteAssessment] -> ShowS
$cshowList :: [DeleteAssessment] -> ShowS
show :: DeleteAssessment -> String
$cshow :: DeleteAssessment -> String
showsPrec :: Int -> DeleteAssessment -> ShowS
$cshowsPrec :: Int -> DeleteAssessment -> ShowS
Prelude.Show, (forall x. DeleteAssessment -> Rep DeleteAssessment x)
-> (forall x. Rep DeleteAssessment x -> DeleteAssessment)
-> Generic DeleteAssessment
forall x. Rep DeleteAssessment x -> DeleteAssessment
forall x. DeleteAssessment -> Rep DeleteAssessment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteAssessment x -> DeleteAssessment
$cfrom :: forall x. DeleteAssessment -> Rep DeleteAssessment x
Prelude.Generic)

-- |
-- Create a value of 'DeleteAssessment' 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:
--
-- 'assessmentId', 'deleteAssessment_assessmentId' - The identifier for the specified assessment.
newDeleteAssessment ::
  -- | 'assessmentId'
  Prelude.Text ->
  DeleteAssessment
newDeleteAssessment :: Text -> DeleteAssessment
newDeleteAssessment Text
pAssessmentId_ =
  DeleteAssessment' :: Text -> DeleteAssessment
DeleteAssessment' {$sel:assessmentId:DeleteAssessment' :: Text
assessmentId = Text
pAssessmentId_}

-- | The identifier for the specified assessment.
deleteAssessment_assessmentId :: Lens.Lens' DeleteAssessment Prelude.Text
deleteAssessment_assessmentId :: (Text -> f Text) -> DeleteAssessment -> f DeleteAssessment
deleteAssessment_assessmentId = (DeleteAssessment -> Text)
-> (DeleteAssessment -> Text -> DeleteAssessment)
-> Lens DeleteAssessment DeleteAssessment Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAssessment' {Text
assessmentId :: Text
$sel:assessmentId:DeleteAssessment' :: DeleteAssessment -> Text
assessmentId} -> Text
assessmentId) (\s :: DeleteAssessment
s@DeleteAssessment' {} Text
a -> DeleteAssessment
s {$sel:assessmentId:DeleteAssessment' :: Text
assessmentId = Text
a} :: DeleteAssessment)

instance Core.AWSRequest DeleteAssessment where
  type
    AWSResponse DeleteAssessment =
      DeleteAssessmentResponse
  request :: DeleteAssessment -> Request DeleteAssessment
request = Service -> DeleteAssessment -> Request DeleteAssessment
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteAssessment
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteAssessment)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteAssessment))
-> Logger
-> Service
-> Proxy DeleteAssessment
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteAssessment)))
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 -> DeleteAssessmentResponse
DeleteAssessmentResponse'
            (Int -> DeleteAssessmentResponse)
-> Either String Int -> Either String DeleteAssessmentResponse
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 DeleteAssessment

instance Prelude.NFData DeleteAssessment

instance Core.ToHeaders DeleteAssessment where
  toHeaders :: DeleteAssessment -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteAssessment -> 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 DeleteAssessment where
  toPath :: DeleteAssessment -> ByteString
toPath DeleteAssessment' {Text
assessmentId :: Text
$sel:assessmentId:DeleteAssessment' :: DeleteAssessment -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/assessments/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
assessmentId]

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

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

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

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

instance Prelude.NFData DeleteAssessmentResponse