{-# 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.DeleteDhcpOptions
-- 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 set of DHCP options. You must disassociate the set
-- of DHCP options before you can delete it. You can disassociate the set
-- of DHCP options by associating either a new set of options or the
-- default set of options with the VPC.
module Amazonka.EC2.DeleteDhcpOptions
  ( -- * Creating a Request
    DeleteDhcpOptions (..),
    newDeleteDhcpOptions,

    -- * Request Lenses
    deleteDhcpOptions_dryRun,
    deleteDhcpOptions_dhcpOptionsId,

    -- * Destructuring the Response
    DeleteDhcpOptionsResponse (..),
    newDeleteDhcpOptionsResponse,
  )
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:/ 'newDeleteDhcpOptions' smart constructor.
data DeleteDhcpOptions = DeleteDhcpOptions'
  { -- | 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@.
    DeleteDhcpOptions -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
    -- | The ID of the DHCP options set.
    DeleteDhcpOptions -> Text
dhcpOptionsId :: Prelude.Text
  }
  deriving (DeleteDhcpOptions -> DeleteDhcpOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDhcpOptions -> DeleteDhcpOptions -> Bool
$c/= :: DeleteDhcpOptions -> DeleteDhcpOptions -> Bool
== :: DeleteDhcpOptions -> DeleteDhcpOptions -> Bool
$c== :: DeleteDhcpOptions -> DeleteDhcpOptions -> Bool
Prelude.Eq, ReadPrec [DeleteDhcpOptions]
ReadPrec DeleteDhcpOptions
Int -> ReadS DeleteDhcpOptions
ReadS [DeleteDhcpOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDhcpOptions]
$creadListPrec :: ReadPrec [DeleteDhcpOptions]
readPrec :: ReadPrec DeleteDhcpOptions
$creadPrec :: ReadPrec DeleteDhcpOptions
readList :: ReadS [DeleteDhcpOptions]
$creadList :: ReadS [DeleteDhcpOptions]
readsPrec :: Int -> ReadS DeleteDhcpOptions
$creadsPrec :: Int -> ReadS DeleteDhcpOptions
Prelude.Read, Int -> DeleteDhcpOptions -> ShowS
[DeleteDhcpOptions] -> ShowS
DeleteDhcpOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDhcpOptions] -> ShowS
$cshowList :: [DeleteDhcpOptions] -> ShowS
show :: DeleteDhcpOptions -> String
$cshow :: DeleteDhcpOptions -> String
showsPrec :: Int -> DeleteDhcpOptions -> ShowS
$cshowsPrec :: Int -> DeleteDhcpOptions -> ShowS
Prelude.Show, forall x. Rep DeleteDhcpOptions x -> DeleteDhcpOptions
forall x. DeleteDhcpOptions -> Rep DeleteDhcpOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDhcpOptions x -> DeleteDhcpOptions
$cfrom :: forall x. DeleteDhcpOptions -> Rep DeleteDhcpOptions x
Prelude.Generic)

-- |
-- Create a value of 'DeleteDhcpOptions' 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', 'deleteDhcpOptions_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@.
--
-- 'dhcpOptionsId', 'deleteDhcpOptions_dhcpOptionsId' - The ID of the DHCP options set.
newDeleteDhcpOptions ::
  -- | 'dhcpOptionsId'
  Prelude.Text ->
  DeleteDhcpOptions
newDeleteDhcpOptions :: Text -> DeleteDhcpOptions
newDeleteDhcpOptions Text
pDhcpOptionsId_ =
  DeleteDhcpOptions'
    { $sel:dryRun:DeleteDhcpOptions' :: Maybe Bool
dryRun = forall a. Maybe a
Prelude.Nothing,
      $sel:dhcpOptionsId:DeleteDhcpOptions' :: Text
dhcpOptionsId = Text
pDhcpOptionsId_
    }

-- | 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@.
deleteDhcpOptions_dryRun :: Lens.Lens' DeleteDhcpOptions (Prelude.Maybe Prelude.Bool)
deleteDhcpOptions_dryRun :: Lens' DeleteDhcpOptions (Maybe Bool)
deleteDhcpOptions_dryRun = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDhcpOptions' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:DeleteDhcpOptions' :: DeleteDhcpOptions -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: DeleteDhcpOptions
s@DeleteDhcpOptions' {} Maybe Bool
a -> DeleteDhcpOptions
s {$sel:dryRun:DeleteDhcpOptions' :: Maybe Bool
dryRun = Maybe Bool
a} :: DeleteDhcpOptions)

-- | The ID of the DHCP options set.
deleteDhcpOptions_dhcpOptionsId :: Lens.Lens' DeleteDhcpOptions Prelude.Text
deleteDhcpOptions_dhcpOptionsId :: Lens' DeleteDhcpOptions Text
deleteDhcpOptions_dhcpOptionsId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDhcpOptions' {Text
dhcpOptionsId :: Text
$sel:dhcpOptionsId:DeleteDhcpOptions' :: DeleteDhcpOptions -> Text
dhcpOptionsId} -> Text
dhcpOptionsId) (\s :: DeleteDhcpOptions
s@DeleteDhcpOptions' {} Text
a -> DeleteDhcpOptions
s {$sel:dhcpOptionsId:DeleteDhcpOptions' :: Text
dhcpOptionsId = Text
a} :: DeleteDhcpOptions)

instance Core.AWSRequest DeleteDhcpOptions where
  type
    AWSResponse DeleteDhcpOptions =
      DeleteDhcpOptionsResponse
  request :: (Service -> Service)
-> DeleteDhcpOptions -> Request DeleteDhcpOptions
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 DeleteDhcpOptions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteDhcpOptions)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull DeleteDhcpOptionsResponse
DeleteDhcpOptionsResponse'

instance Prelude.Hashable DeleteDhcpOptions where
  hashWithSalt :: Int -> DeleteDhcpOptions -> Int
hashWithSalt Int
_salt DeleteDhcpOptions' {Maybe Bool
Text
dhcpOptionsId :: Text
dryRun :: Maybe Bool
$sel:dhcpOptionsId:DeleteDhcpOptions' :: DeleteDhcpOptions -> Text
$sel:dryRun:DeleteDhcpOptions' :: DeleteDhcpOptions -> 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
dhcpOptionsId

instance Prelude.NFData DeleteDhcpOptions where
  rnf :: DeleteDhcpOptions -> ()
rnf DeleteDhcpOptions' {Maybe Bool
Text
dhcpOptionsId :: Text
dryRun :: Maybe Bool
$sel:dhcpOptionsId:DeleteDhcpOptions' :: DeleteDhcpOptions -> Text
$sel:dryRun:DeleteDhcpOptions' :: DeleteDhcpOptions -> 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
dhcpOptionsId

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

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

instance Data.ToQuery DeleteDhcpOptions where
  toQuery :: DeleteDhcpOptions -> QueryString
toQuery DeleteDhcpOptions' {Maybe Bool
Text
dhcpOptionsId :: Text
dryRun :: Maybe Bool
$sel:dhcpOptionsId:DeleteDhcpOptions' :: DeleteDhcpOptions -> Text
$sel:dryRun:DeleteDhcpOptions' :: DeleteDhcpOptions -> Maybe Bool
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"DeleteDhcpOptions" :: 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
"DhcpOptionsId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
dhcpOptionsId
      ]

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

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

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