{-# 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.DeleteChannelMembership
-- 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 member from a channel.
--
-- 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.DeleteChannelMembership
  ( -- * Creating a Request
    DeleteChannelMembership (..),
    newDeleteChannelMembership,

    -- * Request Lenses
    deleteChannelMembership_chimeBearer,
    deleteChannelMembership_channelArn,
    deleteChannelMembership_memberArn,

    -- * Destructuring the Response
    DeleteChannelMembershipResponse (..),
    newDeleteChannelMembershipResponse,
  )
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:/ 'newDeleteChannelMembership' smart constructor.
data DeleteChannelMembership = DeleteChannelMembership'
  { -- | The @AppInstanceUserArn@ of the user that makes the API call.
    DeleteChannelMembership -> Maybe Text
chimeBearer :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the channel from which you want to remove the user.
    DeleteChannelMembership -> Text
channelArn :: Prelude.Text,
    -- | The ARN of the member that you\'re removing from the channel.
    DeleteChannelMembership -> Text
memberArn :: Prelude.Text
  }
  deriving (DeleteChannelMembership -> DeleteChannelMembership -> Bool
(DeleteChannelMembership -> DeleteChannelMembership -> Bool)
-> (DeleteChannelMembership -> DeleteChannelMembership -> Bool)
-> Eq DeleteChannelMembership
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteChannelMembership -> DeleteChannelMembership -> Bool
$c/= :: DeleteChannelMembership -> DeleteChannelMembership -> Bool
== :: DeleteChannelMembership -> DeleteChannelMembership -> Bool
$c== :: DeleteChannelMembership -> DeleteChannelMembership -> Bool
Prelude.Eq, ReadPrec [DeleteChannelMembership]
ReadPrec DeleteChannelMembership
Int -> ReadS DeleteChannelMembership
ReadS [DeleteChannelMembership]
(Int -> ReadS DeleteChannelMembership)
-> ReadS [DeleteChannelMembership]
-> ReadPrec DeleteChannelMembership
-> ReadPrec [DeleteChannelMembership]
-> Read DeleteChannelMembership
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteChannelMembership]
$creadListPrec :: ReadPrec [DeleteChannelMembership]
readPrec :: ReadPrec DeleteChannelMembership
$creadPrec :: ReadPrec DeleteChannelMembership
readList :: ReadS [DeleteChannelMembership]
$creadList :: ReadS [DeleteChannelMembership]
readsPrec :: Int -> ReadS DeleteChannelMembership
$creadsPrec :: Int -> ReadS DeleteChannelMembership
Prelude.Read, Int -> DeleteChannelMembership -> ShowS
[DeleteChannelMembership] -> ShowS
DeleteChannelMembership -> String
(Int -> DeleteChannelMembership -> ShowS)
-> (DeleteChannelMembership -> String)
-> ([DeleteChannelMembership] -> ShowS)
-> Show DeleteChannelMembership
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteChannelMembership] -> ShowS
$cshowList :: [DeleteChannelMembership] -> ShowS
show :: DeleteChannelMembership -> String
$cshow :: DeleteChannelMembership -> String
showsPrec :: Int -> DeleteChannelMembership -> ShowS
$cshowsPrec :: Int -> DeleteChannelMembership -> ShowS
Prelude.Show, (forall x.
 DeleteChannelMembership -> Rep DeleteChannelMembership x)
-> (forall x.
    Rep DeleteChannelMembership x -> DeleteChannelMembership)
-> Generic DeleteChannelMembership
forall x. Rep DeleteChannelMembership x -> DeleteChannelMembership
forall x. DeleteChannelMembership -> Rep DeleteChannelMembership x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteChannelMembership x -> DeleteChannelMembership
$cfrom :: forall x. DeleteChannelMembership -> Rep DeleteChannelMembership x
Prelude.Generic)

-- |
-- Create a value of 'DeleteChannelMembership' 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', 'deleteChannelMembership_chimeBearer' - The @AppInstanceUserArn@ of the user that makes the API call.
--
-- 'channelArn', 'deleteChannelMembership_channelArn' - The ARN of the channel from which you want to remove the user.
--
-- 'memberArn', 'deleteChannelMembership_memberArn' - The ARN of the member that you\'re removing from the channel.
newDeleteChannelMembership ::
  -- | 'channelArn'
  Prelude.Text ->
  -- | 'memberArn'
  Prelude.Text ->
  DeleteChannelMembership
newDeleteChannelMembership :: Text -> Text -> DeleteChannelMembership
newDeleteChannelMembership Text
pChannelArn_ Text
pMemberArn_ =
  DeleteChannelMembership' :: Maybe Text -> Text -> Text -> DeleteChannelMembership
DeleteChannelMembership'
    { $sel:chimeBearer:DeleteChannelMembership' :: Maybe Text
chimeBearer =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:channelArn:DeleteChannelMembership' :: Text
channelArn = Text
pChannelArn_,
      $sel:memberArn:DeleteChannelMembership' :: Text
memberArn = Text
pMemberArn_
    }

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

-- | The ARN of the channel from which you want to remove the user.
deleteChannelMembership_channelArn :: Lens.Lens' DeleteChannelMembership Prelude.Text
deleteChannelMembership_channelArn :: (Text -> f Text)
-> DeleteChannelMembership -> f DeleteChannelMembership
deleteChannelMembership_channelArn = (DeleteChannelMembership -> Text)
-> (DeleteChannelMembership -> Text -> DeleteChannelMembership)
-> Lens DeleteChannelMembership DeleteChannelMembership Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteChannelMembership' {Text
channelArn :: Text
$sel:channelArn:DeleteChannelMembership' :: DeleteChannelMembership -> Text
channelArn} -> Text
channelArn) (\s :: DeleteChannelMembership
s@DeleteChannelMembership' {} Text
a -> DeleteChannelMembership
s {$sel:channelArn:DeleteChannelMembership' :: Text
channelArn = Text
a} :: DeleteChannelMembership)

-- | The ARN of the member that you\'re removing from the channel.
deleteChannelMembership_memberArn :: Lens.Lens' DeleteChannelMembership Prelude.Text
deleteChannelMembership_memberArn :: (Text -> f Text)
-> DeleteChannelMembership -> f DeleteChannelMembership
deleteChannelMembership_memberArn = (DeleteChannelMembership -> Text)
-> (DeleteChannelMembership -> Text -> DeleteChannelMembership)
-> Lens DeleteChannelMembership DeleteChannelMembership Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteChannelMembership' {Text
memberArn :: Text
$sel:memberArn:DeleteChannelMembership' :: DeleteChannelMembership -> Text
memberArn} -> Text
memberArn) (\s :: DeleteChannelMembership
s@DeleteChannelMembership' {} Text
a -> DeleteChannelMembership
s {$sel:memberArn:DeleteChannelMembership' :: Text
memberArn = Text
a} :: DeleteChannelMembership)

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

instance Prelude.Hashable DeleteChannelMembership

instance Prelude.NFData DeleteChannelMembership

instance Core.ToHeaders DeleteChannelMembership where
  toHeaders :: DeleteChannelMembership -> [Header]
toHeaders DeleteChannelMembership' {Maybe Text
Text
memberArn :: Text
channelArn :: Text
chimeBearer :: Maybe Text
$sel:memberArn:DeleteChannelMembership' :: DeleteChannelMembership -> Text
$sel:channelArn:DeleteChannelMembership' :: DeleteChannelMembership -> Text
$sel:chimeBearer:DeleteChannelMembership' :: DeleteChannelMembership -> 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 DeleteChannelMembership where
  toPath :: DeleteChannelMembership -> ByteString
toPath DeleteChannelMembership' {Maybe Text
Text
memberArn :: Text
channelArn :: Text
chimeBearer :: Maybe Text
$sel:memberArn:DeleteChannelMembership' :: DeleteChannelMembership -> Text
$sel:channelArn:DeleteChannelMembership' :: DeleteChannelMembership -> Text
$sel:chimeBearer:DeleteChannelMembership' :: DeleteChannelMembership -> 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
"/memberships/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
memberArn
      ]

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

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

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

instance
  Prelude.NFData
    DeleteChannelMembershipResponse