{-# 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.LookoutMetrics.DeleteAlert
-- 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 an alert.
module Amazonka.LookoutMetrics.DeleteAlert
  ( -- * Creating a Request
    DeleteAlert (..),
    newDeleteAlert,

    -- * Request Lenses
    deleteAlert_alertArn,

    -- * Destructuring the Response
    DeleteAlertResponse (..),
    newDeleteAlertResponse,

    -- * Response Lenses
    deleteAlertResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.LookoutMetrics.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDeleteAlert' smart constructor.
data DeleteAlert = DeleteAlert'
  { -- | The ARN of the alert to delete.
    DeleteAlert -> Text
alertArn :: Prelude.Text
  }
  deriving (DeleteAlert -> DeleteAlert -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteAlert -> DeleteAlert -> Bool
$c/= :: DeleteAlert -> DeleteAlert -> Bool
== :: DeleteAlert -> DeleteAlert -> Bool
$c== :: DeleteAlert -> DeleteAlert -> Bool
Prelude.Eq, ReadPrec [DeleteAlert]
ReadPrec DeleteAlert
Int -> ReadS DeleteAlert
ReadS [DeleteAlert]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteAlert]
$creadListPrec :: ReadPrec [DeleteAlert]
readPrec :: ReadPrec DeleteAlert
$creadPrec :: ReadPrec DeleteAlert
readList :: ReadS [DeleteAlert]
$creadList :: ReadS [DeleteAlert]
readsPrec :: Int -> ReadS DeleteAlert
$creadsPrec :: Int -> ReadS DeleteAlert
Prelude.Read, Int -> DeleteAlert -> ShowS
[DeleteAlert] -> ShowS
DeleteAlert -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteAlert] -> ShowS
$cshowList :: [DeleteAlert] -> ShowS
show :: DeleteAlert -> String
$cshow :: DeleteAlert -> String
showsPrec :: Int -> DeleteAlert -> ShowS
$cshowsPrec :: Int -> DeleteAlert -> ShowS
Prelude.Show, forall x. Rep DeleteAlert x -> DeleteAlert
forall x. DeleteAlert -> Rep DeleteAlert x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteAlert x -> DeleteAlert
$cfrom :: forall x. DeleteAlert -> Rep DeleteAlert x
Prelude.Generic)

-- |
-- Create a value of 'DeleteAlert' 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:
--
-- 'alertArn', 'deleteAlert_alertArn' - The ARN of the alert to delete.
newDeleteAlert ::
  -- | 'alertArn'
  Prelude.Text ->
  DeleteAlert
newDeleteAlert :: Text -> DeleteAlert
newDeleteAlert Text
pAlertArn_ =
  DeleteAlert' {$sel:alertArn:DeleteAlert' :: Text
alertArn = Text
pAlertArn_}

-- | The ARN of the alert to delete.
deleteAlert_alertArn :: Lens.Lens' DeleteAlert Prelude.Text
deleteAlert_alertArn :: Lens' DeleteAlert Text
deleteAlert_alertArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAlert' {Text
alertArn :: Text
$sel:alertArn:DeleteAlert' :: DeleteAlert -> Text
alertArn} -> Text
alertArn) (\s :: DeleteAlert
s@DeleteAlert' {} Text
a -> DeleteAlert
s {$sel:alertArn:DeleteAlert' :: Text
alertArn = Text
a} :: DeleteAlert)

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

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

instance Data.ToHeaders DeleteAlert where
  toHeaders :: DeleteAlert -> 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 DeleteAlert where
  toJSON :: DeleteAlert -> Value
toJSON DeleteAlert' {Text
alertArn :: Text
$sel:alertArn:DeleteAlert' :: DeleteAlert -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"AlertArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
alertArn)]
      )

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

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

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

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

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

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