{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- 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.Lens as Lens
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
(DeleteRoute -> DeleteRoute -> Bool)
-> (DeleteRoute -> DeleteRoute -> Bool) -> Eq DeleteRoute
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]
(Int -> ReadS DeleteRoute)
-> ReadS [DeleteRoute]
-> ReadPrec DeleteRoute
-> ReadPrec [DeleteRoute]
-> Read 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
(Int -> DeleteRoute -> ShowS)
-> (DeleteRoute -> String)
-> ([DeleteRoute] -> ShowS)
-> Show DeleteRoute
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. DeleteRoute -> Rep DeleteRoute x)
-> (forall x. Rep DeleteRoute x -> DeleteRoute)
-> Generic DeleteRoute
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' :: Text -> Text -> DeleteRoute
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 :: (Text -> f Text) -> DeleteRoute -> f DeleteRoute
deleteRoute_apiId = (DeleteRoute -> Text)
-> (DeleteRoute -> Text -> DeleteRoute)
-> Lens DeleteRoute DeleteRoute Text Text
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 :: (Text -> f Text) -> DeleteRoute -> f DeleteRoute
deleteRoute_routeId = (DeleteRoute -> Text)
-> (DeleteRoute -> Text -> DeleteRoute)
-> Lens DeleteRoute DeleteRoute Text Text
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 :: DeleteRoute -> Request DeleteRoute
request = Service -> DeleteRoute -> Request DeleteRoute
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteRoute
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteRoute)))
response = AWSResponse DeleteRoute
-> Logger
-> Service
-> Proxy DeleteRoute
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteRoute)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeleteRoute
DeleteRouteResponse'
DeleteRouteResponse''

instance Prelude.Hashable DeleteRoute

instance Prelude.NFData DeleteRoute

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

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

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

-- | /See:/ 'newDeleteRouteResponse'' smart constructor.
data DeleteRouteResponse' = DeleteRouteResponse''
  {
  }
  deriving (DeleteRouteResponse' -> DeleteRouteResponse' -> Bool
(DeleteRouteResponse' -> DeleteRouteResponse' -> Bool)
-> (DeleteRouteResponse' -> DeleteRouteResponse' -> Bool)
-> Eq DeleteRouteResponse'
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']
(Int -> ReadS DeleteRouteResponse')
-> ReadS [DeleteRouteResponse']
-> ReadPrec DeleteRouteResponse'
-> ReadPrec [DeleteRouteResponse']
-> Read 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
(Int -> DeleteRouteResponse' -> ShowS)
-> (DeleteRouteResponse' -> String)
-> ([DeleteRouteResponse'] -> ShowS)
-> Show DeleteRouteResponse'
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. DeleteRouteResponse' -> Rep DeleteRouteResponse' x)
-> (forall x. Rep DeleteRouteResponse' x -> DeleteRouteResponse')
-> Generic DeleteRouteResponse'
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'