{-# 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-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 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.Lens as Lens
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
(DeleteQueuedSavingsPlan -> DeleteQueuedSavingsPlan -> Bool)
-> (DeleteQueuedSavingsPlan -> DeleteQueuedSavingsPlan -> Bool)
-> Eq DeleteQueuedSavingsPlan
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]
(Int -> ReadS DeleteQueuedSavingsPlan)
-> ReadS [DeleteQueuedSavingsPlan]
-> ReadPrec DeleteQueuedSavingsPlan
-> ReadPrec [DeleteQueuedSavingsPlan]
-> Read 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
(Int -> DeleteQueuedSavingsPlan -> ShowS)
-> (DeleteQueuedSavingsPlan -> String)
-> ([DeleteQueuedSavingsPlan] -> ShowS)
-> Show DeleteQueuedSavingsPlan
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.
 DeleteQueuedSavingsPlan -> Rep DeleteQueuedSavingsPlan x)
-> (forall x.
    Rep DeleteQueuedSavingsPlan x -> DeleteQueuedSavingsPlan)
-> Generic DeleteQueuedSavingsPlan
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' :: Text -> DeleteQueuedSavingsPlan
DeleteQueuedSavingsPlan'
    { $sel:savingsPlanId:DeleteQueuedSavingsPlan' :: Text
savingsPlanId =
        Text
pSavingsPlanId_
    }

-- | The ID of the Savings Plan.
deleteQueuedSavingsPlan_savingsPlanId :: Lens.Lens' DeleteQueuedSavingsPlan Prelude.Text
deleteQueuedSavingsPlan_savingsPlanId :: (Text -> f Text)
-> DeleteQueuedSavingsPlan -> f DeleteQueuedSavingsPlan
deleteQueuedSavingsPlan_savingsPlanId = (DeleteQueuedSavingsPlan -> Text)
-> (DeleteQueuedSavingsPlan -> Text -> DeleteQueuedSavingsPlan)
-> Lens DeleteQueuedSavingsPlan DeleteQueuedSavingsPlan Text Text
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 :: DeleteQueuedSavingsPlan -> Request DeleteQueuedSavingsPlan
request = Service
-> DeleteQueuedSavingsPlan -> Request DeleteQueuedSavingsPlan
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteQueuedSavingsPlan
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteQueuedSavingsPlan)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteQueuedSavingsPlan))
-> Logger
-> Service
-> Proxy DeleteQueuedSavingsPlan
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteQueuedSavingsPlan)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteQueuedSavingsPlanResponse
DeleteQueuedSavingsPlanResponse'
            (Int -> DeleteQueuedSavingsPlanResponse)
-> Either String Int
-> Either String DeleteQueuedSavingsPlanResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteQueuedSavingsPlan

instance Prelude.NFData DeleteQueuedSavingsPlan

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

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

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

instance Core.ToQuery DeleteQueuedSavingsPlan where
  toQuery :: DeleteQueuedSavingsPlan -> QueryString
toQuery = QueryString -> DeleteQueuedSavingsPlan -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DeleteQueuedSavingsPlanResponse
 -> DeleteQueuedSavingsPlanResponse -> Bool)
-> (DeleteQueuedSavingsPlanResponse
    -> DeleteQueuedSavingsPlanResponse -> Bool)
-> Eq DeleteQueuedSavingsPlanResponse
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]
(Int -> ReadS DeleteQueuedSavingsPlanResponse)
-> ReadS [DeleteQueuedSavingsPlanResponse]
-> ReadPrec DeleteQueuedSavingsPlanResponse
-> ReadPrec [DeleteQueuedSavingsPlanResponse]
-> Read 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
(Int -> DeleteQueuedSavingsPlanResponse -> ShowS)
-> (DeleteQueuedSavingsPlanResponse -> String)
-> ([DeleteQueuedSavingsPlanResponse] -> ShowS)
-> Show DeleteQueuedSavingsPlanResponse
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.
 DeleteQueuedSavingsPlanResponse
 -> Rep DeleteQueuedSavingsPlanResponse x)
-> (forall x.
    Rep DeleteQueuedSavingsPlanResponse x
    -> DeleteQueuedSavingsPlanResponse)
-> Generic DeleteQueuedSavingsPlanResponse
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' :: Int -> DeleteQueuedSavingsPlanResponse
DeleteQueuedSavingsPlanResponse'
    { $sel:httpStatus:DeleteQueuedSavingsPlanResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deleteQueuedSavingsPlanResponse_httpStatus :: Lens.Lens' DeleteQueuedSavingsPlanResponse Prelude.Int
deleteQueuedSavingsPlanResponse_httpStatus :: (Int -> f Int)
-> DeleteQueuedSavingsPlanResponse
-> f DeleteQueuedSavingsPlanResponse
deleteQueuedSavingsPlanResponse_httpStatus = (DeleteQueuedSavingsPlanResponse -> Int)
-> (DeleteQueuedSavingsPlanResponse
    -> Int -> DeleteQueuedSavingsPlanResponse)
-> Lens
     DeleteQueuedSavingsPlanResponse
     DeleteQueuedSavingsPlanResponse
     Int
     Int
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