{-# 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.DeleteStage
-- 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 Stage resource.
module Amazonka.APIGateway.DeleteStage
  ( -- * Creating a Request
    DeleteStage (..),
    newDeleteStage,

    -- * Request Lenses
    deleteStage_restApiId,
    deleteStage_stageName,

    -- * Destructuring the Response
    DeleteStageResponse (..),
    newDeleteStageResponse,
  )
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

-- | Requests API Gateway to delete a Stage resource.
--
-- /See:/ 'newDeleteStage' smart constructor.
data DeleteStage = DeleteStage'
  { -- | [Required] The string identifier of the associated RestApi.
    DeleteStage -> Text
restApiId :: Prelude.Text,
    -- | [Required] The name of the Stage resource to delete.
    DeleteStage -> Text
stageName :: Prelude.Text
  }
  deriving (DeleteStage -> DeleteStage -> Bool
(DeleteStage -> DeleteStage -> Bool)
-> (DeleteStage -> DeleteStage -> Bool) -> Eq DeleteStage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteStage -> DeleteStage -> Bool
$c/= :: DeleteStage -> DeleteStage -> Bool
== :: DeleteStage -> DeleteStage -> Bool
$c== :: DeleteStage -> DeleteStage -> Bool
Prelude.Eq, ReadPrec [DeleteStage]
ReadPrec DeleteStage
Int -> ReadS DeleteStage
ReadS [DeleteStage]
(Int -> ReadS DeleteStage)
-> ReadS [DeleteStage]
-> ReadPrec DeleteStage
-> ReadPrec [DeleteStage]
-> Read DeleteStage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteStage]
$creadListPrec :: ReadPrec [DeleteStage]
readPrec :: ReadPrec DeleteStage
$creadPrec :: ReadPrec DeleteStage
readList :: ReadS [DeleteStage]
$creadList :: ReadS [DeleteStage]
readsPrec :: Int -> ReadS DeleteStage
$creadsPrec :: Int -> ReadS DeleteStage
Prelude.Read, Int -> DeleteStage -> ShowS
[DeleteStage] -> ShowS
DeleteStage -> String
(Int -> DeleteStage -> ShowS)
-> (DeleteStage -> String)
-> ([DeleteStage] -> ShowS)
-> Show DeleteStage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteStage] -> ShowS
$cshowList :: [DeleteStage] -> ShowS
show :: DeleteStage -> String
$cshow :: DeleteStage -> String
showsPrec :: Int -> DeleteStage -> ShowS
$cshowsPrec :: Int -> DeleteStage -> ShowS
Prelude.Show, (forall x. DeleteStage -> Rep DeleteStage x)
-> (forall x. Rep DeleteStage x -> DeleteStage)
-> Generic DeleteStage
forall x. Rep DeleteStage x -> DeleteStage
forall x. DeleteStage -> Rep DeleteStage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteStage x -> DeleteStage
$cfrom :: forall x. DeleteStage -> Rep DeleteStage x
Prelude.Generic)

-- |
-- Create a value of 'DeleteStage' 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', 'deleteStage_restApiId' - [Required] The string identifier of the associated RestApi.
--
-- 'stageName', 'deleteStage_stageName' - [Required] The name of the Stage resource to delete.
newDeleteStage ::
  -- | 'restApiId'
  Prelude.Text ->
  -- | 'stageName'
  Prelude.Text ->
  DeleteStage
newDeleteStage :: Text -> Text -> DeleteStage
newDeleteStage Text
pRestApiId_ Text
pStageName_ =
  DeleteStage' :: Text -> Text -> DeleteStage
DeleteStage'
    { $sel:restApiId:DeleteStage' :: Text
restApiId = Text
pRestApiId_,
      $sel:stageName:DeleteStage' :: Text
stageName = Text
pStageName_
    }

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

-- | [Required] The name of the Stage resource to delete.
deleteStage_stageName :: Lens.Lens' DeleteStage Prelude.Text
deleteStage_stageName :: (Text -> f Text) -> DeleteStage -> f DeleteStage
deleteStage_stageName = (DeleteStage -> Text)
-> (DeleteStage -> Text -> DeleteStage)
-> Lens DeleteStage DeleteStage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteStage' {Text
stageName :: Text
$sel:stageName:DeleteStage' :: DeleteStage -> Text
stageName} -> Text
stageName) (\s :: DeleteStage
s@DeleteStage' {} Text
a -> DeleteStage
s {$sel:stageName:DeleteStage' :: Text
stageName = Text
a} :: DeleteStage)

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

instance Prelude.Hashable DeleteStage

instance Prelude.NFData DeleteStage

instance Core.ToHeaders DeleteStage where
  toHeaders :: DeleteStage -> [Header]
toHeaders =
    [Header] -> DeleteStage -> [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 DeleteStage where
  toPath :: DeleteStage -> ByteString
toPath DeleteStage' {Text
stageName :: Text
restApiId :: Text
$sel:stageName:DeleteStage' :: DeleteStage -> Text
$sel:restApiId:DeleteStage' :: DeleteStage -> 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
"/stages/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
stageName
      ]

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

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

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

instance Prelude.NFData DeleteStageResponse