{-# 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.IoTEvents.DeleteDetectorModel
-- 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 detector model. Any active instances of the detector model are
-- also deleted.
module Amazonka.IoTEvents.DeleteDetectorModel
  ( -- * Creating a Request
    DeleteDetectorModel (..),
    newDeleteDetectorModel,

    -- * Request Lenses
    deleteDetectorModel_detectorModelName,

    -- * Destructuring the Response
    DeleteDetectorModelResponse (..),
    newDeleteDetectorModelResponse,

    -- * Response Lenses
    deleteDetectorModelResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.IoTEvents.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:/ 'newDeleteDetectorModel' smart constructor.
data DeleteDetectorModel = DeleteDetectorModel'
  { -- | The name of the detector model to be deleted.
    DeleteDetectorModel -> Text
detectorModelName :: Prelude.Text
  }
  deriving (DeleteDetectorModel -> DeleteDetectorModel -> Bool
(DeleteDetectorModel -> DeleteDetectorModel -> Bool)
-> (DeleteDetectorModel -> DeleteDetectorModel -> Bool)
-> Eq DeleteDetectorModel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDetectorModel -> DeleteDetectorModel -> Bool
$c/= :: DeleteDetectorModel -> DeleteDetectorModel -> Bool
== :: DeleteDetectorModel -> DeleteDetectorModel -> Bool
$c== :: DeleteDetectorModel -> DeleteDetectorModel -> Bool
Prelude.Eq, ReadPrec [DeleteDetectorModel]
ReadPrec DeleteDetectorModel
Int -> ReadS DeleteDetectorModel
ReadS [DeleteDetectorModel]
(Int -> ReadS DeleteDetectorModel)
-> ReadS [DeleteDetectorModel]
-> ReadPrec DeleteDetectorModel
-> ReadPrec [DeleteDetectorModel]
-> Read DeleteDetectorModel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDetectorModel]
$creadListPrec :: ReadPrec [DeleteDetectorModel]
readPrec :: ReadPrec DeleteDetectorModel
$creadPrec :: ReadPrec DeleteDetectorModel
readList :: ReadS [DeleteDetectorModel]
$creadList :: ReadS [DeleteDetectorModel]
readsPrec :: Int -> ReadS DeleteDetectorModel
$creadsPrec :: Int -> ReadS DeleteDetectorModel
Prelude.Read, Int -> DeleteDetectorModel -> ShowS
[DeleteDetectorModel] -> ShowS
DeleteDetectorModel -> String
(Int -> DeleteDetectorModel -> ShowS)
-> (DeleteDetectorModel -> String)
-> ([DeleteDetectorModel] -> ShowS)
-> Show DeleteDetectorModel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDetectorModel] -> ShowS
$cshowList :: [DeleteDetectorModel] -> ShowS
show :: DeleteDetectorModel -> String
$cshow :: DeleteDetectorModel -> String
showsPrec :: Int -> DeleteDetectorModel -> ShowS
$cshowsPrec :: Int -> DeleteDetectorModel -> ShowS
Prelude.Show, (forall x. DeleteDetectorModel -> Rep DeleteDetectorModel x)
-> (forall x. Rep DeleteDetectorModel x -> DeleteDetectorModel)
-> Generic DeleteDetectorModel
forall x. Rep DeleteDetectorModel x -> DeleteDetectorModel
forall x. DeleteDetectorModel -> Rep DeleteDetectorModel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDetectorModel x -> DeleteDetectorModel
$cfrom :: forall x. DeleteDetectorModel -> Rep DeleteDetectorModel x
Prelude.Generic)

-- |
-- Create a value of 'DeleteDetectorModel' 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:
--
-- 'detectorModelName', 'deleteDetectorModel_detectorModelName' - The name of the detector model to be deleted.
newDeleteDetectorModel ::
  -- | 'detectorModelName'
  Prelude.Text ->
  DeleteDetectorModel
newDeleteDetectorModel :: Text -> DeleteDetectorModel
newDeleteDetectorModel Text
pDetectorModelName_ =
  DeleteDetectorModel' :: Text -> DeleteDetectorModel
DeleteDetectorModel'
    { $sel:detectorModelName:DeleteDetectorModel' :: Text
detectorModelName =
        Text
pDetectorModelName_
    }

-- | The name of the detector model to be deleted.
deleteDetectorModel_detectorModelName :: Lens.Lens' DeleteDetectorModel Prelude.Text
deleteDetectorModel_detectorModelName :: (Text -> f Text) -> DeleteDetectorModel -> f DeleteDetectorModel
deleteDetectorModel_detectorModelName = (DeleteDetectorModel -> Text)
-> (DeleteDetectorModel -> Text -> DeleteDetectorModel)
-> Lens DeleteDetectorModel DeleteDetectorModel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDetectorModel' {Text
detectorModelName :: Text
$sel:detectorModelName:DeleteDetectorModel' :: DeleteDetectorModel -> Text
detectorModelName} -> Text
detectorModelName) (\s :: DeleteDetectorModel
s@DeleteDetectorModel' {} Text
a -> DeleteDetectorModel
s {$sel:detectorModelName:DeleteDetectorModel' :: Text
detectorModelName = Text
a} :: DeleteDetectorModel)

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

instance Prelude.NFData DeleteDetectorModel

instance Core.ToHeaders DeleteDetectorModel where
  toHeaders :: DeleteDetectorModel -> ResponseHeaders
toHeaders = ResponseHeaders -> DeleteDetectorModel -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToPath DeleteDetectorModel where
  toPath :: DeleteDetectorModel -> ByteString
toPath DeleteDetectorModel' {Text
detectorModelName :: Text
$sel:detectorModelName:DeleteDetectorModel' :: DeleteDetectorModel -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/detector-models/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
detectorModelName]

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

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

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

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

instance Prelude.NFData DeleteDetectorModelResponse