{-# 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.IoTWireless.DeleteQueuedMessages
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Remove queued messages from the downlink queue.
module Amazonka.IoTWireless.DeleteQueuedMessages
  ( -- * Creating a Request
    DeleteQueuedMessages (..),
    newDeleteQueuedMessages,

    -- * Request Lenses
    deleteQueuedMessages_wirelessDeviceType,
    deleteQueuedMessages_id,
    deleteQueuedMessages_messageId,

    -- * Destructuring the Response
    DeleteQueuedMessagesResponse (..),
    newDeleteQueuedMessagesResponse,

    -- * Response Lenses
    deleteQueuedMessagesResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeleteQueuedMessages' smart constructor.
data DeleteQueuedMessages = DeleteQueuedMessages'
  { -- | The wireless device type, which can be either Sidewalk or LoRaWAN.
    DeleteQueuedMessages -> Maybe WirelessDeviceType
wirelessDeviceType :: Prelude.Maybe WirelessDeviceType,
    -- | The ID of a given wireless device for which downlink messages will be
    -- deleted.
    DeleteQueuedMessages -> Text
id :: Prelude.Text,
    -- | If message ID is @\"*\"@, it cleares the entire downlink queue for a
    -- given device, specified by the wireless device ID. Otherwise, the
    -- downlink message with the specified message ID will be deleted.
    DeleteQueuedMessages -> Text
messageId :: Prelude.Text
  }
  deriving (DeleteQueuedMessages -> DeleteQueuedMessages -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteQueuedMessages -> DeleteQueuedMessages -> Bool
$c/= :: DeleteQueuedMessages -> DeleteQueuedMessages -> Bool
== :: DeleteQueuedMessages -> DeleteQueuedMessages -> Bool
$c== :: DeleteQueuedMessages -> DeleteQueuedMessages -> Bool
Prelude.Eq, ReadPrec [DeleteQueuedMessages]
ReadPrec DeleteQueuedMessages
Int -> ReadS DeleteQueuedMessages
ReadS [DeleteQueuedMessages]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteQueuedMessages]
$creadListPrec :: ReadPrec [DeleteQueuedMessages]
readPrec :: ReadPrec DeleteQueuedMessages
$creadPrec :: ReadPrec DeleteQueuedMessages
readList :: ReadS [DeleteQueuedMessages]
$creadList :: ReadS [DeleteQueuedMessages]
readsPrec :: Int -> ReadS DeleteQueuedMessages
$creadsPrec :: Int -> ReadS DeleteQueuedMessages
Prelude.Read, Int -> DeleteQueuedMessages -> ShowS
[DeleteQueuedMessages] -> ShowS
DeleteQueuedMessages -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteQueuedMessages] -> ShowS
$cshowList :: [DeleteQueuedMessages] -> ShowS
show :: DeleteQueuedMessages -> String
$cshow :: DeleteQueuedMessages -> String
showsPrec :: Int -> DeleteQueuedMessages -> ShowS
$cshowsPrec :: Int -> DeleteQueuedMessages -> ShowS
Prelude.Show, forall x. Rep DeleteQueuedMessages x -> DeleteQueuedMessages
forall x. DeleteQueuedMessages -> Rep DeleteQueuedMessages x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteQueuedMessages x -> DeleteQueuedMessages
$cfrom :: forall x. DeleteQueuedMessages -> Rep DeleteQueuedMessages x
Prelude.Generic)

-- |
-- Create a value of 'DeleteQueuedMessages' 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:
--
-- 'wirelessDeviceType', 'deleteQueuedMessages_wirelessDeviceType' - The wireless device type, which can be either Sidewalk or LoRaWAN.
--
-- 'id', 'deleteQueuedMessages_id' - The ID of a given wireless device for which downlink messages will be
-- deleted.
--
-- 'messageId', 'deleteQueuedMessages_messageId' - If message ID is @\"*\"@, it cleares the entire downlink queue for a
-- given device, specified by the wireless device ID. Otherwise, the
-- downlink message with the specified message ID will be deleted.
newDeleteQueuedMessages ::
  -- | 'id'
  Prelude.Text ->
  -- | 'messageId'
  Prelude.Text ->
  DeleteQueuedMessages
newDeleteQueuedMessages :: Text -> Text -> DeleteQueuedMessages
newDeleteQueuedMessages Text
pId_ Text
pMessageId_ =
  DeleteQueuedMessages'
    { $sel:wirelessDeviceType:DeleteQueuedMessages' :: Maybe WirelessDeviceType
wirelessDeviceType =
        forall a. Maybe a
Prelude.Nothing,
      $sel:id:DeleteQueuedMessages' :: Text
id = Text
pId_,
      $sel:messageId:DeleteQueuedMessages' :: Text
messageId = Text
pMessageId_
    }

-- | The wireless device type, which can be either Sidewalk or LoRaWAN.
deleteQueuedMessages_wirelessDeviceType :: Lens.Lens' DeleteQueuedMessages (Prelude.Maybe WirelessDeviceType)
deleteQueuedMessages_wirelessDeviceType :: Lens' DeleteQueuedMessages (Maybe WirelessDeviceType)
deleteQueuedMessages_wirelessDeviceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteQueuedMessages' {Maybe WirelessDeviceType
wirelessDeviceType :: Maybe WirelessDeviceType
$sel:wirelessDeviceType:DeleteQueuedMessages' :: DeleteQueuedMessages -> Maybe WirelessDeviceType
wirelessDeviceType} -> Maybe WirelessDeviceType
wirelessDeviceType) (\s :: DeleteQueuedMessages
s@DeleteQueuedMessages' {} Maybe WirelessDeviceType
a -> DeleteQueuedMessages
s {$sel:wirelessDeviceType:DeleteQueuedMessages' :: Maybe WirelessDeviceType
wirelessDeviceType = Maybe WirelessDeviceType
a} :: DeleteQueuedMessages)

-- | The ID of a given wireless device for which downlink messages will be
-- deleted.
deleteQueuedMessages_id :: Lens.Lens' DeleteQueuedMessages Prelude.Text
deleteQueuedMessages_id :: Lens' DeleteQueuedMessages Text
deleteQueuedMessages_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteQueuedMessages' {Text
id :: Text
$sel:id:DeleteQueuedMessages' :: DeleteQueuedMessages -> Text
id} -> Text
id) (\s :: DeleteQueuedMessages
s@DeleteQueuedMessages' {} Text
a -> DeleteQueuedMessages
s {$sel:id:DeleteQueuedMessages' :: Text
id = Text
a} :: DeleteQueuedMessages)

-- | If message ID is @\"*\"@, it cleares the entire downlink queue for a
-- given device, specified by the wireless device ID. Otherwise, the
-- downlink message with the specified message ID will be deleted.
deleteQueuedMessages_messageId :: Lens.Lens' DeleteQueuedMessages Prelude.Text
deleteQueuedMessages_messageId :: Lens' DeleteQueuedMessages Text
deleteQueuedMessages_messageId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteQueuedMessages' {Text
messageId :: Text
$sel:messageId:DeleteQueuedMessages' :: DeleteQueuedMessages -> Text
messageId} -> Text
messageId) (\s :: DeleteQueuedMessages
s@DeleteQueuedMessages' {} Text
a -> DeleteQueuedMessages
s {$sel:messageId:DeleteQueuedMessages' :: Text
messageId = Text
a} :: DeleteQueuedMessages)

instance Core.AWSRequest DeleteQueuedMessages where
  type
    AWSResponse DeleteQueuedMessages =
      DeleteQueuedMessagesResponse
  request :: (Service -> Service)
-> DeleteQueuedMessages -> Request DeleteQueuedMessages
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 DeleteQueuedMessages
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteQueuedMessages)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteQueuedMessagesResponse
DeleteQueuedMessagesResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteQueuedMessages where
  hashWithSalt :: Int -> DeleteQueuedMessages -> Int
hashWithSalt Int
_salt DeleteQueuedMessages' {Maybe WirelessDeviceType
Text
messageId :: Text
id :: Text
wirelessDeviceType :: Maybe WirelessDeviceType
$sel:messageId:DeleteQueuedMessages' :: DeleteQueuedMessages -> Text
$sel:id:DeleteQueuedMessages' :: DeleteQueuedMessages -> Text
$sel:wirelessDeviceType:DeleteQueuedMessages' :: DeleteQueuedMessages -> Maybe WirelessDeviceType
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe WirelessDeviceType
wirelessDeviceType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
messageId

instance Prelude.NFData DeleteQueuedMessages where
  rnf :: DeleteQueuedMessages -> ()
rnf DeleteQueuedMessages' {Maybe WirelessDeviceType
Text
messageId :: Text
id :: Text
wirelessDeviceType :: Maybe WirelessDeviceType
$sel:messageId:DeleteQueuedMessages' :: DeleteQueuedMessages -> Text
$sel:id:DeleteQueuedMessages' :: DeleteQueuedMessages -> Text
$sel:wirelessDeviceType:DeleteQueuedMessages' :: DeleteQueuedMessages -> Maybe WirelessDeviceType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe WirelessDeviceType
wirelessDeviceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
messageId

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

instance Data.ToPath DeleteQueuedMessages where
  toPath :: DeleteQueuedMessages -> ByteString
toPath DeleteQueuedMessages' {Maybe WirelessDeviceType
Text
messageId :: Text
id :: Text
wirelessDeviceType :: Maybe WirelessDeviceType
$sel:messageId:DeleteQueuedMessages' :: DeleteQueuedMessages -> Text
$sel:id:DeleteQueuedMessages' :: DeleteQueuedMessages -> Text
$sel:wirelessDeviceType:DeleteQueuedMessages' :: DeleteQueuedMessages -> Maybe WirelessDeviceType
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/wireless-devices/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
id, ByteString
"/data"]

instance Data.ToQuery DeleteQueuedMessages where
  toQuery :: DeleteQueuedMessages -> QueryString
toQuery DeleteQueuedMessages' {Maybe WirelessDeviceType
Text
messageId :: Text
id :: Text
wirelessDeviceType :: Maybe WirelessDeviceType
$sel:messageId:DeleteQueuedMessages' :: DeleteQueuedMessages -> Text
$sel:id:DeleteQueuedMessages' :: DeleteQueuedMessages -> Text
$sel:wirelessDeviceType:DeleteQueuedMessages' :: DeleteQueuedMessages -> Maybe WirelessDeviceType
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"WirelessDeviceType" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe WirelessDeviceType
wirelessDeviceType,
        ByteString
"messageId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
messageId
      ]

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

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

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

instance Prelude.NFData DeleteQueuedMessagesResponse where
  rnf :: DeleteQueuedMessagesResponse -> ()
rnf DeleteQueuedMessagesResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteQueuedMessagesResponse' :: DeleteQueuedMessagesResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus