{-# 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.DeletePricingRule
-- 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 pricing rule that\'s identified by the input Amazon Resource
-- Name (ARN).
module Amazonka.BillingConductor.DeletePricingRule
  ( -- * Creating a Request
    DeletePricingRule (..),
    newDeletePricingRule,

    -- * Request Lenses
    deletePricingRule_arn,

    -- * Destructuring the Response
    DeletePricingRuleResponse (..),
    newDeletePricingRuleResponse,

    -- * Response Lenses
    deletePricingRuleResponse_arn,
    deletePricingRuleResponse_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:/ 'newDeletePricingRule' smart constructor.
data DeletePricingRule = DeletePricingRule'
  { -- | The Amazon Resource Name (ARN) of the pricing rule that you are
    -- deleting.
    DeletePricingRule -> Text
arn :: Prelude.Text
  }
  deriving (DeletePricingRule -> DeletePricingRule -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeletePricingRule -> DeletePricingRule -> Bool
$c/= :: DeletePricingRule -> DeletePricingRule -> Bool
== :: DeletePricingRule -> DeletePricingRule -> Bool
$c== :: DeletePricingRule -> DeletePricingRule -> Bool
Prelude.Eq, ReadPrec [DeletePricingRule]
ReadPrec DeletePricingRule
Int -> ReadS DeletePricingRule
ReadS [DeletePricingRule]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeletePricingRule]
$creadListPrec :: ReadPrec [DeletePricingRule]
readPrec :: ReadPrec DeletePricingRule
$creadPrec :: ReadPrec DeletePricingRule
readList :: ReadS [DeletePricingRule]
$creadList :: ReadS [DeletePricingRule]
readsPrec :: Int -> ReadS DeletePricingRule
$creadsPrec :: Int -> ReadS DeletePricingRule
Prelude.Read, Int -> DeletePricingRule -> ShowS
[DeletePricingRule] -> ShowS
DeletePricingRule -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeletePricingRule] -> ShowS
$cshowList :: [DeletePricingRule] -> ShowS
show :: DeletePricingRule -> String
$cshow :: DeletePricingRule -> String
showsPrec :: Int -> DeletePricingRule -> ShowS
$cshowsPrec :: Int -> DeletePricingRule -> ShowS
Prelude.Show, forall x. Rep DeletePricingRule x -> DeletePricingRule
forall x. DeletePricingRule -> Rep DeletePricingRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeletePricingRule x -> DeletePricingRule
$cfrom :: forall x. DeletePricingRule -> Rep DeletePricingRule x
Prelude.Generic)

-- |
-- Create a value of 'DeletePricingRule' 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', 'deletePricingRule_arn' - The Amazon Resource Name (ARN) of the pricing rule that you are
-- deleting.
newDeletePricingRule ::
  -- | 'arn'
  Prelude.Text ->
  DeletePricingRule
newDeletePricingRule :: Text -> DeletePricingRule
newDeletePricingRule Text
pArn_ =
  DeletePricingRule' {$sel:arn:DeletePricingRule' :: Text
arn = Text
pArn_}

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

instance Core.AWSRequest DeletePricingRule where
  type
    AWSResponse DeletePricingRule =
      DeletePricingRuleResponse
  request :: (Service -> Service)
-> DeletePricingRule -> Request DeletePricingRule
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 DeletePricingRule
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeletePricingRule)))
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 -> DeletePricingRuleResponse
DeletePricingRuleResponse'
            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 DeletePricingRule where
  hashWithSalt :: Int -> DeletePricingRule -> Int
hashWithSalt Int
_salt DeletePricingRule' {Text
arn :: Text
$sel:arn:DeletePricingRule' :: DeletePricingRule -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn

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

instance Data.ToHeaders DeletePricingRule where
  toHeaders :: DeletePricingRule -> 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 DeletePricingRule where
  toJSON :: DeletePricingRule -> Value
toJSON DeletePricingRule' {Text
arn :: Text
$sel:arn:DeletePricingRule' :: DeletePricingRule -> 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 DeletePricingRule where
  toPath :: DeletePricingRule -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/delete-pricing-rule"

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

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

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

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

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

instance Prelude.NFData DeletePricingRuleResponse where
  rnf :: DeletePricingRuleResponse -> ()
rnf DeletePricingRuleResponse' {Int
Maybe Text
httpStatus :: Int
arn :: Maybe Text
$sel:httpStatus:DeletePricingRuleResponse' :: DeletePricingRuleResponse -> Int
$sel:arn:DeletePricingRuleResponse' :: DeletePricingRuleResponse -> 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