{-# 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.UpdateUserHierarchyGroupName
-- 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 name of the user hierarchy group.
module Amazonka.Connect.UpdateUserHierarchyGroupName
  ( -- * Creating a Request
    UpdateUserHierarchyGroupName (..),
    newUpdateUserHierarchyGroupName,

    -- * Request Lenses
    updateUserHierarchyGroupName_name,
    updateUserHierarchyGroupName_hierarchyGroupId,
    updateUserHierarchyGroupName_instanceId,

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

-- |
-- Create a value of 'UpdateUserHierarchyGroupName' 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:
--
-- 'name', 'updateUserHierarchyGroupName_name' - The name of the hierarchy group. Must not be more than 100 characters.
--
-- 'hierarchyGroupId', 'updateUserHierarchyGroupName_hierarchyGroupId' - The identifier of the hierarchy group.
--
-- 'instanceId', 'updateUserHierarchyGroupName_instanceId' - The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
newUpdateUserHierarchyGroupName ::
  -- | 'name'
  Prelude.Text ->
  -- | 'hierarchyGroupId'
  Prelude.Text ->
  -- | 'instanceId'
  Prelude.Text ->
  UpdateUserHierarchyGroupName
newUpdateUserHierarchyGroupName :: Text -> Text -> Text -> UpdateUserHierarchyGroupName
newUpdateUserHierarchyGroupName
  Text
pName_
  Text
pHierarchyGroupId_
  Text
pInstanceId_ =
    UpdateUserHierarchyGroupName' :: Text -> Text -> Text -> UpdateUserHierarchyGroupName
UpdateUserHierarchyGroupName'
      { $sel:name:UpdateUserHierarchyGroupName' :: Text
name = Text
pName_,
        $sel:hierarchyGroupId:UpdateUserHierarchyGroupName' :: Text
hierarchyGroupId = Text
pHierarchyGroupId_,
        $sel:instanceId:UpdateUserHierarchyGroupName' :: Text
instanceId = Text
pInstanceId_
      }

-- | The name of the hierarchy group. Must not be more than 100 characters.
updateUserHierarchyGroupName_name :: Lens.Lens' UpdateUserHierarchyGroupName Prelude.Text
updateUserHierarchyGroupName_name :: (Text -> f Text)
-> UpdateUserHierarchyGroupName -> f UpdateUserHierarchyGroupName
updateUserHierarchyGroupName_name = (UpdateUserHierarchyGroupName -> Text)
-> (UpdateUserHierarchyGroupName
    -> Text -> UpdateUserHierarchyGroupName)
-> Lens
     UpdateUserHierarchyGroupName UpdateUserHierarchyGroupName Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUserHierarchyGroupName' {Text
name :: Text
$sel:name:UpdateUserHierarchyGroupName' :: UpdateUserHierarchyGroupName -> Text
name} -> Text
name) (\s :: UpdateUserHierarchyGroupName
s@UpdateUserHierarchyGroupName' {} Text
a -> UpdateUserHierarchyGroupName
s {$sel:name:UpdateUserHierarchyGroupName' :: Text
name = Text
a} :: UpdateUserHierarchyGroupName)

-- | The identifier of the hierarchy group.
updateUserHierarchyGroupName_hierarchyGroupId :: Lens.Lens' UpdateUserHierarchyGroupName Prelude.Text
updateUserHierarchyGroupName_hierarchyGroupId :: (Text -> f Text)
-> UpdateUserHierarchyGroupName -> f UpdateUserHierarchyGroupName
updateUserHierarchyGroupName_hierarchyGroupId = (UpdateUserHierarchyGroupName -> Text)
-> (UpdateUserHierarchyGroupName
    -> Text -> UpdateUserHierarchyGroupName)
-> Lens
     UpdateUserHierarchyGroupName UpdateUserHierarchyGroupName Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUserHierarchyGroupName' {Text
hierarchyGroupId :: Text
$sel:hierarchyGroupId:UpdateUserHierarchyGroupName' :: UpdateUserHierarchyGroupName -> Text
hierarchyGroupId} -> Text
hierarchyGroupId) (\s :: UpdateUserHierarchyGroupName
s@UpdateUserHierarchyGroupName' {} Text
a -> UpdateUserHierarchyGroupName
s {$sel:hierarchyGroupId:UpdateUserHierarchyGroupName' :: Text
hierarchyGroupId = Text
a} :: UpdateUserHierarchyGroupName)

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

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

instance
  Prelude.Hashable
    UpdateUserHierarchyGroupName

instance Prelude.NFData UpdateUserHierarchyGroupName

instance Core.ToHeaders UpdateUserHierarchyGroupName where
  toHeaders :: UpdateUserHierarchyGroupName -> [Header]
toHeaders =
    [Header] -> UpdateUserHierarchyGroupName -> [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 UpdateUserHierarchyGroupName where
  toJSON :: UpdateUserHierarchyGroupName -> Value
toJSON UpdateUserHierarchyGroupName' {Text
instanceId :: Text
hierarchyGroupId :: Text
name :: Text
$sel:instanceId:UpdateUserHierarchyGroupName' :: UpdateUserHierarchyGroupName -> Text
$sel:hierarchyGroupId:UpdateUserHierarchyGroupName' :: UpdateUserHierarchyGroupName -> Text
$sel:name:UpdateUserHierarchyGroupName' :: UpdateUserHierarchyGroupName -> Text
..} =
    [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
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)]
      )

instance Core.ToPath UpdateUserHierarchyGroupName where
  toPath :: UpdateUserHierarchyGroupName -> ByteString
toPath UpdateUserHierarchyGroupName' {Text
instanceId :: Text
hierarchyGroupId :: Text
name :: Text
$sel:instanceId:UpdateUserHierarchyGroupName' :: UpdateUserHierarchyGroupName -> Text
$sel:hierarchyGroupId:UpdateUserHierarchyGroupName' :: UpdateUserHierarchyGroupName -> Text
$sel:name:UpdateUserHierarchyGroupName' :: UpdateUserHierarchyGroupName -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/user-hierarchy-groups/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
instanceId,
        ByteString
"/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
hierarchyGroupId,
        ByteString
"/name"
      ]

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

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

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

instance
  Prelude.NFData
    UpdateUserHierarchyGroupNameResponse