{-# 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.UpdateUserHierarchyStructure
-- 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 user hierarchy structure: add, remove, and rename user
-- hierarchy levels.
module Amazonka.Connect.UpdateUserHierarchyStructure
  ( -- * Creating a Request
    UpdateUserHierarchyStructure (..),
    newUpdateUserHierarchyStructure,

    -- * Request Lenses
    updateUserHierarchyStructure_hierarchyStructure,
    updateUserHierarchyStructure_instanceId,

    -- * Destructuring the Response
    UpdateUserHierarchyStructureResponse (..),
    newUpdateUserHierarchyStructureResponse,
  )
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:/ 'newUpdateUserHierarchyStructure' smart constructor.
data UpdateUserHierarchyStructure = UpdateUserHierarchyStructure'
  { -- | The hierarchy levels to update.
    UpdateUserHierarchyStructure -> HierarchyStructureUpdate
hierarchyStructure :: HierarchyStructureUpdate,
    -- | The identifier of the Amazon Connect instance. You can find the
    -- instanceId in the ARN of the instance.
    UpdateUserHierarchyStructure -> Text
instanceId :: Prelude.Text
  }
  deriving (UpdateUserHierarchyStructure
-> UpdateUserHierarchyStructure -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateUserHierarchyStructure
-> UpdateUserHierarchyStructure -> Bool
$c/= :: UpdateUserHierarchyStructure
-> UpdateUserHierarchyStructure -> Bool
== :: UpdateUserHierarchyStructure
-> UpdateUserHierarchyStructure -> Bool
$c== :: UpdateUserHierarchyStructure
-> UpdateUserHierarchyStructure -> Bool
Prelude.Eq, ReadPrec [UpdateUserHierarchyStructure]
ReadPrec UpdateUserHierarchyStructure
Int -> ReadS UpdateUserHierarchyStructure
ReadS [UpdateUserHierarchyStructure]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateUserHierarchyStructure]
$creadListPrec :: ReadPrec [UpdateUserHierarchyStructure]
readPrec :: ReadPrec UpdateUserHierarchyStructure
$creadPrec :: ReadPrec UpdateUserHierarchyStructure
readList :: ReadS [UpdateUserHierarchyStructure]
$creadList :: ReadS [UpdateUserHierarchyStructure]
readsPrec :: Int -> ReadS UpdateUserHierarchyStructure
$creadsPrec :: Int -> ReadS UpdateUserHierarchyStructure
Prelude.Read, Int -> UpdateUserHierarchyStructure -> ShowS
[UpdateUserHierarchyStructure] -> ShowS
UpdateUserHierarchyStructure -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateUserHierarchyStructure] -> ShowS
$cshowList :: [UpdateUserHierarchyStructure] -> ShowS
show :: UpdateUserHierarchyStructure -> String
$cshow :: UpdateUserHierarchyStructure -> String
showsPrec :: Int -> UpdateUserHierarchyStructure -> ShowS
$cshowsPrec :: Int -> UpdateUserHierarchyStructure -> ShowS
Prelude.Show, forall x.
Rep UpdateUserHierarchyStructure x -> UpdateUserHierarchyStructure
forall x.
UpdateUserHierarchyStructure -> Rep UpdateUserHierarchyStructure x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateUserHierarchyStructure x -> UpdateUserHierarchyStructure
$cfrom :: forall x.
UpdateUserHierarchyStructure -> Rep UpdateUserHierarchyStructure x
Prelude.Generic)

-- |
-- Create a value of 'UpdateUserHierarchyStructure' 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:
--
-- 'hierarchyStructure', 'updateUserHierarchyStructure_hierarchyStructure' - The hierarchy levels to update.
--
-- 'instanceId', 'updateUserHierarchyStructure_instanceId' - The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
newUpdateUserHierarchyStructure ::
  -- | 'hierarchyStructure'
  HierarchyStructureUpdate ->
  -- | 'instanceId'
  Prelude.Text ->
  UpdateUserHierarchyStructure
newUpdateUserHierarchyStructure :: HierarchyStructureUpdate -> Text -> UpdateUserHierarchyStructure
newUpdateUserHierarchyStructure
  HierarchyStructureUpdate
pHierarchyStructure_
  Text
pInstanceId_ =
    UpdateUserHierarchyStructure'
      { $sel:hierarchyStructure:UpdateUserHierarchyStructure' :: HierarchyStructureUpdate
hierarchyStructure =
          HierarchyStructureUpdate
pHierarchyStructure_,
        $sel:instanceId:UpdateUserHierarchyStructure' :: Text
instanceId = Text
pInstanceId_
      }

-- | The hierarchy levels to update.
updateUserHierarchyStructure_hierarchyStructure :: Lens.Lens' UpdateUserHierarchyStructure HierarchyStructureUpdate
updateUserHierarchyStructure_hierarchyStructure :: Lens' UpdateUserHierarchyStructure HierarchyStructureUpdate
updateUserHierarchyStructure_hierarchyStructure = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUserHierarchyStructure' {HierarchyStructureUpdate
hierarchyStructure :: HierarchyStructureUpdate
$sel:hierarchyStructure:UpdateUserHierarchyStructure' :: UpdateUserHierarchyStructure -> HierarchyStructureUpdate
hierarchyStructure} -> HierarchyStructureUpdate
hierarchyStructure) (\s :: UpdateUserHierarchyStructure
s@UpdateUserHierarchyStructure' {} HierarchyStructureUpdate
a -> UpdateUserHierarchyStructure
s {$sel:hierarchyStructure:UpdateUserHierarchyStructure' :: HierarchyStructureUpdate
hierarchyStructure = HierarchyStructureUpdate
a} :: UpdateUserHierarchyStructure)

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

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

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

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

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

instance Data.ToPath UpdateUserHierarchyStructure where
  toPath :: UpdateUserHierarchyStructure -> ByteString
toPath UpdateUserHierarchyStructure' {Text
HierarchyStructureUpdate
instanceId :: Text
hierarchyStructure :: HierarchyStructureUpdate
$sel:instanceId:UpdateUserHierarchyStructure' :: UpdateUserHierarchyStructure -> Text
$sel:hierarchyStructure:UpdateUserHierarchyStructure' :: UpdateUserHierarchyStructure -> HierarchyStructureUpdate
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/user-hierarchy-structure/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
instanceId]

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

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

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

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