{-# 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.DevOpsGuru.DeleteInsight
-- 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 the insight along with the associated anomalies, events and
-- recommendations.
module Amazonka.DevOpsGuru.DeleteInsight
  ( -- * Creating a Request
    DeleteInsight (..),
    newDeleteInsight,

    -- * Request Lenses
    deleteInsight_id,

    -- * Destructuring the Response
    DeleteInsightResponse (..),
    newDeleteInsightResponse,

    -- * Response Lenses
    deleteInsightResponse_httpStatus,
  )
where

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

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

-- |
-- Create a value of 'DeleteInsight' 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:
--
-- 'id', 'deleteInsight_id' - The ID of the insight.
newDeleteInsight ::
  -- | 'id'
  Prelude.Text ->
  DeleteInsight
newDeleteInsight :: Text -> DeleteInsight
newDeleteInsight Text
pId_ = DeleteInsight' {$sel:id:DeleteInsight' :: Text
id = Text
pId_}

-- | The ID of the insight.
deleteInsight_id :: Lens.Lens' DeleteInsight Prelude.Text
deleteInsight_id :: Lens' DeleteInsight Text
deleteInsight_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteInsight' {Text
id :: Text
$sel:id:DeleteInsight' :: DeleteInsight -> Text
id} -> Text
id) (\s :: DeleteInsight
s@DeleteInsight' {} Text
a -> DeleteInsight
s {$sel:id:DeleteInsight' :: Text
id = Text
a} :: DeleteInsight)

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

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

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

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

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

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

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

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