{-# 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-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)
--
-- 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.Lens as Lens
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
(DeleteUserHierarchyGroup -> DeleteUserHierarchyGroup -> Bool)
-> (DeleteUserHierarchyGroup -> DeleteUserHierarchyGroup -> Bool)
-> Eq DeleteUserHierarchyGroup
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]
(Int -> ReadS DeleteUserHierarchyGroup)
-> ReadS [DeleteUserHierarchyGroup]
-> ReadPrec DeleteUserHierarchyGroup
-> ReadPrec [DeleteUserHierarchyGroup]
-> Read 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
(Int -> DeleteUserHierarchyGroup -> ShowS)
-> (DeleteUserHierarchyGroup -> String)
-> ([DeleteUserHierarchyGroup] -> ShowS)
-> Show DeleteUserHierarchyGroup
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.
 DeleteUserHierarchyGroup -> Rep DeleteUserHierarchyGroup x)
-> (forall x.
    Rep DeleteUserHierarchyGroup x -> DeleteUserHierarchyGroup)
-> Generic DeleteUserHierarchyGroup
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' :: Text -> Text -> DeleteUserHierarchyGroup
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 :: (Text -> f Text)
-> DeleteUserHierarchyGroup -> f DeleteUserHierarchyGroup
deleteUserHierarchyGroup_hierarchyGroupId = (DeleteUserHierarchyGroup -> Text)
-> (DeleteUserHierarchyGroup -> Text -> DeleteUserHierarchyGroup)
-> Lens DeleteUserHierarchyGroup DeleteUserHierarchyGroup Text Text
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 :: (Text -> f Text)
-> DeleteUserHierarchyGroup -> f DeleteUserHierarchyGroup
deleteUserHierarchyGroup_instanceId = (DeleteUserHierarchyGroup -> Text)
-> (DeleteUserHierarchyGroup -> Text -> DeleteUserHierarchyGroup)
-> Lens DeleteUserHierarchyGroup DeleteUserHierarchyGroup Text Text
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 :: DeleteUserHierarchyGroup -> Request DeleteUserHierarchyGroup
request = Service
-> DeleteUserHierarchyGroup -> Request DeleteUserHierarchyGroup
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteUserHierarchyGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteUserHierarchyGroup)))
response =
    AWSResponse DeleteUserHierarchyGroup
-> Logger
-> Service
-> Proxy DeleteUserHierarchyGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteUserHierarchyGroup)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      AWSResponse DeleteUserHierarchyGroup
DeleteUserHierarchyGroupResponse
DeleteUserHierarchyGroupResponse'

instance Prelude.Hashable DeleteUserHierarchyGroup

instance Prelude.NFData DeleteUserHierarchyGroup

instance Core.ToHeaders DeleteUserHierarchyGroup where
  toHeaders :: DeleteUserHierarchyGroup -> [Header]
toHeaders =
    [Header] -> DeleteUserHierarchyGroup -> [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.ToPath DeleteUserHierarchyGroup where
  toPath :: DeleteUserHierarchyGroup -> ByteString
toPath DeleteUserHierarchyGroup' {Text
instanceId :: Text
hierarchyGroupId :: Text
$sel:instanceId:DeleteUserHierarchyGroup' :: DeleteUserHierarchyGroup -> Text
$sel:hierarchyGroupId:DeleteUserHierarchyGroup' :: DeleteUserHierarchyGroup -> 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
      ]

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

-- | /See:/ 'newDeleteUserHierarchyGroupResponse' smart constructor.
data DeleteUserHierarchyGroupResponse = DeleteUserHierarchyGroupResponse'
  {
  }
  deriving (DeleteUserHierarchyGroupResponse
-> DeleteUserHierarchyGroupResponse -> Bool
(DeleteUserHierarchyGroupResponse
 -> DeleteUserHierarchyGroupResponse -> Bool)
-> (DeleteUserHierarchyGroupResponse
    -> DeleteUserHierarchyGroupResponse -> Bool)
-> Eq DeleteUserHierarchyGroupResponse
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]
(Int -> ReadS DeleteUserHierarchyGroupResponse)
-> ReadS [DeleteUserHierarchyGroupResponse]
-> ReadPrec DeleteUserHierarchyGroupResponse
-> ReadPrec [DeleteUserHierarchyGroupResponse]
-> Read 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
(Int -> DeleteUserHierarchyGroupResponse -> ShowS)
-> (DeleteUserHierarchyGroupResponse -> String)
-> ([DeleteUserHierarchyGroupResponse] -> ShowS)
-> Show DeleteUserHierarchyGroupResponse
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.
 DeleteUserHierarchyGroupResponse
 -> Rep DeleteUserHierarchyGroupResponse x)
-> (forall x.
    Rep DeleteUserHierarchyGroupResponse x
    -> DeleteUserHierarchyGroupResponse)
-> Generic DeleteUserHierarchyGroupResponse
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