{-# 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.DisassociateChannelFlow
-- 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)
--
-- Disassociates a channel flow from all its channels. Once disassociated,
-- all messages to that channel stop going through the channel flow
-- processor.
--
-- Only administrators or channel moderators can disassociate a channel
-- flow. 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.DisassociateChannelFlow
  ( -- * Creating a Request
    DisassociateChannelFlow (..),
    newDisassociateChannelFlow,

    -- * Request Lenses
    disassociateChannelFlow_channelArn,
    disassociateChannelFlow_channelFlowArn,
    disassociateChannelFlow_chimeBearer,

    -- * Destructuring the Response
    DisassociateChannelFlowResponse (..),
    newDisassociateChannelFlowResponse,
  )
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:/ 'newDisassociateChannelFlow' smart constructor.
data DisassociateChannelFlow = DisassociateChannelFlow'
  { -- | The ARN of the channel.
    DisassociateChannelFlow -> Text
channelArn :: Prelude.Text,
    -- | The ARN of the channel flow.
    DisassociateChannelFlow -> Text
channelFlowArn :: Prelude.Text,
    -- | The @AppInstanceUserArn@ of the user making the API call.
    DisassociateChannelFlow -> Text
chimeBearer :: Prelude.Text
  }
  deriving (DisassociateChannelFlow -> DisassociateChannelFlow -> Bool
(DisassociateChannelFlow -> DisassociateChannelFlow -> Bool)
-> (DisassociateChannelFlow -> DisassociateChannelFlow -> Bool)
-> Eq DisassociateChannelFlow
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisassociateChannelFlow -> DisassociateChannelFlow -> Bool
$c/= :: DisassociateChannelFlow -> DisassociateChannelFlow -> Bool
== :: DisassociateChannelFlow -> DisassociateChannelFlow -> Bool
$c== :: DisassociateChannelFlow -> DisassociateChannelFlow -> Bool
Prelude.Eq, ReadPrec [DisassociateChannelFlow]
ReadPrec DisassociateChannelFlow
Int -> ReadS DisassociateChannelFlow
ReadS [DisassociateChannelFlow]
(Int -> ReadS DisassociateChannelFlow)
-> ReadS [DisassociateChannelFlow]
-> ReadPrec DisassociateChannelFlow
-> ReadPrec [DisassociateChannelFlow]
-> Read DisassociateChannelFlow
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisassociateChannelFlow]
$creadListPrec :: ReadPrec [DisassociateChannelFlow]
readPrec :: ReadPrec DisassociateChannelFlow
$creadPrec :: ReadPrec DisassociateChannelFlow
readList :: ReadS [DisassociateChannelFlow]
$creadList :: ReadS [DisassociateChannelFlow]
readsPrec :: Int -> ReadS DisassociateChannelFlow
$creadsPrec :: Int -> ReadS DisassociateChannelFlow
Prelude.Read, Int -> DisassociateChannelFlow -> ShowS
[DisassociateChannelFlow] -> ShowS
DisassociateChannelFlow -> String
(Int -> DisassociateChannelFlow -> ShowS)
-> (DisassociateChannelFlow -> String)
-> ([DisassociateChannelFlow] -> ShowS)
-> Show DisassociateChannelFlow
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisassociateChannelFlow] -> ShowS
$cshowList :: [DisassociateChannelFlow] -> ShowS
show :: DisassociateChannelFlow -> String
$cshow :: DisassociateChannelFlow -> String
showsPrec :: Int -> DisassociateChannelFlow -> ShowS
$cshowsPrec :: Int -> DisassociateChannelFlow -> ShowS
Prelude.Show, (forall x.
 DisassociateChannelFlow -> Rep DisassociateChannelFlow x)
-> (forall x.
    Rep DisassociateChannelFlow x -> DisassociateChannelFlow)
-> Generic DisassociateChannelFlow
forall x. Rep DisassociateChannelFlow x -> DisassociateChannelFlow
forall x. DisassociateChannelFlow -> Rep DisassociateChannelFlow x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DisassociateChannelFlow x -> DisassociateChannelFlow
$cfrom :: forall x. DisassociateChannelFlow -> Rep DisassociateChannelFlow x
Prelude.Generic)

-- |
-- Create a value of 'DisassociateChannelFlow' 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', 'disassociateChannelFlow_channelArn' - The ARN of the channel.
--
-- 'channelFlowArn', 'disassociateChannelFlow_channelFlowArn' - The ARN of the channel flow.
--
-- 'chimeBearer', 'disassociateChannelFlow_chimeBearer' - The @AppInstanceUserArn@ of the user making the API call.
newDisassociateChannelFlow ::
  -- | 'channelArn'
  Prelude.Text ->
  -- | 'channelFlowArn'
  Prelude.Text ->
  -- | 'chimeBearer'
  Prelude.Text ->
  DisassociateChannelFlow
newDisassociateChannelFlow :: Text -> Text -> Text -> DisassociateChannelFlow
newDisassociateChannelFlow
  Text
pChannelArn_
  Text
pChannelFlowArn_
  Text
pChimeBearer_ =
    DisassociateChannelFlow' :: Text -> Text -> Text -> DisassociateChannelFlow
DisassociateChannelFlow'
      { $sel:channelArn:DisassociateChannelFlow' :: Text
channelArn = Text
pChannelArn_,
        $sel:channelFlowArn:DisassociateChannelFlow' :: Text
channelFlowArn = Text
pChannelFlowArn_,
        $sel:chimeBearer:DisassociateChannelFlow' :: Text
chimeBearer = Text
pChimeBearer_
      }

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

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

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

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

instance Prelude.Hashable DisassociateChannelFlow

instance Prelude.NFData DisassociateChannelFlow

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

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

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

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

instance
  Prelude.NFData
    DisassociateChannelFlowResponse