{-# 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.DeleteEvaluationResults
-- 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 evaluation results for the specified Config rule. You can
-- specify one Config rule per request. After you delete the evaluation
-- results, you can call the StartConfigRulesEvaluation API to start
-- evaluating your Amazon Web Services resources against the rule.
module Amazonka.Config.DeleteEvaluationResults
  ( -- * Creating a Request
    DeleteEvaluationResults (..),
    newDeleteEvaluationResults,

    -- * Request Lenses
    deleteEvaluationResults_configRuleName,

    -- * Destructuring the Response
    DeleteEvaluationResultsResponse (..),
    newDeleteEvaluationResultsResponse,

    -- * Response Lenses
    deleteEvaluationResultsResponse_httpStatus,
  )
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:/ 'newDeleteEvaluationResults' smart constructor.
data DeleteEvaluationResults = DeleteEvaluationResults'
  { -- | The name of the Config rule for which you want to delete the evaluation
    -- results.
    DeleteEvaluationResults -> Text
configRuleName :: Prelude.Text
  }
  deriving (DeleteEvaluationResults -> DeleteEvaluationResults -> Bool
(DeleteEvaluationResults -> DeleteEvaluationResults -> Bool)
-> (DeleteEvaluationResults -> DeleteEvaluationResults -> Bool)
-> Eq DeleteEvaluationResults
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteEvaluationResults -> DeleteEvaluationResults -> Bool
$c/= :: DeleteEvaluationResults -> DeleteEvaluationResults -> Bool
== :: DeleteEvaluationResults -> DeleteEvaluationResults -> Bool
$c== :: DeleteEvaluationResults -> DeleteEvaluationResults -> Bool
Prelude.Eq, ReadPrec [DeleteEvaluationResults]
ReadPrec DeleteEvaluationResults
Int -> ReadS DeleteEvaluationResults
ReadS [DeleteEvaluationResults]
(Int -> ReadS DeleteEvaluationResults)
-> ReadS [DeleteEvaluationResults]
-> ReadPrec DeleteEvaluationResults
-> ReadPrec [DeleteEvaluationResults]
-> Read DeleteEvaluationResults
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteEvaluationResults]
$creadListPrec :: ReadPrec [DeleteEvaluationResults]
readPrec :: ReadPrec DeleteEvaluationResults
$creadPrec :: ReadPrec DeleteEvaluationResults
readList :: ReadS [DeleteEvaluationResults]
$creadList :: ReadS [DeleteEvaluationResults]
readsPrec :: Int -> ReadS DeleteEvaluationResults
$creadsPrec :: Int -> ReadS DeleteEvaluationResults
Prelude.Read, Int -> DeleteEvaluationResults -> ShowS
[DeleteEvaluationResults] -> ShowS
DeleteEvaluationResults -> String
(Int -> DeleteEvaluationResults -> ShowS)
-> (DeleteEvaluationResults -> String)
-> ([DeleteEvaluationResults] -> ShowS)
-> Show DeleteEvaluationResults
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteEvaluationResults] -> ShowS
$cshowList :: [DeleteEvaluationResults] -> ShowS
show :: DeleteEvaluationResults -> String
$cshow :: DeleteEvaluationResults -> String
showsPrec :: Int -> DeleteEvaluationResults -> ShowS
$cshowsPrec :: Int -> DeleteEvaluationResults -> ShowS
Prelude.Show, (forall x.
 DeleteEvaluationResults -> Rep DeleteEvaluationResults x)
-> (forall x.
    Rep DeleteEvaluationResults x -> DeleteEvaluationResults)
-> Generic DeleteEvaluationResults
forall x. Rep DeleteEvaluationResults x -> DeleteEvaluationResults
forall x. DeleteEvaluationResults -> Rep DeleteEvaluationResults x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteEvaluationResults x -> DeleteEvaluationResults
$cfrom :: forall x. DeleteEvaluationResults -> Rep DeleteEvaluationResults x
Prelude.Generic)

-- |
-- Create a value of 'DeleteEvaluationResults' 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:
--
-- 'configRuleName', 'deleteEvaluationResults_configRuleName' - The name of the Config rule for which you want to delete the evaluation
-- results.
newDeleteEvaluationResults ::
  -- | 'configRuleName'
  Prelude.Text ->
  DeleteEvaluationResults
newDeleteEvaluationResults :: Text -> DeleteEvaluationResults
newDeleteEvaluationResults Text
pConfigRuleName_ =
  DeleteEvaluationResults' :: Text -> DeleteEvaluationResults
DeleteEvaluationResults'
    { $sel:configRuleName:DeleteEvaluationResults' :: Text
configRuleName =
        Text
pConfigRuleName_
    }

-- | The name of the Config rule for which you want to delete the evaluation
-- results.
deleteEvaluationResults_configRuleName :: Lens.Lens' DeleteEvaluationResults Prelude.Text
deleteEvaluationResults_configRuleName :: (Text -> f Text)
-> DeleteEvaluationResults -> f DeleteEvaluationResults
deleteEvaluationResults_configRuleName = (DeleteEvaluationResults -> Text)
-> (DeleteEvaluationResults -> Text -> DeleteEvaluationResults)
-> Lens DeleteEvaluationResults DeleteEvaluationResults Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteEvaluationResults' {Text
configRuleName :: Text
$sel:configRuleName:DeleteEvaluationResults' :: DeleteEvaluationResults -> Text
configRuleName} -> Text
configRuleName) (\s :: DeleteEvaluationResults
s@DeleteEvaluationResults' {} Text
a -> DeleteEvaluationResults
s {$sel:configRuleName:DeleteEvaluationResults' :: Text
configRuleName = Text
a} :: DeleteEvaluationResults)

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

instance Prelude.NFData DeleteEvaluationResults

instance Core.ToHeaders DeleteEvaluationResults where
  toHeaders :: DeleteEvaluationResults -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteEvaluationResults -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"StarlingDoveService.DeleteEvaluationResults" ::
                          Prelude.ByteString
                      ),
            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.ToJSON DeleteEvaluationResults where
  toJSON :: DeleteEvaluationResults -> Value
toJSON DeleteEvaluationResults' {Text
configRuleName :: Text
$sel:configRuleName:DeleteEvaluationResults' :: DeleteEvaluationResults -> 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
"ConfigRuleName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
configRuleName)
          ]
      )

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

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

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

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

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

instance
  Prelude.NFData
    DeleteEvaluationResultsResponse