{-# 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.SavingsPlans.DeleteQueuedSavingsPlan
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes the queued purchase for the specified Savings Plan.
module Amazonka.SavingsPlans.DeleteQueuedSavingsPlan
  ( -- * Creating a Request
    DeleteQueuedSavingsPlan (..),
    newDeleteQueuedSavingsPlan,

    -- * Request Lenses
    deleteQueuedSavingsPlan_savingsPlanId,

    -- * Destructuring the Response
    DeleteQueuedSavingsPlanResponse (..),
    newDeleteQueuedSavingsPlanResponse,

    -- * Response Lenses
    deleteQueuedSavingsPlanResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SavingsPlans.Types

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

-- |
-- Create a value of 'DeleteQueuedSavingsPlan' 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:
--
-- 'savingsPlanId', 'deleteQueuedSavingsPlan_savingsPlanId' - The ID of the Savings Plan.
newDeleteQueuedSavingsPlan ::
  -- | 'savingsPlanId'
  Prelude.Text ->
  DeleteQueuedSavingsPlan
newDeleteQueuedSavingsPlan :: Text -> DeleteQueuedSavingsPlan
newDeleteQueuedSavingsPlan Text
pSavingsPlanId_ =
  DeleteQueuedSavingsPlan'
    { $sel:savingsPlanId:DeleteQueuedSavingsPlan' :: Text
savingsPlanId =
        Text
pSavingsPlanId_
    }

-- | The ID of the Savings Plan.
deleteQueuedSavingsPlan_savingsPlanId :: Lens.Lens' DeleteQueuedSavingsPlan Prelude.Text
deleteQueuedSavingsPlan_savingsPlanId :: Lens' DeleteQueuedSavingsPlan Text
deleteQueuedSavingsPlan_savingsPlanId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteQueuedSavingsPlan' {Text
savingsPlanId :: Text
$sel:savingsPlanId:DeleteQueuedSavingsPlan' :: DeleteQueuedSavingsPlan -> Text
savingsPlanId} -> Text
savingsPlanId) (\s :: DeleteQueuedSavingsPlan
s@DeleteQueuedSavingsPlan' {} Text
a -> DeleteQueuedSavingsPlan
s {$sel:savingsPlanId:DeleteQueuedSavingsPlan' :: Text
savingsPlanId = Text
a} :: DeleteQueuedSavingsPlan)

instance Core.AWSRequest DeleteQueuedSavingsPlan where
  type
    AWSResponse DeleteQueuedSavingsPlan =
      DeleteQueuedSavingsPlanResponse
  request :: (Service -> Service)
-> DeleteQueuedSavingsPlan -> Request DeleteQueuedSavingsPlan
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteQueuedSavingsPlan
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteQueuedSavingsPlan)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteQueuedSavingsPlanResponse
DeleteQueuedSavingsPlanResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteQueuedSavingsPlan where
  hashWithSalt :: Int -> DeleteQueuedSavingsPlan -> Int
hashWithSalt Int
_salt DeleteQueuedSavingsPlan' {Text
savingsPlanId :: Text
$sel:savingsPlanId:DeleteQueuedSavingsPlan' :: DeleteQueuedSavingsPlan -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
savingsPlanId

instance Prelude.NFData DeleteQueuedSavingsPlan where
  rnf :: DeleteQueuedSavingsPlan -> ()
rnf DeleteQueuedSavingsPlan' {Text
savingsPlanId :: Text
$sel:savingsPlanId:DeleteQueuedSavingsPlan' :: DeleteQueuedSavingsPlan -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
savingsPlanId

instance Data.ToHeaders DeleteQueuedSavingsPlan where
  toHeaders :: DeleteQueuedSavingsPlan -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON DeleteQueuedSavingsPlan where
  toJSON :: DeleteQueuedSavingsPlan -> Value
toJSON DeleteQueuedSavingsPlan' {Text
savingsPlanId :: Text
$sel:savingsPlanId:DeleteQueuedSavingsPlan' :: DeleteQueuedSavingsPlan -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"savingsPlanId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
savingsPlanId)
          ]
      )

instance Data.ToPath DeleteQueuedSavingsPlan where
  toPath :: DeleteQueuedSavingsPlan -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/DeleteQueuedSavingsPlan"

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

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

-- |
-- Create a value of 'DeleteQueuedSavingsPlanResponse' 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:
--
-- 'httpStatus', 'deleteQueuedSavingsPlanResponse_httpStatus' - The response's http status code.
newDeleteQueuedSavingsPlanResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteQueuedSavingsPlanResponse
newDeleteQueuedSavingsPlanResponse :: Int -> DeleteQueuedSavingsPlanResponse
newDeleteQueuedSavingsPlanResponse Int
pHttpStatus_ =
  DeleteQueuedSavingsPlanResponse'
    { $sel:httpStatus:DeleteQueuedSavingsPlanResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deleteQueuedSavingsPlanResponse_httpStatus :: Lens.Lens' DeleteQueuedSavingsPlanResponse Prelude.Int
deleteQueuedSavingsPlanResponse_httpStatus :: Lens' DeleteQueuedSavingsPlanResponse Int
deleteQueuedSavingsPlanResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteQueuedSavingsPlanResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteQueuedSavingsPlanResponse' :: DeleteQueuedSavingsPlanResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteQueuedSavingsPlanResponse
s@DeleteQueuedSavingsPlanResponse' {} Int
a -> DeleteQueuedSavingsPlanResponse
s {$sel:httpStatus:DeleteQueuedSavingsPlanResponse' :: Int
httpStatus = Int
a} :: DeleteQueuedSavingsPlanResponse)

instance
  Prelude.NFData
    DeleteQueuedSavingsPlanResponse
  where
  rnf :: DeleteQueuedSavingsPlanResponse -> ()
rnf DeleteQueuedSavingsPlanResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteQueuedSavingsPlanResponse' :: DeleteQueuedSavingsPlanResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus