{-# 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.Lens as Lens
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 :: Core.HashedBody
}
deriving (Int -> DetectAnomalies -> ShowS
[DetectAnomalies] -> ShowS
DetectAnomalies -> String
(Int -> DetectAnomalies -> ShowS)
-> (DetectAnomalies -> String)
-> ([DetectAnomalies] -> ShowS)
-> Show DetectAnomalies
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. DetectAnomalies -> Rep DetectAnomalies x)
-> (forall x. Rep DetectAnomalies x -> DetectAnomalies)
-> Generic DetectAnomalies
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 ->
Core.HashedBody ->
DetectAnomalies
newDetectAnomalies :: Text -> Text -> Text -> HashedBody -> DetectAnomalies
newDetectAnomalies
Text
pProjectName_
Text
pModelVersion_
Text
pContentType_
HashedBody
pBody_ =
DetectAnomalies' :: Text -> Text -> Text -> HashedBody -> DetectAnomalies
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 :: (Text -> f Text) -> DetectAnomalies -> f DetectAnomalies
detectAnomalies_projectName = (DetectAnomalies -> Text)
-> (DetectAnomalies -> Text -> DetectAnomalies)
-> Lens DetectAnomalies DetectAnomalies Text Text
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 :: (Text -> f Text) -> DetectAnomalies -> f DetectAnomalies
detectAnomalies_modelVersion = (DetectAnomalies -> Text)
-> (DetectAnomalies -> Text -> DetectAnomalies)
-> Lens DetectAnomalies DetectAnomalies Text Text
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 :: (Text -> f Text) -> DetectAnomalies -> f DetectAnomalies
detectAnomalies_contentType = (DetectAnomalies -> Text)
-> (DetectAnomalies -> Text -> DetectAnomalies)
-> Lens DetectAnomalies DetectAnomalies Text Text
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 Core.HashedBody
detectAnomalies_body :: (HashedBody -> f HashedBody)
-> DetectAnomalies -> f DetectAnomalies
detectAnomalies_body = (DetectAnomalies -> HashedBody)
-> (DetectAnomalies -> HashedBody -> DetectAnomalies)
-> Lens DetectAnomalies DetectAnomalies HashedBody HashedBody
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 :: DetectAnomalies -> Request DetectAnomalies
request = Service -> DetectAnomalies -> Request DetectAnomalies
forall a. (ToRequest a, ToBody a) => Service -> a -> Request a
Request.postBody Service
defaultService
response :: Logger
-> Service
-> Proxy DetectAnomalies
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DetectAnomalies)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DetectAnomalies))
-> Logger
-> Service
-> Proxy DetectAnomalies
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DetectAnomalies)))
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 DetectAnomalyResult -> Int -> DetectAnomaliesResponse
DetectAnomaliesResponse'
(Maybe DetectAnomalyResult -> Int -> DetectAnomaliesResponse)
-> Either String (Maybe DetectAnomalyResult)
-> Either String (Int -> DetectAnomaliesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe DetectAnomalyResult)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"DetectAnomalyResult")
Either String (Int -> DetectAnomaliesResponse)
-> Either String Int -> Either String DetectAnomaliesResponse
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 Core.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
..} = HashedBody -> RequestBody
forall a. ToBody a => a -> RequestBody
Core.toBody HashedBody
body
instance Core.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
..} =
[ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[HeaderName
"Content-Type" HeaderName -> Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Text
contentType]
instance Core.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
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/2020-11-20/projects/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
projectName,
ByteString
"/models/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
modelVersion,
ByteString
"/detect"
]
instance Core.ToQuery DetectAnomalies where
toQuery :: DetectAnomalies -> QueryString
toQuery = QueryString -> DetectAnomalies -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DetectAnomaliesResponse -> DetectAnomaliesResponse -> Bool)
-> (DetectAnomaliesResponse -> DetectAnomaliesResponse -> Bool)
-> Eq DetectAnomaliesResponse
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]
(Int -> ReadS DetectAnomaliesResponse)
-> ReadS [DetectAnomaliesResponse]
-> ReadPrec DetectAnomaliesResponse
-> ReadPrec [DetectAnomaliesResponse]
-> Read 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
(Int -> DetectAnomaliesResponse -> ShowS)
-> (DetectAnomaliesResponse -> String)
-> ([DetectAnomaliesResponse] -> ShowS)
-> Show DetectAnomaliesResponse
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.
DetectAnomaliesResponse -> Rep DetectAnomaliesResponse x)
-> (forall x.
Rep DetectAnomaliesResponse x -> DetectAnomaliesResponse)
-> Generic DetectAnomaliesResponse
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' :: Maybe DetectAnomalyResult -> Int -> DetectAnomaliesResponse
DetectAnomaliesResponse'
{ $sel:detectAnomalyResult:DetectAnomaliesResponse' :: Maybe DetectAnomalyResult
detectAnomalyResult =
Maybe DetectAnomalyResult
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DetectAnomaliesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
detectAnomaliesResponse_detectAnomalyResult :: Lens.Lens' DetectAnomaliesResponse (Prelude.Maybe DetectAnomalyResult)
detectAnomaliesResponse_detectAnomalyResult :: (Maybe DetectAnomalyResult -> f (Maybe DetectAnomalyResult))
-> DetectAnomaliesResponse -> f DetectAnomaliesResponse
detectAnomaliesResponse_detectAnomalyResult = (DetectAnomaliesResponse -> Maybe DetectAnomalyResult)
-> (DetectAnomaliesResponse
-> Maybe DetectAnomalyResult -> DetectAnomaliesResponse)
-> Lens
DetectAnomaliesResponse
DetectAnomaliesResponse
(Maybe DetectAnomalyResult)
(Maybe 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 :: (Int -> f Int)
-> DetectAnomaliesResponse -> f DetectAnomaliesResponse
detectAnomaliesResponse_httpStatus = (DetectAnomaliesResponse -> Int)
-> (DetectAnomaliesResponse -> Int -> DetectAnomaliesResponse)
-> Lens DetectAnomaliesResponse DetectAnomaliesResponse Int Int
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