{-# 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.DescribeUserHierarchyGroup
-- 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)
--
-- Describes the specified hierarchy group.
module Amazonka.Connect.DescribeUserHierarchyGroup
  ( -- * Creating a Request
    DescribeUserHierarchyGroup (..),
    newDescribeUserHierarchyGroup,

    -- * Request Lenses
    describeUserHierarchyGroup_hierarchyGroupId,
    describeUserHierarchyGroup_instanceId,

    -- * Destructuring the Response
    DescribeUserHierarchyGroupResponse (..),
    newDescribeUserHierarchyGroupResponse,

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

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

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

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

instance Core.AWSRequest DescribeUserHierarchyGroup where
  type
    AWSResponse DescribeUserHierarchyGroup =
      DescribeUserHierarchyGroupResponse
  request :: DescribeUserHierarchyGroup -> Request DescribeUserHierarchyGroup
request = Service
-> DescribeUserHierarchyGroup -> Request DescribeUserHierarchyGroup
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeUserHierarchyGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeUserHierarchyGroup)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeUserHierarchyGroup))
-> Logger
-> Service
-> Proxy DescribeUserHierarchyGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeUserHierarchyGroup)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe HierarchyGroup -> Int -> DescribeUserHierarchyGroupResponse
DescribeUserHierarchyGroupResponse'
            (Maybe HierarchyGroup -> Int -> DescribeUserHierarchyGroupResponse)
-> Either String (Maybe HierarchyGroup)
-> Either String (Int -> DescribeUserHierarchyGroupResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe HierarchyGroup)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"HierarchyGroup")
            Either String (Int -> DescribeUserHierarchyGroupResponse)
-> Either String Int
-> Either String DescribeUserHierarchyGroupResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DescribeUserHierarchyGroup

instance Prelude.NFData DescribeUserHierarchyGroup

instance Core.ToHeaders DescribeUserHierarchyGroup where
  toHeaders :: DescribeUserHierarchyGroup -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeUserHierarchyGroup -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToPath DescribeUserHierarchyGroup where
  toPath :: DescribeUserHierarchyGroup -> ByteString
toPath DescribeUserHierarchyGroup' {Text
instanceId :: Text
hierarchyGroupId :: Text
$sel:instanceId:DescribeUserHierarchyGroup' :: DescribeUserHierarchyGroup -> Text
$sel:hierarchyGroupId:DescribeUserHierarchyGroup' :: DescribeUserHierarchyGroup -> 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 DescribeUserHierarchyGroup where
  toQuery :: DescribeUserHierarchyGroup -> QueryString
toQuery = QueryString -> DescribeUserHierarchyGroup -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newDescribeUserHierarchyGroupResponse' smart constructor.
data DescribeUserHierarchyGroupResponse = DescribeUserHierarchyGroupResponse'
  { -- | Information about the hierarchy group.
    DescribeUserHierarchyGroupResponse -> Maybe HierarchyGroup
hierarchyGroup :: Prelude.Maybe HierarchyGroup,
    -- | The response's http status code.
    DescribeUserHierarchyGroupResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeUserHierarchyGroupResponse
-> DescribeUserHierarchyGroupResponse -> Bool
(DescribeUserHierarchyGroupResponse
 -> DescribeUserHierarchyGroupResponse -> Bool)
-> (DescribeUserHierarchyGroupResponse
    -> DescribeUserHierarchyGroupResponse -> Bool)
-> Eq DescribeUserHierarchyGroupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeUserHierarchyGroupResponse
-> DescribeUserHierarchyGroupResponse -> Bool
$c/= :: DescribeUserHierarchyGroupResponse
-> DescribeUserHierarchyGroupResponse -> Bool
== :: DescribeUserHierarchyGroupResponse
-> DescribeUserHierarchyGroupResponse -> Bool
$c== :: DescribeUserHierarchyGroupResponse
-> DescribeUserHierarchyGroupResponse -> Bool
Prelude.Eq, ReadPrec [DescribeUserHierarchyGroupResponse]
ReadPrec DescribeUserHierarchyGroupResponse
Int -> ReadS DescribeUserHierarchyGroupResponse
ReadS [DescribeUserHierarchyGroupResponse]
(Int -> ReadS DescribeUserHierarchyGroupResponse)
-> ReadS [DescribeUserHierarchyGroupResponse]
-> ReadPrec DescribeUserHierarchyGroupResponse
-> ReadPrec [DescribeUserHierarchyGroupResponse]
-> Read DescribeUserHierarchyGroupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeUserHierarchyGroupResponse]
$creadListPrec :: ReadPrec [DescribeUserHierarchyGroupResponse]
readPrec :: ReadPrec DescribeUserHierarchyGroupResponse
$creadPrec :: ReadPrec DescribeUserHierarchyGroupResponse
readList :: ReadS [DescribeUserHierarchyGroupResponse]
$creadList :: ReadS [DescribeUserHierarchyGroupResponse]
readsPrec :: Int -> ReadS DescribeUserHierarchyGroupResponse
$creadsPrec :: Int -> ReadS DescribeUserHierarchyGroupResponse
Prelude.Read, Int -> DescribeUserHierarchyGroupResponse -> ShowS
[DescribeUserHierarchyGroupResponse] -> ShowS
DescribeUserHierarchyGroupResponse -> String
(Int -> DescribeUserHierarchyGroupResponse -> ShowS)
-> (DescribeUserHierarchyGroupResponse -> String)
-> ([DescribeUserHierarchyGroupResponse] -> ShowS)
-> Show DescribeUserHierarchyGroupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeUserHierarchyGroupResponse] -> ShowS
$cshowList :: [DescribeUserHierarchyGroupResponse] -> ShowS
show :: DescribeUserHierarchyGroupResponse -> String
$cshow :: DescribeUserHierarchyGroupResponse -> String
showsPrec :: Int -> DescribeUserHierarchyGroupResponse -> ShowS
$cshowsPrec :: Int -> DescribeUserHierarchyGroupResponse -> ShowS
Prelude.Show, (forall x.
 DescribeUserHierarchyGroupResponse
 -> Rep DescribeUserHierarchyGroupResponse x)
-> (forall x.
    Rep DescribeUserHierarchyGroupResponse x
    -> DescribeUserHierarchyGroupResponse)
-> Generic DescribeUserHierarchyGroupResponse
forall x.
Rep DescribeUserHierarchyGroupResponse x
-> DescribeUserHierarchyGroupResponse
forall x.
DescribeUserHierarchyGroupResponse
-> Rep DescribeUserHierarchyGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeUserHierarchyGroupResponse x
-> DescribeUserHierarchyGroupResponse
$cfrom :: forall x.
DescribeUserHierarchyGroupResponse
-> Rep DescribeUserHierarchyGroupResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeUserHierarchyGroupResponse' 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:
--
-- 'hierarchyGroup', 'describeUserHierarchyGroupResponse_hierarchyGroup' - Information about the hierarchy group.
--
-- 'httpStatus', 'describeUserHierarchyGroupResponse_httpStatus' - The response's http status code.
newDescribeUserHierarchyGroupResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeUserHierarchyGroupResponse
newDescribeUserHierarchyGroupResponse :: Int -> DescribeUserHierarchyGroupResponse
newDescribeUserHierarchyGroupResponse Int
pHttpStatus_ =
  DescribeUserHierarchyGroupResponse' :: Maybe HierarchyGroup -> Int -> DescribeUserHierarchyGroupResponse
DescribeUserHierarchyGroupResponse'
    { $sel:hierarchyGroup:DescribeUserHierarchyGroupResponse' :: Maybe HierarchyGroup
hierarchyGroup =
        Maybe HierarchyGroup
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeUserHierarchyGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the hierarchy group.
describeUserHierarchyGroupResponse_hierarchyGroup :: Lens.Lens' DescribeUserHierarchyGroupResponse (Prelude.Maybe HierarchyGroup)
describeUserHierarchyGroupResponse_hierarchyGroup :: (Maybe HierarchyGroup -> f (Maybe HierarchyGroup))
-> DescribeUserHierarchyGroupResponse
-> f DescribeUserHierarchyGroupResponse
describeUserHierarchyGroupResponse_hierarchyGroup = (DescribeUserHierarchyGroupResponse -> Maybe HierarchyGroup)
-> (DescribeUserHierarchyGroupResponse
    -> Maybe HierarchyGroup -> DescribeUserHierarchyGroupResponse)
-> Lens
     DescribeUserHierarchyGroupResponse
     DescribeUserHierarchyGroupResponse
     (Maybe HierarchyGroup)
     (Maybe HierarchyGroup)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeUserHierarchyGroupResponse' {Maybe HierarchyGroup
hierarchyGroup :: Maybe HierarchyGroup
$sel:hierarchyGroup:DescribeUserHierarchyGroupResponse' :: DescribeUserHierarchyGroupResponse -> Maybe HierarchyGroup
hierarchyGroup} -> Maybe HierarchyGroup
hierarchyGroup) (\s :: DescribeUserHierarchyGroupResponse
s@DescribeUserHierarchyGroupResponse' {} Maybe HierarchyGroup
a -> DescribeUserHierarchyGroupResponse
s {$sel:hierarchyGroup:DescribeUserHierarchyGroupResponse' :: Maybe HierarchyGroup
hierarchyGroup = Maybe HierarchyGroup
a} :: DescribeUserHierarchyGroupResponse)

-- | The response's http status code.
describeUserHierarchyGroupResponse_httpStatus :: Lens.Lens' DescribeUserHierarchyGroupResponse Prelude.Int
describeUserHierarchyGroupResponse_httpStatus :: (Int -> f Int)
-> DescribeUserHierarchyGroupResponse
-> f DescribeUserHierarchyGroupResponse
describeUserHierarchyGroupResponse_httpStatus = (DescribeUserHierarchyGroupResponse -> Int)
-> (DescribeUserHierarchyGroupResponse
    -> Int -> DescribeUserHierarchyGroupResponse)
-> Lens
     DescribeUserHierarchyGroupResponse
     DescribeUserHierarchyGroupResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeUserHierarchyGroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeUserHierarchyGroupResponse' :: DescribeUserHierarchyGroupResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeUserHierarchyGroupResponse
s@DescribeUserHierarchyGroupResponse' {} Int
a -> DescribeUserHierarchyGroupResponse
s {$sel:httpStatus:DescribeUserHierarchyGroupResponse' :: Int
httpStatus = Int
a} :: DescribeUserHierarchyGroupResponse)

instance
  Prelude.NFData
    DescribeUserHierarchyGroupResponse