{-# 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.UpdateUserPhoneConfig
-- 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)
--
-- Updates the phone configuration settings for the specified user.
module Amazonka.Connect.UpdateUserPhoneConfig
  ( -- * Creating a Request
    UpdateUserPhoneConfig (..),
    newUpdateUserPhoneConfig,

    -- * Request Lenses
    updateUserPhoneConfig_phoneConfig,
    updateUserPhoneConfig_userId,
    updateUserPhoneConfig_instanceId,

    -- * Destructuring the Response
    UpdateUserPhoneConfigResponse (..),
    newUpdateUserPhoneConfigResponse,
  )
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:/ 'newUpdateUserPhoneConfig' smart constructor.
data UpdateUserPhoneConfig = UpdateUserPhoneConfig'
  { -- | Information about phone configuration settings for the user.
    UpdateUserPhoneConfig -> UserPhoneConfig
phoneConfig :: UserPhoneConfig,
    -- | The identifier of the user account.
    UpdateUserPhoneConfig -> Text
userId :: Prelude.Text,
    -- | The identifier of the Amazon Connect instance. You can find the
    -- instanceId in the ARN of the instance.
    UpdateUserPhoneConfig -> Text
instanceId :: Prelude.Text
  }
  deriving (UpdateUserPhoneConfig -> UpdateUserPhoneConfig -> Bool
(UpdateUserPhoneConfig -> UpdateUserPhoneConfig -> Bool)
-> (UpdateUserPhoneConfig -> UpdateUserPhoneConfig -> Bool)
-> Eq UpdateUserPhoneConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateUserPhoneConfig -> UpdateUserPhoneConfig -> Bool
$c/= :: UpdateUserPhoneConfig -> UpdateUserPhoneConfig -> Bool
== :: UpdateUserPhoneConfig -> UpdateUserPhoneConfig -> Bool
$c== :: UpdateUserPhoneConfig -> UpdateUserPhoneConfig -> Bool
Prelude.Eq, ReadPrec [UpdateUserPhoneConfig]
ReadPrec UpdateUserPhoneConfig
Int -> ReadS UpdateUserPhoneConfig
ReadS [UpdateUserPhoneConfig]
(Int -> ReadS UpdateUserPhoneConfig)
-> ReadS [UpdateUserPhoneConfig]
-> ReadPrec UpdateUserPhoneConfig
-> ReadPrec [UpdateUserPhoneConfig]
-> Read UpdateUserPhoneConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateUserPhoneConfig]
$creadListPrec :: ReadPrec [UpdateUserPhoneConfig]
readPrec :: ReadPrec UpdateUserPhoneConfig
$creadPrec :: ReadPrec UpdateUserPhoneConfig
readList :: ReadS [UpdateUserPhoneConfig]
$creadList :: ReadS [UpdateUserPhoneConfig]
readsPrec :: Int -> ReadS UpdateUserPhoneConfig
$creadsPrec :: Int -> ReadS UpdateUserPhoneConfig
Prelude.Read, Int -> UpdateUserPhoneConfig -> ShowS
[UpdateUserPhoneConfig] -> ShowS
UpdateUserPhoneConfig -> String
(Int -> UpdateUserPhoneConfig -> ShowS)
-> (UpdateUserPhoneConfig -> String)
-> ([UpdateUserPhoneConfig] -> ShowS)
-> Show UpdateUserPhoneConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateUserPhoneConfig] -> ShowS
$cshowList :: [UpdateUserPhoneConfig] -> ShowS
show :: UpdateUserPhoneConfig -> String
$cshow :: UpdateUserPhoneConfig -> String
showsPrec :: Int -> UpdateUserPhoneConfig -> ShowS
$cshowsPrec :: Int -> UpdateUserPhoneConfig -> ShowS
Prelude.Show, (forall x. UpdateUserPhoneConfig -> Rep UpdateUserPhoneConfig x)
-> (forall x. Rep UpdateUserPhoneConfig x -> UpdateUserPhoneConfig)
-> Generic UpdateUserPhoneConfig
forall x. Rep UpdateUserPhoneConfig x -> UpdateUserPhoneConfig
forall x. UpdateUserPhoneConfig -> Rep UpdateUserPhoneConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateUserPhoneConfig x -> UpdateUserPhoneConfig
$cfrom :: forall x. UpdateUserPhoneConfig -> Rep UpdateUserPhoneConfig x
Prelude.Generic)

-- |
-- Create a value of 'UpdateUserPhoneConfig' 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:
--
-- 'phoneConfig', 'updateUserPhoneConfig_phoneConfig' - Information about phone configuration settings for the user.
--
-- 'userId', 'updateUserPhoneConfig_userId' - The identifier of the user account.
--
-- 'instanceId', 'updateUserPhoneConfig_instanceId' - The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
newUpdateUserPhoneConfig ::
  -- | 'phoneConfig'
  UserPhoneConfig ->
  -- | 'userId'
  Prelude.Text ->
  -- | 'instanceId'
  Prelude.Text ->
  UpdateUserPhoneConfig
newUpdateUserPhoneConfig :: UserPhoneConfig -> Text -> Text -> UpdateUserPhoneConfig
newUpdateUserPhoneConfig
  UserPhoneConfig
pPhoneConfig_
  Text
pUserId_
  Text
pInstanceId_ =
    UpdateUserPhoneConfig' :: UserPhoneConfig -> Text -> Text -> UpdateUserPhoneConfig
UpdateUserPhoneConfig'
      { $sel:phoneConfig:UpdateUserPhoneConfig' :: UserPhoneConfig
phoneConfig = UserPhoneConfig
pPhoneConfig_,
        $sel:userId:UpdateUserPhoneConfig' :: Text
userId = Text
pUserId_,
        $sel:instanceId:UpdateUserPhoneConfig' :: Text
instanceId = Text
pInstanceId_
      }

-- | Information about phone configuration settings for the user.
updateUserPhoneConfig_phoneConfig :: Lens.Lens' UpdateUserPhoneConfig UserPhoneConfig
updateUserPhoneConfig_phoneConfig :: (UserPhoneConfig -> f UserPhoneConfig)
-> UpdateUserPhoneConfig -> f UpdateUserPhoneConfig
updateUserPhoneConfig_phoneConfig = (UpdateUserPhoneConfig -> UserPhoneConfig)
-> (UpdateUserPhoneConfig
    -> UserPhoneConfig -> UpdateUserPhoneConfig)
-> Lens
     UpdateUserPhoneConfig
     UpdateUserPhoneConfig
     UserPhoneConfig
     UserPhoneConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUserPhoneConfig' {UserPhoneConfig
phoneConfig :: UserPhoneConfig
$sel:phoneConfig:UpdateUserPhoneConfig' :: UpdateUserPhoneConfig -> UserPhoneConfig
phoneConfig} -> UserPhoneConfig
phoneConfig) (\s :: UpdateUserPhoneConfig
s@UpdateUserPhoneConfig' {} UserPhoneConfig
a -> UpdateUserPhoneConfig
s {$sel:phoneConfig:UpdateUserPhoneConfig' :: UserPhoneConfig
phoneConfig = UserPhoneConfig
a} :: UpdateUserPhoneConfig)

-- | The identifier of the user account.
updateUserPhoneConfig_userId :: Lens.Lens' UpdateUserPhoneConfig Prelude.Text
updateUserPhoneConfig_userId :: (Text -> f Text)
-> UpdateUserPhoneConfig -> f UpdateUserPhoneConfig
updateUserPhoneConfig_userId = (UpdateUserPhoneConfig -> Text)
-> (UpdateUserPhoneConfig -> Text -> UpdateUserPhoneConfig)
-> Lens UpdateUserPhoneConfig UpdateUserPhoneConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUserPhoneConfig' {Text
userId :: Text
$sel:userId:UpdateUserPhoneConfig' :: UpdateUserPhoneConfig -> Text
userId} -> Text
userId) (\s :: UpdateUserPhoneConfig
s@UpdateUserPhoneConfig' {} Text
a -> UpdateUserPhoneConfig
s {$sel:userId:UpdateUserPhoneConfig' :: Text
userId = Text
a} :: UpdateUserPhoneConfig)

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

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

instance Prelude.Hashable UpdateUserPhoneConfig

instance Prelude.NFData UpdateUserPhoneConfig

instance Core.ToHeaders UpdateUserPhoneConfig where
  toHeaders :: UpdateUserPhoneConfig -> [Header]
toHeaders =
    [Header] -> UpdateUserPhoneConfig -> [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.ToJSON UpdateUserPhoneConfig where
  toJSON :: UpdateUserPhoneConfig -> Value
toJSON UpdateUserPhoneConfig' {Text
UserPhoneConfig
instanceId :: Text
userId :: Text
phoneConfig :: UserPhoneConfig
$sel:instanceId:UpdateUserPhoneConfig' :: UpdateUserPhoneConfig -> Text
$sel:userId:UpdateUserPhoneConfig' :: UpdateUserPhoneConfig -> Text
$sel:phoneConfig:UpdateUserPhoneConfig' :: UpdateUserPhoneConfig -> UserPhoneConfig
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"PhoneConfig" Text -> UserPhoneConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= UserPhoneConfig
phoneConfig)]
      )

instance Core.ToPath UpdateUserPhoneConfig where
  toPath :: UpdateUserPhoneConfig -> ByteString
toPath UpdateUserPhoneConfig' {Text
UserPhoneConfig
instanceId :: Text
userId :: Text
phoneConfig :: UserPhoneConfig
$sel:instanceId:UpdateUserPhoneConfig' :: UpdateUserPhoneConfig -> Text
$sel:userId:UpdateUserPhoneConfig' :: UpdateUserPhoneConfig -> Text
$sel:phoneConfig:UpdateUserPhoneConfig' :: UpdateUserPhoneConfig -> UserPhoneConfig
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/users/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
instanceId,
        ByteString
"/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
userId,
        ByteString
"/phone-config"
      ]

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

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

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

instance Prelude.NFData UpdateUserPhoneConfigResponse