{-# 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.SecurityHub.DeleteFindingAggregator
-- 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 finding aggregator. When you delete the finding aggregator,
-- you stop finding aggregation.
--
-- When you stop finding aggregation, findings that were already aggregated
-- to the aggregation Region are still visible from the aggregation Region.
-- New findings and finding updates are not aggregated.
module Amazonka.SecurityHub.DeleteFindingAggregator
  ( -- * Creating a Request
    DeleteFindingAggregator (..),
    newDeleteFindingAggregator,

    -- * Request Lenses
    deleteFindingAggregator_findingAggregatorArn,

    -- * Destructuring the Response
    DeleteFindingAggregatorResponse (..),
    newDeleteFindingAggregatorResponse,

    -- * Response Lenses
    deleteFindingAggregatorResponse_httpStatus,
  )
where

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
import Amazonka.SecurityHub.Types

-- | /See:/ 'newDeleteFindingAggregator' smart constructor.
data DeleteFindingAggregator = DeleteFindingAggregator'
  { -- | The ARN of the finding aggregator to delete. To obtain the ARN, use
    -- @ListFindingAggregators@.
    DeleteFindingAggregator -> Text
findingAggregatorArn :: Prelude.Text
  }
  deriving (DeleteFindingAggregator -> DeleteFindingAggregator -> Bool
(DeleteFindingAggregator -> DeleteFindingAggregator -> Bool)
-> (DeleteFindingAggregator -> DeleteFindingAggregator -> Bool)
-> Eq DeleteFindingAggregator
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteFindingAggregator -> DeleteFindingAggregator -> Bool
$c/= :: DeleteFindingAggregator -> DeleteFindingAggregator -> Bool
== :: DeleteFindingAggregator -> DeleteFindingAggregator -> Bool
$c== :: DeleteFindingAggregator -> DeleteFindingAggregator -> Bool
Prelude.Eq, ReadPrec [DeleteFindingAggregator]
ReadPrec DeleteFindingAggregator
Int -> ReadS DeleteFindingAggregator
ReadS [DeleteFindingAggregator]
(Int -> ReadS DeleteFindingAggregator)
-> ReadS [DeleteFindingAggregator]
-> ReadPrec DeleteFindingAggregator
-> ReadPrec [DeleteFindingAggregator]
-> Read DeleteFindingAggregator
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteFindingAggregator]
$creadListPrec :: ReadPrec [DeleteFindingAggregator]
readPrec :: ReadPrec DeleteFindingAggregator
$creadPrec :: ReadPrec DeleteFindingAggregator
readList :: ReadS [DeleteFindingAggregator]
$creadList :: ReadS [DeleteFindingAggregator]
readsPrec :: Int -> ReadS DeleteFindingAggregator
$creadsPrec :: Int -> ReadS DeleteFindingAggregator
Prelude.Read, Int -> DeleteFindingAggregator -> ShowS
[DeleteFindingAggregator] -> ShowS
DeleteFindingAggregator -> String
(Int -> DeleteFindingAggregator -> ShowS)
-> (DeleteFindingAggregator -> String)
-> ([DeleteFindingAggregator] -> ShowS)
-> Show DeleteFindingAggregator
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteFindingAggregator] -> ShowS
$cshowList :: [DeleteFindingAggregator] -> ShowS
show :: DeleteFindingAggregator -> String
$cshow :: DeleteFindingAggregator -> String
showsPrec :: Int -> DeleteFindingAggregator -> ShowS
$cshowsPrec :: Int -> DeleteFindingAggregator -> ShowS
Prelude.Show, (forall x.
 DeleteFindingAggregator -> Rep DeleteFindingAggregator x)
-> (forall x.
    Rep DeleteFindingAggregator x -> DeleteFindingAggregator)
-> Generic DeleteFindingAggregator
forall x. Rep DeleteFindingAggregator x -> DeleteFindingAggregator
forall x. DeleteFindingAggregator -> Rep DeleteFindingAggregator x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteFindingAggregator x -> DeleteFindingAggregator
$cfrom :: forall x. DeleteFindingAggregator -> Rep DeleteFindingAggregator x
Prelude.Generic)

-- |
-- Create a value of 'DeleteFindingAggregator' 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:
--
-- 'findingAggregatorArn', 'deleteFindingAggregator_findingAggregatorArn' - The ARN of the finding aggregator to delete. To obtain the ARN, use
-- @ListFindingAggregators@.
newDeleteFindingAggregator ::
  -- | 'findingAggregatorArn'
  Prelude.Text ->
  DeleteFindingAggregator
newDeleteFindingAggregator :: Text -> DeleteFindingAggregator
newDeleteFindingAggregator Text
pFindingAggregatorArn_ =
  DeleteFindingAggregator' :: Text -> DeleteFindingAggregator
DeleteFindingAggregator'
    { $sel:findingAggregatorArn:DeleteFindingAggregator' :: Text
findingAggregatorArn =
        Text
pFindingAggregatorArn_
    }

-- | The ARN of the finding aggregator to delete. To obtain the ARN, use
-- @ListFindingAggregators@.
deleteFindingAggregator_findingAggregatorArn :: Lens.Lens' DeleteFindingAggregator Prelude.Text
deleteFindingAggregator_findingAggregatorArn :: (Text -> f Text)
-> DeleteFindingAggregator -> f DeleteFindingAggregator
deleteFindingAggregator_findingAggregatorArn = (DeleteFindingAggregator -> Text)
-> (DeleteFindingAggregator -> Text -> DeleteFindingAggregator)
-> Lens DeleteFindingAggregator DeleteFindingAggregator Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteFindingAggregator' {Text
findingAggregatorArn :: Text
$sel:findingAggregatorArn:DeleteFindingAggregator' :: DeleteFindingAggregator -> Text
findingAggregatorArn} -> Text
findingAggregatorArn) (\s :: DeleteFindingAggregator
s@DeleteFindingAggregator' {} Text
a -> DeleteFindingAggregator
s {$sel:findingAggregatorArn:DeleteFindingAggregator' :: Text
findingAggregatorArn = Text
a} :: DeleteFindingAggregator)

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

instance Prelude.NFData DeleteFindingAggregator

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

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

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

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

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

instance
  Prelude.NFData
    DeleteFindingAggregatorResponse