{-# 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.GuardDuty.DeleteFilter
-- 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 filter specified by the filter name.
module Amazonka.GuardDuty.DeleteFilter
  ( -- * Creating a Request
    DeleteFilter (..),
    newDeleteFilter,

    -- * Request Lenses
    deleteFilter_detectorId,
    deleteFilter_filterName,

    -- * Destructuring the Response
    DeleteFilterResponse (..),
    newDeleteFilterResponse,

    -- * Response Lenses
    deleteFilterResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.GuardDuty.Types
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:/ 'newDeleteFilter' smart constructor.
data DeleteFilter = DeleteFilter'
  { -- | The unique ID of the detector that the filter is associated with.
    DeleteFilter -> Text
detectorId :: Prelude.Text,
    -- | The name of the filter that you want to delete.
    DeleteFilter -> Text
filterName :: Prelude.Text
  }
  deriving (DeleteFilter -> DeleteFilter -> Bool
(DeleteFilter -> DeleteFilter -> Bool)
-> (DeleteFilter -> DeleteFilter -> Bool) -> Eq DeleteFilter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteFilter -> DeleteFilter -> Bool
$c/= :: DeleteFilter -> DeleteFilter -> Bool
== :: DeleteFilter -> DeleteFilter -> Bool
$c== :: DeleteFilter -> DeleteFilter -> Bool
Prelude.Eq, ReadPrec [DeleteFilter]
ReadPrec DeleteFilter
Int -> ReadS DeleteFilter
ReadS [DeleteFilter]
(Int -> ReadS DeleteFilter)
-> ReadS [DeleteFilter]
-> ReadPrec DeleteFilter
-> ReadPrec [DeleteFilter]
-> Read DeleteFilter
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteFilter]
$creadListPrec :: ReadPrec [DeleteFilter]
readPrec :: ReadPrec DeleteFilter
$creadPrec :: ReadPrec DeleteFilter
readList :: ReadS [DeleteFilter]
$creadList :: ReadS [DeleteFilter]
readsPrec :: Int -> ReadS DeleteFilter
$creadsPrec :: Int -> ReadS DeleteFilter
Prelude.Read, Int -> DeleteFilter -> ShowS
[DeleteFilter] -> ShowS
DeleteFilter -> String
(Int -> DeleteFilter -> ShowS)
-> (DeleteFilter -> String)
-> ([DeleteFilter] -> ShowS)
-> Show DeleteFilter
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteFilter] -> ShowS
$cshowList :: [DeleteFilter] -> ShowS
show :: DeleteFilter -> String
$cshow :: DeleteFilter -> String
showsPrec :: Int -> DeleteFilter -> ShowS
$cshowsPrec :: Int -> DeleteFilter -> ShowS
Prelude.Show, (forall x. DeleteFilter -> Rep DeleteFilter x)
-> (forall x. Rep DeleteFilter x -> DeleteFilter)
-> Generic DeleteFilter
forall x. Rep DeleteFilter x -> DeleteFilter
forall x. DeleteFilter -> Rep DeleteFilter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteFilter x -> DeleteFilter
$cfrom :: forall x. DeleteFilter -> Rep DeleteFilter x
Prelude.Generic)

-- |
-- Create a value of 'DeleteFilter' 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:
--
-- 'detectorId', 'deleteFilter_detectorId' - The unique ID of the detector that the filter is associated with.
--
-- 'filterName', 'deleteFilter_filterName' - The name of the filter that you want to delete.
newDeleteFilter ::
  -- | 'detectorId'
  Prelude.Text ->
  -- | 'filterName'
  Prelude.Text ->
  DeleteFilter
newDeleteFilter :: Text -> Text -> DeleteFilter
newDeleteFilter Text
pDetectorId_ Text
pFilterName_ =
  DeleteFilter' :: Text -> Text -> DeleteFilter
DeleteFilter'
    { $sel:detectorId:DeleteFilter' :: Text
detectorId = Text
pDetectorId_,
      $sel:filterName:DeleteFilter' :: Text
filterName = Text
pFilterName_
    }

-- | The unique ID of the detector that the filter is associated with.
deleteFilter_detectorId :: Lens.Lens' DeleteFilter Prelude.Text
deleteFilter_detectorId :: (Text -> f Text) -> DeleteFilter -> f DeleteFilter
deleteFilter_detectorId = (DeleteFilter -> Text)
-> (DeleteFilter -> Text -> DeleteFilter)
-> Lens DeleteFilter DeleteFilter Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteFilter' {Text
detectorId :: Text
$sel:detectorId:DeleteFilter' :: DeleteFilter -> Text
detectorId} -> Text
detectorId) (\s :: DeleteFilter
s@DeleteFilter' {} Text
a -> DeleteFilter
s {$sel:detectorId:DeleteFilter' :: Text
detectorId = Text
a} :: DeleteFilter)

-- | The name of the filter that you want to delete.
deleteFilter_filterName :: Lens.Lens' DeleteFilter Prelude.Text
deleteFilter_filterName :: (Text -> f Text) -> DeleteFilter -> f DeleteFilter
deleteFilter_filterName = (DeleteFilter -> Text)
-> (DeleteFilter -> Text -> DeleteFilter)
-> Lens DeleteFilter DeleteFilter Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteFilter' {Text
filterName :: Text
$sel:filterName:DeleteFilter' :: DeleteFilter -> Text
filterName} -> Text
filterName) (\s :: DeleteFilter
s@DeleteFilter' {} Text
a -> DeleteFilter
s {$sel:filterName:DeleteFilter' :: Text
filterName = Text
a} :: DeleteFilter)

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

instance Prelude.NFData DeleteFilter

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

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

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

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

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

instance Prelude.NFData DeleteFilterResponse