{-# 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.APIGateway.DeleteMethod
-- 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 an existing Method resource.
module Amazonka.APIGateway.DeleteMethod
  ( -- * Creating a Request
    DeleteMethod (..),
    newDeleteMethod,

    -- * Request Lenses
    deleteMethod_restApiId,
    deleteMethod_resourceId,
    deleteMethod_httpMethod,

    -- * Destructuring the Response
    DeleteMethodResponse' (..),
    newDeleteMethodResponse',
  )
where

import Amazonka.APIGateway.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

-- | Request to delete an existing Method resource.
--
-- /See:/ 'newDeleteMethod' smart constructor.
data DeleteMethod = DeleteMethod'
  { -- | The string identifier of the associated RestApi.
    DeleteMethod -> Text
restApiId :: Prelude.Text,
    -- | The Resource identifier for the Method resource.
    DeleteMethod -> Text
resourceId :: Prelude.Text,
    -- | The HTTP verb of the Method resource.
    DeleteMethod -> Text
httpMethod :: Prelude.Text
  }
  deriving (DeleteMethod -> DeleteMethod -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteMethod -> DeleteMethod -> Bool
$c/= :: DeleteMethod -> DeleteMethod -> Bool
== :: DeleteMethod -> DeleteMethod -> Bool
$c== :: DeleteMethod -> DeleteMethod -> Bool
Prelude.Eq, ReadPrec [DeleteMethod]
ReadPrec DeleteMethod
Int -> ReadS DeleteMethod
ReadS [DeleteMethod]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteMethod]
$creadListPrec :: ReadPrec [DeleteMethod]
readPrec :: ReadPrec DeleteMethod
$creadPrec :: ReadPrec DeleteMethod
readList :: ReadS [DeleteMethod]
$creadList :: ReadS [DeleteMethod]
readsPrec :: Int -> ReadS DeleteMethod
$creadsPrec :: Int -> ReadS DeleteMethod
Prelude.Read, Int -> DeleteMethod -> ShowS
[DeleteMethod] -> ShowS
DeleteMethod -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteMethod] -> ShowS
$cshowList :: [DeleteMethod] -> ShowS
show :: DeleteMethod -> String
$cshow :: DeleteMethod -> String
showsPrec :: Int -> DeleteMethod -> ShowS
$cshowsPrec :: Int -> DeleteMethod -> ShowS
Prelude.Show, forall x. Rep DeleteMethod x -> DeleteMethod
forall x. DeleteMethod -> Rep DeleteMethod x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteMethod x -> DeleteMethod
$cfrom :: forall x. DeleteMethod -> Rep DeleteMethod x
Prelude.Generic)

-- |
-- Create a value of 'DeleteMethod' 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:
--
-- 'restApiId', 'deleteMethod_restApiId' - The string identifier of the associated RestApi.
--
-- 'resourceId', 'deleteMethod_resourceId' - The Resource identifier for the Method resource.
--
-- 'httpMethod', 'deleteMethod_httpMethod' - The HTTP verb of the Method resource.
newDeleteMethod ::
  -- | 'restApiId'
  Prelude.Text ->
  -- | 'resourceId'
  Prelude.Text ->
  -- | 'httpMethod'
  Prelude.Text ->
  DeleteMethod
newDeleteMethod :: Text -> Text -> Text -> DeleteMethod
newDeleteMethod Text
pRestApiId_ Text
pResourceId_ Text
pHttpMethod_ =
  DeleteMethod'
    { $sel:restApiId:DeleteMethod' :: Text
restApiId = Text
pRestApiId_,
      $sel:resourceId:DeleteMethod' :: Text
resourceId = Text
pResourceId_,
      $sel:httpMethod:DeleteMethod' :: Text
httpMethod = Text
pHttpMethod_
    }

-- | The string identifier of the associated RestApi.
deleteMethod_restApiId :: Lens.Lens' DeleteMethod Prelude.Text
deleteMethod_restApiId :: Lens' DeleteMethod Text
deleteMethod_restApiId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteMethod' {Text
restApiId :: Text
$sel:restApiId:DeleteMethod' :: DeleteMethod -> Text
restApiId} -> Text
restApiId) (\s :: DeleteMethod
s@DeleteMethod' {} Text
a -> DeleteMethod
s {$sel:restApiId:DeleteMethod' :: Text
restApiId = Text
a} :: DeleteMethod)

-- | The Resource identifier for the Method resource.
deleteMethod_resourceId :: Lens.Lens' DeleteMethod Prelude.Text
deleteMethod_resourceId :: Lens' DeleteMethod Text
deleteMethod_resourceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteMethod' {Text
resourceId :: Text
$sel:resourceId:DeleteMethod' :: DeleteMethod -> Text
resourceId} -> Text
resourceId) (\s :: DeleteMethod
s@DeleteMethod' {} Text
a -> DeleteMethod
s {$sel:resourceId:DeleteMethod' :: Text
resourceId = Text
a} :: DeleteMethod)

-- | The HTTP verb of the Method resource.
deleteMethod_httpMethod :: Lens.Lens' DeleteMethod Prelude.Text
deleteMethod_httpMethod :: Lens' DeleteMethod Text
deleteMethod_httpMethod = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteMethod' {Text
httpMethod :: Text
$sel:httpMethod:DeleteMethod' :: DeleteMethod -> Text
httpMethod} -> Text
httpMethod) (\s :: DeleteMethod
s@DeleteMethod' {} Text
a -> DeleteMethod
s {$sel:httpMethod:DeleteMethod' :: Text
httpMethod = Text
a} :: DeleteMethod)

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

instance Prelude.Hashable DeleteMethod where
  hashWithSalt :: Int -> DeleteMethod -> Int
hashWithSalt Int
_salt DeleteMethod' {Text
httpMethod :: Text
resourceId :: Text
restApiId :: Text
$sel:httpMethod:DeleteMethod' :: DeleteMethod -> Text
$sel:resourceId:DeleteMethod' :: DeleteMethod -> Text
$sel:restApiId:DeleteMethod' :: DeleteMethod -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
restApiId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
resourceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
httpMethod

instance Prelude.NFData DeleteMethod where
  rnf :: DeleteMethod -> ()
rnf DeleteMethod' {Text
httpMethod :: Text
resourceId :: Text
restApiId :: Text
$sel:httpMethod:DeleteMethod' :: DeleteMethod -> Text
$sel:resourceId:DeleteMethod' :: DeleteMethod -> Text
$sel:restApiId:DeleteMethod' :: DeleteMethod -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
restApiId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
resourceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
httpMethod

instance Data.ToHeaders DeleteMethod where
  toHeaders :: DeleteMethod -> [Header]
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Accept"
              forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# (ByteString
"application/json" :: Prelude.ByteString)
          ]
      )

instance Data.ToPath DeleteMethod where
  toPath :: DeleteMethod -> ByteString
toPath DeleteMethod' {Text
httpMethod :: Text
resourceId :: Text
restApiId :: Text
$sel:httpMethod:DeleteMethod' :: DeleteMethod -> Text
$sel:resourceId:DeleteMethod' :: DeleteMethod -> Text
$sel:restApiId:DeleteMethod' :: DeleteMethod -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/restapis/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
restApiId,
        ByteString
"/resources/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
resourceId,
        ByteString
"/methods/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
httpMethod
      ]

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

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

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

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