{-# 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.Shield.DeleteProtectionGroup
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Removes the specified protection group.
module Amazonka.Shield.DeleteProtectionGroup
  ( -- * Creating a Request
    DeleteProtectionGroup (..),
    newDeleteProtectionGroup,

    -- * Request Lenses
    deleteProtectionGroup_protectionGroupId,

    -- * Destructuring the Response
    DeleteProtectionGroupResponse (..),
    newDeleteProtectionGroupResponse,

    -- * Response Lenses
    deleteProtectionGroupResponse_httpStatus,
  )
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 qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Shield.Types

-- | /See:/ 'newDeleteProtectionGroup' smart constructor.
data DeleteProtectionGroup = DeleteProtectionGroup'
  { -- | The name of the protection group. You use this to identify the
    -- protection group in lists and to manage the protection group, for
    -- example to update, delete, or describe it.
    DeleteProtectionGroup -> Text
protectionGroupId :: Prelude.Text
  }
  deriving (DeleteProtectionGroup -> DeleteProtectionGroup -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteProtectionGroup -> DeleteProtectionGroup -> Bool
$c/= :: DeleteProtectionGroup -> DeleteProtectionGroup -> Bool
== :: DeleteProtectionGroup -> DeleteProtectionGroup -> Bool
$c== :: DeleteProtectionGroup -> DeleteProtectionGroup -> Bool
Prelude.Eq, ReadPrec [DeleteProtectionGroup]
ReadPrec DeleteProtectionGroup
Int -> ReadS DeleteProtectionGroup
ReadS [DeleteProtectionGroup]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteProtectionGroup]
$creadListPrec :: ReadPrec [DeleteProtectionGroup]
readPrec :: ReadPrec DeleteProtectionGroup
$creadPrec :: ReadPrec DeleteProtectionGroup
readList :: ReadS [DeleteProtectionGroup]
$creadList :: ReadS [DeleteProtectionGroup]
readsPrec :: Int -> ReadS DeleteProtectionGroup
$creadsPrec :: Int -> ReadS DeleteProtectionGroup
Prelude.Read, Int -> DeleteProtectionGroup -> ShowS
[DeleteProtectionGroup] -> ShowS
DeleteProtectionGroup -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteProtectionGroup] -> ShowS
$cshowList :: [DeleteProtectionGroup] -> ShowS
show :: DeleteProtectionGroup -> String
$cshow :: DeleteProtectionGroup -> String
showsPrec :: Int -> DeleteProtectionGroup -> ShowS
$cshowsPrec :: Int -> DeleteProtectionGroup -> ShowS
Prelude.Show, forall x. Rep DeleteProtectionGroup x -> DeleteProtectionGroup
forall x. DeleteProtectionGroup -> Rep DeleteProtectionGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteProtectionGroup x -> DeleteProtectionGroup
$cfrom :: forall x. DeleteProtectionGroup -> Rep DeleteProtectionGroup x
Prelude.Generic)

-- |
-- Create a value of 'DeleteProtectionGroup' 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:
--
-- 'protectionGroupId', 'deleteProtectionGroup_protectionGroupId' - The name of the protection group. You use this to identify the
-- protection group in lists and to manage the protection group, for
-- example to update, delete, or describe it.
newDeleteProtectionGroup ::
  -- | 'protectionGroupId'
  Prelude.Text ->
  DeleteProtectionGroup
newDeleteProtectionGroup :: Text -> DeleteProtectionGroup
newDeleteProtectionGroup Text
pProtectionGroupId_ =
  DeleteProtectionGroup'
    { $sel:protectionGroupId:DeleteProtectionGroup' :: Text
protectionGroupId =
        Text
pProtectionGroupId_
    }

-- | The name of the protection group. You use this to identify the
-- protection group in lists and to manage the protection group, for
-- example to update, delete, or describe it.
deleteProtectionGroup_protectionGroupId :: Lens.Lens' DeleteProtectionGroup Prelude.Text
deleteProtectionGroup_protectionGroupId :: Lens' DeleteProtectionGroup Text
deleteProtectionGroup_protectionGroupId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteProtectionGroup' {Text
protectionGroupId :: Text
$sel:protectionGroupId:DeleteProtectionGroup' :: DeleteProtectionGroup -> Text
protectionGroupId} -> Text
protectionGroupId) (\s :: DeleteProtectionGroup
s@DeleteProtectionGroup' {} Text
a -> DeleteProtectionGroup
s {$sel:protectionGroupId:DeleteProtectionGroup' :: Text
protectionGroupId = Text
a} :: DeleteProtectionGroup)

instance Core.AWSRequest DeleteProtectionGroup where
  type
    AWSResponse DeleteProtectionGroup =
      DeleteProtectionGroupResponse
  request :: (Service -> Service)
-> DeleteProtectionGroup -> Request DeleteProtectionGroup
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteProtectionGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteProtectionGroup)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteProtectionGroupResponse
DeleteProtectionGroupResponse'
            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))
      )

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

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

instance Data.ToHeaders DeleteProtectionGroup where
  toHeaders :: DeleteProtectionGroup -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWSShield_20160616.DeleteProtectionGroup" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON DeleteProtectionGroup where
  toJSON :: DeleteProtectionGroup -> Value
toJSON DeleteProtectionGroup' {Text
protectionGroupId :: Text
$sel:protectionGroupId:DeleteProtectionGroup' :: DeleteProtectionGroup -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"ProtectionGroupId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
protectionGroupId)
          ]
      )

instance Data.ToPath DeleteProtectionGroup where
  toPath :: DeleteProtectionGroup -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

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

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

instance Prelude.NFData DeleteProtectionGroupResponse where
  rnf :: DeleteProtectionGroupResponse -> ()
rnf DeleteProtectionGroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteProtectionGroupResponse' :: DeleteProtectionGroupResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus