{-# 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.LookoutVision.DetectAnomalies
(
DetectAnomalies (..),
newDetectAnomalies,
detectAnomalies_projectName,
detectAnomalies_modelVersion,
detectAnomalies_contentType,
detectAnomalies_body,
DetectAnomaliesResponse (..),
newDetectAnomaliesResponse,
detectAnomaliesResponse_detectAnomalyResult,
detectAnomaliesResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.LookoutVision.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DetectAnomalies = DetectAnomalies'
{
DetectAnomalies -> Text
projectName :: Prelude.Text,
DetectAnomalies -> Text
modelVersion :: Prelude.Text,
DetectAnomalies -> Text
contentType :: Prelude.Text,
DetectAnomalies -> HashedBody
body :: Data.HashedBody
}
deriving (Int -> DetectAnomalies -> ShowS
[DetectAnomalies] -> ShowS
DetectAnomalies -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetectAnomalies] -> ShowS
$cshowList :: [DetectAnomalies] -> ShowS
show :: DetectAnomalies -> String
$cshow :: DetectAnomalies -> String
showsPrec :: Int -> DetectAnomalies -> ShowS
$cshowsPrec :: Int -> DetectAnomalies -> ShowS
Prelude.Show, forall x. Rep DetectAnomalies x -> DetectAnomalies
forall x. DetectAnomalies -> Rep DetectAnomalies x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DetectAnomalies x -> DetectAnomalies
$cfrom :: forall x. DetectAnomalies -> Rep DetectAnomalies x
Prelude.Generic)
newDetectAnomalies ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Data.HashedBody ->
DetectAnomalies
newDetectAnomalies :: Text -> Text -> Text -> HashedBody -> DetectAnomalies
newDetectAnomalies
Text
pProjectName_
Text
pModelVersion_
Text
pContentType_
HashedBody
pBody_ =
DetectAnomalies'
{ $sel:projectName:DetectAnomalies' :: Text
projectName = Text
pProjectName_,
$sel:modelVersion:DetectAnomalies' :: Text
modelVersion = Text
pModelVersion_,
$sel:contentType:DetectAnomalies' :: Text
contentType = Text
pContentType_,
$sel:body:DetectAnomalies' :: HashedBody
body = HashedBody
pBody_
}
detectAnomalies_projectName :: Lens.Lens' DetectAnomalies Prelude.Text
detectAnomalies_projectName :: Lens' DetectAnomalies Text
detectAnomalies_projectName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectAnomalies' {Text
projectName :: Text
$sel:projectName:DetectAnomalies' :: DetectAnomalies -> Text
projectName} -> Text
projectName) (\s :: DetectAnomalies
s@DetectAnomalies' {} Text
a -> DetectAnomalies
s {$sel:projectName:DetectAnomalies' :: Text
projectName = Text
a} :: DetectAnomalies)
detectAnomalies_modelVersion :: Lens.Lens' DetectAnomalies Prelude.Text
detectAnomalies_modelVersion :: Lens' DetectAnomalies Text
detectAnomalies_modelVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectAnomalies' {Text
modelVersion :: Text
$sel:modelVersion:DetectAnomalies' :: DetectAnomalies -> Text
modelVersion} -> Text
modelVersion) (\s :: DetectAnomalies
s@DetectAnomalies' {} Text
a -> DetectAnomalies
s {$sel:modelVersion:DetectAnomalies' :: Text
modelVersion = Text
a} :: DetectAnomalies)
detectAnomalies_contentType :: Lens.Lens' DetectAnomalies Prelude.Text
detectAnomalies_contentType :: Lens' DetectAnomalies Text
detectAnomalies_contentType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectAnomalies' {Text
contentType :: Text
$sel:contentType:DetectAnomalies' :: DetectAnomalies -> Text
contentType} -> Text
contentType) (\s :: DetectAnomalies
s@DetectAnomalies' {} Text
a -> DetectAnomalies
s {$sel:contentType:DetectAnomalies' :: Text
contentType = Text
a} :: DetectAnomalies)
detectAnomalies_body :: Lens.Lens' DetectAnomalies Data.HashedBody
detectAnomalies_body :: Lens' DetectAnomalies HashedBody
detectAnomalies_body = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectAnomalies' {HashedBody
body :: HashedBody
$sel:body:DetectAnomalies' :: DetectAnomalies -> HashedBody
body} -> HashedBody
body) (\s :: DetectAnomalies
s@DetectAnomalies' {} HashedBody
a -> DetectAnomalies
s {$sel:body:DetectAnomalies' :: HashedBody
body = HashedBody
a} :: DetectAnomalies)
instance Core.AWSRequest DetectAnomalies where
type
AWSResponse DetectAnomalies =
DetectAnomaliesResponse
request :: (Service -> Service) -> DetectAnomalies -> Request DetectAnomalies
request Service -> Service
overrides =
forall a. (ToRequest a, ToBody a) => Service -> a -> Request a
Request.postBody (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DetectAnomalies
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DetectAnomalies)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe DetectAnomalyResult -> Int -> DetectAnomaliesResponse
DetectAnomaliesResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"DetectAnomalyResult")
forall (f :: * -> *) a b. Applicative f => 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 Data.ToBody DetectAnomalies where
toBody :: DetectAnomalies -> RequestBody
toBody DetectAnomalies' {Text
HashedBody
body :: HashedBody
contentType :: Text
modelVersion :: Text
projectName :: Text
$sel:body:DetectAnomalies' :: DetectAnomalies -> HashedBody
$sel:contentType:DetectAnomalies' :: DetectAnomalies -> Text
$sel:modelVersion:DetectAnomalies' :: DetectAnomalies -> Text
$sel:projectName:DetectAnomalies' :: DetectAnomalies -> Text
..} = forall a. ToBody a => a -> RequestBody
Data.toBody HashedBody
body
instance Data.ToHeaders DetectAnomalies where
toHeaders :: DetectAnomalies -> ResponseHeaders
toHeaders DetectAnomalies' {Text
HashedBody
body :: HashedBody
contentType :: Text
modelVersion :: Text
projectName :: Text
$sel:body:DetectAnomalies' :: DetectAnomalies -> HashedBody
$sel:contentType:DetectAnomalies' :: DetectAnomalies -> Text
$sel:modelVersion:DetectAnomalies' :: DetectAnomalies -> Text
$sel:projectName:DetectAnomalies' :: DetectAnomalies -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[HeaderName
"Content-Type" forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# Text
contentType]
instance Data.ToPath DetectAnomalies where
toPath :: DetectAnomalies -> ByteString
toPath DetectAnomalies' {Text
HashedBody
body :: HashedBody
contentType :: Text
modelVersion :: Text
projectName :: Text
$sel:body:DetectAnomalies' :: DetectAnomalies -> HashedBody
$sel:contentType:DetectAnomalies' :: DetectAnomalies -> Text
$sel:modelVersion:DetectAnomalies' :: DetectAnomalies -> Text
$sel:projectName:DetectAnomalies' :: DetectAnomalies -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/2020-11-20/projects/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
projectName,
ByteString
"/models/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
modelVersion,
ByteString
"/detect"
]
instance Data.ToQuery DetectAnomalies where
toQuery :: DetectAnomalies -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data DetectAnomaliesResponse = DetectAnomaliesResponse'
{
DetectAnomaliesResponse -> Maybe DetectAnomalyResult
detectAnomalyResult :: Prelude.Maybe DetectAnomalyResult,
DetectAnomaliesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DetectAnomaliesResponse -> DetectAnomaliesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DetectAnomaliesResponse -> DetectAnomaliesResponse -> Bool
$c/= :: DetectAnomaliesResponse -> DetectAnomaliesResponse -> Bool
== :: DetectAnomaliesResponse -> DetectAnomaliesResponse -> Bool
$c== :: DetectAnomaliesResponse -> DetectAnomaliesResponse -> Bool
Prelude.Eq, ReadPrec [DetectAnomaliesResponse]
ReadPrec DetectAnomaliesResponse
Int -> ReadS DetectAnomaliesResponse
ReadS [DetectAnomaliesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DetectAnomaliesResponse]
$creadListPrec :: ReadPrec [DetectAnomaliesResponse]
readPrec :: ReadPrec DetectAnomaliesResponse
$creadPrec :: ReadPrec DetectAnomaliesResponse
readList :: ReadS [DetectAnomaliesResponse]
$creadList :: ReadS [DetectAnomaliesResponse]
readsPrec :: Int -> ReadS DetectAnomaliesResponse
$creadsPrec :: Int -> ReadS DetectAnomaliesResponse
Prelude.Read, Int -> DetectAnomaliesResponse -> ShowS
[DetectAnomaliesResponse] -> ShowS
DetectAnomaliesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetectAnomaliesResponse] -> ShowS
$cshowList :: [DetectAnomaliesResponse] -> ShowS
show :: DetectAnomaliesResponse -> String
$cshow :: DetectAnomaliesResponse -> String
showsPrec :: Int -> DetectAnomaliesResponse -> ShowS
$cshowsPrec :: Int -> DetectAnomaliesResponse -> ShowS
Prelude.Show, forall x. Rep DetectAnomaliesResponse x -> DetectAnomaliesResponse
forall x. DetectAnomaliesResponse -> Rep DetectAnomaliesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DetectAnomaliesResponse x -> DetectAnomaliesResponse
$cfrom :: forall x. DetectAnomaliesResponse -> Rep DetectAnomaliesResponse x
Prelude.Generic)
newDetectAnomaliesResponse ::
Prelude.Int ->
DetectAnomaliesResponse
newDetectAnomaliesResponse :: Int -> DetectAnomaliesResponse
newDetectAnomaliesResponse Int
pHttpStatus_ =
DetectAnomaliesResponse'
{ $sel:detectAnomalyResult:DetectAnomaliesResponse' :: Maybe DetectAnomalyResult
detectAnomalyResult =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DetectAnomaliesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
detectAnomaliesResponse_detectAnomalyResult :: Lens.Lens' DetectAnomaliesResponse (Prelude.Maybe DetectAnomalyResult)
detectAnomaliesResponse_detectAnomalyResult :: Lens' DetectAnomaliesResponse (Maybe DetectAnomalyResult)
detectAnomaliesResponse_detectAnomalyResult = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectAnomaliesResponse' {Maybe DetectAnomalyResult
detectAnomalyResult :: Maybe DetectAnomalyResult
$sel:detectAnomalyResult:DetectAnomaliesResponse' :: DetectAnomaliesResponse -> Maybe DetectAnomalyResult
detectAnomalyResult} -> Maybe DetectAnomalyResult
detectAnomalyResult) (\s :: DetectAnomaliesResponse
s@DetectAnomaliesResponse' {} Maybe DetectAnomalyResult
a -> DetectAnomaliesResponse
s {$sel:detectAnomalyResult:DetectAnomaliesResponse' :: Maybe DetectAnomalyResult
detectAnomalyResult = Maybe DetectAnomalyResult
a} :: DetectAnomaliesResponse)
detectAnomaliesResponse_httpStatus :: Lens.Lens' DetectAnomaliesResponse Prelude.Int
detectAnomaliesResponse_httpStatus :: Lens' DetectAnomaliesResponse Int
detectAnomaliesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectAnomaliesResponse' {Int
httpStatus :: Int
$sel:httpStatus:DetectAnomaliesResponse' :: DetectAnomaliesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DetectAnomaliesResponse
s@DetectAnomaliesResponse' {} Int
a -> DetectAnomaliesResponse
s {$sel:httpStatus:DetectAnomaliesResponse' :: Int
httpStatus = Int
a} :: DetectAnomaliesResponse)
instance Prelude.NFData DetectAnomaliesResponse where
rnf :: DetectAnomaliesResponse -> ()
rnf DetectAnomaliesResponse' {Int
Maybe DetectAnomalyResult
httpStatus :: Int
detectAnomalyResult :: Maybe DetectAnomalyResult
$sel:httpStatus:DetectAnomaliesResponse' :: DetectAnomaliesResponse -> Int
$sel:detectAnomalyResult:DetectAnomaliesResponse' :: DetectAnomaliesResponse -> Maybe DetectAnomalyResult
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe DetectAnomalyResult
detectAnomalyResult
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus