{-# 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-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 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 Amazonka.CostExplorer.Types
import qualified Amazonka.Lens as Lens
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
(DeleteAnomalySubscription -> DeleteAnomalySubscription -> Bool)
-> (DeleteAnomalySubscription -> DeleteAnomalySubscription -> Bool)
-> Eq DeleteAnomalySubscription
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]
(Int -> ReadS DeleteAnomalySubscription)
-> ReadS [DeleteAnomalySubscription]
-> ReadPrec DeleteAnomalySubscription
-> ReadPrec [DeleteAnomalySubscription]
-> Read 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
(Int -> DeleteAnomalySubscription -> ShowS)
-> (DeleteAnomalySubscription -> String)
-> ([DeleteAnomalySubscription] -> ShowS)
-> Show DeleteAnomalySubscription
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.
 DeleteAnomalySubscription -> Rep DeleteAnomalySubscription x)
-> (forall x.
    Rep DeleteAnomalySubscription x -> DeleteAnomalySubscription)
-> Generic DeleteAnomalySubscription
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' :: Text -> DeleteAnomalySubscription
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 :: (Text -> f Text)
-> DeleteAnomalySubscription -> f DeleteAnomalySubscription
deleteAnomalySubscription_subscriptionArn = (DeleteAnomalySubscription -> Text)
-> (DeleteAnomalySubscription -> Text -> DeleteAnomalySubscription)
-> Lens
     DeleteAnomalySubscription DeleteAnomalySubscription Text Text
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 :: DeleteAnomalySubscription -> Request DeleteAnomalySubscription
request = Service
-> DeleteAnomalySubscription -> Request DeleteAnomalySubscription
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteAnomalySubscription
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteAnomalySubscription)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteAnomalySubscription))
-> Logger
-> Service
-> Proxy DeleteAnomalySubscription
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteAnomalySubscription)))
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 -> DeleteAnomalySubscriptionResponse
DeleteAnomalySubscriptionResponse'
            (Int -> DeleteAnomalySubscriptionResponse)
-> Either String Int
-> Either String DeleteAnomalySubscriptionResponse
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 DeleteAnomalySubscription

instance Prelude.NFData DeleteAnomalySubscription

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

instance Core.ToJSON DeleteAnomalySubscription where
  toJSON :: DeleteAnomalySubscription -> Value
toJSON DeleteAnomalySubscription' {Text
subscriptionArn :: Text
$sel:subscriptionArn:DeleteAnomalySubscription' :: DeleteAnomalySubscription -> 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
"SubscriptionArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
subscriptionArn)
          ]
      )

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

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

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