{-# 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.DeleteUsagePlan
-- 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 usage plan of a given plan Id.
module Amazonka.APIGateway.DeleteUsagePlan
  ( -- * Creating a Request
    DeleteUsagePlan (..),
    newDeleteUsagePlan,

    -- * Request Lenses
    deleteUsagePlan_usagePlanId,

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

-- | The DELETE request to delete a usage plan of a given plan Id.
--
-- /See:/ 'newDeleteUsagePlan' smart constructor.
data DeleteUsagePlan = DeleteUsagePlan'
  { -- | [Required] The Id of the to-be-deleted usage plan.
    DeleteUsagePlan -> Text
usagePlanId :: Prelude.Text
  }
  deriving (DeleteUsagePlan -> DeleteUsagePlan -> Bool
(DeleteUsagePlan -> DeleteUsagePlan -> Bool)
-> (DeleteUsagePlan -> DeleteUsagePlan -> Bool)
-> Eq DeleteUsagePlan
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteUsagePlan -> DeleteUsagePlan -> Bool
$c/= :: DeleteUsagePlan -> DeleteUsagePlan -> Bool
== :: DeleteUsagePlan -> DeleteUsagePlan -> Bool
$c== :: DeleteUsagePlan -> DeleteUsagePlan -> Bool
Prelude.Eq, ReadPrec [DeleteUsagePlan]
ReadPrec DeleteUsagePlan
Int -> ReadS DeleteUsagePlan
ReadS [DeleteUsagePlan]
(Int -> ReadS DeleteUsagePlan)
-> ReadS [DeleteUsagePlan]
-> ReadPrec DeleteUsagePlan
-> ReadPrec [DeleteUsagePlan]
-> Read DeleteUsagePlan
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteUsagePlan]
$creadListPrec :: ReadPrec [DeleteUsagePlan]
readPrec :: ReadPrec DeleteUsagePlan
$creadPrec :: ReadPrec DeleteUsagePlan
readList :: ReadS [DeleteUsagePlan]
$creadList :: ReadS [DeleteUsagePlan]
readsPrec :: Int -> ReadS DeleteUsagePlan
$creadsPrec :: Int -> ReadS DeleteUsagePlan
Prelude.Read, Int -> DeleteUsagePlan -> ShowS
[DeleteUsagePlan] -> ShowS
DeleteUsagePlan -> String
(Int -> DeleteUsagePlan -> ShowS)
-> (DeleteUsagePlan -> String)
-> ([DeleteUsagePlan] -> ShowS)
-> Show DeleteUsagePlan
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteUsagePlan] -> ShowS
$cshowList :: [DeleteUsagePlan] -> ShowS
show :: DeleteUsagePlan -> String
$cshow :: DeleteUsagePlan -> String
showsPrec :: Int -> DeleteUsagePlan -> ShowS
$cshowsPrec :: Int -> DeleteUsagePlan -> ShowS
Prelude.Show, (forall x. DeleteUsagePlan -> Rep DeleteUsagePlan x)
-> (forall x. Rep DeleteUsagePlan x -> DeleteUsagePlan)
-> Generic DeleteUsagePlan
forall x. Rep DeleteUsagePlan x -> DeleteUsagePlan
forall x. DeleteUsagePlan -> Rep DeleteUsagePlan x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteUsagePlan x -> DeleteUsagePlan
$cfrom :: forall x. DeleteUsagePlan -> Rep DeleteUsagePlan x
Prelude.Generic)

-- |
-- Create a value of 'DeleteUsagePlan' 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:
--
-- 'usagePlanId', 'deleteUsagePlan_usagePlanId' - [Required] The Id of the to-be-deleted usage plan.
newDeleteUsagePlan ::
  -- | 'usagePlanId'
  Prelude.Text ->
  DeleteUsagePlan
newDeleteUsagePlan :: Text -> DeleteUsagePlan
newDeleteUsagePlan Text
pUsagePlanId_ =
  DeleteUsagePlan' :: Text -> DeleteUsagePlan
DeleteUsagePlan' {$sel:usagePlanId:DeleteUsagePlan' :: Text
usagePlanId = Text
pUsagePlanId_}

-- | [Required] The Id of the to-be-deleted usage plan.
deleteUsagePlan_usagePlanId :: Lens.Lens' DeleteUsagePlan Prelude.Text
deleteUsagePlan_usagePlanId :: (Text -> f Text) -> DeleteUsagePlan -> f DeleteUsagePlan
deleteUsagePlan_usagePlanId = (DeleteUsagePlan -> Text)
-> (DeleteUsagePlan -> Text -> DeleteUsagePlan)
-> Lens DeleteUsagePlan DeleteUsagePlan Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteUsagePlan' {Text
usagePlanId :: Text
$sel:usagePlanId:DeleteUsagePlan' :: DeleteUsagePlan -> Text
usagePlanId} -> Text
usagePlanId) (\s :: DeleteUsagePlan
s@DeleteUsagePlan' {} Text
a -> DeleteUsagePlan
s {$sel:usagePlanId:DeleteUsagePlan' :: Text
usagePlanId = Text
a} :: DeleteUsagePlan)

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

instance Prelude.Hashable DeleteUsagePlan

instance Prelude.NFData DeleteUsagePlan

instance Core.ToHeaders DeleteUsagePlan where
  toHeaders :: DeleteUsagePlan -> [Header]
toHeaders =
    [Header] -> DeleteUsagePlan -> [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 DeleteUsagePlan where
  toPath :: DeleteUsagePlan -> ByteString
toPath DeleteUsagePlan' {Text
usagePlanId :: Text
$sel:usagePlanId:DeleteUsagePlan' :: DeleteUsagePlan -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/usageplans/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
usagePlanId]

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

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

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

instance Prelude.NFData DeleteUsagePlanResponse