{-# 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-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 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 Amazonka.IoT.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

-- | 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
(DeleteTopicRule -> DeleteTopicRule -> Bool)
-> (DeleteTopicRule -> DeleteTopicRule -> Bool)
-> Eq DeleteTopicRule
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]
(Int -> ReadS DeleteTopicRule)
-> ReadS [DeleteTopicRule]
-> ReadPrec DeleteTopicRule
-> ReadPrec [DeleteTopicRule]
-> Read 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
(Int -> DeleteTopicRule -> ShowS)
-> (DeleteTopicRule -> String)
-> ([DeleteTopicRule] -> ShowS)
-> Show DeleteTopicRule
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. DeleteTopicRule -> Rep DeleteTopicRule x)
-> (forall x. Rep DeleteTopicRule x -> DeleteTopicRule)
-> Generic DeleteTopicRule
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' :: Text -> DeleteTopicRule
DeleteTopicRule' {$sel:ruleName:DeleteTopicRule' :: Text
ruleName = Text
pRuleName_}

-- | The name of the rule.
deleteTopicRule_ruleName :: Lens.Lens' DeleteTopicRule Prelude.Text
deleteTopicRule_ruleName :: (Text -> f Text) -> DeleteTopicRule -> f DeleteTopicRule
deleteTopicRule_ruleName = (DeleteTopicRule -> Text)
-> (DeleteTopicRule -> Text -> DeleteTopicRule)
-> Lens DeleteTopicRule DeleteTopicRule Text Text
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 :: DeleteTopicRule -> Request DeleteTopicRule
request = Service -> DeleteTopicRule -> Request DeleteTopicRule
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteTopicRule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteTopicRule)))
response =
    AWSResponse DeleteTopicRule
-> Logger
-> Service
-> Proxy DeleteTopicRule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteTopicRule)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeleteTopicRule
DeleteTopicRuleResponse
DeleteTopicRuleResponse'

instance Prelude.Hashable DeleteTopicRule

instance Prelude.NFData DeleteTopicRule

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

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

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

-- | /See:/ 'newDeleteTopicRuleResponse' smart constructor.
data DeleteTopicRuleResponse = DeleteTopicRuleResponse'
  {
  }
  deriving (DeleteTopicRuleResponse -> DeleteTopicRuleResponse -> Bool
(DeleteTopicRuleResponse -> DeleteTopicRuleResponse -> Bool)
-> (DeleteTopicRuleResponse -> DeleteTopicRuleResponse -> Bool)
-> Eq DeleteTopicRuleResponse
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]
(Int -> ReadS DeleteTopicRuleResponse)
-> ReadS [DeleteTopicRuleResponse]
-> ReadPrec DeleteTopicRuleResponse
-> ReadPrec [DeleteTopicRuleResponse]
-> Read 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
(Int -> DeleteTopicRuleResponse -> ShowS)
-> (DeleteTopicRuleResponse -> String)
-> ([DeleteTopicRuleResponse] -> ShowS)
-> Show DeleteTopicRuleResponse
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.
 DeleteTopicRuleResponse -> Rep DeleteTopicRuleResponse x)
-> (forall x.
    Rep DeleteTopicRuleResponse x -> DeleteTopicRuleResponse)
-> Generic DeleteTopicRuleResponse
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