{-# 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.UpdateQueueOutboundCallerConfig
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- This API is in preview release for Amazon Connect and is subject to
-- change.
--
-- Updates the outbound caller ID name, number, and outbound whisper flow
-- for a specified queue.
--
-- If the number being used in the input 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 @OutboundCallerIdNumberId@ value of the
-- <https://docs.aws.amazon.com/connect/latest/APIReference/API_OutboundCallerConfig OutboundCallerConfig>
-- request body 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.UpdateQueueOutboundCallerConfig
  ( -- * Creating a Request
    UpdateQueueOutboundCallerConfig (..),
    newUpdateQueueOutboundCallerConfig,

    -- * Request Lenses
    updateQueueOutboundCallerConfig_instanceId,
    updateQueueOutboundCallerConfig_queueId,
    updateQueueOutboundCallerConfig_outboundCallerConfig,

    -- * Destructuring the Response
    UpdateQueueOutboundCallerConfigResponse (..),
    newUpdateQueueOutboundCallerConfigResponse,
  )
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:/ 'newUpdateQueueOutboundCallerConfig' smart constructor.
data UpdateQueueOutboundCallerConfig = UpdateQueueOutboundCallerConfig'
  { -- | The identifier of the Amazon Connect instance. You can find the
    -- instanceId in the ARN of the instance.
    UpdateQueueOutboundCallerConfig -> Text
instanceId :: Prelude.Text,
    -- | The identifier for the queue.
    UpdateQueueOutboundCallerConfig -> Text
queueId :: Prelude.Text,
    -- | The outbound caller ID name, number, and outbound whisper flow.
    UpdateQueueOutboundCallerConfig -> OutboundCallerConfig
outboundCallerConfig :: OutboundCallerConfig
  }
  deriving (UpdateQueueOutboundCallerConfig
-> UpdateQueueOutboundCallerConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateQueueOutboundCallerConfig
-> UpdateQueueOutboundCallerConfig -> Bool
$c/= :: UpdateQueueOutboundCallerConfig
-> UpdateQueueOutboundCallerConfig -> Bool
== :: UpdateQueueOutboundCallerConfig
-> UpdateQueueOutboundCallerConfig -> Bool
$c== :: UpdateQueueOutboundCallerConfig
-> UpdateQueueOutboundCallerConfig -> Bool
Prelude.Eq, ReadPrec [UpdateQueueOutboundCallerConfig]
ReadPrec UpdateQueueOutboundCallerConfig
Int -> ReadS UpdateQueueOutboundCallerConfig
ReadS [UpdateQueueOutboundCallerConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateQueueOutboundCallerConfig]
$creadListPrec :: ReadPrec [UpdateQueueOutboundCallerConfig]
readPrec :: ReadPrec UpdateQueueOutboundCallerConfig
$creadPrec :: ReadPrec UpdateQueueOutboundCallerConfig
readList :: ReadS [UpdateQueueOutboundCallerConfig]
$creadList :: ReadS [UpdateQueueOutboundCallerConfig]
readsPrec :: Int -> ReadS UpdateQueueOutboundCallerConfig
$creadsPrec :: Int -> ReadS UpdateQueueOutboundCallerConfig
Prelude.Read, Int -> UpdateQueueOutboundCallerConfig -> ShowS
[UpdateQueueOutboundCallerConfig] -> ShowS
UpdateQueueOutboundCallerConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateQueueOutboundCallerConfig] -> ShowS
$cshowList :: [UpdateQueueOutboundCallerConfig] -> ShowS
show :: UpdateQueueOutboundCallerConfig -> String
$cshow :: UpdateQueueOutboundCallerConfig -> String
showsPrec :: Int -> UpdateQueueOutboundCallerConfig -> ShowS
$cshowsPrec :: Int -> UpdateQueueOutboundCallerConfig -> ShowS
Prelude.Show, forall x.
Rep UpdateQueueOutboundCallerConfig x
-> UpdateQueueOutboundCallerConfig
forall x.
UpdateQueueOutboundCallerConfig
-> Rep UpdateQueueOutboundCallerConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateQueueOutboundCallerConfig x
-> UpdateQueueOutboundCallerConfig
$cfrom :: forall x.
UpdateQueueOutboundCallerConfig
-> Rep UpdateQueueOutboundCallerConfig x
Prelude.Generic)

-- |
-- Create a value of 'UpdateQueueOutboundCallerConfig' 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', 'updateQueueOutboundCallerConfig_instanceId' - The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
--
-- 'queueId', 'updateQueueOutboundCallerConfig_queueId' - The identifier for the queue.
--
-- 'outboundCallerConfig', 'updateQueueOutboundCallerConfig_outboundCallerConfig' - The outbound caller ID name, number, and outbound whisper flow.
newUpdateQueueOutboundCallerConfig ::
  -- | 'instanceId'
  Prelude.Text ->
  -- | 'queueId'
  Prelude.Text ->
  -- | 'outboundCallerConfig'
  OutboundCallerConfig ->
  UpdateQueueOutboundCallerConfig
newUpdateQueueOutboundCallerConfig :: Text
-> Text -> OutboundCallerConfig -> UpdateQueueOutboundCallerConfig
newUpdateQueueOutboundCallerConfig
  Text
pInstanceId_
  Text
pQueueId_
  OutboundCallerConfig
pOutboundCallerConfig_ =
    UpdateQueueOutboundCallerConfig'
      { $sel:instanceId:UpdateQueueOutboundCallerConfig' :: Text
instanceId =
          Text
pInstanceId_,
        $sel:queueId:UpdateQueueOutboundCallerConfig' :: Text
queueId = Text
pQueueId_,
        $sel:outboundCallerConfig:UpdateQueueOutboundCallerConfig' :: OutboundCallerConfig
outboundCallerConfig =
          OutboundCallerConfig
pOutboundCallerConfig_
      }

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

-- | The identifier for the queue.
updateQueueOutboundCallerConfig_queueId :: Lens.Lens' UpdateQueueOutboundCallerConfig Prelude.Text
updateQueueOutboundCallerConfig_queueId :: Lens' UpdateQueueOutboundCallerConfig Text
updateQueueOutboundCallerConfig_queueId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateQueueOutboundCallerConfig' {Text
queueId :: Text
$sel:queueId:UpdateQueueOutboundCallerConfig' :: UpdateQueueOutboundCallerConfig -> Text
queueId} -> Text
queueId) (\s :: UpdateQueueOutboundCallerConfig
s@UpdateQueueOutboundCallerConfig' {} Text
a -> UpdateQueueOutboundCallerConfig
s {$sel:queueId:UpdateQueueOutboundCallerConfig' :: Text
queueId = Text
a} :: UpdateQueueOutboundCallerConfig)

-- | The outbound caller ID name, number, and outbound whisper flow.
updateQueueOutboundCallerConfig_outboundCallerConfig :: Lens.Lens' UpdateQueueOutboundCallerConfig OutboundCallerConfig
updateQueueOutboundCallerConfig_outboundCallerConfig :: Lens' UpdateQueueOutboundCallerConfig OutboundCallerConfig
updateQueueOutboundCallerConfig_outboundCallerConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateQueueOutboundCallerConfig' {OutboundCallerConfig
outboundCallerConfig :: OutboundCallerConfig
$sel:outboundCallerConfig:UpdateQueueOutboundCallerConfig' :: UpdateQueueOutboundCallerConfig -> OutboundCallerConfig
outboundCallerConfig} -> OutboundCallerConfig
outboundCallerConfig) (\s :: UpdateQueueOutboundCallerConfig
s@UpdateQueueOutboundCallerConfig' {} OutboundCallerConfig
a -> UpdateQueueOutboundCallerConfig
s {$sel:outboundCallerConfig:UpdateQueueOutboundCallerConfig' :: OutboundCallerConfig
outboundCallerConfig = OutboundCallerConfig
a} :: UpdateQueueOutboundCallerConfig)

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

instance
  Prelude.Hashable
    UpdateQueueOutboundCallerConfig
  where
  hashWithSalt :: Int -> UpdateQueueOutboundCallerConfig -> Int
hashWithSalt
    Int
_salt
    UpdateQueueOutboundCallerConfig' {Text
OutboundCallerConfig
outboundCallerConfig :: OutboundCallerConfig
queueId :: Text
instanceId :: Text
$sel:outboundCallerConfig:UpdateQueueOutboundCallerConfig' :: UpdateQueueOutboundCallerConfig -> OutboundCallerConfig
$sel:queueId:UpdateQueueOutboundCallerConfig' :: UpdateQueueOutboundCallerConfig -> Text
$sel:instanceId:UpdateQueueOutboundCallerConfig' :: UpdateQueueOutboundCallerConfig -> Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
instanceId
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
queueId
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` OutboundCallerConfig
outboundCallerConfig

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

instance
  Data.ToHeaders
    UpdateQueueOutboundCallerConfig
  where
  toHeaders :: UpdateQueueOutboundCallerConfig -> [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.ToJSON UpdateQueueOutboundCallerConfig where
  toJSON :: UpdateQueueOutboundCallerConfig -> Value
toJSON UpdateQueueOutboundCallerConfig' {Text
OutboundCallerConfig
outboundCallerConfig :: OutboundCallerConfig
queueId :: Text
instanceId :: Text
$sel:outboundCallerConfig:UpdateQueueOutboundCallerConfig' :: UpdateQueueOutboundCallerConfig -> OutboundCallerConfig
$sel:queueId:UpdateQueueOutboundCallerConfig' :: UpdateQueueOutboundCallerConfig -> Text
$sel:instanceId:UpdateQueueOutboundCallerConfig' :: UpdateQueueOutboundCallerConfig -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              ( Key
"OutboundCallerConfig"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= OutboundCallerConfig
outboundCallerConfig
              )
          ]
      )

instance Data.ToPath UpdateQueueOutboundCallerConfig where
  toPath :: UpdateQueueOutboundCallerConfig -> ByteString
toPath UpdateQueueOutboundCallerConfig' {Text
OutboundCallerConfig
outboundCallerConfig :: OutboundCallerConfig
queueId :: Text
instanceId :: Text
$sel:outboundCallerConfig:UpdateQueueOutboundCallerConfig' :: UpdateQueueOutboundCallerConfig -> OutboundCallerConfig
$sel:queueId:UpdateQueueOutboundCallerConfig' :: UpdateQueueOutboundCallerConfig -> Text
$sel:instanceId:UpdateQueueOutboundCallerConfig' :: UpdateQueueOutboundCallerConfig -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/queues/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
instanceId,
        ByteString
"/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
queueId,
        ByteString
"/outbound-caller-config"
      ]

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

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

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

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