{-# 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-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)
--
-- 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.Lens as Lens
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
(DescribeProfilingGroup -> DescribeProfilingGroup -> Bool)
-> (DescribeProfilingGroup -> DescribeProfilingGroup -> Bool)
-> Eq DescribeProfilingGroup
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]
(Int -> ReadS DescribeProfilingGroup)
-> ReadS [DescribeProfilingGroup]
-> ReadPrec DescribeProfilingGroup
-> ReadPrec [DescribeProfilingGroup]
-> Read 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
(Int -> DescribeProfilingGroup -> ShowS)
-> (DescribeProfilingGroup -> String)
-> ([DescribeProfilingGroup] -> ShowS)
-> Show DescribeProfilingGroup
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. DescribeProfilingGroup -> Rep DescribeProfilingGroup x)
-> (forall x.
    Rep DescribeProfilingGroup x -> DescribeProfilingGroup)
-> Generic DescribeProfilingGroup
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' :: Text -> DescribeProfilingGroup
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 :: (Text -> f Text)
-> DescribeProfilingGroup -> f DescribeProfilingGroup
describeProfilingGroup_profilingGroupName = (DescribeProfilingGroup -> Text)
-> (DescribeProfilingGroup -> Text -> DescribeProfilingGroup)
-> Lens DescribeProfilingGroup DescribeProfilingGroup Text Text
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 :: DescribeProfilingGroup -> Request DescribeProfilingGroup
request = Service -> DescribeProfilingGroup -> Request DescribeProfilingGroup
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeProfilingGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeProfilingGroup)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeProfilingGroup))
-> Logger
-> Service
-> Proxy DescribeProfilingGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeProfilingGroup)))
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 ->
          Int -> ProfilingGroupDescription -> DescribeProfilingGroupResponse
DescribeProfilingGroupResponse'
            (Int
 -> ProfilingGroupDescription -> DescribeProfilingGroupResponse)
-> Either String Int
-> Either
     String
     (ProfilingGroupDescription -> DescribeProfilingGroupResponse)
forall (f :: * -> *) a b. Functor 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))
            Either
  String
  (ProfilingGroupDescription -> DescribeProfilingGroupResponse)
-> Either String ProfilingGroupDescription
-> Either String DescribeProfilingGroupResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String ProfilingGroupDescription
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
      )

instance Prelude.Hashable DescribeProfilingGroup

instance Prelude.NFData DescribeProfilingGroup

instance Core.ToHeaders DescribeProfilingGroup where
  toHeaders :: DescribeProfilingGroup -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeProfilingGroup -> 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 DescribeProfilingGroup where
  toPath :: DescribeProfilingGroup -> ByteString
toPath DescribeProfilingGroup' {Text
profilingGroupName :: Text
$sel:profilingGroupName:DescribeProfilingGroup' :: DescribeProfilingGroup -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/profilingGroups/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
profilingGroupName]

instance Core.ToQuery DescribeProfilingGroup where
  toQuery :: DescribeProfilingGroup -> QueryString
toQuery = QueryString -> DescribeProfilingGroup -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DescribeProfilingGroupResponse
 -> DescribeProfilingGroupResponse -> Bool)
-> (DescribeProfilingGroupResponse
    -> DescribeProfilingGroupResponse -> Bool)
-> Eq DescribeProfilingGroupResponse
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]
(Int -> ReadS DescribeProfilingGroupResponse)
-> ReadS [DescribeProfilingGroupResponse]
-> ReadPrec DescribeProfilingGroupResponse
-> ReadPrec [DescribeProfilingGroupResponse]
-> Read 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
(Int -> DescribeProfilingGroupResponse -> ShowS)
-> (DescribeProfilingGroupResponse -> String)
-> ([DescribeProfilingGroupResponse] -> ShowS)
-> Show DescribeProfilingGroupResponse
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.
 DescribeProfilingGroupResponse
 -> Rep DescribeProfilingGroupResponse x)
-> (forall x.
    Rep DescribeProfilingGroupResponse x
    -> DescribeProfilingGroupResponse)
-> Generic DescribeProfilingGroupResponse
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' :: Int -> ProfilingGroupDescription -> DescribeProfilingGroupResponse
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 :: (Int -> f Int)
-> DescribeProfilingGroupResponse
-> f DescribeProfilingGroupResponse
describeProfilingGroupResponse_httpStatus = (DescribeProfilingGroupResponse -> Int)
-> (DescribeProfilingGroupResponse
    -> Int -> DescribeProfilingGroupResponse)
-> Lens
     DescribeProfilingGroupResponse
     DescribeProfilingGroupResponse
     Int
     Int
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 :: (ProfilingGroupDescription -> f ProfilingGroupDescription)
-> DescribeProfilingGroupResponse
-> f DescribeProfilingGroupResponse
describeProfilingGroupResponse_profilingGroup = (DescribeProfilingGroupResponse -> ProfilingGroupDescription)
-> (DescribeProfilingGroupResponse
    -> ProfilingGroupDescription -> DescribeProfilingGroupResponse)
-> Lens
     DescribeProfilingGroupResponse
     DescribeProfilingGroupResponse
     ProfilingGroupDescription
     ProfilingGroupDescription
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