{-# 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.DeleteResource
-- 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 Resource resource.
module Amazonka.APIGateway.DeleteResource
  ( -- * Creating a Request
    DeleteResource (..),
    newDeleteResource,

    -- * Request Lenses
    deleteResource_restApiId,
    deleteResource_resourceId,

    -- * Destructuring the Response
    DeleteResourceResponse (..),
    newDeleteResourceResponse,
  )
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 a Resource.
--
-- /See:/ 'newDeleteResource' smart constructor.
data DeleteResource = DeleteResource'
  { -- | [Required] The string identifier of the associated RestApi.
    DeleteResource -> Text
restApiId :: Prelude.Text,
    -- | [Required] The identifier of the Resource resource.
    DeleteResource -> Text
resourceId :: Prelude.Text
  }
  deriving (DeleteResource -> DeleteResource -> Bool
(DeleteResource -> DeleteResource -> Bool)
-> (DeleteResource -> DeleteResource -> Bool) -> Eq DeleteResource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteResource -> DeleteResource -> Bool
$c/= :: DeleteResource -> DeleteResource -> Bool
== :: DeleteResource -> DeleteResource -> Bool
$c== :: DeleteResource -> DeleteResource -> Bool
Prelude.Eq, ReadPrec [DeleteResource]
ReadPrec DeleteResource
Int -> ReadS DeleteResource
ReadS [DeleteResource]
(Int -> ReadS DeleteResource)
-> ReadS [DeleteResource]
-> ReadPrec DeleteResource
-> ReadPrec [DeleteResource]
-> Read DeleteResource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteResource]
$creadListPrec :: ReadPrec [DeleteResource]
readPrec :: ReadPrec DeleteResource
$creadPrec :: ReadPrec DeleteResource
readList :: ReadS [DeleteResource]
$creadList :: ReadS [DeleteResource]
readsPrec :: Int -> ReadS DeleteResource
$creadsPrec :: Int -> ReadS DeleteResource
Prelude.Read, Int -> DeleteResource -> ShowS
[DeleteResource] -> ShowS
DeleteResource -> String
(Int -> DeleteResource -> ShowS)
-> (DeleteResource -> String)
-> ([DeleteResource] -> ShowS)
-> Show DeleteResource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteResource] -> ShowS
$cshowList :: [DeleteResource] -> ShowS
show :: DeleteResource -> String
$cshow :: DeleteResource -> String
showsPrec :: Int -> DeleteResource -> ShowS
$cshowsPrec :: Int -> DeleteResource -> ShowS
Prelude.Show, (forall x. DeleteResource -> Rep DeleteResource x)
-> (forall x. Rep DeleteResource x -> DeleteResource)
-> Generic DeleteResource
forall x. Rep DeleteResource x -> DeleteResource
forall x. DeleteResource -> Rep DeleteResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteResource x -> DeleteResource
$cfrom :: forall x. DeleteResource -> Rep DeleteResource x
Prelude.Generic)

-- |
-- Create a value of 'DeleteResource' 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', 'deleteResource_restApiId' - [Required] The string identifier of the associated RestApi.
--
-- 'resourceId', 'deleteResource_resourceId' - [Required] The identifier of the Resource resource.
newDeleteResource ::
  -- | 'restApiId'
  Prelude.Text ->
  -- | 'resourceId'
  Prelude.Text ->
  DeleteResource
newDeleteResource :: Text -> Text -> DeleteResource
newDeleteResource Text
pRestApiId_ Text
pResourceId_ =
  DeleteResource' :: Text -> Text -> DeleteResource
DeleteResource'
    { $sel:restApiId:DeleteResource' :: Text
restApiId = Text
pRestApiId_,
      $sel:resourceId:DeleteResource' :: Text
resourceId = Text
pResourceId_
    }

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

-- | [Required] The identifier of the Resource resource.
deleteResource_resourceId :: Lens.Lens' DeleteResource Prelude.Text
deleteResource_resourceId :: (Text -> f Text) -> DeleteResource -> f DeleteResource
deleteResource_resourceId = (DeleteResource -> Text)
-> (DeleteResource -> Text -> DeleteResource)
-> Lens DeleteResource DeleteResource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteResource' {Text
resourceId :: Text
$sel:resourceId:DeleteResource' :: DeleteResource -> Text
resourceId} -> Text
resourceId) (\s :: DeleteResource
s@DeleteResource' {} Text
a -> DeleteResource
s {$sel:resourceId:DeleteResource' :: Text
resourceId = Text
a} :: DeleteResource)

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

instance Prelude.Hashable DeleteResource

instance Prelude.NFData DeleteResource

instance Core.ToHeaders DeleteResource where
  toHeaders :: DeleteResource -> [Header]
toHeaders =
    [Header] -> DeleteResource -> [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 DeleteResource where
  toPath :: DeleteResource -> ByteString
toPath DeleteResource' {Text
resourceId :: Text
restApiId :: Text
$sel:resourceId:DeleteResource' :: DeleteResource -> Text
$sel:restApiId:DeleteResource' :: DeleteResource -> 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
      ]

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

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

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

instance Prelude.NFData DeleteResourceResponse