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

    -- * Request Lenses
    disableTopicRule_ruleName,

    -- * Destructuring the Response
    DisableTopicRuleResponse (..),
    newDisableTopicRuleResponse,
  )
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 DisableTopicRuleRequest operation.
--
-- /See:/ 'newDisableTopicRule' smart constructor.
data DisableTopicRule = DisableTopicRule'
  { -- | The name of the rule to disable.
    DisableTopicRule -> Text
ruleName :: Prelude.Text
  }
  deriving (DisableTopicRule -> DisableTopicRule -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisableTopicRule -> DisableTopicRule -> Bool
$c/= :: DisableTopicRule -> DisableTopicRule -> Bool
== :: DisableTopicRule -> DisableTopicRule -> Bool
$c== :: DisableTopicRule -> DisableTopicRule -> Bool
Prelude.Eq, ReadPrec [DisableTopicRule]
ReadPrec DisableTopicRule
Int -> ReadS DisableTopicRule
ReadS [DisableTopicRule]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisableTopicRule]
$creadListPrec :: ReadPrec [DisableTopicRule]
readPrec :: ReadPrec DisableTopicRule
$creadPrec :: ReadPrec DisableTopicRule
readList :: ReadS [DisableTopicRule]
$creadList :: ReadS [DisableTopicRule]
readsPrec :: Int -> ReadS DisableTopicRule
$creadsPrec :: Int -> ReadS DisableTopicRule
Prelude.Read, Int -> DisableTopicRule -> ShowS
[DisableTopicRule] -> ShowS
DisableTopicRule -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisableTopicRule] -> ShowS
$cshowList :: [DisableTopicRule] -> ShowS
show :: DisableTopicRule -> String
$cshow :: DisableTopicRule -> String
showsPrec :: Int -> DisableTopicRule -> ShowS
$cshowsPrec :: Int -> DisableTopicRule -> ShowS
Prelude.Show, forall x. Rep DisableTopicRule x -> DisableTopicRule
forall x. DisableTopicRule -> Rep DisableTopicRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DisableTopicRule x -> DisableTopicRule
$cfrom :: forall x. DisableTopicRule -> Rep DisableTopicRule x
Prelude.Generic)

-- |
-- Create a value of 'DisableTopicRule' 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', 'disableTopicRule_ruleName' - The name of the rule to disable.
newDisableTopicRule ::
  -- | 'ruleName'
  Prelude.Text ->
  DisableTopicRule
newDisableTopicRule :: Text -> DisableTopicRule
newDisableTopicRule Text
pRuleName_ =
  DisableTopicRule' {$sel:ruleName:DisableTopicRule' :: Text
ruleName = Text
pRuleName_}

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

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

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

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

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

instance Data.ToJSON DisableTopicRule where
  toJSON :: DisableTopicRule -> Value
toJSON = forall a b. a -> b -> a
Prelude.const (Object -> Value
Data.Object forall a. Monoid a => a
Prelude.mempty)

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

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

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

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

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