{-# 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.DeleteProfilingGroup
-- 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 a profiling group.
module Amazonka.CodeGuruProfiler.DeleteProfilingGroup
  ( -- * Creating a Request
    DeleteProfilingGroup (..),
    newDeleteProfilingGroup,

    -- * Request Lenses
    deleteProfilingGroup_profilingGroupName,

    -- * Destructuring the Response
    DeleteProfilingGroupResponse (..),
    newDeleteProfilingGroupResponse,

    -- * Response Lenses
    deleteProfilingGroupResponse_httpStatus,
  )
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 deleteProfilingGroupRequest.
--
-- /See:/ 'newDeleteProfilingGroup' smart constructor.
data DeleteProfilingGroup = DeleteProfilingGroup'
  { -- | The name of the profiling group to delete.
    DeleteProfilingGroup -> Text
profilingGroupName :: Prelude.Text
  }
  deriving (DeleteProfilingGroup -> DeleteProfilingGroup -> Bool
(DeleteProfilingGroup -> DeleteProfilingGroup -> Bool)
-> (DeleteProfilingGroup -> DeleteProfilingGroup -> Bool)
-> Eq DeleteProfilingGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteProfilingGroup -> DeleteProfilingGroup -> Bool
$c/= :: DeleteProfilingGroup -> DeleteProfilingGroup -> Bool
== :: DeleteProfilingGroup -> DeleteProfilingGroup -> Bool
$c== :: DeleteProfilingGroup -> DeleteProfilingGroup -> Bool
Prelude.Eq, ReadPrec [DeleteProfilingGroup]
ReadPrec DeleteProfilingGroup
Int -> ReadS DeleteProfilingGroup
ReadS [DeleteProfilingGroup]
(Int -> ReadS DeleteProfilingGroup)
-> ReadS [DeleteProfilingGroup]
-> ReadPrec DeleteProfilingGroup
-> ReadPrec [DeleteProfilingGroup]
-> Read DeleteProfilingGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteProfilingGroup]
$creadListPrec :: ReadPrec [DeleteProfilingGroup]
readPrec :: ReadPrec DeleteProfilingGroup
$creadPrec :: ReadPrec DeleteProfilingGroup
readList :: ReadS [DeleteProfilingGroup]
$creadList :: ReadS [DeleteProfilingGroup]
readsPrec :: Int -> ReadS DeleteProfilingGroup
$creadsPrec :: Int -> ReadS DeleteProfilingGroup
Prelude.Read, Int -> DeleteProfilingGroup -> ShowS
[DeleteProfilingGroup] -> ShowS
DeleteProfilingGroup -> String
(Int -> DeleteProfilingGroup -> ShowS)
-> (DeleteProfilingGroup -> String)
-> ([DeleteProfilingGroup] -> ShowS)
-> Show DeleteProfilingGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteProfilingGroup] -> ShowS
$cshowList :: [DeleteProfilingGroup] -> ShowS
show :: DeleteProfilingGroup -> String
$cshow :: DeleteProfilingGroup -> String
showsPrec :: Int -> DeleteProfilingGroup -> ShowS
$cshowsPrec :: Int -> DeleteProfilingGroup -> ShowS
Prelude.Show, (forall x. DeleteProfilingGroup -> Rep DeleteProfilingGroup x)
-> (forall x. Rep DeleteProfilingGroup x -> DeleteProfilingGroup)
-> Generic DeleteProfilingGroup
forall x. Rep DeleteProfilingGroup x -> DeleteProfilingGroup
forall x. DeleteProfilingGroup -> Rep DeleteProfilingGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteProfilingGroup x -> DeleteProfilingGroup
$cfrom :: forall x. DeleteProfilingGroup -> Rep DeleteProfilingGroup x
Prelude.Generic)

-- |
-- Create a value of 'DeleteProfilingGroup' 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', 'deleteProfilingGroup_profilingGroupName' - The name of the profiling group to delete.
newDeleteProfilingGroup ::
  -- | 'profilingGroupName'
  Prelude.Text ->
  DeleteProfilingGroup
newDeleteProfilingGroup :: Text -> DeleteProfilingGroup
newDeleteProfilingGroup Text
pProfilingGroupName_ =
  DeleteProfilingGroup' :: Text -> DeleteProfilingGroup
DeleteProfilingGroup'
    { $sel:profilingGroupName:DeleteProfilingGroup' :: Text
profilingGroupName =
        Text
pProfilingGroupName_
    }

-- | The name of the profiling group to delete.
deleteProfilingGroup_profilingGroupName :: Lens.Lens' DeleteProfilingGroup Prelude.Text
deleteProfilingGroup_profilingGroupName :: (Text -> f Text) -> DeleteProfilingGroup -> f DeleteProfilingGroup
deleteProfilingGroup_profilingGroupName = (DeleteProfilingGroup -> Text)
-> (DeleteProfilingGroup -> Text -> DeleteProfilingGroup)
-> Lens DeleteProfilingGroup DeleteProfilingGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteProfilingGroup' {Text
profilingGroupName :: Text
$sel:profilingGroupName:DeleteProfilingGroup' :: DeleteProfilingGroup -> Text
profilingGroupName} -> Text
profilingGroupName) (\s :: DeleteProfilingGroup
s@DeleteProfilingGroup' {} Text
a -> DeleteProfilingGroup
s {$sel:profilingGroupName:DeleteProfilingGroup' :: Text
profilingGroupName = Text
a} :: DeleteProfilingGroup)

instance Core.AWSRequest DeleteProfilingGroup where
  type
    AWSResponse DeleteProfilingGroup =
      DeleteProfilingGroupResponse
  request :: DeleteProfilingGroup -> Request DeleteProfilingGroup
request = Service -> DeleteProfilingGroup -> Request DeleteProfilingGroup
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteProfilingGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteProfilingGroup)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteProfilingGroup))
-> Logger
-> Service
-> Proxy DeleteProfilingGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteProfilingGroup)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteProfilingGroupResponse
DeleteProfilingGroupResponse'
            (Int -> DeleteProfilingGroupResponse)
-> Either String Int -> Either String DeleteProfilingGroupResponse
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))
      )

instance Prelude.Hashable DeleteProfilingGroup

instance Prelude.NFData DeleteProfilingGroup

instance Core.ToHeaders DeleteProfilingGroup where
  toHeaders :: DeleteProfilingGroup -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteProfilingGroup -> 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 DeleteProfilingGroup where
  toPath :: DeleteProfilingGroup -> ByteString
toPath DeleteProfilingGroup' {Text
profilingGroupName :: Text
$sel:profilingGroupName:DeleteProfilingGroup' :: DeleteProfilingGroup -> 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 DeleteProfilingGroup where
  toQuery :: DeleteProfilingGroup -> QueryString
toQuery = QueryString -> DeleteProfilingGroup -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

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

-- |
-- Create a value of 'DeleteProfilingGroupResponse' 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', 'deleteProfilingGroupResponse_httpStatus' - The response's http status code.
newDeleteProfilingGroupResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteProfilingGroupResponse
newDeleteProfilingGroupResponse :: Int -> DeleteProfilingGroupResponse
newDeleteProfilingGroupResponse Int
pHttpStatus_ =
  DeleteProfilingGroupResponse' :: Int -> DeleteProfilingGroupResponse
DeleteProfilingGroupResponse'
    { $sel:httpStatus:DeleteProfilingGroupResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance Prelude.NFData DeleteProfilingGroupResponse