{-# 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-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 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.Lens as Lens
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'
  { -- | [Required] The string identifier of the associated RestApi.
    DeleteMethod -> Text
restApiId :: Prelude.Text,
    -- | [Required] The Resource identifier for the Method resource.
    DeleteMethod -> Text
resourceId :: Prelude.Text,
    -- | [Required] The HTTP verb of the Method resource.
    DeleteMethod -> Text
httpMethod :: Prelude.Text
  }
  deriving (DeleteMethod -> DeleteMethod -> Bool
(DeleteMethod -> DeleteMethod -> Bool)
-> (DeleteMethod -> DeleteMethod -> Bool) -> Eq DeleteMethod
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]
(Int -> ReadS DeleteMethod)
-> ReadS [DeleteMethod]
-> ReadPrec DeleteMethod
-> ReadPrec [DeleteMethod]
-> Read 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
(Int -> DeleteMethod -> ShowS)
-> (DeleteMethod -> String)
-> ([DeleteMethod] -> ShowS)
-> Show DeleteMethod
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. DeleteMethod -> Rep DeleteMethod x)
-> (forall x. Rep DeleteMethod x -> DeleteMethod)
-> Generic DeleteMethod
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' - [Required] The string identifier of the associated RestApi.
--
-- 'resourceId', 'deleteMethod_resourceId' - [Required] The Resource identifier for the Method resource.
--
-- 'httpMethod', 'deleteMethod_httpMethod' - [Required] 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' :: Text -> Text -> Text -> DeleteMethod
DeleteMethod'
    { $sel:restApiId:DeleteMethod' :: Text
restApiId = Text
pRestApiId_,
      $sel:resourceId:DeleteMethod' :: Text
resourceId = Text
pResourceId_,
      $sel:httpMethod:DeleteMethod' :: Text
httpMethod = Text
pHttpMethod_
    }

-- | [Required] The string identifier of the associated RestApi.
deleteMethod_restApiId :: Lens.Lens' DeleteMethod Prelude.Text
deleteMethod_restApiId :: (Text -> f Text) -> DeleteMethod -> f DeleteMethod
deleteMethod_restApiId = (DeleteMethod -> Text)
-> (DeleteMethod -> Text -> DeleteMethod)
-> Lens DeleteMethod DeleteMethod Text Text
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)

-- | [Required] The Resource identifier for the Method resource.
deleteMethod_resourceId :: Lens.Lens' DeleteMethod Prelude.Text
deleteMethod_resourceId :: (Text -> f Text) -> DeleteMethod -> f DeleteMethod
deleteMethod_resourceId = (DeleteMethod -> Text)
-> (DeleteMethod -> Text -> DeleteMethod)
-> Lens DeleteMethod DeleteMethod Text Text
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)

-- | [Required] The HTTP verb of the Method resource.
deleteMethod_httpMethod :: Lens.Lens' DeleteMethod Prelude.Text
deleteMethod_httpMethod :: (Text -> f Text) -> DeleteMethod -> f DeleteMethod
deleteMethod_httpMethod = (DeleteMethod -> Text)
-> (DeleteMethod -> Text -> DeleteMethod)
-> Lens DeleteMethod DeleteMethod Text Text
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 :: DeleteMethod -> Request DeleteMethod
request = Service -> DeleteMethod -> Request DeleteMethod
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteMethod
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteMethod)))
response =
    AWSResponse DeleteMethod
-> Logger
-> Service
-> Proxy DeleteMethod
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteMethod)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeleteMethod
DeleteMethodResponse'
DeleteMethodResponse''

instance Prelude.Hashable DeleteMethod

instance Prelude.NFData DeleteMethod

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

instance Core.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
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/restapis/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
restApiId,
        ByteString
"/resources/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
resourceId,
        ByteString
"/methods/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
httpMethod
      ]

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

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