{-# 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.DisassociatePhoneNumberContactFlow
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Removes the flow association from a phone number claimed to your Amazon
-- Connect instance.
--
-- If the number is claimed to a traffic distribution group, and you are
-- calling this API using an instance in the Amazon Web Services Region
-- where the traffic distribution group was created, you can use either a
-- full phone number ARN or UUID value for the @PhoneNumberId@ URI request
-- parameter. However, if the number is claimed to a traffic distribution
-- group and you are calling this API using an instance in the alternate
-- Amazon Web Services Region associated with the traffic distribution
-- group, you must provide a full phone number ARN. If a UUID is provided
-- in this scenario, you will receive a @ResourceNotFoundException@.
module Amazonka.Connect.DisassociatePhoneNumberContactFlow
  ( -- * Creating a Request
    DisassociatePhoneNumberContactFlow (..),
    newDisassociatePhoneNumberContactFlow,

    -- * Request Lenses
    disassociatePhoneNumberContactFlow_phoneNumberId,
    disassociatePhoneNumberContactFlow_instanceId,

    -- * Destructuring the Response
    DisassociatePhoneNumberContactFlowResponse (..),
    newDisassociatePhoneNumberContactFlowResponse,
  )
where

import Amazonka.Connect.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDisassociatePhoneNumberContactFlow' smart constructor.
data DisassociatePhoneNumberContactFlow = DisassociatePhoneNumberContactFlow'
  { -- | A unique identifier for the phone number.
    DisassociatePhoneNumberContactFlow -> Text
phoneNumberId :: Prelude.Text,
    -- | The identifier of the Amazon Connect instance. You can find the
    -- instanceId in the ARN of the instance.
    DisassociatePhoneNumberContactFlow -> Text
instanceId :: Prelude.Text
  }
  deriving (DisassociatePhoneNumberContactFlow
-> DisassociatePhoneNumberContactFlow -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisassociatePhoneNumberContactFlow
-> DisassociatePhoneNumberContactFlow -> Bool
$c/= :: DisassociatePhoneNumberContactFlow
-> DisassociatePhoneNumberContactFlow -> Bool
== :: DisassociatePhoneNumberContactFlow
-> DisassociatePhoneNumberContactFlow -> Bool
$c== :: DisassociatePhoneNumberContactFlow
-> DisassociatePhoneNumberContactFlow -> Bool
Prelude.Eq, ReadPrec [DisassociatePhoneNumberContactFlow]
ReadPrec DisassociatePhoneNumberContactFlow
Int -> ReadS DisassociatePhoneNumberContactFlow
ReadS [DisassociatePhoneNumberContactFlow]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisassociatePhoneNumberContactFlow]
$creadListPrec :: ReadPrec [DisassociatePhoneNumberContactFlow]
readPrec :: ReadPrec DisassociatePhoneNumberContactFlow
$creadPrec :: ReadPrec DisassociatePhoneNumberContactFlow
readList :: ReadS [DisassociatePhoneNumberContactFlow]
$creadList :: ReadS [DisassociatePhoneNumberContactFlow]
readsPrec :: Int -> ReadS DisassociatePhoneNumberContactFlow
$creadsPrec :: Int -> ReadS DisassociatePhoneNumberContactFlow
Prelude.Read, Int -> DisassociatePhoneNumberContactFlow -> ShowS
[DisassociatePhoneNumberContactFlow] -> ShowS
DisassociatePhoneNumberContactFlow -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisassociatePhoneNumberContactFlow] -> ShowS
$cshowList :: [DisassociatePhoneNumberContactFlow] -> ShowS
show :: DisassociatePhoneNumberContactFlow -> String
$cshow :: DisassociatePhoneNumberContactFlow -> String
showsPrec :: Int -> DisassociatePhoneNumberContactFlow -> ShowS
$cshowsPrec :: Int -> DisassociatePhoneNumberContactFlow -> ShowS
Prelude.Show, forall x.
Rep DisassociatePhoneNumberContactFlow x
-> DisassociatePhoneNumberContactFlow
forall x.
DisassociatePhoneNumberContactFlow
-> Rep DisassociatePhoneNumberContactFlow x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DisassociatePhoneNumberContactFlow x
-> DisassociatePhoneNumberContactFlow
$cfrom :: forall x.
DisassociatePhoneNumberContactFlow
-> Rep DisassociatePhoneNumberContactFlow x
Prelude.Generic)

-- |
-- Create a value of 'DisassociatePhoneNumberContactFlow' 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:
--
-- 'phoneNumberId', 'disassociatePhoneNumberContactFlow_phoneNumberId' - A unique identifier for the phone number.
--
-- 'instanceId', 'disassociatePhoneNumberContactFlow_instanceId' - The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
newDisassociatePhoneNumberContactFlow ::
  -- | 'phoneNumberId'
  Prelude.Text ->
  -- | 'instanceId'
  Prelude.Text ->
  DisassociatePhoneNumberContactFlow
newDisassociatePhoneNumberContactFlow :: Text -> Text -> DisassociatePhoneNumberContactFlow
newDisassociatePhoneNumberContactFlow
  Text
pPhoneNumberId_
  Text
pInstanceId_ =
    DisassociatePhoneNumberContactFlow'
      { $sel:phoneNumberId:DisassociatePhoneNumberContactFlow' :: Text
phoneNumberId =
          Text
pPhoneNumberId_,
        $sel:instanceId:DisassociatePhoneNumberContactFlow' :: Text
instanceId = Text
pInstanceId_
      }

-- | A unique identifier for the phone number.
disassociatePhoneNumberContactFlow_phoneNumberId :: Lens.Lens' DisassociatePhoneNumberContactFlow Prelude.Text
disassociatePhoneNumberContactFlow_phoneNumberId :: Lens' DisassociatePhoneNumberContactFlow Text
disassociatePhoneNumberContactFlow_phoneNumberId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociatePhoneNumberContactFlow' {Text
phoneNumberId :: Text
$sel:phoneNumberId:DisassociatePhoneNumberContactFlow' :: DisassociatePhoneNumberContactFlow -> Text
phoneNumberId} -> Text
phoneNumberId) (\s :: DisassociatePhoneNumberContactFlow
s@DisassociatePhoneNumberContactFlow' {} Text
a -> DisassociatePhoneNumberContactFlow
s {$sel:phoneNumberId:DisassociatePhoneNumberContactFlow' :: Text
phoneNumberId = Text
a} :: DisassociatePhoneNumberContactFlow)

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

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

instance
  Prelude.Hashable
    DisassociatePhoneNumberContactFlow
  where
  hashWithSalt :: Int -> DisassociatePhoneNumberContactFlow -> Int
hashWithSalt
    Int
_salt
    DisassociatePhoneNumberContactFlow' {Text
instanceId :: Text
phoneNumberId :: Text
$sel:instanceId:DisassociatePhoneNumberContactFlow' :: DisassociatePhoneNumberContactFlow -> Text
$sel:phoneNumberId:DisassociatePhoneNumberContactFlow' :: DisassociatePhoneNumberContactFlow -> Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
phoneNumberId
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
instanceId

instance
  Prelude.NFData
    DisassociatePhoneNumberContactFlow
  where
  rnf :: DisassociatePhoneNumberContactFlow -> ()
rnf DisassociatePhoneNumberContactFlow' {Text
instanceId :: Text
phoneNumberId :: Text
$sel:instanceId:DisassociatePhoneNumberContactFlow' :: DisassociatePhoneNumberContactFlow -> Text
$sel:phoneNumberId:DisassociatePhoneNumberContactFlow' :: DisassociatePhoneNumberContactFlow -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
phoneNumberId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
instanceId

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

instance
  Data.ToPath
    DisassociatePhoneNumberContactFlow
  where
  toPath :: DisassociatePhoneNumberContactFlow -> ByteString
toPath DisassociatePhoneNumberContactFlow' {Text
instanceId :: Text
phoneNumberId :: Text
$sel:instanceId:DisassociatePhoneNumberContactFlow' :: DisassociatePhoneNumberContactFlow -> Text
$sel:phoneNumberId:DisassociatePhoneNumberContactFlow' :: DisassociatePhoneNumberContactFlow -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/phone-number/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
phoneNumberId,
        ByteString
"/contact-flow"
      ]

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

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

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

instance
  Prelude.NFData
    DisassociatePhoneNumberContactFlowResponse
  where
  rnf :: DisassociatePhoneNumberContactFlowResponse -> ()
rnf DisassociatePhoneNumberContactFlowResponse
_ = ()