{-# 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.EC2.DeletePlacementGroup
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes the specified placement group. You must terminate all instances
-- in the placement group before you can delete the placement group. For
-- more information, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html Placement groups>
-- in the /Amazon EC2 User Guide/.
module Amazonka.EC2.DeletePlacementGroup
  ( -- * Creating a Request
    DeletePlacementGroup (..),
    newDeletePlacementGroup,

    -- * Request Lenses
    deletePlacementGroup_dryRun,
    deletePlacementGroup_groupName,

    -- * Destructuring the Response
    DeletePlacementGroupResponse (..),
    newDeletePlacementGroupResponse,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDeletePlacementGroup' smart constructor.
data DeletePlacementGroup = DeletePlacementGroup'
  { -- | Checks whether you have the required permissions for the action, without
    -- actually making the request, and provides an error response. If you have
    -- the required permissions, the error response is @DryRunOperation@.
    -- Otherwise, it is @UnauthorizedOperation@.
    DeletePlacementGroup -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
    -- | The name of the placement group.
    DeletePlacementGroup -> Text
groupName :: Prelude.Text
  }
  deriving (DeletePlacementGroup -> DeletePlacementGroup -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeletePlacementGroup -> DeletePlacementGroup -> Bool
$c/= :: DeletePlacementGroup -> DeletePlacementGroup -> Bool
== :: DeletePlacementGroup -> DeletePlacementGroup -> Bool
$c== :: DeletePlacementGroup -> DeletePlacementGroup -> Bool
Prelude.Eq, ReadPrec [DeletePlacementGroup]
ReadPrec DeletePlacementGroup
Int -> ReadS DeletePlacementGroup
ReadS [DeletePlacementGroup]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeletePlacementGroup]
$creadListPrec :: ReadPrec [DeletePlacementGroup]
readPrec :: ReadPrec DeletePlacementGroup
$creadPrec :: ReadPrec DeletePlacementGroup
readList :: ReadS [DeletePlacementGroup]
$creadList :: ReadS [DeletePlacementGroup]
readsPrec :: Int -> ReadS DeletePlacementGroup
$creadsPrec :: Int -> ReadS DeletePlacementGroup
Prelude.Read, Int -> DeletePlacementGroup -> ShowS
[DeletePlacementGroup] -> ShowS
DeletePlacementGroup -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeletePlacementGroup] -> ShowS
$cshowList :: [DeletePlacementGroup] -> ShowS
show :: DeletePlacementGroup -> String
$cshow :: DeletePlacementGroup -> String
showsPrec :: Int -> DeletePlacementGroup -> ShowS
$cshowsPrec :: Int -> DeletePlacementGroup -> ShowS
Prelude.Show, forall x. Rep DeletePlacementGroup x -> DeletePlacementGroup
forall x. DeletePlacementGroup -> Rep DeletePlacementGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeletePlacementGroup x -> DeletePlacementGroup
$cfrom :: forall x. DeletePlacementGroup -> Rep DeletePlacementGroup x
Prelude.Generic)

-- |
-- Create a value of 'DeletePlacementGroup' 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:
--
-- 'dryRun', 'deletePlacementGroup_dryRun' - Checks whether you have the required permissions for the action, without
-- actually making the request, and provides an error response. If you have
-- the required permissions, the error response is @DryRunOperation@.
-- Otherwise, it is @UnauthorizedOperation@.
--
-- 'groupName', 'deletePlacementGroup_groupName' - The name of the placement group.
newDeletePlacementGroup ::
  -- | 'groupName'
  Prelude.Text ->
  DeletePlacementGroup
newDeletePlacementGroup :: Text -> DeletePlacementGroup
newDeletePlacementGroup Text
pGroupName_ =
  DeletePlacementGroup'
    { $sel:dryRun:DeletePlacementGroup' :: Maybe Bool
dryRun = forall a. Maybe a
Prelude.Nothing,
      $sel:groupName:DeletePlacementGroup' :: Text
groupName = Text
pGroupName_
    }

-- | Checks whether you have the required permissions for the action, without
-- actually making the request, and provides an error response. If you have
-- the required permissions, the error response is @DryRunOperation@.
-- Otherwise, it is @UnauthorizedOperation@.
deletePlacementGroup_dryRun :: Lens.Lens' DeletePlacementGroup (Prelude.Maybe Prelude.Bool)
deletePlacementGroup_dryRun :: Lens' DeletePlacementGroup (Maybe Bool)
deletePlacementGroup_dryRun = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeletePlacementGroup' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:DeletePlacementGroup' :: DeletePlacementGroup -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: DeletePlacementGroup
s@DeletePlacementGroup' {} Maybe Bool
a -> DeletePlacementGroup
s {$sel:dryRun:DeletePlacementGroup' :: Maybe Bool
dryRun = Maybe Bool
a} :: DeletePlacementGroup)

-- | The name of the placement group.
deletePlacementGroup_groupName :: Lens.Lens' DeletePlacementGroup Prelude.Text
deletePlacementGroup_groupName :: Lens' DeletePlacementGroup Text
deletePlacementGroup_groupName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeletePlacementGroup' {Text
groupName :: Text
$sel:groupName:DeletePlacementGroup' :: DeletePlacementGroup -> Text
groupName} -> Text
groupName) (\s :: DeletePlacementGroup
s@DeletePlacementGroup' {} Text
a -> DeletePlacementGroup
s {$sel:groupName:DeletePlacementGroup' :: Text
groupName = Text
a} :: DeletePlacementGroup)

instance Core.AWSRequest DeletePlacementGroup where
  type
    AWSResponse DeletePlacementGroup =
      DeletePlacementGroupResponse
  request :: (Service -> Service)
-> DeletePlacementGroup -> Request DeletePlacementGroup
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeletePlacementGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeletePlacementGroup)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull DeletePlacementGroupResponse
DeletePlacementGroupResponse'

instance Prelude.Hashable DeletePlacementGroup where
  hashWithSalt :: Int -> DeletePlacementGroup -> Int
hashWithSalt Int
_salt DeletePlacementGroup' {Maybe Bool
Text
groupName :: Text
dryRun :: Maybe Bool
$sel:groupName:DeletePlacementGroup' :: DeletePlacementGroup -> Text
$sel:dryRun:DeletePlacementGroup' :: DeletePlacementGroup -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
dryRun
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
groupName

instance Prelude.NFData DeletePlacementGroup where
  rnf :: DeletePlacementGroup -> ()
rnf DeletePlacementGroup' {Maybe Bool
Text
groupName :: Text
dryRun :: Maybe Bool
$sel:groupName:DeletePlacementGroup' :: DeletePlacementGroup -> Text
$sel:dryRun:DeletePlacementGroup' :: DeletePlacementGroup -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
dryRun
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
groupName

instance Data.ToHeaders DeletePlacementGroup where
  toHeaders :: DeletePlacementGroup -> [Header]
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

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

instance Data.ToQuery DeletePlacementGroup where
  toQuery :: DeletePlacementGroup -> QueryString
toQuery DeletePlacementGroup' {Maybe Bool
Text
groupName :: Text
dryRun :: Maybe Bool
$sel:groupName:DeletePlacementGroup' :: DeletePlacementGroup -> Text
$sel:dryRun:DeletePlacementGroup' :: DeletePlacementGroup -> Maybe Bool
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"DeletePlacementGroup" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2016-11-15" :: Prelude.ByteString),
        ByteString
"DryRun" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
dryRun,
        ByteString
"GroupName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
groupName
      ]

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

-- |
-- Create a value of 'DeletePlacementGroupResponse' 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.
newDeletePlacementGroupResponse ::
  DeletePlacementGroupResponse
newDeletePlacementGroupResponse :: DeletePlacementGroupResponse
newDeletePlacementGroupResponse =
  DeletePlacementGroupResponse
DeletePlacementGroupResponse'

instance Prelude.NFData DeletePlacementGroupResponse where
  rnf :: DeletePlacementGroupResponse -> ()
rnf DeletePlacementGroupResponse
_ = ()