{-# 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.AccessAnalyzer.DeleteAnalyzer
-- 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 analyzer. When you delete an analyzer, IAM Access
-- Analyzer is disabled for the account or organization in the current or
-- specific Region. All findings that were generated by the analyzer are
-- deleted. You cannot undo this action.
module Amazonka.AccessAnalyzer.DeleteAnalyzer
  ( -- * Creating a Request
    DeleteAnalyzer (..),
    newDeleteAnalyzer,

    -- * Request Lenses
    deleteAnalyzer_clientToken,
    deleteAnalyzer_analyzerName,

    -- * Destructuring the Response
    DeleteAnalyzerResponse (..),
    newDeleteAnalyzerResponse,
  )
where

import Amazonka.AccessAnalyzer.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

-- | Deletes an analyzer.
--
-- /See:/ 'newDeleteAnalyzer' smart constructor.
data DeleteAnalyzer = DeleteAnalyzer'
  { -- | A client token.
    DeleteAnalyzer -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | The name of the analyzer to delete.
    DeleteAnalyzer -> Text
analyzerName :: Prelude.Text
  }
  deriving (DeleteAnalyzer -> DeleteAnalyzer -> Bool
(DeleteAnalyzer -> DeleteAnalyzer -> Bool)
-> (DeleteAnalyzer -> DeleteAnalyzer -> Bool) -> Eq DeleteAnalyzer
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteAnalyzer -> DeleteAnalyzer -> Bool
$c/= :: DeleteAnalyzer -> DeleteAnalyzer -> Bool
== :: DeleteAnalyzer -> DeleteAnalyzer -> Bool
$c== :: DeleteAnalyzer -> DeleteAnalyzer -> Bool
Prelude.Eq, ReadPrec [DeleteAnalyzer]
ReadPrec DeleteAnalyzer
Int -> ReadS DeleteAnalyzer
ReadS [DeleteAnalyzer]
(Int -> ReadS DeleteAnalyzer)
-> ReadS [DeleteAnalyzer]
-> ReadPrec DeleteAnalyzer
-> ReadPrec [DeleteAnalyzer]
-> Read DeleteAnalyzer
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteAnalyzer]
$creadListPrec :: ReadPrec [DeleteAnalyzer]
readPrec :: ReadPrec DeleteAnalyzer
$creadPrec :: ReadPrec DeleteAnalyzer
readList :: ReadS [DeleteAnalyzer]
$creadList :: ReadS [DeleteAnalyzer]
readsPrec :: Int -> ReadS DeleteAnalyzer
$creadsPrec :: Int -> ReadS DeleteAnalyzer
Prelude.Read, Int -> DeleteAnalyzer -> ShowS
[DeleteAnalyzer] -> ShowS
DeleteAnalyzer -> String
(Int -> DeleteAnalyzer -> ShowS)
-> (DeleteAnalyzer -> String)
-> ([DeleteAnalyzer] -> ShowS)
-> Show DeleteAnalyzer
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteAnalyzer] -> ShowS
$cshowList :: [DeleteAnalyzer] -> ShowS
show :: DeleteAnalyzer -> String
$cshow :: DeleteAnalyzer -> String
showsPrec :: Int -> DeleteAnalyzer -> ShowS
$cshowsPrec :: Int -> DeleteAnalyzer -> ShowS
Prelude.Show, (forall x. DeleteAnalyzer -> Rep DeleteAnalyzer x)
-> (forall x. Rep DeleteAnalyzer x -> DeleteAnalyzer)
-> Generic DeleteAnalyzer
forall x. Rep DeleteAnalyzer x -> DeleteAnalyzer
forall x. DeleteAnalyzer -> Rep DeleteAnalyzer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteAnalyzer x -> DeleteAnalyzer
$cfrom :: forall x. DeleteAnalyzer -> Rep DeleteAnalyzer x
Prelude.Generic)

-- |
-- Create a value of 'DeleteAnalyzer' 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:
--
-- 'clientToken', 'deleteAnalyzer_clientToken' - A client token.
--
-- 'analyzerName', 'deleteAnalyzer_analyzerName' - The name of the analyzer to delete.
newDeleteAnalyzer ::
  -- | 'analyzerName'
  Prelude.Text ->
  DeleteAnalyzer
newDeleteAnalyzer :: Text -> DeleteAnalyzer
newDeleteAnalyzer Text
pAnalyzerName_ =
  DeleteAnalyzer' :: Maybe Text -> Text -> DeleteAnalyzer
DeleteAnalyzer'
    { $sel:clientToken:DeleteAnalyzer' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:analyzerName:DeleteAnalyzer' :: Text
analyzerName = Text
pAnalyzerName_
    }

-- | A client token.
deleteAnalyzer_clientToken :: Lens.Lens' DeleteAnalyzer (Prelude.Maybe Prelude.Text)
deleteAnalyzer_clientToken :: (Maybe Text -> f (Maybe Text))
-> DeleteAnalyzer -> f DeleteAnalyzer
deleteAnalyzer_clientToken = (DeleteAnalyzer -> Maybe Text)
-> (DeleteAnalyzer -> Maybe Text -> DeleteAnalyzer)
-> Lens DeleteAnalyzer DeleteAnalyzer (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAnalyzer' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:DeleteAnalyzer' :: DeleteAnalyzer -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: DeleteAnalyzer
s@DeleteAnalyzer' {} Maybe Text
a -> DeleteAnalyzer
s {$sel:clientToken:DeleteAnalyzer' :: Maybe Text
clientToken = Maybe Text
a} :: DeleteAnalyzer)

-- | The name of the analyzer to delete.
deleteAnalyzer_analyzerName :: Lens.Lens' DeleteAnalyzer Prelude.Text
deleteAnalyzer_analyzerName :: (Text -> f Text) -> DeleteAnalyzer -> f DeleteAnalyzer
deleteAnalyzer_analyzerName = (DeleteAnalyzer -> Text)
-> (DeleteAnalyzer -> Text -> DeleteAnalyzer)
-> Lens DeleteAnalyzer DeleteAnalyzer Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAnalyzer' {Text
analyzerName :: Text
$sel:analyzerName:DeleteAnalyzer' :: DeleteAnalyzer -> Text
analyzerName} -> Text
analyzerName) (\s :: DeleteAnalyzer
s@DeleteAnalyzer' {} Text
a -> DeleteAnalyzer
s {$sel:analyzerName:DeleteAnalyzer' :: Text
analyzerName = Text
a} :: DeleteAnalyzer)

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

instance Prelude.Hashable DeleteAnalyzer

instance Prelude.NFData DeleteAnalyzer

instance Core.ToHeaders DeleteAnalyzer where
  toHeaders :: DeleteAnalyzer -> [Header]
toHeaders =
    [Header] -> DeleteAnalyzer -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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.ToPath DeleteAnalyzer where
  toPath :: DeleteAnalyzer -> ByteString
toPath DeleteAnalyzer' {Maybe Text
Text
analyzerName :: Text
clientToken :: Maybe Text
$sel:analyzerName:DeleteAnalyzer' :: DeleteAnalyzer -> Text
$sel:clientToken:DeleteAnalyzer' :: DeleteAnalyzer -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/analyzer/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
analyzerName]

instance Core.ToQuery DeleteAnalyzer where
  toQuery :: DeleteAnalyzer -> QueryString
toQuery DeleteAnalyzer' {Maybe Text
Text
analyzerName :: Text
clientToken :: Maybe Text
$sel:analyzerName:DeleteAnalyzer' :: DeleteAnalyzer -> Text
$sel:clientToken:DeleteAnalyzer' :: DeleteAnalyzer -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"clientToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
clientToken]

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

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

instance Prelude.NFData DeleteAnalyzerResponse