{-# 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.Rum.DeleteAppMonitor
-- 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 existing app monitor. This immediately stops the collection
-- of data.
module Amazonka.Rum.DeleteAppMonitor
  ( -- * Creating a Request
    DeleteAppMonitor (..),
    newDeleteAppMonitor,

    -- * Request Lenses
    deleteAppMonitor_name,

    -- * Destructuring the Response
    DeleteAppMonitorResponse (..),
    newDeleteAppMonitorResponse,

    -- * Response Lenses
    deleteAppMonitorResponse_httpStatus,
  )
where

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
import Amazonka.Rum.Types

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

-- |
-- Create a value of 'DeleteAppMonitor' 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:
--
-- 'name', 'deleteAppMonitor_name' - The name of the app monitor to delete.
newDeleteAppMonitor ::
  -- | 'name'
  Prelude.Text ->
  DeleteAppMonitor
newDeleteAppMonitor :: Text -> DeleteAppMonitor
newDeleteAppMonitor Text
pName_ =
  DeleteAppMonitor' {$sel:name:DeleteAppMonitor' :: Text
name = Text
pName_}

-- | The name of the app monitor to delete.
deleteAppMonitor_name :: Lens.Lens' DeleteAppMonitor Prelude.Text
deleteAppMonitor_name :: Lens' DeleteAppMonitor Text
deleteAppMonitor_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAppMonitor' {Text
name :: Text
$sel:name:DeleteAppMonitor' :: DeleteAppMonitor -> Text
name} -> Text
name) (\s :: DeleteAppMonitor
s@DeleteAppMonitor' {} Text
a -> DeleteAppMonitor
s {$sel:name:DeleteAppMonitor' :: Text
name = Text
a} :: DeleteAppMonitor)

instance Core.AWSRequest DeleteAppMonitor where
  type
    AWSResponse DeleteAppMonitor =
      DeleteAppMonitorResponse
  request :: (Service -> Service)
-> DeleteAppMonitor -> Request DeleteAppMonitor
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.delete (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteAppMonitor
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteAppMonitor)))
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 -> DeleteAppMonitorResponse
DeleteAppMonitorResponse'
            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 DeleteAppMonitor where
  hashWithSalt :: Int -> DeleteAppMonitor -> Int
hashWithSalt Int
_salt DeleteAppMonitor' {Text
name :: Text
$sel:name:DeleteAppMonitor' :: DeleteAppMonitor -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name

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

instance Data.ToHeaders DeleteAppMonitor where
  toHeaders :: DeleteAppMonitor -> 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.ToPath DeleteAppMonitor where
  toPath :: DeleteAppMonitor -> ByteString
toPath DeleteAppMonitor' {Text
name :: Text
$sel:name:DeleteAppMonitor' :: DeleteAppMonitor -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/appmonitor/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
name]

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

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

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

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

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