{-# 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.DeleteUserHierarchyGroup
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes an existing user hierarchy group. It must not be associated with
-- any agents or have any active child groups.
module Amazonka.Connect.DeleteUserHierarchyGroup
  ( -- * Creating a Request
    DeleteUserHierarchyGroup (..),
    newDeleteUserHierarchyGroup,

    -- * Request Lenses
    deleteUserHierarchyGroup_hierarchyGroupId,
    deleteUserHierarchyGroup_instanceId,

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

-- |
-- Create a value of 'DeleteUserHierarchyGroup' 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:
--
-- 'hierarchyGroupId', 'deleteUserHierarchyGroup_hierarchyGroupId' - The identifier of the hierarchy group.
--
-- 'instanceId', 'deleteUserHierarchyGroup_instanceId' - The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
newDeleteUserHierarchyGroup ::
  -- | 'hierarchyGroupId'
  Prelude.Text ->
  -- | 'instanceId'
  Prelude.Text ->
  DeleteUserHierarchyGroup
newDeleteUserHierarchyGroup :: Text -> Text -> DeleteUserHierarchyGroup
newDeleteUserHierarchyGroup
  Text
pHierarchyGroupId_
  Text
pInstanceId_ =
    DeleteUserHierarchyGroup'
      { $sel:hierarchyGroupId:DeleteUserHierarchyGroup' :: Text
hierarchyGroupId =
          Text
pHierarchyGroupId_,
        $sel:instanceId:DeleteUserHierarchyGroup' :: Text
instanceId = Text
pInstanceId_
      }

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

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

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

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

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

instance Data.ToHeaders DeleteUserHierarchyGroup where
  toHeaders :: DeleteUserHierarchyGroup -> [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.ToPath DeleteUserHierarchyGroup where
  toPath :: DeleteUserHierarchyGroup -> ByteString
toPath DeleteUserHierarchyGroup' {Text
instanceId :: Text
hierarchyGroupId :: Text
$sel:instanceId:DeleteUserHierarchyGroup' :: DeleteUserHierarchyGroup -> Text
$sel:hierarchyGroupId:DeleteUserHierarchyGroup' :: DeleteUserHierarchyGroup -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/user-hierarchy-groups/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
instanceId,
        ByteString
"/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
hierarchyGroupId
      ]

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

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

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

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