{-# 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.Personalize.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 a filter.
module Amazonka.Personalize.DeleteFilter
  ( -- * Creating a Request
    DeleteFilter (..),
    newDeleteFilter,

    -- * Request Lenses
    deleteFilter_filterArn,

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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Personalize.Types
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 ARN of the filter to delete.
    DeleteFilter -> Text
filterArn :: 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:
--
-- 'filterArn', 'deleteFilter_filterArn' - The ARN of the filter to delete.
newDeleteFilter ::
  -- | 'filterArn'
  Prelude.Text ->
  DeleteFilter
newDeleteFilter :: Text -> DeleteFilter
newDeleteFilter Text
pFilterArn_ =
  DeleteFilter' :: Text -> DeleteFilter
DeleteFilter' {$sel:filterArn:DeleteFilter' :: Text
filterArn = Text
pFilterArn_}

-- | The ARN of the filter to delete.
deleteFilter_filterArn :: Lens.Lens' DeleteFilter Prelude.Text
deleteFilter_filterArn :: (Text -> f Text) -> DeleteFilter -> f DeleteFilter
deleteFilter_filterArn = (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
filterArn :: Text
$sel:filterArn:DeleteFilter' :: DeleteFilter -> Text
filterArn} -> Text
filterArn) (\s :: DeleteFilter
s@DeleteFilter' {} Text
a -> DeleteFilter
s {$sel:filterArn:DeleteFilter' :: Text
filterArn = 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, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteFilter
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteFilter)))
response = AWSResponse DeleteFilter
-> Logger
-> Service
-> Proxy DeleteFilter
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteFilter)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeleteFilter
DeleteFilterResponse
DeleteFilterResponse'

instance Prelude.Hashable DeleteFilter

instance Prelude.NFData DeleteFilter

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

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

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'
  {
  }
  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.
newDeleteFilterResponse ::
  DeleteFilterResponse
newDeleteFilterResponse :: DeleteFilterResponse
newDeleteFilterResponse = DeleteFilterResponse
DeleteFilterResponse'

instance Prelude.NFData DeleteFilterResponse