{-# 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.DeleteDeployment
-- 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 Deployment resource. Deleting a deployment will only succeed
-- if there are no Stage resources associated with it.
module Amazonka.APIGateway.DeleteDeployment
  ( -- * Creating a Request
    DeleteDeployment (..),
    newDeleteDeployment,

    -- * Request Lenses
    deleteDeployment_restApiId,
    deleteDeployment_deploymentId,

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

-- |
-- Create a value of 'DeleteDeployment' 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', 'deleteDeployment_restApiId' - [Required] The string identifier of the associated RestApi.
--
-- 'deploymentId', 'deleteDeployment_deploymentId' - [Required] The identifier of the Deployment resource to delete.
newDeleteDeployment ::
  -- | 'restApiId'
  Prelude.Text ->
  -- | 'deploymentId'
  Prelude.Text ->
  DeleteDeployment
newDeleteDeployment :: Text -> Text -> DeleteDeployment
newDeleteDeployment Text
pRestApiId_ Text
pDeploymentId_ =
  DeleteDeployment' :: Text -> Text -> DeleteDeployment
DeleteDeployment'
    { $sel:restApiId:DeleteDeployment' :: Text
restApiId = Text
pRestApiId_,
      $sel:deploymentId:DeleteDeployment' :: Text
deploymentId = Text
pDeploymentId_
    }

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

-- | [Required] The identifier of the Deployment resource to delete.
deleteDeployment_deploymentId :: Lens.Lens' DeleteDeployment Prelude.Text
deleteDeployment_deploymentId :: (Text -> f Text) -> DeleteDeployment -> f DeleteDeployment
deleteDeployment_deploymentId = (DeleteDeployment -> Text)
-> (DeleteDeployment -> Text -> DeleteDeployment)
-> Lens DeleteDeployment DeleteDeployment Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDeployment' {Text
deploymentId :: Text
$sel:deploymentId:DeleteDeployment' :: DeleteDeployment -> Text
deploymentId} -> Text
deploymentId) (\s :: DeleteDeployment
s@DeleteDeployment' {} Text
a -> DeleteDeployment
s {$sel:deploymentId:DeleteDeployment' :: Text
deploymentId = Text
a} :: DeleteDeployment)

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

instance Prelude.Hashable DeleteDeployment

instance Prelude.NFData DeleteDeployment

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

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

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

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

instance Prelude.NFData DeleteDeploymentResponse