{-# 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.DeleteVpnGateway
-- 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 virtual private gateway. You must first detach the
-- virtual private gateway from the VPC. Note that you don\'t need to
-- delete the virtual private gateway if you plan to delete and recreate
-- the VPN connection between your VPC and your network.
module Amazonka.EC2.DeleteVpnGateway
  ( -- * Creating a Request
    DeleteVpnGateway (..),
    newDeleteVpnGateway,

    -- * Request Lenses
    deleteVpnGateway_dryRun,
    deleteVpnGateway_vpnGatewayId,

    -- * Destructuring the Response
    DeleteVpnGatewayResponse (..),
    newDeleteVpnGatewayResponse,
  )
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

-- | Contains the parameters for DeleteVpnGateway.
--
-- /See:/ 'newDeleteVpnGateway' smart constructor.
data DeleteVpnGateway = DeleteVpnGateway'
  { -- | 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@.
    DeleteVpnGateway -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
    -- | The ID of the virtual private gateway.
    DeleteVpnGateway -> Text
vpnGatewayId :: Prelude.Text
  }
  deriving (DeleteVpnGateway -> DeleteVpnGateway -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteVpnGateway -> DeleteVpnGateway -> Bool
$c/= :: DeleteVpnGateway -> DeleteVpnGateway -> Bool
== :: DeleteVpnGateway -> DeleteVpnGateway -> Bool
$c== :: DeleteVpnGateway -> DeleteVpnGateway -> Bool
Prelude.Eq, ReadPrec [DeleteVpnGateway]
ReadPrec DeleteVpnGateway
Int -> ReadS DeleteVpnGateway
ReadS [DeleteVpnGateway]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteVpnGateway]
$creadListPrec :: ReadPrec [DeleteVpnGateway]
readPrec :: ReadPrec DeleteVpnGateway
$creadPrec :: ReadPrec DeleteVpnGateway
readList :: ReadS [DeleteVpnGateway]
$creadList :: ReadS [DeleteVpnGateway]
readsPrec :: Int -> ReadS DeleteVpnGateway
$creadsPrec :: Int -> ReadS DeleteVpnGateway
Prelude.Read, Int -> DeleteVpnGateway -> ShowS
[DeleteVpnGateway] -> ShowS
DeleteVpnGateway -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteVpnGateway] -> ShowS
$cshowList :: [DeleteVpnGateway] -> ShowS
show :: DeleteVpnGateway -> String
$cshow :: DeleteVpnGateway -> String
showsPrec :: Int -> DeleteVpnGateway -> ShowS
$cshowsPrec :: Int -> DeleteVpnGateway -> ShowS
Prelude.Show, forall x. Rep DeleteVpnGateway x -> DeleteVpnGateway
forall x. DeleteVpnGateway -> Rep DeleteVpnGateway x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteVpnGateway x -> DeleteVpnGateway
$cfrom :: forall x. DeleteVpnGateway -> Rep DeleteVpnGateway x
Prelude.Generic)

-- |
-- Create a value of 'DeleteVpnGateway' 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', 'deleteVpnGateway_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@.
--
-- 'vpnGatewayId', 'deleteVpnGateway_vpnGatewayId' - The ID of the virtual private gateway.
newDeleteVpnGateway ::
  -- | 'vpnGatewayId'
  Prelude.Text ->
  DeleteVpnGateway
newDeleteVpnGateway :: Text -> DeleteVpnGateway
newDeleteVpnGateway Text
pVpnGatewayId_ =
  DeleteVpnGateway'
    { $sel:dryRun:DeleteVpnGateway' :: Maybe Bool
dryRun = forall a. Maybe a
Prelude.Nothing,
      $sel:vpnGatewayId:DeleteVpnGateway' :: Text
vpnGatewayId = Text
pVpnGatewayId_
    }

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

-- | The ID of the virtual private gateway.
deleteVpnGateway_vpnGatewayId :: Lens.Lens' DeleteVpnGateway Prelude.Text
deleteVpnGateway_vpnGatewayId :: Lens' DeleteVpnGateway Text
deleteVpnGateway_vpnGatewayId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteVpnGateway' {Text
vpnGatewayId :: Text
$sel:vpnGatewayId:DeleteVpnGateway' :: DeleteVpnGateway -> Text
vpnGatewayId} -> Text
vpnGatewayId) (\s :: DeleteVpnGateway
s@DeleteVpnGateway' {} Text
a -> DeleteVpnGateway
s {$sel:vpnGatewayId:DeleteVpnGateway' :: Text
vpnGatewayId = Text
a} :: DeleteVpnGateway)

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

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

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

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

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

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

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

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

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