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

-- | The name of the rule to disable.
disableTopicRule_ruleName :: Lens.Lens' DisableTopicRule Prelude.Text
disableTopicRule_ruleName :: (Text -> f Text) -> DisableTopicRule -> f DisableTopicRule
disableTopicRule_ruleName = (DisableTopicRule -> Text)
-> (DisableTopicRule -> Text -> DisableTopicRule)
-> Lens DisableTopicRule DisableTopicRule Text Text
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 :: DisableTopicRule -> Request DisableTopicRule
request = Service -> DisableTopicRule -> Request DisableTopicRule
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DisableTopicRule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DisableTopicRule)))
response =
    AWSResponse DisableTopicRule
-> Logger
-> Service
-> Proxy DisableTopicRule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DisableTopicRule)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DisableTopicRule
DisableTopicRuleResponse
DisableTopicRuleResponse'

instance Prelude.Hashable DisableTopicRule

instance Prelude.NFData DisableTopicRule

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

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

instance Core.ToPath DisableTopicRule where
  toPath :: DisableTopicRule -> ByteString
toPath DisableTopicRule' {Text
ruleName :: Text
$sel:ruleName:DisableTopicRule' :: DisableTopicRule -> 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, ByteString
"/disable"]

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

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