{-# 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.DeleteTopicRuleDestination
-- 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 topic rule destination.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions DeleteTopicRuleDestination>
-- action.
module Amazonka.IoT.DeleteTopicRuleDestination
  ( -- * Creating a Request
    DeleteTopicRuleDestination (..),
    newDeleteTopicRuleDestination,

    -- * Request Lenses
    deleteTopicRuleDestination_arn,

    -- * Destructuring the Response
    DeleteTopicRuleDestinationResponse (..),
    newDeleteTopicRuleDestinationResponse,

    -- * Response Lenses
    deleteTopicRuleDestinationResponse_httpStatus,
  )
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

-- | /See:/ 'newDeleteTopicRuleDestination' smart constructor.
data DeleteTopicRuleDestination = DeleteTopicRuleDestination'
  { -- | The ARN of the topic rule destination to delete.
    DeleteTopicRuleDestination -> Text
arn :: Prelude.Text
  }
  deriving (DeleteTopicRuleDestination -> DeleteTopicRuleDestination -> Bool
(DeleteTopicRuleDestination -> DeleteTopicRuleDestination -> Bool)
-> (DeleteTopicRuleDestination
    -> DeleteTopicRuleDestination -> Bool)
-> Eq DeleteTopicRuleDestination
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteTopicRuleDestination -> DeleteTopicRuleDestination -> Bool
$c/= :: DeleteTopicRuleDestination -> DeleteTopicRuleDestination -> Bool
== :: DeleteTopicRuleDestination -> DeleteTopicRuleDestination -> Bool
$c== :: DeleteTopicRuleDestination -> DeleteTopicRuleDestination -> Bool
Prelude.Eq, ReadPrec [DeleteTopicRuleDestination]
ReadPrec DeleteTopicRuleDestination
Int -> ReadS DeleteTopicRuleDestination
ReadS [DeleteTopicRuleDestination]
(Int -> ReadS DeleteTopicRuleDestination)
-> ReadS [DeleteTopicRuleDestination]
-> ReadPrec DeleteTopicRuleDestination
-> ReadPrec [DeleteTopicRuleDestination]
-> Read DeleteTopicRuleDestination
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteTopicRuleDestination]
$creadListPrec :: ReadPrec [DeleteTopicRuleDestination]
readPrec :: ReadPrec DeleteTopicRuleDestination
$creadPrec :: ReadPrec DeleteTopicRuleDestination
readList :: ReadS [DeleteTopicRuleDestination]
$creadList :: ReadS [DeleteTopicRuleDestination]
readsPrec :: Int -> ReadS DeleteTopicRuleDestination
$creadsPrec :: Int -> ReadS DeleteTopicRuleDestination
Prelude.Read, Int -> DeleteTopicRuleDestination -> ShowS
[DeleteTopicRuleDestination] -> ShowS
DeleteTopicRuleDestination -> String
(Int -> DeleteTopicRuleDestination -> ShowS)
-> (DeleteTopicRuleDestination -> String)
-> ([DeleteTopicRuleDestination] -> ShowS)
-> Show DeleteTopicRuleDestination
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteTopicRuleDestination] -> ShowS
$cshowList :: [DeleteTopicRuleDestination] -> ShowS
show :: DeleteTopicRuleDestination -> String
$cshow :: DeleteTopicRuleDestination -> String
showsPrec :: Int -> DeleteTopicRuleDestination -> ShowS
$cshowsPrec :: Int -> DeleteTopicRuleDestination -> ShowS
Prelude.Show, (forall x.
 DeleteTopicRuleDestination -> Rep DeleteTopicRuleDestination x)
-> (forall x.
    Rep DeleteTopicRuleDestination x -> DeleteTopicRuleDestination)
-> Generic DeleteTopicRuleDestination
forall x.
Rep DeleteTopicRuleDestination x -> DeleteTopicRuleDestination
forall x.
DeleteTopicRuleDestination -> Rep DeleteTopicRuleDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteTopicRuleDestination x -> DeleteTopicRuleDestination
$cfrom :: forall x.
DeleteTopicRuleDestination -> Rep DeleteTopicRuleDestination x
Prelude.Generic)

-- |
-- Create a value of 'DeleteTopicRuleDestination' 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:
--
-- 'arn', 'deleteTopicRuleDestination_arn' - The ARN of the topic rule destination to delete.
newDeleteTopicRuleDestination ::
  -- | 'arn'
  Prelude.Text ->
  DeleteTopicRuleDestination
newDeleteTopicRuleDestination :: Text -> DeleteTopicRuleDestination
newDeleteTopicRuleDestination Text
pArn_ =
  DeleteTopicRuleDestination' :: Text -> DeleteTopicRuleDestination
DeleteTopicRuleDestination' {$sel:arn:DeleteTopicRuleDestination' :: Text
arn = Text
pArn_}

-- | The ARN of the topic rule destination to delete.
deleteTopicRuleDestination_arn :: Lens.Lens' DeleteTopicRuleDestination Prelude.Text
deleteTopicRuleDestination_arn :: (Text -> f Text)
-> DeleteTopicRuleDestination -> f DeleteTopicRuleDestination
deleteTopicRuleDestination_arn = (DeleteTopicRuleDestination -> Text)
-> (DeleteTopicRuleDestination
    -> Text -> DeleteTopicRuleDestination)
-> Lens
     DeleteTopicRuleDestination DeleteTopicRuleDestination Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteTopicRuleDestination' {Text
arn :: Text
$sel:arn:DeleteTopicRuleDestination' :: DeleteTopicRuleDestination -> Text
arn} -> Text
arn) (\s :: DeleteTopicRuleDestination
s@DeleteTopicRuleDestination' {} Text
a -> DeleteTopicRuleDestination
s {$sel:arn:DeleteTopicRuleDestination' :: Text
arn = Text
a} :: DeleteTopicRuleDestination)

instance Core.AWSRequest DeleteTopicRuleDestination where
  type
    AWSResponse DeleteTopicRuleDestination =
      DeleteTopicRuleDestinationResponse
  request :: DeleteTopicRuleDestination -> Request DeleteTopicRuleDestination
request = Service
-> DeleteTopicRuleDestination -> Request DeleteTopicRuleDestination
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteTopicRuleDestination
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteTopicRuleDestination)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteTopicRuleDestination))
-> Logger
-> Service
-> Proxy DeleteTopicRuleDestination
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteTopicRuleDestination)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteTopicRuleDestinationResponse
DeleteTopicRuleDestinationResponse'
            (Int -> DeleteTopicRuleDestinationResponse)
-> Either String Int
-> Either String DeleteTopicRuleDestinationResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteTopicRuleDestination

instance Prelude.NFData DeleteTopicRuleDestination

instance Core.ToHeaders DeleteTopicRuleDestination where
  toHeaders :: DeleteTopicRuleDestination -> ResponseHeaders
toHeaders = ResponseHeaders -> DeleteTopicRuleDestination -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

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

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

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

-- |
-- Create a value of 'DeleteTopicRuleDestinationResponse' 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:
--
-- 'httpStatus', 'deleteTopicRuleDestinationResponse_httpStatus' - The response's http status code.
newDeleteTopicRuleDestinationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteTopicRuleDestinationResponse
newDeleteTopicRuleDestinationResponse :: Int -> DeleteTopicRuleDestinationResponse
newDeleteTopicRuleDestinationResponse Int
pHttpStatus_ =
  DeleteTopicRuleDestinationResponse' :: Int -> DeleteTopicRuleDestinationResponse
DeleteTopicRuleDestinationResponse'
    { $sel:httpStatus:DeleteTopicRuleDestinationResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deleteTopicRuleDestinationResponse_httpStatus :: Lens.Lens' DeleteTopicRuleDestinationResponse Prelude.Int
deleteTopicRuleDestinationResponse_httpStatus :: (Int -> f Int)
-> DeleteTopicRuleDestinationResponse
-> f DeleteTopicRuleDestinationResponse
deleteTopicRuleDestinationResponse_httpStatus = (DeleteTopicRuleDestinationResponse -> Int)
-> (DeleteTopicRuleDestinationResponse
    -> Int -> DeleteTopicRuleDestinationResponse)
-> Lens
     DeleteTopicRuleDestinationResponse
     DeleteTopicRuleDestinationResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteTopicRuleDestinationResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteTopicRuleDestinationResponse' :: DeleteTopicRuleDestinationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteTopicRuleDestinationResponse
s@DeleteTopicRuleDestinationResponse' {} Int
a -> DeleteTopicRuleDestinationResponse
s {$sel:httpStatus:DeleteTopicRuleDestinationResponse' :: Int
httpStatus = Int
a} :: DeleteTopicRuleDestinationResponse)

instance
  Prelude.NFData
    DeleteTopicRuleDestinationResponse