{-# 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-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)
--
-- 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.Lens as Lens
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
(DeleteProtectionGroup -> DeleteProtectionGroup -> Bool)
-> (DeleteProtectionGroup -> DeleteProtectionGroup -> Bool)
-> Eq DeleteProtectionGroup
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]
(Int -> ReadS DeleteProtectionGroup)
-> ReadS [DeleteProtectionGroup]
-> ReadPrec DeleteProtectionGroup
-> ReadPrec [DeleteProtectionGroup]
-> Read 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
(Int -> DeleteProtectionGroup -> ShowS)
-> (DeleteProtectionGroup -> String)
-> ([DeleteProtectionGroup] -> ShowS)
-> Show DeleteProtectionGroup
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. DeleteProtectionGroup -> Rep DeleteProtectionGroup x)
-> (forall x. Rep DeleteProtectionGroup x -> DeleteProtectionGroup)
-> Generic DeleteProtectionGroup
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' :: Text -> DeleteProtectionGroup
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 :: (Text -> f Text)
-> DeleteProtectionGroup -> f DeleteProtectionGroup
deleteProtectionGroup_protectionGroupId = (DeleteProtectionGroup -> Text)
-> (DeleteProtectionGroup -> Text -> DeleteProtectionGroup)
-> Lens DeleteProtectionGroup DeleteProtectionGroup Text Text
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 :: DeleteProtectionGroup -> Request DeleteProtectionGroup
request = Service -> DeleteProtectionGroup -> Request DeleteProtectionGroup
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteProtectionGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteProtectionGroup)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteProtectionGroup))
-> Logger
-> Service
-> Proxy DeleteProtectionGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteProtectionGroup)))
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 -> DeleteProtectionGroupResponse
DeleteProtectionGroupResponse'
            (Int -> DeleteProtectionGroupResponse)
-> Either String Int -> Either String DeleteProtectionGroupResponse
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 DeleteProtectionGroup

instance Prelude.NFData DeleteProtectionGroup

instance Core.ToHeaders DeleteProtectionGroup where
  toHeaders :: DeleteProtectionGroup -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteProtectionGroup -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSShield_20160616.DeleteProtectionGroup" ::
                          Prelude.ByteString
                      ),
            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.ToJSON DeleteProtectionGroup where
  toJSON :: DeleteProtectionGroup -> Value
toJSON DeleteProtectionGroup' {Text
protectionGroupId :: Text
$sel:protectionGroupId:DeleteProtectionGroup' :: DeleteProtectionGroup -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ProtectionGroupId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
protectionGroupId)
          ]
      )

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

instance Core.ToQuery DeleteProtectionGroup where
  toQuery :: DeleteProtectionGroup -> QueryString
toQuery = QueryString -> DeleteProtectionGroup -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DeleteProtectionGroupResponse
 -> DeleteProtectionGroupResponse -> Bool)
-> (DeleteProtectionGroupResponse
    -> DeleteProtectionGroupResponse -> Bool)
-> Eq DeleteProtectionGroupResponse
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]
(Int -> ReadS DeleteProtectionGroupResponse)
-> ReadS [DeleteProtectionGroupResponse]
-> ReadPrec DeleteProtectionGroupResponse
-> ReadPrec [DeleteProtectionGroupResponse]
-> Read 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
(Int -> DeleteProtectionGroupResponse -> ShowS)
-> (DeleteProtectionGroupResponse -> String)
-> ([DeleteProtectionGroupResponse] -> ShowS)
-> Show DeleteProtectionGroupResponse
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.
 DeleteProtectionGroupResponse
 -> Rep DeleteProtectionGroupResponse x)
-> (forall x.
    Rep DeleteProtectionGroupResponse x
    -> DeleteProtectionGroupResponse)
-> Generic DeleteProtectionGroupResponse
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' :: Int -> DeleteProtectionGroupResponse
DeleteProtectionGroupResponse'
    { $sel:httpStatus:DeleteProtectionGroupResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deleteProtectionGroupResponse_httpStatus :: Lens.Lens' DeleteProtectionGroupResponse Prelude.Int
deleteProtectionGroupResponse_httpStatus :: (Int -> f Int)
-> DeleteProtectionGroupResponse -> f DeleteProtectionGroupResponse
deleteProtectionGroupResponse_httpStatus = (DeleteProtectionGroupResponse -> Int)
-> (DeleteProtectionGroupResponse
    -> Int -> DeleteProtectionGroupResponse)
-> Lens
     DeleteProtectionGroupResponse DeleteProtectionGroupResponse Int Int
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