{-# 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.CodeGuruProfiler.DescribeProfilingGroup
-- 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 a
-- <https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_ProfilingGroupDescription.html ProfilingGroupDescription>
-- object that contains information about the requested profiling group.
module Amazonka.CodeGuruProfiler.DescribeProfilingGroup
  ( -- * Creating a Request
    DescribeProfilingGroup (..),
    newDescribeProfilingGroup,

    -- * Request Lenses
    describeProfilingGroup_profilingGroupName,

    -- * Destructuring the Response
    DescribeProfilingGroupResponse (..),
    newDescribeProfilingGroupResponse,

    -- * Response Lenses
    describeProfilingGroupResponse_httpStatus,
    describeProfilingGroupResponse_profilingGroup,
  )
where

import Amazonka.CodeGuruProfiler.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

-- | The structure representing the describeProfilingGroupRequest.
--
-- /See:/ 'newDescribeProfilingGroup' smart constructor.
data DescribeProfilingGroup = DescribeProfilingGroup'
  { -- | The name of the profiling group to get information about.
    DescribeProfilingGroup -> Text
profilingGroupName :: Prelude.Text
  }
  deriving (DescribeProfilingGroup -> DescribeProfilingGroup -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeProfilingGroup -> DescribeProfilingGroup -> Bool
$c/= :: DescribeProfilingGroup -> DescribeProfilingGroup -> Bool
== :: DescribeProfilingGroup -> DescribeProfilingGroup -> Bool
$c== :: DescribeProfilingGroup -> DescribeProfilingGroup -> Bool
Prelude.Eq, ReadPrec [DescribeProfilingGroup]
ReadPrec DescribeProfilingGroup
Int -> ReadS DescribeProfilingGroup
ReadS [DescribeProfilingGroup]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeProfilingGroup]
$creadListPrec :: ReadPrec [DescribeProfilingGroup]
readPrec :: ReadPrec DescribeProfilingGroup
$creadPrec :: ReadPrec DescribeProfilingGroup
readList :: ReadS [DescribeProfilingGroup]
$creadList :: ReadS [DescribeProfilingGroup]
readsPrec :: Int -> ReadS DescribeProfilingGroup
$creadsPrec :: Int -> ReadS DescribeProfilingGroup
Prelude.Read, Int -> DescribeProfilingGroup -> ShowS
[DescribeProfilingGroup] -> ShowS
DescribeProfilingGroup -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeProfilingGroup] -> ShowS
$cshowList :: [DescribeProfilingGroup] -> ShowS
show :: DescribeProfilingGroup -> String
$cshow :: DescribeProfilingGroup -> String
showsPrec :: Int -> DescribeProfilingGroup -> ShowS
$cshowsPrec :: Int -> DescribeProfilingGroup -> ShowS
Prelude.Show, forall x. Rep DescribeProfilingGroup x -> DescribeProfilingGroup
forall x. DescribeProfilingGroup -> Rep DescribeProfilingGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeProfilingGroup x -> DescribeProfilingGroup
$cfrom :: forall x. DescribeProfilingGroup -> Rep DescribeProfilingGroup x
Prelude.Generic)

-- |
-- Create a value of 'DescribeProfilingGroup' 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:
--
-- 'profilingGroupName', 'describeProfilingGroup_profilingGroupName' - The name of the profiling group to get information about.
newDescribeProfilingGroup ::
  -- | 'profilingGroupName'
  Prelude.Text ->
  DescribeProfilingGroup
newDescribeProfilingGroup :: Text -> DescribeProfilingGroup
newDescribeProfilingGroup Text
pProfilingGroupName_ =
  DescribeProfilingGroup'
    { $sel:profilingGroupName:DescribeProfilingGroup' :: Text
profilingGroupName =
        Text
pProfilingGroupName_
    }

-- | The name of the profiling group to get information about.
describeProfilingGroup_profilingGroupName :: Lens.Lens' DescribeProfilingGroup Prelude.Text
describeProfilingGroup_profilingGroupName :: Lens' DescribeProfilingGroup Text
describeProfilingGroup_profilingGroupName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeProfilingGroup' {Text
profilingGroupName :: Text
$sel:profilingGroupName:DescribeProfilingGroup' :: DescribeProfilingGroup -> Text
profilingGroupName} -> Text
profilingGroupName) (\s :: DescribeProfilingGroup
s@DescribeProfilingGroup' {} Text
a -> DescribeProfilingGroup
s {$sel:profilingGroupName:DescribeProfilingGroup' :: Text
profilingGroupName = Text
a} :: DescribeProfilingGroup)

instance Core.AWSRequest DescribeProfilingGroup where
  type
    AWSResponse DescribeProfilingGroup =
      DescribeProfilingGroupResponse
  request :: (Service -> Service)
-> DescribeProfilingGroup -> Request DescribeProfilingGroup
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 DescribeProfilingGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeProfilingGroup)))
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 ->
          Int -> ProfilingGroupDescription -> DescribeProfilingGroupResponse
DescribeProfilingGroupResponse'
            forall (f :: * -> *) a b. Functor 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))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall a. FromJSON a => Object -> Either String a
Data.eitherParseJSON Object
x)
      )

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

instance Prelude.NFData DescribeProfilingGroup where
  rnf :: DescribeProfilingGroup -> ()
rnf DescribeProfilingGroup' {Text
profilingGroupName :: Text
$sel:profilingGroupName:DescribeProfilingGroup' :: DescribeProfilingGroup -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
profilingGroupName

instance Data.ToHeaders DescribeProfilingGroup where
  toHeaders :: DescribeProfilingGroup -> 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.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToPath DescribeProfilingGroup where
  toPath :: DescribeProfilingGroup -> ByteString
toPath DescribeProfilingGroup' {Text
profilingGroupName :: Text
$sel:profilingGroupName:DescribeProfilingGroup' :: DescribeProfilingGroup -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/profilingGroups/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
profilingGroupName]

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

-- | The structure representing the describeProfilingGroupResponse.
--
-- /See:/ 'newDescribeProfilingGroupResponse' smart constructor.
data DescribeProfilingGroupResponse = DescribeProfilingGroupResponse'
  { -- | The response's http status code.
    DescribeProfilingGroupResponse -> Int
httpStatus :: Prelude.Int,
    -- | The returned
    -- <https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_ProfilingGroupDescription.html ProfilingGroupDescription>
    -- object that contains information about the requested profiling group.
    DescribeProfilingGroupResponse -> ProfilingGroupDescription
profilingGroup :: ProfilingGroupDescription
  }
  deriving (DescribeProfilingGroupResponse
-> DescribeProfilingGroupResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeProfilingGroupResponse
-> DescribeProfilingGroupResponse -> Bool
$c/= :: DescribeProfilingGroupResponse
-> DescribeProfilingGroupResponse -> Bool
== :: DescribeProfilingGroupResponse
-> DescribeProfilingGroupResponse -> Bool
$c== :: DescribeProfilingGroupResponse
-> DescribeProfilingGroupResponse -> Bool
Prelude.Eq, ReadPrec [DescribeProfilingGroupResponse]
ReadPrec DescribeProfilingGroupResponse
Int -> ReadS DescribeProfilingGroupResponse
ReadS [DescribeProfilingGroupResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeProfilingGroupResponse]
$creadListPrec :: ReadPrec [DescribeProfilingGroupResponse]
readPrec :: ReadPrec DescribeProfilingGroupResponse
$creadPrec :: ReadPrec DescribeProfilingGroupResponse
readList :: ReadS [DescribeProfilingGroupResponse]
$creadList :: ReadS [DescribeProfilingGroupResponse]
readsPrec :: Int -> ReadS DescribeProfilingGroupResponse
$creadsPrec :: Int -> ReadS DescribeProfilingGroupResponse
Prelude.Read, Int -> DescribeProfilingGroupResponse -> ShowS
[DescribeProfilingGroupResponse] -> ShowS
DescribeProfilingGroupResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeProfilingGroupResponse] -> ShowS
$cshowList :: [DescribeProfilingGroupResponse] -> ShowS
show :: DescribeProfilingGroupResponse -> String
$cshow :: DescribeProfilingGroupResponse -> String
showsPrec :: Int -> DescribeProfilingGroupResponse -> ShowS
$cshowsPrec :: Int -> DescribeProfilingGroupResponse -> ShowS
Prelude.Show, forall x.
Rep DescribeProfilingGroupResponse x
-> DescribeProfilingGroupResponse
forall x.
DescribeProfilingGroupResponse
-> Rep DescribeProfilingGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeProfilingGroupResponse x
-> DescribeProfilingGroupResponse
$cfrom :: forall x.
DescribeProfilingGroupResponse
-> Rep DescribeProfilingGroupResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeProfilingGroupResponse' 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:
--
-- 'httpStatus', 'describeProfilingGroupResponse_httpStatus' - The response's http status code.
--
-- 'profilingGroup', 'describeProfilingGroupResponse_profilingGroup' - The returned
-- <https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_ProfilingGroupDescription.html ProfilingGroupDescription>
-- object that contains information about the requested profiling group.
newDescribeProfilingGroupResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'profilingGroup'
  ProfilingGroupDescription ->
  DescribeProfilingGroupResponse
newDescribeProfilingGroupResponse :: Int -> ProfilingGroupDescription -> DescribeProfilingGroupResponse
newDescribeProfilingGroupResponse
  Int
pHttpStatus_
  ProfilingGroupDescription
pProfilingGroup_ =
    DescribeProfilingGroupResponse'
      { $sel:httpStatus:DescribeProfilingGroupResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:profilingGroup:DescribeProfilingGroupResponse' :: ProfilingGroupDescription
profilingGroup = ProfilingGroupDescription
pProfilingGroup_
      }

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

-- | The returned
-- <https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_ProfilingGroupDescription.html ProfilingGroupDescription>
-- object that contains information about the requested profiling group.
describeProfilingGroupResponse_profilingGroup :: Lens.Lens' DescribeProfilingGroupResponse ProfilingGroupDescription
describeProfilingGroupResponse_profilingGroup :: Lens' DescribeProfilingGroupResponse ProfilingGroupDescription
describeProfilingGroupResponse_profilingGroup = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeProfilingGroupResponse' {ProfilingGroupDescription
profilingGroup :: ProfilingGroupDescription
$sel:profilingGroup:DescribeProfilingGroupResponse' :: DescribeProfilingGroupResponse -> ProfilingGroupDescription
profilingGroup} -> ProfilingGroupDescription
profilingGroup) (\s :: DescribeProfilingGroupResponse
s@DescribeProfilingGroupResponse' {} ProfilingGroupDescription
a -> DescribeProfilingGroupResponse
s {$sel:profilingGroup:DescribeProfilingGroupResponse' :: ProfilingGroupDescription
profilingGroup = ProfilingGroupDescription
a} :: DescribeProfilingGroupResponse)

instance
  Prelude.NFData
    DescribeProfilingGroupResponse
  where
  rnf :: DescribeProfilingGroupResponse -> ()
rnf DescribeProfilingGroupResponse' {Int
ProfilingGroupDescription
profilingGroup :: ProfilingGroupDescription
httpStatus :: Int
$sel:profilingGroup:DescribeProfilingGroupResponse' :: DescribeProfilingGroupResponse -> ProfilingGroupDescription
$sel:httpStatus:DescribeProfilingGroupResponse' :: DescribeProfilingGroupResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ProfilingGroupDescription
profilingGroup