{-# 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.ChimeSDKMessaging.DeleteChannelMessage
-- 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 channel message. Only admins can perform this action. Deletion
-- makes messages inaccessible immediately. A background process deletes
-- any revisions created by @UpdateChannelMessage@.
--
-- The @x-amz-chime-bearer@ request header is mandatory. Use the
-- @AppInstanceUserArn@ of the user that makes the API call as the value in
-- the header.
module Amazonka.ChimeSDKMessaging.DeleteChannelMessage
  ( -- * Creating a Request
    DeleteChannelMessage (..),
    newDeleteChannelMessage,

    -- * Request Lenses
    deleteChannelMessage_channelArn,
    deleteChannelMessage_messageId,
    deleteChannelMessage_chimeBearer,

    -- * Destructuring the Response
    DeleteChannelMessageResponse (..),
    newDeleteChannelMessageResponse,
  )
where

import Amazonka.ChimeSDKMessaging.Types
import qualified Amazonka.Core as Core
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:/ 'newDeleteChannelMessage' smart constructor.
data DeleteChannelMessage = DeleteChannelMessage'
  { -- | The ARN of the channel.
    DeleteChannelMessage -> Text
channelArn :: Prelude.Text,
    -- | The ID of the message being deleted.
    DeleteChannelMessage -> Text
messageId :: Prelude.Text,
    -- | The @AppInstanceUserArn@ of the user that makes the API call.
    DeleteChannelMessage -> Text
chimeBearer :: Prelude.Text
  }
  deriving (DeleteChannelMessage -> DeleteChannelMessage -> Bool
(DeleteChannelMessage -> DeleteChannelMessage -> Bool)
-> (DeleteChannelMessage -> DeleteChannelMessage -> Bool)
-> Eq DeleteChannelMessage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteChannelMessage -> DeleteChannelMessage -> Bool
$c/= :: DeleteChannelMessage -> DeleteChannelMessage -> Bool
== :: DeleteChannelMessage -> DeleteChannelMessage -> Bool
$c== :: DeleteChannelMessage -> DeleteChannelMessage -> Bool
Prelude.Eq, ReadPrec [DeleteChannelMessage]
ReadPrec DeleteChannelMessage
Int -> ReadS DeleteChannelMessage
ReadS [DeleteChannelMessage]
(Int -> ReadS DeleteChannelMessage)
-> ReadS [DeleteChannelMessage]
-> ReadPrec DeleteChannelMessage
-> ReadPrec [DeleteChannelMessage]
-> Read DeleteChannelMessage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteChannelMessage]
$creadListPrec :: ReadPrec [DeleteChannelMessage]
readPrec :: ReadPrec DeleteChannelMessage
$creadPrec :: ReadPrec DeleteChannelMessage
readList :: ReadS [DeleteChannelMessage]
$creadList :: ReadS [DeleteChannelMessage]
readsPrec :: Int -> ReadS DeleteChannelMessage
$creadsPrec :: Int -> ReadS DeleteChannelMessage
Prelude.Read, Int -> DeleteChannelMessage -> ShowS
[DeleteChannelMessage] -> ShowS
DeleteChannelMessage -> String
(Int -> DeleteChannelMessage -> ShowS)
-> (DeleteChannelMessage -> String)
-> ([DeleteChannelMessage] -> ShowS)
-> Show DeleteChannelMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteChannelMessage] -> ShowS
$cshowList :: [DeleteChannelMessage] -> ShowS
show :: DeleteChannelMessage -> String
$cshow :: DeleteChannelMessage -> String
showsPrec :: Int -> DeleteChannelMessage -> ShowS
$cshowsPrec :: Int -> DeleteChannelMessage -> ShowS
Prelude.Show, (forall x. DeleteChannelMessage -> Rep DeleteChannelMessage x)
-> (forall x. Rep DeleteChannelMessage x -> DeleteChannelMessage)
-> Generic DeleteChannelMessage
forall x. Rep DeleteChannelMessage x -> DeleteChannelMessage
forall x. DeleteChannelMessage -> Rep DeleteChannelMessage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteChannelMessage x -> DeleteChannelMessage
$cfrom :: forall x. DeleteChannelMessage -> Rep DeleteChannelMessage x
Prelude.Generic)

-- |
-- Create a value of 'DeleteChannelMessage' 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:
--
-- 'channelArn', 'deleteChannelMessage_channelArn' - The ARN of the channel.
--
-- 'messageId', 'deleteChannelMessage_messageId' - The ID of the message being deleted.
--
-- 'chimeBearer', 'deleteChannelMessage_chimeBearer' - The @AppInstanceUserArn@ of the user that makes the API call.
newDeleteChannelMessage ::
  -- | 'channelArn'
  Prelude.Text ->
  -- | 'messageId'
  Prelude.Text ->
  -- | 'chimeBearer'
  Prelude.Text ->
  DeleteChannelMessage
newDeleteChannelMessage :: Text -> Text -> Text -> DeleteChannelMessage
newDeleteChannelMessage
  Text
pChannelArn_
  Text
pMessageId_
  Text
pChimeBearer_ =
    DeleteChannelMessage' :: Text -> Text -> Text -> DeleteChannelMessage
DeleteChannelMessage'
      { $sel:channelArn:DeleteChannelMessage' :: Text
channelArn = Text
pChannelArn_,
        $sel:messageId:DeleteChannelMessage' :: Text
messageId = Text
pMessageId_,
        $sel:chimeBearer:DeleteChannelMessage' :: Text
chimeBearer = Text
pChimeBearer_
      }

-- | The ARN of the channel.
deleteChannelMessage_channelArn :: Lens.Lens' DeleteChannelMessage Prelude.Text
deleteChannelMessage_channelArn :: (Text -> f Text) -> DeleteChannelMessage -> f DeleteChannelMessage
deleteChannelMessage_channelArn = (DeleteChannelMessage -> Text)
-> (DeleteChannelMessage -> Text -> DeleteChannelMessage)
-> Lens DeleteChannelMessage DeleteChannelMessage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteChannelMessage' {Text
channelArn :: Text
$sel:channelArn:DeleteChannelMessage' :: DeleteChannelMessage -> Text
channelArn} -> Text
channelArn) (\s :: DeleteChannelMessage
s@DeleteChannelMessage' {} Text
a -> DeleteChannelMessage
s {$sel:channelArn:DeleteChannelMessage' :: Text
channelArn = Text
a} :: DeleteChannelMessage)

-- | The ID of the message being deleted.
deleteChannelMessage_messageId :: Lens.Lens' DeleteChannelMessage Prelude.Text
deleteChannelMessage_messageId :: (Text -> f Text) -> DeleteChannelMessage -> f DeleteChannelMessage
deleteChannelMessage_messageId = (DeleteChannelMessage -> Text)
-> (DeleteChannelMessage -> Text -> DeleteChannelMessage)
-> Lens DeleteChannelMessage DeleteChannelMessage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteChannelMessage' {Text
messageId :: Text
$sel:messageId:DeleteChannelMessage' :: DeleteChannelMessage -> Text
messageId} -> Text
messageId) (\s :: DeleteChannelMessage
s@DeleteChannelMessage' {} Text
a -> DeleteChannelMessage
s {$sel:messageId:DeleteChannelMessage' :: Text
messageId = Text
a} :: DeleteChannelMessage)

-- | The @AppInstanceUserArn@ of the user that makes the API call.
deleteChannelMessage_chimeBearer :: Lens.Lens' DeleteChannelMessage Prelude.Text
deleteChannelMessage_chimeBearer :: (Text -> f Text) -> DeleteChannelMessage -> f DeleteChannelMessage
deleteChannelMessage_chimeBearer = (DeleteChannelMessage -> Text)
-> (DeleteChannelMessage -> Text -> DeleteChannelMessage)
-> Lens DeleteChannelMessage DeleteChannelMessage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteChannelMessage' {Text
chimeBearer :: Text
$sel:chimeBearer:DeleteChannelMessage' :: DeleteChannelMessage -> Text
chimeBearer} -> Text
chimeBearer) (\s :: DeleteChannelMessage
s@DeleteChannelMessage' {} Text
a -> DeleteChannelMessage
s {$sel:chimeBearer:DeleteChannelMessage' :: Text
chimeBearer = Text
a} :: DeleteChannelMessage)

instance Core.AWSRequest DeleteChannelMessage where
  type
    AWSResponse DeleteChannelMessage =
      DeleteChannelMessageResponse
  request :: DeleteChannelMessage -> Request DeleteChannelMessage
request = Service -> DeleteChannelMessage -> Request DeleteChannelMessage
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteChannelMessage
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteChannelMessage)))
response =
    AWSResponse DeleteChannelMessage
-> Logger
-> Service
-> Proxy DeleteChannelMessage
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteChannelMessage)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeleteChannelMessage
DeleteChannelMessageResponse
DeleteChannelMessageResponse'

instance Prelude.Hashable DeleteChannelMessage

instance Prelude.NFData DeleteChannelMessage

instance Core.ToHeaders DeleteChannelMessage where
  toHeaders :: DeleteChannelMessage -> [Header]
toHeaders DeleteChannelMessage' {Text
chimeBearer :: Text
messageId :: Text
channelArn :: Text
$sel:chimeBearer:DeleteChannelMessage' :: DeleteChannelMessage -> Text
$sel:messageId:DeleteChannelMessage' :: DeleteChannelMessage -> Text
$sel:channelArn:DeleteChannelMessage' :: DeleteChannelMessage -> Text
..} =
    [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [HeaderName
"x-amz-chime-bearer" HeaderName -> Text -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# Text
chimeBearer]

instance Core.ToPath DeleteChannelMessage where
  toPath :: DeleteChannelMessage -> ByteString
toPath DeleteChannelMessage' {Text
chimeBearer :: Text
messageId :: Text
channelArn :: Text
$sel:chimeBearer:DeleteChannelMessage' :: DeleteChannelMessage -> Text
$sel:messageId:DeleteChannelMessage' :: DeleteChannelMessage -> Text
$sel:channelArn:DeleteChannelMessage' :: DeleteChannelMessage -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/channels/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
channelArn,
        ByteString
"/messages/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
messageId
      ]

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

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

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

instance Prelude.NFData DeleteChannelMessageResponse