{-# 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.CostExplorer.DeleteAnomalySubscription
-- 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 cost anomaly subscription.
module Amazonka.CostExplorer.DeleteAnomalySubscription
  ( -- * Creating a Request
    DeleteAnomalySubscription (..),
    newDeleteAnomalySubscription,

    -- * Request Lenses
    deleteAnomalySubscription_subscriptionArn,

    -- * Destructuring the Response
    DeleteAnomalySubscriptionResponse (..),
    newDeleteAnomalySubscriptionResponse,

    -- * Response Lenses
    deleteAnomalySubscriptionResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import Amazonka.CostExplorer.Types
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:/ 'newDeleteAnomalySubscription' smart constructor.
data DeleteAnomalySubscription = DeleteAnomalySubscription'
  { -- | The unique identifier of the cost anomaly subscription that you want to
    -- delete.
    DeleteAnomalySubscription -> Text
subscriptionArn :: Prelude.Text
  }
  deriving (DeleteAnomalySubscription -> DeleteAnomalySubscription -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteAnomalySubscription -> DeleteAnomalySubscription -> Bool
$c/= :: DeleteAnomalySubscription -> DeleteAnomalySubscription -> Bool
== :: DeleteAnomalySubscription -> DeleteAnomalySubscription -> Bool
$c== :: DeleteAnomalySubscription -> DeleteAnomalySubscription -> Bool
Prelude.Eq, ReadPrec [DeleteAnomalySubscription]
ReadPrec DeleteAnomalySubscription
Int -> ReadS DeleteAnomalySubscription
ReadS [DeleteAnomalySubscription]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteAnomalySubscription]
$creadListPrec :: ReadPrec [DeleteAnomalySubscription]
readPrec :: ReadPrec DeleteAnomalySubscription
$creadPrec :: ReadPrec DeleteAnomalySubscription
readList :: ReadS [DeleteAnomalySubscription]
$creadList :: ReadS [DeleteAnomalySubscription]
readsPrec :: Int -> ReadS DeleteAnomalySubscription
$creadsPrec :: Int -> ReadS DeleteAnomalySubscription
Prelude.Read, Int -> DeleteAnomalySubscription -> ShowS
[DeleteAnomalySubscription] -> ShowS
DeleteAnomalySubscription -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteAnomalySubscription] -> ShowS
$cshowList :: [DeleteAnomalySubscription] -> ShowS
show :: DeleteAnomalySubscription -> String
$cshow :: DeleteAnomalySubscription -> String
showsPrec :: Int -> DeleteAnomalySubscription -> ShowS
$cshowsPrec :: Int -> DeleteAnomalySubscription -> ShowS
Prelude.Show, forall x.
Rep DeleteAnomalySubscription x -> DeleteAnomalySubscription
forall x.
DeleteAnomalySubscription -> Rep DeleteAnomalySubscription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteAnomalySubscription x -> DeleteAnomalySubscription
$cfrom :: forall x.
DeleteAnomalySubscription -> Rep DeleteAnomalySubscription x
Prelude.Generic)

-- |
-- Create a value of 'DeleteAnomalySubscription' 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:
--
-- 'subscriptionArn', 'deleteAnomalySubscription_subscriptionArn' - The unique identifier of the cost anomaly subscription that you want to
-- delete.
newDeleteAnomalySubscription ::
  -- | 'subscriptionArn'
  Prelude.Text ->
  DeleteAnomalySubscription
newDeleteAnomalySubscription :: Text -> DeleteAnomalySubscription
newDeleteAnomalySubscription Text
pSubscriptionArn_ =
  DeleteAnomalySubscription'
    { $sel:subscriptionArn:DeleteAnomalySubscription' :: Text
subscriptionArn =
        Text
pSubscriptionArn_
    }

-- | The unique identifier of the cost anomaly subscription that you want to
-- delete.
deleteAnomalySubscription_subscriptionArn :: Lens.Lens' DeleteAnomalySubscription Prelude.Text
deleteAnomalySubscription_subscriptionArn :: Lens' DeleteAnomalySubscription Text
deleteAnomalySubscription_subscriptionArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAnomalySubscription' {Text
subscriptionArn :: Text
$sel:subscriptionArn:DeleteAnomalySubscription' :: DeleteAnomalySubscription -> Text
subscriptionArn} -> Text
subscriptionArn) (\s :: DeleteAnomalySubscription
s@DeleteAnomalySubscription' {} Text
a -> DeleteAnomalySubscription
s {$sel:subscriptionArn:DeleteAnomalySubscription' :: Text
subscriptionArn = Text
a} :: DeleteAnomalySubscription)

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

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

instance Data.ToHeaders DeleteAnomalySubscription where
  toHeaders :: DeleteAnomalySubscription -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWSInsightsIndexService.DeleteAnomalySubscription" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

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

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

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

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

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

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

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