{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.IoTEvents.Types.AnalysisResult where
import qualified Amazonka.Core as Core
import Amazonka.IoTEvents.Types.AnalysisResultLevel
import Amazonka.IoTEvents.Types.AnalysisResultLocation
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data AnalysisResult = AnalysisResult'
{
AnalysisResult -> Maybe Text
type' :: Prelude.Maybe Prelude.Text,
AnalysisResult -> Maybe Text
message :: Prelude.Maybe Prelude.Text,
AnalysisResult -> Maybe AnalysisResultLevel
level :: Prelude.Maybe AnalysisResultLevel,
AnalysisResult -> Maybe [AnalysisResultLocation]
locations :: Prelude.Maybe [AnalysisResultLocation]
}
deriving (AnalysisResult -> AnalysisResult -> Bool
(AnalysisResult -> AnalysisResult -> Bool)
-> (AnalysisResult -> AnalysisResult -> Bool) -> Eq AnalysisResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AnalysisResult -> AnalysisResult -> Bool
$c/= :: AnalysisResult -> AnalysisResult -> Bool
== :: AnalysisResult -> AnalysisResult -> Bool
$c== :: AnalysisResult -> AnalysisResult -> Bool
Prelude.Eq, ReadPrec [AnalysisResult]
ReadPrec AnalysisResult
Int -> ReadS AnalysisResult
ReadS [AnalysisResult]
(Int -> ReadS AnalysisResult)
-> ReadS [AnalysisResult]
-> ReadPrec AnalysisResult
-> ReadPrec [AnalysisResult]
-> Read AnalysisResult
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AnalysisResult]
$creadListPrec :: ReadPrec [AnalysisResult]
readPrec :: ReadPrec AnalysisResult
$creadPrec :: ReadPrec AnalysisResult
readList :: ReadS [AnalysisResult]
$creadList :: ReadS [AnalysisResult]
readsPrec :: Int -> ReadS AnalysisResult
$creadsPrec :: Int -> ReadS AnalysisResult
Prelude.Read, Int -> AnalysisResult -> ShowS
[AnalysisResult] -> ShowS
AnalysisResult -> String
(Int -> AnalysisResult -> ShowS)
-> (AnalysisResult -> String)
-> ([AnalysisResult] -> ShowS)
-> Show AnalysisResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AnalysisResult] -> ShowS
$cshowList :: [AnalysisResult] -> ShowS
show :: AnalysisResult -> String
$cshow :: AnalysisResult -> String
showsPrec :: Int -> AnalysisResult -> ShowS
$cshowsPrec :: Int -> AnalysisResult -> ShowS
Prelude.Show, (forall x. AnalysisResult -> Rep AnalysisResult x)
-> (forall x. Rep AnalysisResult x -> AnalysisResult)
-> Generic AnalysisResult
forall x. Rep AnalysisResult x -> AnalysisResult
forall x. AnalysisResult -> Rep AnalysisResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AnalysisResult x -> AnalysisResult
$cfrom :: forall x. AnalysisResult -> Rep AnalysisResult x
Prelude.Generic)
newAnalysisResult ::
AnalysisResult
newAnalysisResult :: AnalysisResult
newAnalysisResult =
AnalysisResult' :: Maybe Text
-> Maybe Text
-> Maybe AnalysisResultLevel
-> Maybe [AnalysisResultLocation]
-> AnalysisResult
AnalysisResult'
{ $sel:type':AnalysisResult' :: Maybe Text
type' = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:message:AnalysisResult' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:level:AnalysisResult' :: Maybe AnalysisResultLevel
level = Maybe AnalysisResultLevel
forall a. Maybe a
Prelude.Nothing,
$sel:locations:AnalysisResult' :: Maybe [AnalysisResultLocation]
locations = Maybe [AnalysisResultLocation]
forall a. Maybe a
Prelude.Nothing
}
analysisResult_type :: Lens.Lens' AnalysisResult (Prelude.Maybe Prelude.Text)
analysisResult_type :: (Maybe Text -> f (Maybe Text))
-> AnalysisResult -> f AnalysisResult
analysisResult_type = (AnalysisResult -> Maybe Text)
-> (AnalysisResult -> Maybe Text -> AnalysisResult)
-> Lens AnalysisResult AnalysisResult (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnalysisResult' {Maybe Text
type' :: Maybe Text
$sel:type':AnalysisResult' :: AnalysisResult -> Maybe Text
type'} -> Maybe Text
type') (\s :: AnalysisResult
s@AnalysisResult' {} Maybe Text
a -> AnalysisResult
s {$sel:type':AnalysisResult' :: Maybe Text
type' = Maybe Text
a} :: AnalysisResult)
analysisResult_message :: Lens.Lens' AnalysisResult (Prelude.Maybe Prelude.Text)
analysisResult_message :: (Maybe Text -> f (Maybe Text))
-> AnalysisResult -> f AnalysisResult
analysisResult_message = (AnalysisResult -> Maybe Text)
-> (AnalysisResult -> Maybe Text -> AnalysisResult)
-> Lens AnalysisResult AnalysisResult (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnalysisResult' {Maybe Text
message :: Maybe Text
$sel:message:AnalysisResult' :: AnalysisResult -> Maybe Text
message} -> Maybe Text
message) (\s :: AnalysisResult
s@AnalysisResult' {} Maybe Text
a -> AnalysisResult
s {$sel:message:AnalysisResult' :: Maybe Text
message = Maybe Text
a} :: AnalysisResult)
analysisResult_level :: Lens.Lens' AnalysisResult (Prelude.Maybe AnalysisResultLevel)
analysisResult_level :: (Maybe AnalysisResultLevel -> f (Maybe AnalysisResultLevel))
-> AnalysisResult -> f AnalysisResult
analysisResult_level = (AnalysisResult -> Maybe AnalysisResultLevel)
-> (AnalysisResult -> Maybe AnalysisResultLevel -> AnalysisResult)
-> Lens
AnalysisResult
AnalysisResult
(Maybe AnalysisResultLevel)
(Maybe AnalysisResultLevel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnalysisResult' {Maybe AnalysisResultLevel
level :: Maybe AnalysisResultLevel
$sel:level:AnalysisResult' :: AnalysisResult -> Maybe AnalysisResultLevel
level} -> Maybe AnalysisResultLevel
level) (\s :: AnalysisResult
s@AnalysisResult' {} Maybe AnalysisResultLevel
a -> AnalysisResult
s {$sel:level:AnalysisResult' :: Maybe AnalysisResultLevel
level = Maybe AnalysisResultLevel
a} :: AnalysisResult)
analysisResult_locations :: Lens.Lens' AnalysisResult (Prelude.Maybe [AnalysisResultLocation])
analysisResult_locations :: (Maybe [AnalysisResultLocation]
-> f (Maybe [AnalysisResultLocation]))
-> AnalysisResult -> f AnalysisResult
analysisResult_locations = (AnalysisResult -> Maybe [AnalysisResultLocation])
-> (AnalysisResult
-> Maybe [AnalysisResultLocation] -> AnalysisResult)
-> Lens
AnalysisResult
AnalysisResult
(Maybe [AnalysisResultLocation])
(Maybe [AnalysisResultLocation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnalysisResult' {Maybe [AnalysisResultLocation]
locations :: Maybe [AnalysisResultLocation]
$sel:locations:AnalysisResult' :: AnalysisResult -> Maybe [AnalysisResultLocation]
locations} -> Maybe [AnalysisResultLocation]
locations) (\s :: AnalysisResult
s@AnalysisResult' {} Maybe [AnalysisResultLocation]
a -> AnalysisResult
s {$sel:locations:AnalysisResult' :: Maybe [AnalysisResultLocation]
locations = Maybe [AnalysisResultLocation]
a} :: AnalysisResult) ((Maybe [AnalysisResultLocation]
-> f (Maybe [AnalysisResultLocation]))
-> AnalysisResult -> f AnalysisResult)
-> ((Maybe [AnalysisResultLocation]
-> f (Maybe [AnalysisResultLocation]))
-> Maybe [AnalysisResultLocation]
-> f (Maybe [AnalysisResultLocation]))
-> (Maybe [AnalysisResultLocation]
-> f (Maybe [AnalysisResultLocation]))
-> AnalysisResult
-> f AnalysisResult
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[AnalysisResultLocation]
[AnalysisResultLocation]
[AnalysisResultLocation]
[AnalysisResultLocation]
-> Iso
(Maybe [AnalysisResultLocation])
(Maybe [AnalysisResultLocation])
(Maybe [AnalysisResultLocation])
(Maybe [AnalysisResultLocation])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[AnalysisResultLocation]
[AnalysisResultLocation]
[AnalysisResultLocation]
[AnalysisResultLocation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON AnalysisResult where
parseJSON :: Value -> Parser AnalysisResult
parseJSON =
String
-> (Object -> Parser AnalysisResult)
-> Value
-> Parser AnalysisResult
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AnalysisResult"
( \Object
x ->
Maybe Text
-> Maybe Text
-> Maybe AnalysisResultLevel
-> Maybe [AnalysisResultLocation]
-> AnalysisResult
AnalysisResult'
(Maybe Text
-> Maybe Text
-> Maybe AnalysisResultLevel
-> Maybe [AnalysisResultLocation]
-> AnalysisResult)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe AnalysisResultLevel
-> Maybe [AnalysisResultLocation]
-> AnalysisResult)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"type")
Parser
(Maybe Text
-> Maybe AnalysisResultLevel
-> Maybe [AnalysisResultLocation]
-> AnalysisResult)
-> Parser (Maybe Text)
-> Parser
(Maybe AnalysisResultLevel
-> Maybe [AnalysisResultLocation] -> AnalysisResult)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"message")
Parser
(Maybe AnalysisResultLevel
-> Maybe [AnalysisResultLocation] -> AnalysisResult)
-> Parser (Maybe AnalysisResultLevel)
-> Parser (Maybe [AnalysisResultLocation] -> AnalysisResult)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AnalysisResultLevel)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"level")
Parser (Maybe [AnalysisResultLocation] -> AnalysisResult)
-> Parser (Maybe [AnalysisResultLocation]) -> Parser AnalysisResult
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [AnalysisResultLocation]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"locations" Parser (Maybe (Maybe [AnalysisResultLocation]))
-> Maybe [AnalysisResultLocation]
-> Parser (Maybe [AnalysisResultLocation])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [AnalysisResultLocation]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable AnalysisResult
instance Prelude.NFData AnalysisResult