{-# 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 #-}
module Amazonka.IoTEvents.StartDetectorModelAnalysis
(
StartDetectorModelAnalysis (..),
newStartDetectorModelAnalysis,
startDetectorModelAnalysis_detectorModelDefinition,
StartDetectorModelAnalysisResponse (..),
newStartDetectorModelAnalysisResponse,
startDetectorModelAnalysisResponse_analysisId,
startDetectorModelAnalysisResponse_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
data StartDetectorModelAnalysis = StartDetectorModelAnalysis'
{ StartDetectorModelAnalysis -> DetectorModelDefinition
detectorModelDefinition :: DetectorModelDefinition
}
deriving (StartDetectorModelAnalysis -> StartDetectorModelAnalysis -> Bool
(StartDetectorModelAnalysis -> StartDetectorModelAnalysis -> Bool)
-> (StartDetectorModelAnalysis
-> StartDetectorModelAnalysis -> Bool)
-> Eq StartDetectorModelAnalysis
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartDetectorModelAnalysis -> StartDetectorModelAnalysis -> Bool
$c/= :: StartDetectorModelAnalysis -> StartDetectorModelAnalysis -> Bool
== :: StartDetectorModelAnalysis -> StartDetectorModelAnalysis -> Bool
$c== :: StartDetectorModelAnalysis -> StartDetectorModelAnalysis -> Bool
Prelude.Eq, ReadPrec [StartDetectorModelAnalysis]
ReadPrec StartDetectorModelAnalysis
Int -> ReadS StartDetectorModelAnalysis
ReadS [StartDetectorModelAnalysis]
(Int -> ReadS StartDetectorModelAnalysis)
-> ReadS [StartDetectorModelAnalysis]
-> ReadPrec StartDetectorModelAnalysis
-> ReadPrec [StartDetectorModelAnalysis]
-> Read StartDetectorModelAnalysis
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartDetectorModelAnalysis]
$creadListPrec :: ReadPrec [StartDetectorModelAnalysis]
readPrec :: ReadPrec StartDetectorModelAnalysis
$creadPrec :: ReadPrec StartDetectorModelAnalysis
readList :: ReadS [StartDetectorModelAnalysis]
$creadList :: ReadS [StartDetectorModelAnalysis]
readsPrec :: Int -> ReadS StartDetectorModelAnalysis
$creadsPrec :: Int -> ReadS StartDetectorModelAnalysis
Prelude.Read, Int -> StartDetectorModelAnalysis -> ShowS
[StartDetectorModelAnalysis] -> ShowS
StartDetectorModelAnalysis -> String
(Int -> StartDetectorModelAnalysis -> ShowS)
-> (StartDetectorModelAnalysis -> String)
-> ([StartDetectorModelAnalysis] -> ShowS)
-> Show StartDetectorModelAnalysis
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartDetectorModelAnalysis] -> ShowS
$cshowList :: [StartDetectorModelAnalysis] -> ShowS
show :: StartDetectorModelAnalysis -> String
$cshow :: StartDetectorModelAnalysis -> String
showsPrec :: Int -> StartDetectorModelAnalysis -> ShowS
$cshowsPrec :: Int -> StartDetectorModelAnalysis -> ShowS
Prelude.Show, (forall x.
StartDetectorModelAnalysis -> Rep StartDetectorModelAnalysis x)
-> (forall x.
Rep StartDetectorModelAnalysis x -> StartDetectorModelAnalysis)
-> Generic StartDetectorModelAnalysis
forall x.
Rep StartDetectorModelAnalysis x -> StartDetectorModelAnalysis
forall x.
StartDetectorModelAnalysis -> Rep StartDetectorModelAnalysis x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartDetectorModelAnalysis x -> StartDetectorModelAnalysis
$cfrom :: forall x.
StartDetectorModelAnalysis -> Rep StartDetectorModelAnalysis x
Prelude.Generic)
newStartDetectorModelAnalysis ::
DetectorModelDefinition ->
StartDetectorModelAnalysis
newStartDetectorModelAnalysis :: DetectorModelDefinition -> StartDetectorModelAnalysis
newStartDetectorModelAnalysis
DetectorModelDefinition
pDetectorModelDefinition_ =
StartDetectorModelAnalysis' :: DetectorModelDefinition -> StartDetectorModelAnalysis
StartDetectorModelAnalysis'
{ $sel:detectorModelDefinition:StartDetectorModelAnalysis' :: DetectorModelDefinition
detectorModelDefinition =
DetectorModelDefinition
pDetectorModelDefinition_
}
startDetectorModelAnalysis_detectorModelDefinition :: Lens.Lens' StartDetectorModelAnalysis DetectorModelDefinition
startDetectorModelAnalysis_detectorModelDefinition :: (DetectorModelDefinition -> f DetectorModelDefinition)
-> StartDetectorModelAnalysis -> f StartDetectorModelAnalysis
startDetectorModelAnalysis_detectorModelDefinition = (StartDetectorModelAnalysis -> DetectorModelDefinition)
-> (StartDetectorModelAnalysis
-> DetectorModelDefinition -> StartDetectorModelAnalysis)
-> Lens
StartDetectorModelAnalysis
StartDetectorModelAnalysis
DetectorModelDefinition
DetectorModelDefinition
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDetectorModelAnalysis' {DetectorModelDefinition
detectorModelDefinition :: DetectorModelDefinition
$sel:detectorModelDefinition:StartDetectorModelAnalysis' :: StartDetectorModelAnalysis -> DetectorModelDefinition
detectorModelDefinition} -> DetectorModelDefinition
detectorModelDefinition) (\s :: StartDetectorModelAnalysis
s@StartDetectorModelAnalysis' {} DetectorModelDefinition
a -> StartDetectorModelAnalysis
s {$sel:detectorModelDefinition:StartDetectorModelAnalysis' :: DetectorModelDefinition
detectorModelDefinition = DetectorModelDefinition
a} :: StartDetectorModelAnalysis)
instance Core.AWSRequest StartDetectorModelAnalysis where
type
AWSResponse StartDetectorModelAnalysis =
StartDetectorModelAnalysisResponse
request :: StartDetectorModelAnalysis -> Request StartDetectorModelAnalysis
request = Service
-> StartDetectorModelAnalysis -> Request StartDetectorModelAnalysis
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StartDetectorModelAnalysis
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StartDetectorModelAnalysis)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StartDetectorModelAnalysis))
-> Logger
-> Service
-> Proxy StartDetectorModelAnalysis
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StartDetectorModelAnalysis)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text -> Int -> StartDetectorModelAnalysisResponse
StartDetectorModelAnalysisResponse'
(Maybe Text -> Int -> StartDetectorModelAnalysisResponse)
-> Either String (Maybe Text)
-> Either String (Int -> StartDetectorModelAnalysisResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"analysisId")
Either String (Int -> StartDetectorModelAnalysisResponse)
-> Either String Int
-> Either String StartDetectorModelAnalysisResponse
forall (f :: * -> *) a b. Applicative f => 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 StartDetectorModelAnalysis
instance Prelude.NFData StartDetectorModelAnalysis
instance Core.ToHeaders StartDetectorModelAnalysis where
toHeaders :: StartDetectorModelAnalysis -> ResponseHeaders
toHeaders = ResponseHeaders -> StartDetectorModelAnalysis -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON StartDetectorModelAnalysis where
toJSON :: StartDetectorModelAnalysis -> Value
toJSON StartDetectorModelAnalysis' {DetectorModelDefinition
detectorModelDefinition :: DetectorModelDefinition
$sel:detectorModelDefinition:StartDetectorModelAnalysis' :: StartDetectorModelAnalysis -> DetectorModelDefinition
..} =
[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
"detectorModelDefinition"
Text -> DetectorModelDefinition -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DetectorModelDefinition
detectorModelDefinition
)
]
)
instance Core.ToPath StartDetectorModelAnalysis where
toPath :: StartDetectorModelAnalysis -> ByteString
toPath = ByteString -> StartDetectorModelAnalysis -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/analysis/detector-models/"
instance Core.ToQuery StartDetectorModelAnalysis where
toQuery :: StartDetectorModelAnalysis -> QueryString
toQuery = QueryString -> StartDetectorModelAnalysis -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StartDetectorModelAnalysisResponse = StartDetectorModelAnalysisResponse'
{
StartDetectorModelAnalysisResponse -> Maybe Text
analysisId :: Prelude.Maybe Prelude.Text,
StartDetectorModelAnalysisResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StartDetectorModelAnalysisResponse
-> StartDetectorModelAnalysisResponse -> Bool
(StartDetectorModelAnalysisResponse
-> StartDetectorModelAnalysisResponse -> Bool)
-> (StartDetectorModelAnalysisResponse
-> StartDetectorModelAnalysisResponse -> Bool)
-> Eq StartDetectorModelAnalysisResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartDetectorModelAnalysisResponse
-> StartDetectorModelAnalysisResponse -> Bool
$c/= :: StartDetectorModelAnalysisResponse
-> StartDetectorModelAnalysisResponse -> Bool
== :: StartDetectorModelAnalysisResponse
-> StartDetectorModelAnalysisResponse -> Bool
$c== :: StartDetectorModelAnalysisResponse
-> StartDetectorModelAnalysisResponse -> Bool
Prelude.Eq, ReadPrec [StartDetectorModelAnalysisResponse]
ReadPrec StartDetectorModelAnalysisResponse
Int -> ReadS StartDetectorModelAnalysisResponse
ReadS [StartDetectorModelAnalysisResponse]
(Int -> ReadS StartDetectorModelAnalysisResponse)
-> ReadS [StartDetectorModelAnalysisResponse]
-> ReadPrec StartDetectorModelAnalysisResponse
-> ReadPrec [StartDetectorModelAnalysisResponse]
-> Read StartDetectorModelAnalysisResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartDetectorModelAnalysisResponse]
$creadListPrec :: ReadPrec [StartDetectorModelAnalysisResponse]
readPrec :: ReadPrec StartDetectorModelAnalysisResponse
$creadPrec :: ReadPrec StartDetectorModelAnalysisResponse
readList :: ReadS [StartDetectorModelAnalysisResponse]
$creadList :: ReadS [StartDetectorModelAnalysisResponse]
readsPrec :: Int -> ReadS StartDetectorModelAnalysisResponse
$creadsPrec :: Int -> ReadS StartDetectorModelAnalysisResponse
Prelude.Read, Int -> StartDetectorModelAnalysisResponse -> ShowS
[StartDetectorModelAnalysisResponse] -> ShowS
StartDetectorModelAnalysisResponse -> String
(Int -> StartDetectorModelAnalysisResponse -> ShowS)
-> (StartDetectorModelAnalysisResponse -> String)
-> ([StartDetectorModelAnalysisResponse] -> ShowS)
-> Show StartDetectorModelAnalysisResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartDetectorModelAnalysisResponse] -> ShowS
$cshowList :: [StartDetectorModelAnalysisResponse] -> ShowS
show :: StartDetectorModelAnalysisResponse -> String
$cshow :: StartDetectorModelAnalysisResponse -> String
showsPrec :: Int -> StartDetectorModelAnalysisResponse -> ShowS
$cshowsPrec :: Int -> StartDetectorModelAnalysisResponse -> ShowS
Prelude.Show, (forall x.
StartDetectorModelAnalysisResponse
-> Rep StartDetectorModelAnalysisResponse x)
-> (forall x.
Rep StartDetectorModelAnalysisResponse x
-> StartDetectorModelAnalysisResponse)
-> Generic StartDetectorModelAnalysisResponse
forall x.
Rep StartDetectorModelAnalysisResponse x
-> StartDetectorModelAnalysisResponse
forall x.
StartDetectorModelAnalysisResponse
-> Rep StartDetectorModelAnalysisResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartDetectorModelAnalysisResponse x
-> StartDetectorModelAnalysisResponse
$cfrom :: forall x.
StartDetectorModelAnalysisResponse
-> Rep StartDetectorModelAnalysisResponse x
Prelude.Generic)
newStartDetectorModelAnalysisResponse ::
Prelude.Int ->
StartDetectorModelAnalysisResponse
newStartDetectorModelAnalysisResponse :: Int -> StartDetectorModelAnalysisResponse
newStartDetectorModelAnalysisResponse Int
pHttpStatus_ =
StartDetectorModelAnalysisResponse' :: Maybe Text -> Int -> StartDetectorModelAnalysisResponse
StartDetectorModelAnalysisResponse'
{ $sel:analysisId:StartDetectorModelAnalysisResponse' :: Maybe Text
analysisId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StartDetectorModelAnalysisResponse' :: Int
httpStatus = Int
pHttpStatus_
}
startDetectorModelAnalysisResponse_analysisId :: Lens.Lens' StartDetectorModelAnalysisResponse (Prelude.Maybe Prelude.Text)
startDetectorModelAnalysisResponse_analysisId :: (Maybe Text -> f (Maybe Text))
-> StartDetectorModelAnalysisResponse
-> f StartDetectorModelAnalysisResponse
startDetectorModelAnalysisResponse_analysisId = (StartDetectorModelAnalysisResponse -> Maybe Text)
-> (StartDetectorModelAnalysisResponse
-> Maybe Text -> StartDetectorModelAnalysisResponse)
-> Lens
StartDetectorModelAnalysisResponse
StartDetectorModelAnalysisResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDetectorModelAnalysisResponse' {Maybe Text
analysisId :: Maybe Text
$sel:analysisId:StartDetectorModelAnalysisResponse' :: StartDetectorModelAnalysisResponse -> Maybe Text
analysisId} -> Maybe Text
analysisId) (\s :: StartDetectorModelAnalysisResponse
s@StartDetectorModelAnalysisResponse' {} Maybe Text
a -> StartDetectorModelAnalysisResponse
s {$sel:analysisId:StartDetectorModelAnalysisResponse' :: Maybe Text
analysisId = Maybe Text
a} :: StartDetectorModelAnalysisResponse)
startDetectorModelAnalysisResponse_httpStatus :: Lens.Lens' StartDetectorModelAnalysisResponse Prelude.Int
startDetectorModelAnalysisResponse_httpStatus :: (Int -> f Int)
-> StartDetectorModelAnalysisResponse
-> f StartDetectorModelAnalysisResponse
startDetectorModelAnalysisResponse_httpStatus = (StartDetectorModelAnalysisResponse -> Int)
-> (StartDetectorModelAnalysisResponse
-> Int -> StartDetectorModelAnalysisResponse)
-> Lens
StartDetectorModelAnalysisResponse
StartDetectorModelAnalysisResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDetectorModelAnalysisResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartDetectorModelAnalysisResponse' :: StartDetectorModelAnalysisResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartDetectorModelAnalysisResponse
s@StartDetectorModelAnalysisResponse' {} Int
a -> StartDetectorModelAnalysisResponse
s {$sel:httpStatus:StartDetectorModelAnalysisResponse' :: Int
httpStatus = Int
a} :: StartDetectorModelAnalysisResponse)
instance
Prelude.NFData
StartDetectorModelAnalysisResponse