{-# 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.Chime.DeleteChannelBan
-- 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)
--
-- Removes a user from a channel\'s ban list.
--
-- 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.Chime.DeleteChannelBan
  ( -- * Creating a Request
    DeleteChannelBan (..),
    newDeleteChannelBan,

    -- * Request Lenses
    deleteChannelBan_chimeBearer,
    deleteChannelBan_channelArn,
    deleteChannelBan_memberArn,

    -- * Destructuring the Response
    DeleteChannelBanResponse (..),
    newDeleteChannelBanResponse,
  )
where

import Amazonka.Chime.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:/ 'newDeleteChannelBan' smart constructor.
data DeleteChannelBan = DeleteChannelBan'
  { -- | The @AppInstanceUserArn@ of the user that makes the API call.
    DeleteChannelBan -> Maybe Text
chimeBearer :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the channel from which the @AppInstanceUser@ was banned.
    DeleteChannelBan -> Text
channelArn :: Prelude.Text,
    -- | The ARN of the @AppInstanceUser@ that you want to reinstate.
    DeleteChannelBan -> Text
memberArn :: Prelude.Text
  }
  deriving (DeleteChannelBan -> DeleteChannelBan -> Bool
(DeleteChannelBan -> DeleteChannelBan -> Bool)
-> (DeleteChannelBan -> DeleteChannelBan -> Bool)
-> Eq DeleteChannelBan
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteChannelBan -> DeleteChannelBan -> Bool
$c/= :: DeleteChannelBan -> DeleteChannelBan -> Bool
== :: DeleteChannelBan -> DeleteChannelBan -> Bool
$c== :: DeleteChannelBan -> DeleteChannelBan -> Bool
Prelude.Eq, ReadPrec [DeleteChannelBan]
ReadPrec DeleteChannelBan
Int -> ReadS DeleteChannelBan
ReadS [DeleteChannelBan]
(Int -> ReadS DeleteChannelBan)
-> ReadS [DeleteChannelBan]
-> ReadPrec DeleteChannelBan
-> ReadPrec [DeleteChannelBan]
-> Read DeleteChannelBan
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteChannelBan]
$creadListPrec :: ReadPrec [DeleteChannelBan]
readPrec :: ReadPrec DeleteChannelBan
$creadPrec :: ReadPrec DeleteChannelBan
readList :: ReadS [DeleteChannelBan]
$creadList :: ReadS [DeleteChannelBan]
readsPrec :: Int -> ReadS DeleteChannelBan
$creadsPrec :: Int -> ReadS DeleteChannelBan
Prelude.Read, Int -> DeleteChannelBan -> ShowS
[DeleteChannelBan] -> ShowS
DeleteChannelBan -> String
(Int -> DeleteChannelBan -> ShowS)
-> (DeleteChannelBan -> String)
-> ([DeleteChannelBan] -> ShowS)
-> Show DeleteChannelBan
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteChannelBan] -> ShowS
$cshowList :: [DeleteChannelBan] -> ShowS
show :: DeleteChannelBan -> String
$cshow :: DeleteChannelBan -> String
showsPrec :: Int -> DeleteChannelBan -> ShowS
$cshowsPrec :: Int -> DeleteChannelBan -> ShowS
Prelude.Show, (forall x. DeleteChannelBan -> Rep DeleteChannelBan x)
-> (forall x. Rep DeleteChannelBan x -> DeleteChannelBan)
-> Generic DeleteChannelBan
forall x. Rep DeleteChannelBan x -> DeleteChannelBan
forall x. DeleteChannelBan -> Rep DeleteChannelBan x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteChannelBan x -> DeleteChannelBan
$cfrom :: forall x. DeleteChannelBan -> Rep DeleteChannelBan x
Prelude.Generic)

-- |
-- Create a value of 'DeleteChannelBan' 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:
--
-- 'chimeBearer', 'deleteChannelBan_chimeBearer' - The @AppInstanceUserArn@ of the user that makes the API call.
--
-- 'channelArn', 'deleteChannelBan_channelArn' - The ARN of the channel from which the @AppInstanceUser@ was banned.
--
-- 'memberArn', 'deleteChannelBan_memberArn' - The ARN of the @AppInstanceUser@ that you want to reinstate.
newDeleteChannelBan ::
  -- | 'channelArn'
  Prelude.Text ->
  -- | 'memberArn'
  Prelude.Text ->
  DeleteChannelBan
newDeleteChannelBan :: Text -> Text -> DeleteChannelBan
newDeleteChannelBan Text
pChannelArn_ Text
pMemberArn_ =
  DeleteChannelBan' :: Maybe Text -> Text -> Text -> DeleteChannelBan
DeleteChannelBan'
    { $sel:chimeBearer:DeleteChannelBan' :: Maybe Text
chimeBearer = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:channelArn:DeleteChannelBan' :: Text
channelArn = Text
pChannelArn_,
      $sel:memberArn:DeleteChannelBan' :: Text
memberArn = Text
pMemberArn_
    }

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

-- | The ARN of the channel from which the @AppInstanceUser@ was banned.
deleteChannelBan_channelArn :: Lens.Lens' DeleteChannelBan Prelude.Text
deleteChannelBan_channelArn :: (Text -> f Text) -> DeleteChannelBan -> f DeleteChannelBan
deleteChannelBan_channelArn = (DeleteChannelBan -> Text)
-> (DeleteChannelBan -> Text -> DeleteChannelBan)
-> Lens DeleteChannelBan DeleteChannelBan Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteChannelBan' {Text
channelArn :: Text
$sel:channelArn:DeleteChannelBan' :: DeleteChannelBan -> Text
channelArn} -> Text
channelArn) (\s :: DeleteChannelBan
s@DeleteChannelBan' {} Text
a -> DeleteChannelBan
s {$sel:channelArn:DeleteChannelBan' :: Text
channelArn = Text
a} :: DeleteChannelBan)

-- | The ARN of the @AppInstanceUser@ that you want to reinstate.
deleteChannelBan_memberArn :: Lens.Lens' DeleteChannelBan Prelude.Text
deleteChannelBan_memberArn :: (Text -> f Text) -> DeleteChannelBan -> f DeleteChannelBan
deleteChannelBan_memberArn = (DeleteChannelBan -> Text)
-> (DeleteChannelBan -> Text -> DeleteChannelBan)
-> Lens DeleteChannelBan DeleteChannelBan Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteChannelBan' {Text
memberArn :: Text
$sel:memberArn:DeleteChannelBan' :: DeleteChannelBan -> Text
memberArn} -> Text
memberArn) (\s :: DeleteChannelBan
s@DeleteChannelBan' {} Text
a -> DeleteChannelBan
s {$sel:memberArn:DeleteChannelBan' :: Text
memberArn = Text
a} :: DeleteChannelBan)

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

instance Prelude.Hashable DeleteChannelBan

instance Prelude.NFData DeleteChannelBan

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

instance Core.ToPath DeleteChannelBan where
  toPath :: DeleteChannelBan -> ByteString
toPath DeleteChannelBan' {Maybe Text
Text
memberArn :: Text
channelArn :: Text
chimeBearer :: Maybe Text
$sel:memberArn:DeleteChannelBan' :: DeleteChannelBan -> Text
$sel:channelArn:DeleteChannelBan' :: DeleteChannelBan -> Text
$sel:chimeBearer:DeleteChannelBan' :: DeleteChannelBan -> Maybe 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
"/bans/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
memberArn
      ]

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

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

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

instance Prelude.NFData DeleteChannelBanResponse