{-# 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.ApiGatewayV2.DeleteRoute
-- 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 Route.
module Amazonka.ApiGatewayV2.DeleteRoute
  ( -- * Creating a Request
    DeleteRoute (..),
    newDeleteRoute,

    -- * Request Lenses
    deleteRoute_apiId,
    deleteRoute_routeId,

    -- * Destructuring the Response
    DeleteRouteResponse' (..),
    newDeleteRouteResponse',
  )
where

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

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

-- |
-- Create a value of 'DeleteRoute' 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:
--
-- 'apiId', 'deleteRoute_apiId' - The API identifier.
--
-- 'routeId', 'deleteRoute_routeId' - The route ID.
newDeleteRoute ::
  -- | 'apiId'
  Prelude.Text ->
  -- | 'routeId'
  Prelude.Text ->
  DeleteRoute
newDeleteRoute :: Text -> Text -> DeleteRoute
newDeleteRoute Text
pApiId_ Text
pRouteId_ =
  DeleteRoute' {$sel:apiId:DeleteRoute' :: Text
apiId = Text
pApiId_, $sel:routeId:DeleteRoute' :: Text
routeId = Text
pRouteId_}

-- | The API identifier.
deleteRoute_apiId :: Lens.Lens' DeleteRoute Prelude.Text
deleteRoute_apiId :: Lens' DeleteRoute Text
deleteRoute_apiId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRoute' {Text
apiId :: Text
$sel:apiId:DeleteRoute' :: DeleteRoute -> Text
apiId} -> Text
apiId) (\s :: DeleteRoute
s@DeleteRoute' {} Text
a -> DeleteRoute
s {$sel:apiId:DeleteRoute' :: Text
apiId = Text
a} :: DeleteRoute)

-- | The route ID.
deleteRoute_routeId :: Lens.Lens' DeleteRoute Prelude.Text
deleteRoute_routeId :: Lens' DeleteRoute Text
deleteRoute_routeId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRoute' {Text
routeId :: Text
$sel:routeId:DeleteRoute' :: DeleteRoute -> Text
routeId} -> Text
routeId) (\s :: DeleteRoute
s@DeleteRoute' {} Text
a -> DeleteRoute
s {$sel:routeId:DeleteRoute' :: Text
routeId = Text
a} :: DeleteRoute)

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

instance Prelude.Hashable DeleteRoute where
  hashWithSalt :: Int -> DeleteRoute -> Int
hashWithSalt Int
_salt DeleteRoute' {Text
routeId :: Text
apiId :: Text
$sel:routeId:DeleteRoute' :: DeleteRoute -> Text
$sel:apiId:DeleteRoute' :: DeleteRoute -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
apiId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
routeId

instance Prelude.NFData DeleteRoute where
  rnf :: DeleteRoute -> ()
rnf DeleteRoute' {Text
routeId :: Text
apiId :: Text
$sel:routeId:DeleteRoute' :: DeleteRoute -> Text
$sel:apiId:DeleteRoute' :: DeleteRoute -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
apiId seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
routeId

instance Data.ToHeaders DeleteRoute where
  toHeaders :: DeleteRoute -> [Header]
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToPath DeleteRoute where
  toPath :: DeleteRoute -> ByteString
toPath DeleteRoute' {Text
routeId :: Text
apiId :: Text
$sel:routeId:DeleteRoute' :: DeleteRoute -> Text
$sel:apiId:DeleteRoute' :: DeleteRoute -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/v2/apis/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
apiId,
        ByteString
"/routes/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
routeId
      ]

instance Data.ToQuery DeleteRoute where
  toQuery :: DeleteRoute -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

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

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

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