{-# 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.QuickSight.DescribeGroup
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns an Amazon QuickSight group\'s description and Amazon Resource
-- Name (ARN).
module Amazonka.QuickSight.DescribeGroup
  ( -- * Creating a Request
    DescribeGroup (..),
    newDescribeGroup,

    -- * Request Lenses
    describeGroup_groupName,
    describeGroup_awsAccountId,
    describeGroup_namespace,

    -- * Destructuring the Response
    DescribeGroupResponse (..),
    newDescribeGroupResponse,

    -- * Response Lenses
    describeGroupResponse_group,
    describeGroupResponse_requestId,
    describeGroupResponse_status,
  )
where

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 Amazonka.QuickSight.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDescribeGroup' smart constructor.
data DescribeGroup = DescribeGroup'
  { -- | The name of the group that you want to describe.
    DescribeGroup -> Text
groupName :: Prelude.Text,
    -- | The ID for the Amazon Web Services account that the group is in.
    -- Currently, you use the ID for the Amazon Web Services account that
    -- contains your Amazon QuickSight account.
    DescribeGroup -> Text
awsAccountId :: Prelude.Text,
    -- | The namespace of the group that you want described.
    DescribeGroup -> Text
namespace :: Prelude.Text
  }
  deriving (DescribeGroup -> DescribeGroup -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeGroup -> DescribeGroup -> Bool
$c/= :: DescribeGroup -> DescribeGroup -> Bool
== :: DescribeGroup -> DescribeGroup -> Bool
$c== :: DescribeGroup -> DescribeGroup -> Bool
Prelude.Eq, ReadPrec [DescribeGroup]
ReadPrec DescribeGroup
Int -> ReadS DescribeGroup
ReadS [DescribeGroup]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeGroup]
$creadListPrec :: ReadPrec [DescribeGroup]
readPrec :: ReadPrec DescribeGroup
$creadPrec :: ReadPrec DescribeGroup
readList :: ReadS [DescribeGroup]
$creadList :: ReadS [DescribeGroup]
readsPrec :: Int -> ReadS DescribeGroup
$creadsPrec :: Int -> ReadS DescribeGroup
Prelude.Read, Int -> DescribeGroup -> ShowS
[DescribeGroup] -> ShowS
DescribeGroup -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeGroup] -> ShowS
$cshowList :: [DescribeGroup] -> ShowS
show :: DescribeGroup -> String
$cshow :: DescribeGroup -> String
showsPrec :: Int -> DescribeGroup -> ShowS
$cshowsPrec :: Int -> DescribeGroup -> ShowS
Prelude.Show, forall x. Rep DescribeGroup x -> DescribeGroup
forall x. DescribeGroup -> Rep DescribeGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeGroup x -> DescribeGroup
$cfrom :: forall x. DescribeGroup -> Rep DescribeGroup x
Prelude.Generic)

-- |
-- Create a value of 'DescribeGroup' 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:
--
-- 'groupName', 'describeGroup_groupName' - The name of the group that you want to describe.
--
-- 'awsAccountId', 'describeGroup_awsAccountId' - The ID for the Amazon Web Services account that the group is in.
-- Currently, you use the ID for the Amazon Web Services account that
-- contains your Amazon QuickSight account.
--
-- 'namespace', 'describeGroup_namespace' - The namespace of the group that you want described.
newDescribeGroup ::
  -- | 'groupName'
  Prelude.Text ->
  -- | 'awsAccountId'
  Prelude.Text ->
  -- | 'namespace'
  Prelude.Text ->
  DescribeGroup
newDescribeGroup :: Text -> Text -> Text -> DescribeGroup
newDescribeGroup
  Text
pGroupName_
  Text
pAwsAccountId_
  Text
pNamespace_ =
    DescribeGroup'
      { $sel:groupName:DescribeGroup' :: Text
groupName = Text
pGroupName_,
        $sel:awsAccountId:DescribeGroup' :: Text
awsAccountId = Text
pAwsAccountId_,
        $sel:namespace:DescribeGroup' :: Text
namespace = Text
pNamespace_
      }

-- | The name of the group that you want to describe.
describeGroup_groupName :: Lens.Lens' DescribeGroup Prelude.Text
describeGroup_groupName :: Lens' DescribeGroup Text
describeGroup_groupName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGroup' {Text
groupName :: Text
$sel:groupName:DescribeGroup' :: DescribeGroup -> Text
groupName} -> Text
groupName) (\s :: DescribeGroup
s@DescribeGroup' {} Text
a -> DescribeGroup
s {$sel:groupName:DescribeGroup' :: Text
groupName = Text
a} :: DescribeGroup)

-- | The ID for the Amazon Web Services account that the group is in.
-- Currently, you use the ID for the Amazon Web Services account that
-- contains your Amazon QuickSight account.
describeGroup_awsAccountId :: Lens.Lens' DescribeGroup Prelude.Text
describeGroup_awsAccountId :: Lens' DescribeGroup Text
describeGroup_awsAccountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGroup' {Text
awsAccountId :: Text
$sel:awsAccountId:DescribeGroup' :: DescribeGroup -> Text
awsAccountId} -> Text
awsAccountId) (\s :: DescribeGroup
s@DescribeGroup' {} Text
a -> DescribeGroup
s {$sel:awsAccountId:DescribeGroup' :: Text
awsAccountId = Text
a} :: DescribeGroup)

-- | The namespace of the group that you want described.
describeGroup_namespace :: Lens.Lens' DescribeGroup Prelude.Text
describeGroup_namespace :: Lens' DescribeGroup Text
describeGroup_namespace = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGroup' {Text
namespace :: Text
$sel:namespace:DescribeGroup' :: DescribeGroup -> Text
namespace} -> Text
namespace) (\s :: DescribeGroup
s@DescribeGroup' {} Text
a -> DescribeGroup
s {$sel:namespace:DescribeGroup' :: Text
namespace = Text
a} :: DescribeGroup)

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

instance Prelude.Hashable DescribeGroup where
  hashWithSalt :: Int -> DescribeGroup -> Int
hashWithSalt Int
_salt DescribeGroup' {Text
namespace :: Text
awsAccountId :: Text
groupName :: Text
$sel:namespace:DescribeGroup' :: DescribeGroup -> Text
$sel:awsAccountId:DescribeGroup' :: DescribeGroup -> Text
$sel:groupName:DescribeGroup' :: DescribeGroup -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
groupName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
awsAccountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
namespace

instance Prelude.NFData DescribeGroup where
  rnf :: DescribeGroup -> ()
rnf DescribeGroup' {Text
namespace :: Text
awsAccountId :: Text
groupName :: Text
$sel:namespace:DescribeGroup' :: DescribeGroup -> Text
$sel:awsAccountId:DescribeGroup' :: DescribeGroup -> Text
$sel:groupName:DescribeGroup' :: DescribeGroup -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
groupName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
awsAccountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
namespace

instance Data.ToHeaders DescribeGroup where
  toHeaders :: DescribeGroup -> ResponseHeaders
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 -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToPath DescribeGroup where
  toPath :: DescribeGroup -> ByteString
toPath DescribeGroup' {Text
namespace :: Text
awsAccountId :: Text
groupName :: Text
$sel:namespace:DescribeGroup' :: DescribeGroup -> Text
$sel:awsAccountId:DescribeGroup' :: DescribeGroup -> Text
$sel:groupName:DescribeGroup' :: DescribeGroup -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/accounts/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
awsAccountId,
        ByteString
"/namespaces/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
namespace,
        ByteString
"/groups/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
groupName
      ]

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

-- | /See:/ 'newDescribeGroupResponse' smart constructor.
data DescribeGroupResponse = DescribeGroupResponse'
  { -- | The name of the group.
    DescribeGroupResponse -> Maybe Group
group' :: Prelude.Maybe Group,
    -- | The Amazon Web Services request ID for this operation.
    DescribeGroupResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
    -- | The HTTP status of the request.
    DescribeGroupResponse -> Int
status :: Prelude.Int
  }
  deriving (DescribeGroupResponse -> DescribeGroupResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeGroupResponse -> DescribeGroupResponse -> Bool
$c/= :: DescribeGroupResponse -> DescribeGroupResponse -> Bool
== :: DescribeGroupResponse -> DescribeGroupResponse -> Bool
$c== :: DescribeGroupResponse -> DescribeGroupResponse -> Bool
Prelude.Eq, ReadPrec [DescribeGroupResponse]
ReadPrec DescribeGroupResponse
Int -> ReadS DescribeGroupResponse
ReadS [DescribeGroupResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeGroupResponse]
$creadListPrec :: ReadPrec [DescribeGroupResponse]
readPrec :: ReadPrec DescribeGroupResponse
$creadPrec :: ReadPrec DescribeGroupResponse
readList :: ReadS [DescribeGroupResponse]
$creadList :: ReadS [DescribeGroupResponse]
readsPrec :: Int -> ReadS DescribeGroupResponse
$creadsPrec :: Int -> ReadS DescribeGroupResponse
Prelude.Read, Int -> DescribeGroupResponse -> ShowS
[DescribeGroupResponse] -> ShowS
DescribeGroupResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeGroupResponse] -> ShowS
$cshowList :: [DescribeGroupResponse] -> ShowS
show :: DescribeGroupResponse -> String
$cshow :: DescribeGroupResponse -> String
showsPrec :: Int -> DescribeGroupResponse -> ShowS
$cshowsPrec :: Int -> DescribeGroupResponse -> ShowS
Prelude.Show, forall x. Rep DescribeGroupResponse x -> DescribeGroupResponse
forall x. DescribeGroupResponse -> Rep DescribeGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeGroupResponse x -> DescribeGroupResponse
$cfrom :: forall x. DescribeGroupResponse -> Rep DescribeGroupResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeGroupResponse' 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:
--
-- 'group'', 'describeGroupResponse_group' - The name of the group.
--
-- 'requestId', 'describeGroupResponse_requestId' - The Amazon Web Services request ID for this operation.
--
-- 'status', 'describeGroupResponse_status' - The HTTP status of the request.
newDescribeGroupResponse ::
  -- | 'status'
  Prelude.Int ->
  DescribeGroupResponse
newDescribeGroupResponse :: Int -> DescribeGroupResponse
newDescribeGroupResponse Int
pStatus_ =
  DescribeGroupResponse'
    { $sel:group':DescribeGroupResponse' :: Maybe Group
group' = forall a. Maybe a
Prelude.Nothing,
      $sel:requestId:DescribeGroupResponse' :: Maybe Text
requestId = forall a. Maybe a
Prelude.Nothing,
      $sel:status:DescribeGroupResponse' :: Int
status = Int
pStatus_
    }

-- | The name of the group.
describeGroupResponse_group :: Lens.Lens' DescribeGroupResponse (Prelude.Maybe Group)
describeGroupResponse_group :: Lens' DescribeGroupResponse (Maybe Group)
describeGroupResponse_group = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGroupResponse' {Maybe Group
group' :: Maybe Group
$sel:group':DescribeGroupResponse' :: DescribeGroupResponse -> Maybe Group
group'} -> Maybe Group
group') (\s :: DescribeGroupResponse
s@DescribeGroupResponse' {} Maybe Group
a -> DescribeGroupResponse
s {$sel:group':DescribeGroupResponse' :: Maybe Group
group' = Maybe Group
a} :: DescribeGroupResponse)

-- | The Amazon Web Services request ID for this operation.
describeGroupResponse_requestId :: Lens.Lens' DescribeGroupResponse (Prelude.Maybe Prelude.Text)
describeGroupResponse_requestId :: Lens' DescribeGroupResponse (Maybe Text)
describeGroupResponse_requestId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGroupResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:DescribeGroupResponse' :: DescribeGroupResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: DescribeGroupResponse
s@DescribeGroupResponse' {} Maybe Text
a -> DescribeGroupResponse
s {$sel:requestId:DescribeGroupResponse' :: Maybe Text
requestId = Maybe Text
a} :: DescribeGroupResponse)

-- | The HTTP status of the request.
describeGroupResponse_status :: Lens.Lens' DescribeGroupResponse Prelude.Int
describeGroupResponse_status :: Lens' DescribeGroupResponse Int
describeGroupResponse_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGroupResponse' {Int
status :: Int
$sel:status:DescribeGroupResponse' :: DescribeGroupResponse -> Int
status} -> Int
status) (\s :: DescribeGroupResponse
s@DescribeGroupResponse' {} Int
a -> DescribeGroupResponse
s {$sel:status:DescribeGroupResponse' :: Int
status = Int
a} :: DescribeGroupResponse)

instance Prelude.NFData DescribeGroupResponse where
  rnf :: DescribeGroupResponse -> ()
rnf DescribeGroupResponse' {Int
Maybe Text
Maybe Group
status :: Int
requestId :: Maybe Text
group' :: Maybe Group
$sel:status:DescribeGroupResponse' :: DescribeGroupResponse -> Int
$sel:requestId:DescribeGroupResponse' :: DescribeGroupResponse -> Maybe Text
$sel:group':DescribeGroupResponse' :: DescribeGroupResponse -> Maybe Group
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Group
group'
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
requestId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
status