{-# 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.DeleteLocalGatewayRouteTable
-- 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 a local gateway route table.
module Amazonka.EC2.DeleteLocalGatewayRouteTable
  ( -- * Creating a Request
    DeleteLocalGatewayRouteTable (..),
    newDeleteLocalGatewayRouteTable,

    -- * Request Lenses
    deleteLocalGatewayRouteTable_dryRun,
    deleteLocalGatewayRouteTable_localGatewayRouteTableId,

    -- * Destructuring the Response
    DeleteLocalGatewayRouteTableResponse (..),
    newDeleteLocalGatewayRouteTableResponse,

    -- * Response Lenses
    deleteLocalGatewayRouteTableResponse_localGatewayRouteTable,
    deleteLocalGatewayRouteTableResponse_httpStatus,
  )
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:/ 'newDeleteLocalGatewayRouteTable' smart constructor.
data DeleteLocalGatewayRouteTable = DeleteLocalGatewayRouteTable'
  { -- | 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@.
    DeleteLocalGatewayRouteTable -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
    -- | The ID of the local gateway route table.
    DeleteLocalGatewayRouteTable -> Text
localGatewayRouteTableId :: Prelude.Text
  }
  deriving (DeleteLocalGatewayRouteTable
-> DeleteLocalGatewayRouteTable -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteLocalGatewayRouteTable
-> DeleteLocalGatewayRouteTable -> Bool
$c/= :: DeleteLocalGatewayRouteTable
-> DeleteLocalGatewayRouteTable -> Bool
== :: DeleteLocalGatewayRouteTable
-> DeleteLocalGatewayRouteTable -> Bool
$c== :: DeleteLocalGatewayRouteTable
-> DeleteLocalGatewayRouteTable -> Bool
Prelude.Eq, ReadPrec [DeleteLocalGatewayRouteTable]
ReadPrec DeleteLocalGatewayRouteTable
Int -> ReadS DeleteLocalGatewayRouteTable
ReadS [DeleteLocalGatewayRouteTable]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteLocalGatewayRouteTable]
$creadListPrec :: ReadPrec [DeleteLocalGatewayRouteTable]
readPrec :: ReadPrec DeleteLocalGatewayRouteTable
$creadPrec :: ReadPrec DeleteLocalGatewayRouteTable
readList :: ReadS [DeleteLocalGatewayRouteTable]
$creadList :: ReadS [DeleteLocalGatewayRouteTable]
readsPrec :: Int -> ReadS DeleteLocalGatewayRouteTable
$creadsPrec :: Int -> ReadS DeleteLocalGatewayRouteTable
Prelude.Read, Int -> DeleteLocalGatewayRouteTable -> ShowS
[DeleteLocalGatewayRouteTable] -> ShowS
DeleteLocalGatewayRouteTable -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteLocalGatewayRouteTable] -> ShowS
$cshowList :: [DeleteLocalGatewayRouteTable] -> ShowS
show :: DeleteLocalGatewayRouteTable -> String
$cshow :: DeleteLocalGatewayRouteTable -> String
showsPrec :: Int -> DeleteLocalGatewayRouteTable -> ShowS
$cshowsPrec :: Int -> DeleteLocalGatewayRouteTable -> ShowS
Prelude.Show, forall x.
Rep DeleteLocalGatewayRouteTable x -> DeleteLocalGatewayRouteTable
forall x.
DeleteLocalGatewayRouteTable -> Rep DeleteLocalGatewayRouteTable x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteLocalGatewayRouteTable x -> DeleteLocalGatewayRouteTable
$cfrom :: forall x.
DeleteLocalGatewayRouteTable -> Rep DeleteLocalGatewayRouteTable x
Prelude.Generic)

-- |
-- Create a value of 'DeleteLocalGatewayRouteTable' 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', 'deleteLocalGatewayRouteTable_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@.
--
-- 'localGatewayRouteTableId', 'deleteLocalGatewayRouteTable_localGatewayRouteTableId' - The ID of the local gateway route table.
newDeleteLocalGatewayRouteTable ::
  -- | 'localGatewayRouteTableId'
  Prelude.Text ->
  DeleteLocalGatewayRouteTable
newDeleteLocalGatewayRouteTable :: Text -> DeleteLocalGatewayRouteTable
newDeleteLocalGatewayRouteTable
  Text
pLocalGatewayRouteTableId_ =
    DeleteLocalGatewayRouteTable'
      { $sel:dryRun:DeleteLocalGatewayRouteTable' :: Maybe Bool
dryRun =
          forall a. Maybe a
Prelude.Nothing,
        $sel:localGatewayRouteTableId:DeleteLocalGatewayRouteTable' :: Text
localGatewayRouteTableId =
          Text
pLocalGatewayRouteTableId_
      }

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

-- | The ID of the local gateway route table.
deleteLocalGatewayRouteTable_localGatewayRouteTableId :: Lens.Lens' DeleteLocalGatewayRouteTable Prelude.Text
deleteLocalGatewayRouteTable_localGatewayRouteTableId :: Lens' DeleteLocalGatewayRouteTable Text
deleteLocalGatewayRouteTable_localGatewayRouteTableId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteLocalGatewayRouteTable' {Text
localGatewayRouteTableId :: Text
$sel:localGatewayRouteTableId:DeleteLocalGatewayRouteTable' :: DeleteLocalGatewayRouteTable -> Text
localGatewayRouteTableId} -> Text
localGatewayRouteTableId) (\s :: DeleteLocalGatewayRouteTable
s@DeleteLocalGatewayRouteTable' {} Text
a -> DeleteLocalGatewayRouteTable
s {$sel:localGatewayRouteTableId:DeleteLocalGatewayRouteTable' :: Text
localGatewayRouteTableId = Text
a} :: DeleteLocalGatewayRouteTable)

instance Core.AWSRequest DeleteLocalGatewayRouteTable where
  type
    AWSResponse DeleteLocalGatewayRouteTable =
      DeleteLocalGatewayRouteTableResponse
  request :: (Service -> Service)
-> DeleteLocalGatewayRouteTable
-> Request DeleteLocalGatewayRouteTable
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 DeleteLocalGatewayRouteTable
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteLocalGatewayRouteTable)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe LocalGatewayRouteTable
-> Int -> DeleteLocalGatewayRouteTableResponse
DeleteLocalGatewayRouteTableResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"localGatewayRouteTable")
            forall (f :: * -> *) a b. Applicative f => 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
    DeleteLocalGatewayRouteTable
  where
  hashWithSalt :: Int -> DeleteLocalGatewayRouteTable -> Int
hashWithSalt Int
_salt DeleteLocalGatewayRouteTable' {Maybe Bool
Text
localGatewayRouteTableId :: Text
dryRun :: Maybe Bool
$sel:localGatewayRouteTableId:DeleteLocalGatewayRouteTable' :: DeleteLocalGatewayRouteTable -> Text
$sel:dryRun:DeleteLocalGatewayRouteTable' :: DeleteLocalGatewayRouteTable -> 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
localGatewayRouteTableId

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

instance Data.ToHeaders DeleteLocalGatewayRouteTable where
  toHeaders :: DeleteLocalGatewayRouteTable -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

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

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

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

-- |
-- Create a value of 'DeleteLocalGatewayRouteTableResponse' 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:
--
-- 'localGatewayRouteTable', 'deleteLocalGatewayRouteTableResponse_localGatewayRouteTable' - Information about the local gateway route table.
--
-- 'httpStatus', 'deleteLocalGatewayRouteTableResponse_httpStatus' - The response's http status code.
newDeleteLocalGatewayRouteTableResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteLocalGatewayRouteTableResponse
newDeleteLocalGatewayRouteTableResponse :: Int -> DeleteLocalGatewayRouteTableResponse
newDeleteLocalGatewayRouteTableResponse Int
pHttpStatus_ =
  DeleteLocalGatewayRouteTableResponse'
    { $sel:localGatewayRouteTable:DeleteLocalGatewayRouteTableResponse' :: Maybe LocalGatewayRouteTable
localGatewayRouteTable =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteLocalGatewayRouteTableResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the local gateway route table.
deleteLocalGatewayRouteTableResponse_localGatewayRouteTable :: Lens.Lens' DeleteLocalGatewayRouteTableResponse (Prelude.Maybe LocalGatewayRouteTable)
deleteLocalGatewayRouteTableResponse_localGatewayRouteTable :: Lens'
  DeleteLocalGatewayRouteTableResponse (Maybe LocalGatewayRouteTable)
deleteLocalGatewayRouteTableResponse_localGatewayRouteTable = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteLocalGatewayRouteTableResponse' {Maybe LocalGatewayRouteTable
localGatewayRouteTable :: Maybe LocalGatewayRouteTable
$sel:localGatewayRouteTable:DeleteLocalGatewayRouteTableResponse' :: DeleteLocalGatewayRouteTableResponse
-> Maybe LocalGatewayRouteTable
localGatewayRouteTable} -> Maybe LocalGatewayRouteTable
localGatewayRouteTable) (\s :: DeleteLocalGatewayRouteTableResponse
s@DeleteLocalGatewayRouteTableResponse' {} Maybe LocalGatewayRouteTable
a -> DeleteLocalGatewayRouteTableResponse
s {$sel:localGatewayRouteTable:DeleteLocalGatewayRouteTableResponse' :: Maybe LocalGatewayRouteTable
localGatewayRouteTable = Maybe LocalGatewayRouteTable
a} :: DeleteLocalGatewayRouteTableResponse)

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

instance
  Prelude.NFData
    DeleteLocalGatewayRouteTableResponse
  where
  rnf :: DeleteLocalGatewayRouteTableResponse -> ()
rnf DeleteLocalGatewayRouteTableResponse' {Int
Maybe LocalGatewayRouteTable
httpStatus :: Int
localGatewayRouteTable :: Maybe LocalGatewayRouteTable
$sel:httpStatus:DeleteLocalGatewayRouteTableResponse' :: DeleteLocalGatewayRouteTableResponse -> Int
$sel:localGatewayRouteTable:DeleteLocalGatewayRouteTableResponse' :: DeleteLocalGatewayRouteTableResponse
-> Maybe LocalGatewayRouteTable
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe LocalGatewayRouteTable
localGatewayRouteTable
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus