{-# 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.Connect.DisassociateLambdaFunction
-- 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)
--
-- This API is in preview release for Amazon Connect and is subject to
-- change.
--
-- Remove the Lambda function from the dropdown options available in the
-- relevant contact flow blocks.
module Amazonka.Connect.DisassociateLambdaFunction
  ( -- * Creating a Request
    DisassociateLambdaFunction (..),
    newDisassociateLambdaFunction,

    -- * Request Lenses
    disassociateLambdaFunction_instanceId,
    disassociateLambdaFunction_functionArn,

    -- * Destructuring the Response
    DisassociateLambdaFunctionResponse (..),
    newDisassociateLambdaFunctionResponse,
  )
where

import Amazonka.Connect.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:/ 'newDisassociateLambdaFunction' smart constructor.
data DisassociateLambdaFunction = DisassociateLambdaFunction'
  { -- | The identifier of the Amazon Connect instance. You can find the
    -- instanceId in the ARN of the instance..
    DisassociateLambdaFunction -> Text
instanceId :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the Lambda function being
    -- disassociated.
    DisassociateLambdaFunction -> Text
functionArn :: Prelude.Text
  }
  deriving (DisassociateLambdaFunction -> DisassociateLambdaFunction -> Bool
(DisassociateLambdaFunction -> DisassociateLambdaFunction -> Bool)
-> (DisassociateLambdaFunction
    -> DisassociateLambdaFunction -> Bool)
-> Eq DisassociateLambdaFunction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisassociateLambdaFunction -> DisassociateLambdaFunction -> Bool
$c/= :: DisassociateLambdaFunction -> DisassociateLambdaFunction -> Bool
== :: DisassociateLambdaFunction -> DisassociateLambdaFunction -> Bool
$c== :: DisassociateLambdaFunction -> DisassociateLambdaFunction -> Bool
Prelude.Eq, ReadPrec [DisassociateLambdaFunction]
ReadPrec DisassociateLambdaFunction
Int -> ReadS DisassociateLambdaFunction
ReadS [DisassociateLambdaFunction]
(Int -> ReadS DisassociateLambdaFunction)
-> ReadS [DisassociateLambdaFunction]
-> ReadPrec DisassociateLambdaFunction
-> ReadPrec [DisassociateLambdaFunction]
-> Read DisassociateLambdaFunction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisassociateLambdaFunction]
$creadListPrec :: ReadPrec [DisassociateLambdaFunction]
readPrec :: ReadPrec DisassociateLambdaFunction
$creadPrec :: ReadPrec DisassociateLambdaFunction
readList :: ReadS [DisassociateLambdaFunction]
$creadList :: ReadS [DisassociateLambdaFunction]
readsPrec :: Int -> ReadS DisassociateLambdaFunction
$creadsPrec :: Int -> ReadS DisassociateLambdaFunction
Prelude.Read, Int -> DisassociateLambdaFunction -> ShowS
[DisassociateLambdaFunction] -> ShowS
DisassociateLambdaFunction -> String
(Int -> DisassociateLambdaFunction -> ShowS)
-> (DisassociateLambdaFunction -> String)
-> ([DisassociateLambdaFunction] -> ShowS)
-> Show DisassociateLambdaFunction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisassociateLambdaFunction] -> ShowS
$cshowList :: [DisassociateLambdaFunction] -> ShowS
show :: DisassociateLambdaFunction -> String
$cshow :: DisassociateLambdaFunction -> String
showsPrec :: Int -> DisassociateLambdaFunction -> ShowS
$cshowsPrec :: Int -> DisassociateLambdaFunction -> ShowS
Prelude.Show, (forall x.
 DisassociateLambdaFunction -> Rep DisassociateLambdaFunction x)
-> (forall x.
    Rep DisassociateLambdaFunction x -> DisassociateLambdaFunction)
-> Generic DisassociateLambdaFunction
forall x.
Rep DisassociateLambdaFunction x -> DisassociateLambdaFunction
forall x.
DisassociateLambdaFunction -> Rep DisassociateLambdaFunction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DisassociateLambdaFunction x -> DisassociateLambdaFunction
$cfrom :: forall x.
DisassociateLambdaFunction -> Rep DisassociateLambdaFunction x
Prelude.Generic)

-- |
-- Create a value of 'DisassociateLambdaFunction' 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:
--
-- 'instanceId', 'disassociateLambdaFunction_instanceId' - The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance..
--
-- 'functionArn', 'disassociateLambdaFunction_functionArn' - The Amazon Resource Name (ARN) of the Lambda function being
-- disassociated.
newDisassociateLambdaFunction ::
  -- | 'instanceId'
  Prelude.Text ->
  -- | 'functionArn'
  Prelude.Text ->
  DisassociateLambdaFunction
newDisassociateLambdaFunction :: Text -> Text -> DisassociateLambdaFunction
newDisassociateLambdaFunction
  Text
pInstanceId_
  Text
pFunctionArn_ =
    DisassociateLambdaFunction' :: Text -> Text -> DisassociateLambdaFunction
DisassociateLambdaFunction'
      { $sel:instanceId:DisassociateLambdaFunction' :: Text
instanceId =
          Text
pInstanceId_,
        $sel:functionArn:DisassociateLambdaFunction' :: Text
functionArn = Text
pFunctionArn_
      }

-- | The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance..
disassociateLambdaFunction_instanceId :: Lens.Lens' DisassociateLambdaFunction Prelude.Text
disassociateLambdaFunction_instanceId :: (Text -> f Text)
-> DisassociateLambdaFunction -> f DisassociateLambdaFunction
disassociateLambdaFunction_instanceId = (DisassociateLambdaFunction -> Text)
-> (DisassociateLambdaFunction
    -> Text -> DisassociateLambdaFunction)
-> Lens
     DisassociateLambdaFunction DisassociateLambdaFunction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateLambdaFunction' {Text
instanceId :: Text
$sel:instanceId:DisassociateLambdaFunction' :: DisassociateLambdaFunction -> Text
instanceId} -> Text
instanceId) (\s :: DisassociateLambdaFunction
s@DisassociateLambdaFunction' {} Text
a -> DisassociateLambdaFunction
s {$sel:instanceId:DisassociateLambdaFunction' :: Text
instanceId = Text
a} :: DisassociateLambdaFunction)

-- | The Amazon Resource Name (ARN) of the Lambda function being
-- disassociated.
disassociateLambdaFunction_functionArn :: Lens.Lens' DisassociateLambdaFunction Prelude.Text
disassociateLambdaFunction_functionArn :: (Text -> f Text)
-> DisassociateLambdaFunction -> f DisassociateLambdaFunction
disassociateLambdaFunction_functionArn = (DisassociateLambdaFunction -> Text)
-> (DisassociateLambdaFunction
    -> Text -> DisassociateLambdaFunction)
-> Lens
     DisassociateLambdaFunction DisassociateLambdaFunction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateLambdaFunction' {Text
functionArn :: Text
$sel:functionArn:DisassociateLambdaFunction' :: DisassociateLambdaFunction -> Text
functionArn} -> Text
functionArn) (\s :: DisassociateLambdaFunction
s@DisassociateLambdaFunction' {} Text
a -> DisassociateLambdaFunction
s {$sel:functionArn:DisassociateLambdaFunction' :: Text
functionArn = Text
a} :: DisassociateLambdaFunction)

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

instance Prelude.Hashable DisassociateLambdaFunction

instance Prelude.NFData DisassociateLambdaFunction

instance Core.ToHeaders DisassociateLambdaFunction where
  toHeaders :: DisassociateLambdaFunction -> [Header]
toHeaders =
    [Header] -> DisassociateLambdaFunction -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToPath DisassociateLambdaFunction where
  toPath :: DisassociateLambdaFunction -> ByteString
toPath DisassociateLambdaFunction' {Text
functionArn :: Text
instanceId :: Text
$sel:functionArn:DisassociateLambdaFunction' :: DisassociateLambdaFunction -> Text
$sel:instanceId:DisassociateLambdaFunction' :: DisassociateLambdaFunction -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/instance/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
instanceId,
        ByteString
"/lambda-function"
      ]

instance Core.ToQuery DisassociateLambdaFunction where
  toQuery :: DisassociateLambdaFunction -> QueryString
toQuery DisassociateLambdaFunction' {Text
functionArn :: Text
instanceId :: Text
$sel:functionArn:DisassociateLambdaFunction' :: DisassociateLambdaFunction -> Text
$sel:instanceId:DisassociateLambdaFunction' :: DisassociateLambdaFunction -> Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"functionArn" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
functionArn]

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

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

instance
  Prelude.NFData
    DisassociateLambdaFunctionResponse