{-# 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.DeleteAnomalyMonitor
-- 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 monitor.
module Amazonka.CostExplorer.DeleteAnomalyMonitor
  ( -- * Creating a Request
    DeleteAnomalyMonitor (..),
    newDeleteAnomalyMonitor,

    -- * Request Lenses
    deleteAnomalyMonitor_monitorArn,

    -- * Destructuring the Response
    DeleteAnomalyMonitorResponse (..),
    newDeleteAnomalyMonitorResponse,

    -- * Response Lenses
    deleteAnomalyMonitorResponse_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:/ 'newDeleteAnomalyMonitor' smart constructor.
data DeleteAnomalyMonitor = DeleteAnomalyMonitor'
  { -- | The unique identifier of the cost anomaly monitor that you want to
    -- delete.
    DeleteAnomalyMonitor -> Text
monitorArn :: Prelude.Text
  }
  deriving (DeleteAnomalyMonitor -> DeleteAnomalyMonitor -> Bool
(DeleteAnomalyMonitor -> DeleteAnomalyMonitor -> Bool)
-> (DeleteAnomalyMonitor -> DeleteAnomalyMonitor -> Bool)
-> Eq DeleteAnomalyMonitor
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteAnomalyMonitor -> DeleteAnomalyMonitor -> Bool
$c/= :: DeleteAnomalyMonitor -> DeleteAnomalyMonitor -> Bool
== :: DeleteAnomalyMonitor -> DeleteAnomalyMonitor -> Bool
$c== :: DeleteAnomalyMonitor -> DeleteAnomalyMonitor -> Bool
Prelude.Eq, ReadPrec [DeleteAnomalyMonitor]
ReadPrec DeleteAnomalyMonitor
Int -> ReadS DeleteAnomalyMonitor
ReadS [DeleteAnomalyMonitor]
(Int -> ReadS DeleteAnomalyMonitor)
-> ReadS [DeleteAnomalyMonitor]
-> ReadPrec DeleteAnomalyMonitor
-> ReadPrec [DeleteAnomalyMonitor]
-> Read DeleteAnomalyMonitor
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteAnomalyMonitor]
$creadListPrec :: ReadPrec [DeleteAnomalyMonitor]
readPrec :: ReadPrec DeleteAnomalyMonitor
$creadPrec :: ReadPrec DeleteAnomalyMonitor
readList :: ReadS [DeleteAnomalyMonitor]
$creadList :: ReadS [DeleteAnomalyMonitor]
readsPrec :: Int -> ReadS DeleteAnomalyMonitor
$creadsPrec :: Int -> ReadS DeleteAnomalyMonitor
Prelude.Read, Int -> DeleteAnomalyMonitor -> ShowS
[DeleteAnomalyMonitor] -> ShowS
DeleteAnomalyMonitor -> String
(Int -> DeleteAnomalyMonitor -> ShowS)
-> (DeleteAnomalyMonitor -> String)
-> ([DeleteAnomalyMonitor] -> ShowS)
-> Show DeleteAnomalyMonitor
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteAnomalyMonitor] -> ShowS
$cshowList :: [DeleteAnomalyMonitor] -> ShowS
show :: DeleteAnomalyMonitor -> String
$cshow :: DeleteAnomalyMonitor -> String
showsPrec :: Int -> DeleteAnomalyMonitor -> ShowS
$cshowsPrec :: Int -> DeleteAnomalyMonitor -> ShowS
Prelude.Show, (forall x. DeleteAnomalyMonitor -> Rep DeleteAnomalyMonitor x)
-> (forall x. Rep DeleteAnomalyMonitor x -> DeleteAnomalyMonitor)
-> Generic DeleteAnomalyMonitor
forall x. Rep DeleteAnomalyMonitor x -> DeleteAnomalyMonitor
forall x. DeleteAnomalyMonitor -> Rep DeleteAnomalyMonitor x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteAnomalyMonitor x -> DeleteAnomalyMonitor
$cfrom :: forall x. DeleteAnomalyMonitor -> Rep DeleteAnomalyMonitor x
Prelude.Generic)

-- |
-- Create a value of 'DeleteAnomalyMonitor' 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:
--
-- 'monitorArn', 'deleteAnomalyMonitor_monitorArn' - The unique identifier of the cost anomaly monitor that you want to
-- delete.
newDeleteAnomalyMonitor ::
  -- | 'monitorArn'
  Prelude.Text ->
  DeleteAnomalyMonitor
newDeleteAnomalyMonitor :: Text -> DeleteAnomalyMonitor
newDeleteAnomalyMonitor Text
pMonitorArn_ =
  DeleteAnomalyMonitor' :: Text -> DeleteAnomalyMonitor
DeleteAnomalyMonitor' {$sel:monitorArn:DeleteAnomalyMonitor' :: Text
monitorArn = Text
pMonitorArn_}

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

instance Core.AWSRequest DeleteAnomalyMonitor where
  type
    AWSResponse DeleteAnomalyMonitor =
      DeleteAnomalyMonitorResponse
  request :: DeleteAnomalyMonitor -> Request DeleteAnomalyMonitor
request = Service -> DeleteAnomalyMonitor -> Request DeleteAnomalyMonitor
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteAnomalyMonitor
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteAnomalyMonitor)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteAnomalyMonitor))
-> Logger
-> Service
-> Proxy DeleteAnomalyMonitor
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteAnomalyMonitor)))
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 -> DeleteAnomalyMonitorResponse
DeleteAnomalyMonitorResponse'
            (Int -> DeleteAnomalyMonitorResponse)
-> Either String Int -> Either String DeleteAnomalyMonitorResponse
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 DeleteAnomalyMonitor

instance Prelude.NFData DeleteAnomalyMonitor

instance Core.ToHeaders DeleteAnomalyMonitor where
  toHeaders :: DeleteAnomalyMonitor -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteAnomalyMonitor -> 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.DeleteAnomalyMonitor" ::
                          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 DeleteAnomalyMonitor where
  toJSON :: DeleteAnomalyMonitor -> Value
toJSON DeleteAnomalyMonitor' {Text
monitorArn :: Text
$sel:monitorArn:DeleteAnomalyMonitor' :: DeleteAnomalyMonitor -> 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
"MonitorArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
monitorArn)]
      )

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

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

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

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

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

instance Prelude.NFData DeleteAnomalyMonitorResponse