{-# 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.BillingConductor.DeletePricingPlan
-- 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 a pricing plan. The pricing plan must not be associated with any
-- billing groups to delete successfully.
module Amazonka.BillingConductor.DeletePricingPlan
  ( -- * Creating a Request
    DeletePricingPlan (..),
    newDeletePricingPlan,

    -- * Request Lenses
    deletePricingPlan_arn,

    -- * Destructuring the Response
    DeletePricingPlanResponse (..),
    newDeletePricingPlanResponse,

    -- * Response Lenses
    deletePricingPlanResponse_arn,
    deletePricingPlanResponse_httpStatus,
  )
where

import Amazonka.BillingConductor.Types
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

-- | /See:/ 'newDeletePricingPlan' smart constructor.
data DeletePricingPlan = DeletePricingPlan'
  { -- | The Amazon Resource Name (ARN) of the pricing plan that you\'re
    -- deleting.
    DeletePricingPlan -> Text
arn :: Prelude.Text
  }
  deriving (DeletePricingPlan -> DeletePricingPlan -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeletePricingPlan -> DeletePricingPlan -> Bool
$c/= :: DeletePricingPlan -> DeletePricingPlan -> Bool
== :: DeletePricingPlan -> DeletePricingPlan -> Bool
$c== :: DeletePricingPlan -> DeletePricingPlan -> Bool
Prelude.Eq, ReadPrec [DeletePricingPlan]
ReadPrec DeletePricingPlan
Int -> ReadS DeletePricingPlan
ReadS [DeletePricingPlan]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeletePricingPlan]
$creadListPrec :: ReadPrec [DeletePricingPlan]
readPrec :: ReadPrec DeletePricingPlan
$creadPrec :: ReadPrec DeletePricingPlan
readList :: ReadS [DeletePricingPlan]
$creadList :: ReadS [DeletePricingPlan]
readsPrec :: Int -> ReadS DeletePricingPlan
$creadsPrec :: Int -> ReadS DeletePricingPlan
Prelude.Read, Int -> DeletePricingPlan -> ShowS
[DeletePricingPlan] -> ShowS
DeletePricingPlan -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeletePricingPlan] -> ShowS
$cshowList :: [DeletePricingPlan] -> ShowS
show :: DeletePricingPlan -> String
$cshow :: DeletePricingPlan -> String
showsPrec :: Int -> DeletePricingPlan -> ShowS
$cshowsPrec :: Int -> DeletePricingPlan -> ShowS
Prelude.Show, forall x. Rep DeletePricingPlan x -> DeletePricingPlan
forall x. DeletePricingPlan -> Rep DeletePricingPlan x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeletePricingPlan x -> DeletePricingPlan
$cfrom :: forall x. DeletePricingPlan -> Rep DeletePricingPlan x
Prelude.Generic)

-- |
-- Create a value of 'DeletePricingPlan' 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:
--
-- 'arn', 'deletePricingPlan_arn' - The Amazon Resource Name (ARN) of the pricing plan that you\'re
-- deleting.
newDeletePricingPlan ::
  -- | 'arn'
  Prelude.Text ->
  DeletePricingPlan
newDeletePricingPlan :: Text -> DeletePricingPlan
newDeletePricingPlan Text
pArn_ =
  DeletePricingPlan' {$sel:arn:DeletePricingPlan' :: Text
arn = Text
pArn_}

-- | The Amazon Resource Name (ARN) of the pricing plan that you\'re
-- deleting.
deletePricingPlan_arn :: Lens.Lens' DeletePricingPlan Prelude.Text
deletePricingPlan_arn :: Lens' DeletePricingPlan Text
deletePricingPlan_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeletePricingPlan' {Text
arn :: Text
$sel:arn:DeletePricingPlan' :: DeletePricingPlan -> Text
arn} -> Text
arn) (\s :: DeletePricingPlan
s@DeletePricingPlan' {} Text
a -> DeletePricingPlan
s {$sel:arn:DeletePricingPlan' :: Text
arn = Text
a} :: DeletePricingPlan)

instance Core.AWSRequest DeletePricingPlan where
  type
    AWSResponse DeletePricingPlan =
      DeletePricingPlanResponse
  request :: (Service -> Service)
-> DeletePricingPlan -> Request DeletePricingPlan
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 DeletePricingPlan
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeletePricingPlan)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> DeletePricingPlanResponse
DeletePricingPlanResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Arn")
            forall (f :: * -> *) a b. Applicative f => 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 DeletePricingPlan where
  hashWithSalt :: Int -> DeletePricingPlan -> Int
hashWithSalt Int
_salt DeletePricingPlan' {Text
arn :: Text
$sel:arn:DeletePricingPlan' :: DeletePricingPlan -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn

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

instance Data.ToHeaders DeletePricingPlan where
  toHeaders :: DeletePricingPlan -> 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.1" ::
                          Prelude.ByteString
                      )
          ]
      )

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

instance Data.ToPath DeletePricingPlan where
  toPath :: DeletePricingPlan -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/delete-pricing-plan"

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

-- | /See:/ 'newDeletePricingPlanResponse' smart constructor.
data DeletePricingPlanResponse = DeletePricingPlanResponse'
  { -- | The Amazon Resource Name (ARN) of the deleted pricing plan.
    DeletePricingPlanResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DeletePricingPlanResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeletePricingPlanResponse -> DeletePricingPlanResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeletePricingPlanResponse -> DeletePricingPlanResponse -> Bool
$c/= :: DeletePricingPlanResponse -> DeletePricingPlanResponse -> Bool
== :: DeletePricingPlanResponse -> DeletePricingPlanResponse -> Bool
$c== :: DeletePricingPlanResponse -> DeletePricingPlanResponse -> Bool
Prelude.Eq, ReadPrec [DeletePricingPlanResponse]
ReadPrec DeletePricingPlanResponse
Int -> ReadS DeletePricingPlanResponse
ReadS [DeletePricingPlanResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeletePricingPlanResponse]
$creadListPrec :: ReadPrec [DeletePricingPlanResponse]
readPrec :: ReadPrec DeletePricingPlanResponse
$creadPrec :: ReadPrec DeletePricingPlanResponse
readList :: ReadS [DeletePricingPlanResponse]
$creadList :: ReadS [DeletePricingPlanResponse]
readsPrec :: Int -> ReadS DeletePricingPlanResponse
$creadsPrec :: Int -> ReadS DeletePricingPlanResponse
Prelude.Read, Int -> DeletePricingPlanResponse -> ShowS
[DeletePricingPlanResponse] -> ShowS
DeletePricingPlanResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeletePricingPlanResponse] -> ShowS
$cshowList :: [DeletePricingPlanResponse] -> ShowS
show :: DeletePricingPlanResponse -> String
$cshow :: DeletePricingPlanResponse -> String
showsPrec :: Int -> DeletePricingPlanResponse -> ShowS
$cshowsPrec :: Int -> DeletePricingPlanResponse -> ShowS
Prelude.Show, forall x.
Rep DeletePricingPlanResponse x -> DeletePricingPlanResponse
forall x.
DeletePricingPlanResponse -> Rep DeletePricingPlanResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeletePricingPlanResponse x -> DeletePricingPlanResponse
$cfrom :: forall x.
DeletePricingPlanResponse -> Rep DeletePricingPlanResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeletePricingPlanResponse' 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:
--
-- 'arn', 'deletePricingPlanResponse_arn' - The Amazon Resource Name (ARN) of the deleted pricing plan.
--
-- 'httpStatus', 'deletePricingPlanResponse_httpStatus' - The response's http status code.
newDeletePricingPlanResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeletePricingPlanResponse
newDeletePricingPlanResponse :: Int -> DeletePricingPlanResponse
newDeletePricingPlanResponse Int
pHttpStatus_ =
  DeletePricingPlanResponse'
    { $sel:arn:DeletePricingPlanResponse' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeletePricingPlanResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon Resource Name (ARN) of the deleted pricing plan.
deletePricingPlanResponse_arn :: Lens.Lens' DeletePricingPlanResponse (Prelude.Maybe Prelude.Text)
deletePricingPlanResponse_arn :: Lens' DeletePricingPlanResponse (Maybe Text)
deletePricingPlanResponse_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeletePricingPlanResponse' {Maybe Text
arn :: Maybe Text
$sel:arn:DeletePricingPlanResponse' :: DeletePricingPlanResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: DeletePricingPlanResponse
s@DeletePricingPlanResponse' {} Maybe Text
a -> DeletePricingPlanResponse
s {$sel:arn:DeletePricingPlanResponse' :: Maybe Text
arn = Maybe Text
a} :: DeletePricingPlanResponse)

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

instance Prelude.NFData DeletePricingPlanResponse where
  rnf :: DeletePricingPlanResponse -> ()
rnf DeletePricingPlanResponse' {Int
Maybe Text
httpStatus :: Int
arn :: Maybe Text
$sel:httpStatus:DeletePricingPlanResponse' :: DeletePricingPlanResponse -> Int
$sel:arn:DeletePricingPlanResponse' :: DeletePricingPlanResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus