{-# 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.UpdateRoutingProfileName
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Updates the name and description of a routing profile. The request
-- accepts the following data in JSON format. At least @Name@ or
-- @Description@ must be provided.
module Amazonka.Connect.UpdateRoutingProfileName
  ( -- * Creating a Request
    UpdateRoutingProfileName (..),
    newUpdateRoutingProfileName,

    -- * Request Lenses
    updateRoutingProfileName_description,
    updateRoutingProfileName_name,
    updateRoutingProfileName_instanceId,
    updateRoutingProfileName_routingProfileId,

    -- * Destructuring the Response
    UpdateRoutingProfileNameResponse (..),
    newUpdateRoutingProfileNameResponse,
  )
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:/ 'newUpdateRoutingProfileName' smart constructor.
data UpdateRoutingProfileName = UpdateRoutingProfileName'
  { -- | The description of the routing profile. Must not be more than 250
    -- characters.
    UpdateRoutingProfileName -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The name of the routing profile. Must not be more than 127 characters.
    UpdateRoutingProfileName -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the Amazon Connect instance. You can find the
    -- instanceId in the ARN of the instance.
    UpdateRoutingProfileName -> Text
instanceId :: Prelude.Text,
    -- | The identifier of the routing profile.
    UpdateRoutingProfileName -> Text
routingProfileId :: Prelude.Text
  }
  deriving (UpdateRoutingProfileName -> UpdateRoutingProfileName -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateRoutingProfileName -> UpdateRoutingProfileName -> Bool
$c/= :: UpdateRoutingProfileName -> UpdateRoutingProfileName -> Bool
== :: UpdateRoutingProfileName -> UpdateRoutingProfileName -> Bool
$c== :: UpdateRoutingProfileName -> UpdateRoutingProfileName -> Bool
Prelude.Eq, ReadPrec [UpdateRoutingProfileName]
ReadPrec UpdateRoutingProfileName
Int -> ReadS UpdateRoutingProfileName
ReadS [UpdateRoutingProfileName]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateRoutingProfileName]
$creadListPrec :: ReadPrec [UpdateRoutingProfileName]
readPrec :: ReadPrec UpdateRoutingProfileName
$creadPrec :: ReadPrec UpdateRoutingProfileName
readList :: ReadS [UpdateRoutingProfileName]
$creadList :: ReadS [UpdateRoutingProfileName]
readsPrec :: Int -> ReadS UpdateRoutingProfileName
$creadsPrec :: Int -> ReadS UpdateRoutingProfileName
Prelude.Read, Int -> UpdateRoutingProfileName -> ShowS
[UpdateRoutingProfileName] -> ShowS
UpdateRoutingProfileName -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateRoutingProfileName] -> ShowS
$cshowList :: [UpdateRoutingProfileName] -> ShowS
show :: UpdateRoutingProfileName -> String
$cshow :: UpdateRoutingProfileName -> String
showsPrec :: Int -> UpdateRoutingProfileName -> ShowS
$cshowsPrec :: Int -> UpdateRoutingProfileName -> ShowS
Prelude.Show, forall x.
Rep UpdateRoutingProfileName x -> UpdateRoutingProfileName
forall x.
UpdateRoutingProfileName -> Rep UpdateRoutingProfileName x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateRoutingProfileName x -> UpdateRoutingProfileName
$cfrom :: forall x.
UpdateRoutingProfileName -> Rep UpdateRoutingProfileName x
Prelude.Generic)

-- |
-- Create a value of 'UpdateRoutingProfileName' 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:
--
-- 'description', 'updateRoutingProfileName_description' - The description of the routing profile. Must not be more than 250
-- characters.
--
-- 'name', 'updateRoutingProfileName_name' - The name of the routing profile. Must not be more than 127 characters.
--
-- 'instanceId', 'updateRoutingProfileName_instanceId' - The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
--
-- 'routingProfileId', 'updateRoutingProfileName_routingProfileId' - The identifier of the routing profile.
newUpdateRoutingProfileName ::
  -- | 'instanceId'
  Prelude.Text ->
  -- | 'routingProfileId'
  Prelude.Text ->
  UpdateRoutingProfileName
newUpdateRoutingProfileName :: Text -> Text -> UpdateRoutingProfileName
newUpdateRoutingProfileName
  Text
pInstanceId_
  Text
pRoutingProfileId_ =
    UpdateRoutingProfileName'
      { $sel:description:UpdateRoutingProfileName' :: Maybe Text
description =
          forall a. Maybe a
Prelude.Nothing,
        $sel:name:UpdateRoutingProfileName' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
        $sel:instanceId:UpdateRoutingProfileName' :: Text
instanceId = Text
pInstanceId_,
        $sel:routingProfileId:UpdateRoutingProfileName' :: Text
routingProfileId = Text
pRoutingProfileId_
      }

-- | The description of the routing profile. Must not be more than 250
-- characters.
updateRoutingProfileName_description :: Lens.Lens' UpdateRoutingProfileName (Prelude.Maybe Prelude.Text)
updateRoutingProfileName_description :: Lens' UpdateRoutingProfileName (Maybe Text)
updateRoutingProfileName_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoutingProfileName' {Maybe Text
description :: Maybe Text
$sel:description:UpdateRoutingProfileName' :: UpdateRoutingProfileName -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateRoutingProfileName
s@UpdateRoutingProfileName' {} Maybe Text
a -> UpdateRoutingProfileName
s {$sel:description:UpdateRoutingProfileName' :: Maybe Text
description = Maybe Text
a} :: UpdateRoutingProfileName)

-- | The name of the routing profile. Must not be more than 127 characters.
updateRoutingProfileName_name :: Lens.Lens' UpdateRoutingProfileName (Prelude.Maybe Prelude.Text)
updateRoutingProfileName_name :: Lens' UpdateRoutingProfileName (Maybe Text)
updateRoutingProfileName_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoutingProfileName' {Maybe Text
name :: Maybe Text
$sel:name:UpdateRoutingProfileName' :: UpdateRoutingProfileName -> Maybe Text
name} -> Maybe Text
name) (\s :: UpdateRoutingProfileName
s@UpdateRoutingProfileName' {} Maybe Text
a -> UpdateRoutingProfileName
s {$sel:name:UpdateRoutingProfileName' :: Maybe Text
name = Maybe Text
a} :: UpdateRoutingProfileName)

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

-- | The identifier of the routing profile.
updateRoutingProfileName_routingProfileId :: Lens.Lens' UpdateRoutingProfileName Prelude.Text
updateRoutingProfileName_routingProfileId :: Lens' UpdateRoutingProfileName Text
updateRoutingProfileName_routingProfileId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoutingProfileName' {Text
routingProfileId :: Text
$sel:routingProfileId:UpdateRoutingProfileName' :: UpdateRoutingProfileName -> Text
routingProfileId} -> Text
routingProfileId) (\s :: UpdateRoutingProfileName
s@UpdateRoutingProfileName' {} Text
a -> UpdateRoutingProfileName
s {$sel:routingProfileId:UpdateRoutingProfileName' :: Text
routingProfileId = Text
a} :: UpdateRoutingProfileName)

instance Core.AWSRequest UpdateRoutingProfileName where
  type
    AWSResponse UpdateRoutingProfileName =
      UpdateRoutingProfileNameResponse
  request :: (Service -> Service)
-> UpdateRoutingProfileName -> Request UpdateRoutingProfileName
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 UpdateRoutingProfileName
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateRoutingProfileName)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      UpdateRoutingProfileNameResponse
UpdateRoutingProfileNameResponse'

instance Prelude.Hashable UpdateRoutingProfileName where
  hashWithSalt :: Int -> UpdateRoutingProfileName -> Int
hashWithSalt Int
_salt UpdateRoutingProfileName' {Maybe Text
Text
routingProfileId :: Text
instanceId :: Text
name :: Maybe Text
description :: Maybe Text
$sel:routingProfileId:UpdateRoutingProfileName' :: UpdateRoutingProfileName -> Text
$sel:instanceId:UpdateRoutingProfileName' :: UpdateRoutingProfileName -> Text
$sel:name:UpdateRoutingProfileName' :: UpdateRoutingProfileName -> Maybe Text
$sel:description:UpdateRoutingProfileName' :: UpdateRoutingProfileName -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
instanceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
routingProfileId

instance Prelude.NFData UpdateRoutingProfileName where
  rnf :: UpdateRoutingProfileName -> ()
rnf UpdateRoutingProfileName' {Maybe Text
Text
routingProfileId :: Text
instanceId :: Text
name :: Maybe Text
description :: Maybe Text
$sel:routingProfileId:UpdateRoutingProfileName' :: UpdateRoutingProfileName -> Text
$sel:instanceId:UpdateRoutingProfileName' :: UpdateRoutingProfileName -> Text
$sel:name:UpdateRoutingProfileName' :: UpdateRoutingProfileName -> Maybe Text
$sel:description:UpdateRoutingProfileName' :: UpdateRoutingProfileName -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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
routingProfileId

instance Data.ToHeaders UpdateRoutingProfileName where
  toHeaders :: UpdateRoutingProfileName -> [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 UpdateRoutingProfileName where
  toJSON :: UpdateRoutingProfileName -> Value
toJSON UpdateRoutingProfileName' {Maybe Text
Text
routingProfileId :: Text
instanceId :: Text
name :: Maybe Text
description :: Maybe Text
$sel:routingProfileId:UpdateRoutingProfileName' :: UpdateRoutingProfileName -> Text
$sel:instanceId:UpdateRoutingProfileName' :: UpdateRoutingProfileName -> Text
$sel:name:UpdateRoutingProfileName' :: UpdateRoutingProfileName -> Maybe Text
$sel:description:UpdateRoutingProfileName' :: UpdateRoutingProfileName -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Description" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name
          ]
      )

instance Data.ToPath UpdateRoutingProfileName where
  toPath :: UpdateRoutingProfileName -> ByteString
toPath UpdateRoutingProfileName' {Maybe Text
Text
routingProfileId :: Text
instanceId :: Text
name :: Maybe Text
description :: Maybe Text
$sel:routingProfileId:UpdateRoutingProfileName' :: UpdateRoutingProfileName -> Text
$sel:instanceId:UpdateRoutingProfileName' :: UpdateRoutingProfileName -> Text
$sel:name:UpdateRoutingProfileName' :: UpdateRoutingProfileName -> Maybe Text
$sel:description:UpdateRoutingProfileName' :: UpdateRoutingProfileName -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/routing-profiles/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
instanceId,
        ByteString
"/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
routingProfileId,
        ByteString
"/name"
      ]

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

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

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

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