{-# 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.Rekognition.Types.Instance where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.Rekognition.Types.BoundingBox
import Amazonka.Rekognition.Types.DominantColor
data Instance = Instance'
{
Instance -> Maybe BoundingBox
boundingBox :: Prelude.Maybe BoundingBox,
Instance -> Maybe Double
confidence :: Prelude.Maybe Prelude.Double,
Instance -> Maybe [DominantColor]
dominantColors :: Prelude.Maybe [DominantColor]
}
deriving (Instance -> Instance -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Instance -> Instance -> Bool
$c/= :: Instance -> Instance -> Bool
== :: Instance -> Instance -> Bool
$c== :: Instance -> Instance -> Bool
Prelude.Eq, ReadPrec [Instance]
ReadPrec Instance
Int -> ReadS Instance
ReadS [Instance]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Instance]
$creadListPrec :: ReadPrec [Instance]
readPrec :: ReadPrec Instance
$creadPrec :: ReadPrec Instance
readList :: ReadS [Instance]
$creadList :: ReadS [Instance]
readsPrec :: Int -> ReadS Instance
$creadsPrec :: Int -> ReadS Instance
Prelude.Read, Int -> Instance -> ShowS
[Instance] -> ShowS
Instance -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Instance] -> ShowS
$cshowList :: [Instance] -> ShowS
show :: Instance -> String
$cshow :: Instance -> String
showsPrec :: Int -> Instance -> ShowS
$cshowsPrec :: Int -> Instance -> ShowS
Prelude.Show, forall x. Rep Instance x -> Instance
forall x. Instance -> Rep Instance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Instance x -> Instance
$cfrom :: forall x. Instance -> Rep Instance x
Prelude.Generic)
newInstance ::
Instance
newInstance :: Instance
newInstance =
Instance'
{ $sel:boundingBox:Instance' :: Maybe BoundingBox
boundingBox = forall a. Maybe a
Prelude.Nothing,
$sel:confidence:Instance' :: Maybe Double
confidence = forall a. Maybe a
Prelude.Nothing,
$sel:dominantColors:Instance' :: Maybe [DominantColor]
dominantColors = forall a. Maybe a
Prelude.Nothing
}
instance_boundingBox :: Lens.Lens' Instance (Prelude.Maybe BoundingBox)
instance_boundingBox :: Lens' Instance (Maybe BoundingBox)
instance_boundingBox = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Instance' {Maybe BoundingBox
boundingBox :: Maybe BoundingBox
$sel:boundingBox:Instance' :: Instance -> Maybe BoundingBox
boundingBox} -> Maybe BoundingBox
boundingBox) (\s :: Instance
s@Instance' {} Maybe BoundingBox
a -> Instance
s {$sel:boundingBox:Instance' :: Maybe BoundingBox
boundingBox = Maybe BoundingBox
a} :: Instance)
instance_confidence :: Lens.Lens' Instance (Prelude.Maybe Prelude.Double)
instance_confidence :: Lens' Instance (Maybe Double)
instance_confidence = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Instance' {Maybe Double
confidence :: Maybe Double
$sel:confidence:Instance' :: Instance -> Maybe Double
confidence} -> Maybe Double
confidence) (\s :: Instance
s@Instance' {} Maybe Double
a -> Instance
s {$sel:confidence:Instance' :: Maybe Double
confidence = Maybe Double
a} :: Instance)
instance_dominantColors :: Lens.Lens' Instance (Prelude.Maybe [DominantColor])
instance_dominantColors :: Lens' Instance (Maybe [DominantColor])
instance_dominantColors = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Instance' {Maybe [DominantColor]
dominantColors :: Maybe [DominantColor]
$sel:dominantColors:Instance' :: Instance -> Maybe [DominantColor]
dominantColors} -> Maybe [DominantColor]
dominantColors) (\s :: Instance
s@Instance' {} Maybe [DominantColor]
a -> Instance
s {$sel:dominantColors:Instance' :: Maybe [DominantColor]
dominantColors = Maybe [DominantColor]
a} :: Instance) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromJSON Instance where
parseJSON :: Value -> Parser Instance
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Instance"
( \Object
x ->
Maybe BoundingBox
-> Maybe Double -> Maybe [DominantColor] -> Instance
Instance'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"BoundingBox")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Confidence")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DominantColors"
forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable Instance where
hashWithSalt :: Int -> Instance -> Int
hashWithSalt Int
_salt Instance' {Maybe Double
Maybe [DominantColor]
Maybe BoundingBox
dominantColors :: Maybe [DominantColor]
confidence :: Maybe Double
boundingBox :: Maybe BoundingBox
$sel:dominantColors:Instance' :: Instance -> Maybe [DominantColor]
$sel:confidence:Instance' :: Instance -> Maybe Double
$sel:boundingBox:Instance' :: Instance -> Maybe BoundingBox
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe BoundingBox
boundingBox
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
confidence
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [DominantColor]
dominantColors
instance Prelude.NFData Instance where
rnf :: Instance -> ()
rnf Instance' {Maybe Double
Maybe [DominantColor]
Maybe BoundingBox
dominantColors :: Maybe [DominantColor]
confidence :: Maybe Double
boundingBox :: Maybe BoundingBox
$sel:dominantColors:Instance' :: Instance -> Maybe [DominantColor]
$sel:confidence:Instance' :: Instance -> Maybe Double
$sel:boundingBox:Instance' :: Instance -> Maybe BoundingBox
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe BoundingBox
boundingBox
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
confidence
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [DominantColor]
dominantColors