{-# 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.DeleteChannelFlow
-- 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 flow, an irreversible process. This is a developer
-- API.
--
-- This API works only when the channel flow is not associated with any
-- channel. To get a list of all channels that a channel flow is associated
-- with, use the @ListChannelsAssociatedWithChannelFlow@ API. Use the
-- @DisassociateChannelFlow@ API to disassociate a channel flow from all
-- channels.
module Amazonka.ChimeSDKMessaging.DeleteChannelFlow
  ( -- * Creating a Request
    DeleteChannelFlow (..),
    newDeleteChannelFlow,

    -- * Request Lenses
    deleteChannelFlow_channelFlowArn,

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

-- |
-- Create a value of 'DeleteChannelFlow' 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:
--
-- 'channelFlowArn', 'deleteChannelFlow_channelFlowArn' - The ARN of the channel flow.
newDeleteChannelFlow ::
  -- | 'channelFlowArn'
  Prelude.Text ->
  DeleteChannelFlow
newDeleteChannelFlow :: Text -> DeleteChannelFlow
newDeleteChannelFlow Text
pChannelFlowArn_ =
  DeleteChannelFlow' :: Text -> DeleteChannelFlow
DeleteChannelFlow'
    { $sel:channelFlowArn:DeleteChannelFlow' :: Text
channelFlowArn =
        Text
pChannelFlowArn_
    }

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

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

instance Prelude.Hashable DeleteChannelFlow

instance Prelude.NFData DeleteChannelFlow

instance Core.ToHeaders DeleteChannelFlow where
  toHeaders :: DeleteChannelFlow -> [Header]
toHeaders = [Header] -> DeleteChannelFlow -> [Header]
forall a b. a -> b -> a
Prelude.const [Header]
forall a. Monoid a => a
Prelude.mempty

instance Core.ToPath DeleteChannelFlow where
  toPath :: DeleteChannelFlow -> ByteString
toPath DeleteChannelFlow' {Text
channelFlowArn :: Text
$sel:channelFlowArn:DeleteChannelFlow' :: DeleteChannelFlow -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/channel-flows/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
channelFlowArn]

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

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

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

instance Prelude.NFData DeleteChannelFlowResponse