{-# 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.IoT.DeleteTopicRule
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes the rule.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions DeleteTopicRule>
-- action.
module Amazonka.IoT.DeleteTopicRule
  ( -- * Creating a Request
    DeleteTopicRule (..),
    newDeleteTopicRule,

    -- * Request Lenses
    deleteTopicRule_ruleName,

    -- * Destructuring the Response
    DeleteTopicRuleResponse (..),
    newDeleteTopicRuleResponse,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoT.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | The input for the DeleteTopicRule operation.
--
-- /See:/ 'newDeleteTopicRule' smart constructor.
data DeleteTopicRule = DeleteTopicRule'
  { -- | The name of the rule.
    DeleteTopicRule -> Text
ruleName :: Prelude.Text
  }
  deriving (DeleteTopicRule -> DeleteTopicRule -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteTopicRule -> DeleteTopicRule -> Bool
$c/= :: DeleteTopicRule -> DeleteTopicRule -> Bool
== :: DeleteTopicRule -> DeleteTopicRule -> Bool
$c== :: DeleteTopicRule -> DeleteTopicRule -> Bool
Prelude.Eq, ReadPrec [DeleteTopicRule]
ReadPrec DeleteTopicRule
Int -> ReadS DeleteTopicRule
ReadS [DeleteTopicRule]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteTopicRule]
$creadListPrec :: ReadPrec [DeleteTopicRule]
readPrec :: ReadPrec DeleteTopicRule
$creadPrec :: ReadPrec DeleteTopicRule
readList :: ReadS [DeleteTopicRule]
$creadList :: ReadS [DeleteTopicRule]
readsPrec :: Int -> ReadS DeleteTopicRule
$creadsPrec :: Int -> ReadS DeleteTopicRule
Prelude.Read, Int -> DeleteTopicRule -> ShowS
[DeleteTopicRule] -> ShowS
DeleteTopicRule -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteTopicRule] -> ShowS
$cshowList :: [DeleteTopicRule] -> ShowS
show :: DeleteTopicRule -> String
$cshow :: DeleteTopicRule -> String
showsPrec :: Int -> DeleteTopicRule -> ShowS
$cshowsPrec :: Int -> DeleteTopicRule -> ShowS
Prelude.Show, forall x. Rep DeleteTopicRule x -> DeleteTopicRule
forall x. DeleteTopicRule -> Rep DeleteTopicRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteTopicRule x -> DeleteTopicRule
$cfrom :: forall x. DeleteTopicRule -> Rep DeleteTopicRule x
Prelude.Generic)

-- |
-- Create a value of 'DeleteTopicRule' 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:
--
-- 'ruleName', 'deleteTopicRule_ruleName' - The name of the rule.
newDeleteTopicRule ::
  -- | 'ruleName'
  Prelude.Text ->
  DeleteTopicRule
newDeleteTopicRule :: Text -> DeleteTopicRule
newDeleteTopicRule Text
pRuleName_ =
  DeleteTopicRule' {$sel:ruleName:DeleteTopicRule' :: Text
ruleName = Text
pRuleName_}

-- | The name of the rule.
deleteTopicRule_ruleName :: Lens.Lens' DeleteTopicRule Prelude.Text
deleteTopicRule_ruleName :: Lens' DeleteTopicRule Text
deleteTopicRule_ruleName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteTopicRule' {Text
ruleName :: Text
$sel:ruleName:DeleteTopicRule' :: DeleteTopicRule -> Text
ruleName} -> Text
ruleName) (\s :: DeleteTopicRule
s@DeleteTopicRule' {} Text
a -> DeleteTopicRule
s {$sel:ruleName:DeleteTopicRule' :: Text
ruleName = Text
a} :: DeleteTopicRule)

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

instance Prelude.Hashable DeleteTopicRule where
  hashWithSalt :: Int -> DeleteTopicRule -> Int
hashWithSalt Int
_salt DeleteTopicRule' {Text
ruleName :: Text
$sel:ruleName:DeleteTopicRule' :: DeleteTopicRule -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
ruleName

instance Prelude.NFData DeleteTopicRule where
  rnf :: DeleteTopicRule -> ()
rnf DeleteTopicRule' {Text
ruleName :: Text
$sel:ruleName:DeleteTopicRule' :: DeleteTopicRule -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
ruleName

instance Data.ToHeaders DeleteTopicRule where
  toHeaders :: DeleteTopicRule -> [Header]
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance Data.ToPath DeleteTopicRule where
  toPath :: DeleteTopicRule -> ByteString
toPath DeleteTopicRule' {Text
ruleName :: Text
$sel:ruleName:DeleteTopicRule' :: DeleteTopicRule -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/rules/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
ruleName]

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

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

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

instance Prelude.NFData DeleteTopicRuleResponse where
  rnf :: DeleteTopicRuleResponse -> ()
rnf DeleteTopicRuleResponse
_ = ()