{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Rekognition.DetectLabels
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Detects instances of real-world entities within an image (JPEG or PNG)
-- provided as input. This includes objects like flower, tree, and table;
-- events like wedding, graduation, and birthday party; and concepts like
-- landscape, evening, and nature.
--
-- For an example, see Analyzing Images Stored in an Amazon S3 Bucket in
-- the Amazon Rekognition Developer Guide.
--
-- @DetectLabels@ does not support the detection of activities. However,
-- activity detection is supported for label detection in videos. For more
-- information, see StartLabelDetection in the Amazon Rekognition Developer
-- Guide.
--
-- You pass the input image as base64-encoded image bytes or as a reference
-- to an image in an Amazon S3 bucket. If you use the AWS CLI to call
-- Amazon Rekognition operations, passing image bytes is not supported. The
-- image must be either a PNG or JPEG formatted file.
--
-- For each object, scene, and concept the API returns one or more labels.
-- Each label provides the object name, and the level of confidence that
-- the image contains the object. For example, suppose the input image has
-- a lighthouse, the sea, and a rock. The response includes all three
-- labels, one for each object.
--
-- @{Name: lighthouse, Confidence: 98.4629}@
--
-- @{Name: rock,Confidence: 79.2097}@
--
-- @ {Name: sea,Confidence: 75.061}@
--
-- In the preceding example, the operation returns one label for each of
-- the three objects. The operation can also return multiple labels for the
-- same object in the image. For example, if the input image shows a flower
-- (for example, a tulip), the operation might return the following three
-- labels.
--
-- @{Name: flower,Confidence: 99.0562}@
--
-- @{Name: plant,Confidence: 99.0562}@
--
-- @{Name: tulip,Confidence: 99.0562}@
--
-- In this example, the detection algorithm more precisely identifies the
-- flower as a tulip.
--
-- In response, the API returns an array of labels. In addition, the
-- response also includes the orientation correction. Optionally, you can
-- specify @MinConfidence@ to control the confidence threshold for the
-- labels returned. The default is 55%. You can also add the @MaxLabels@
-- parameter to limit the number of labels returned.
--
-- If the object detected is a person, the operation doesn\'t provide the
-- same facial details that the DetectFaces operation provides.
--
-- @DetectLabels@ returns bounding boxes for instances of common object
-- labels in an array of Instance objects. An @Instance@ object contains a
-- BoundingBox object, for the location of the label on the image. It also
-- includes the confidence by which the bounding box was detected.
--
-- @DetectLabels@ also returns a hierarchical taxonomy of detected labels.
-- For example, a detected car might be assigned the label /car/. The label
-- /car/ has two parent labels: /Vehicle/ (its parent) and /Transportation/
-- (its grandparent). The response returns the entire list of ancestors for
-- a label. Each ancestor is a unique label in the response. In the
-- previous example, /Car/, /Vehicle/, and /Transportation/ are returned as
-- unique labels in the response.
--
-- This is a stateless API operation. That is, the operation does not
-- persist any data.
--
-- This operation requires permissions to perform the
-- @rekognition:DetectLabels@ action.
module Amazonka.Rekognition.DetectLabels
  ( -- * Creating a Request
    DetectLabels (..),
    newDetectLabels,

    -- * Request Lenses
    detectLabels_minConfidence,
    detectLabels_maxLabels,
    detectLabels_image,

    -- * Destructuring the Response
    DetectLabelsResponse (..),
    newDetectLabelsResponse,

    -- * Response Lenses
    detectLabelsResponse_labels,
    detectLabelsResponse_orientationCorrection,
    detectLabelsResponse_labelModelVersion,
    detectLabelsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Rekognition.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDetectLabels' smart constructor.
data DetectLabels = DetectLabels'
  { -- | Specifies the minimum confidence level for the labels to return. Amazon
    -- Rekognition doesn\'t return any labels with confidence lower than this
    -- specified value.
    --
    -- If @MinConfidence@ is not specified, the operation returns labels with a
    -- confidence values greater than or equal to 55 percent.
    DetectLabels -> Maybe Double
minConfidence :: Prelude.Maybe Prelude.Double,
    -- | Maximum number of labels you want the service to return in the response.
    -- The service returns the specified number of highest confidence labels.
    DetectLabels -> Maybe Natural
maxLabels :: Prelude.Maybe Prelude.Natural,
    -- | The input image as base64-encoded bytes or an S3 object. If you use the
    -- AWS CLI to call Amazon Rekognition operations, passing image bytes is
    -- not supported. Images stored in an S3 Bucket do not need to be
    -- base64-encoded.
    --
    -- If you are using an AWS SDK to call Amazon Rekognition, you might not
    -- need to base64-encode image bytes passed using the @Bytes@ field. For
    -- more information, see Images in the Amazon Rekognition developer guide.
    DetectLabels -> Image
image :: Image
  }
  deriving (DetectLabels -> DetectLabels -> Bool
(DetectLabels -> DetectLabels -> Bool)
-> (DetectLabels -> DetectLabels -> Bool) -> Eq DetectLabels
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DetectLabels -> DetectLabels -> Bool
$c/= :: DetectLabels -> DetectLabels -> Bool
== :: DetectLabels -> DetectLabels -> Bool
$c== :: DetectLabels -> DetectLabels -> Bool
Prelude.Eq, ReadPrec [DetectLabels]
ReadPrec DetectLabels
Int -> ReadS DetectLabels
ReadS [DetectLabels]
(Int -> ReadS DetectLabels)
-> ReadS [DetectLabels]
-> ReadPrec DetectLabels
-> ReadPrec [DetectLabels]
-> Read DetectLabels
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DetectLabels]
$creadListPrec :: ReadPrec [DetectLabels]
readPrec :: ReadPrec DetectLabels
$creadPrec :: ReadPrec DetectLabels
readList :: ReadS [DetectLabels]
$creadList :: ReadS [DetectLabels]
readsPrec :: Int -> ReadS DetectLabels
$creadsPrec :: Int -> ReadS DetectLabels
Prelude.Read, Int -> DetectLabels -> ShowS
[DetectLabels] -> ShowS
DetectLabels -> String
(Int -> DetectLabels -> ShowS)
-> (DetectLabels -> String)
-> ([DetectLabels] -> ShowS)
-> Show DetectLabels
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetectLabels] -> ShowS
$cshowList :: [DetectLabels] -> ShowS
show :: DetectLabels -> String
$cshow :: DetectLabels -> String
showsPrec :: Int -> DetectLabels -> ShowS
$cshowsPrec :: Int -> DetectLabels -> ShowS
Prelude.Show, (forall x. DetectLabels -> Rep DetectLabels x)
-> (forall x. Rep DetectLabels x -> DetectLabels)
-> Generic DetectLabels
forall x. Rep DetectLabels x -> DetectLabels
forall x. DetectLabels -> Rep DetectLabels x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DetectLabels x -> DetectLabels
$cfrom :: forall x. DetectLabels -> Rep DetectLabels x
Prelude.Generic)

-- |
-- Create a value of 'DetectLabels' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'minConfidence', 'detectLabels_minConfidence' - Specifies the minimum confidence level for the labels to return. Amazon
-- Rekognition doesn\'t return any labels with confidence lower than this
-- specified value.
--
-- If @MinConfidence@ is not specified, the operation returns labels with a
-- confidence values greater than or equal to 55 percent.
--
-- 'maxLabels', 'detectLabels_maxLabels' - Maximum number of labels you want the service to return in the response.
-- The service returns the specified number of highest confidence labels.
--
-- 'image', 'detectLabels_image' - The input image as base64-encoded bytes or an S3 object. If you use the
-- AWS CLI to call Amazon Rekognition operations, passing image bytes is
-- not supported. Images stored in an S3 Bucket do not need to be
-- base64-encoded.
--
-- If you are using an AWS SDK to call Amazon Rekognition, you might not
-- need to base64-encode image bytes passed using the @Bytes@ field. For
-- more information, see Images in the Amazon Rekognition developer guide.
newDetectLabels ::
  -- | 'image'
  Image ->
  DetectLabels
newDetectLabels :: Image -> DetectLabels
newDetectLabels Image
pImage_ =
  DetectLabels' :: Maybe Double -> Maybe Natural -> Image -> DetectLabels
DetectLabels'
    { $sel:minConfidence:DetectLabels' :: Maybe Double
minConfidence = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:maxLabels:DetectLabels' :: Maybe Natural
maxLabels = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:image:DetectLabels' :: Image
image = Image
pImage_
    }

-- | Specifies the minimum confidence level for the labels to return. Amazon
-- Rekognition doesn\'t return any labels with confidence lower than this
-- specified value.
--
-- If @MinConfidence@ is not specified, the operation returns labels with a
-- confidence values greater than or equal to 55 percent.
detectLabels_minConfidence :: Lens.Lens' DetectLabels (Prelude.Maybe Prelude.Double)
detectLabels_minConfidence :: (Maybe Double -> f (Maybe Double))
-> DetectLabels -> f DetectLabels
detectLabels_minConfidence = (DetectLabels -> Maybe Double)
-> (DetectLabels -> Maybe Double -> DetectLabels)
-> Lens DetectLabels DetectLabels (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectLabels' {Maybe Double
minConfidence :: Maybe Double
$sel:minConfidence:DetectLabels' :: DetectLabels -> Maybe Double
minConfidence} -> Maybe Double
minConfidence) (\s :: DetectLabels
s@DetectLabels' {} Maybe Double
a -> DetectLabels
s {$sel:minConfidence:DetectLabels' :: Maybe Double
minConfidence = Maybe Double
a} :: DetectLabels)

-- | Maximum number of labels you want the service to return in the response.
-- The service returns the specified number of highest confidence labels.
detectLabels_maxLabels :: Lens.Lens' DetectLabels (Prelude.Maybe Prelude.Natural)
detectLabels_maxLabels :: (Maybe Natural -> f (Maybe Natural))
-> DetectLabels -> f DetectLabels
detectLabels_maxLabels = (DetectLabels -> Maybe Natural)
-> (DetectLabels -> Maybe Natural -> DetectLabels)
-> Lens DetectLabels DetectLabels (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectLabels' {Maybe Natural
maxLabels :: Maybe Natural
$sel:maxLabels:DetectLabels' :: DetectLabels -> Maybe Natural
maxLabels} -> Maybe Natural
maxLabels) (\s :: DetectLabels
s@DetectLabels' {} Maybe Natural
a -> DetectLabels
s {$sel:maxLabels:DetectLabels' :: Maybe Natural
maxLabels = Maybe Natural
a} :: DetectLabels)

-- | The input image as base64-encoded bytes or an S3 object. If you use the
-- AWS CLI to call Amazon Rekognition operations, passing image bytes is
-- not supported. Images stored in an S3 Bucket do not need to be
-- base64-encoded.
--
-- If you are using an AWS SDK to call Amazon Rekognition, you might not
-- need to base64-encode image bytes passed using the @Bytes@ field. For
-- more information, see Images in the Amazon Rekognition developer guide.
detectLabels_image :: Lens.Lens' DetectLabels Image
detectLabels_image :: (Image -> f Image) -> DetectLabels -> f DetectLabels
detectLabels_image = (DetectLabels -> Image)
-> (DetectLabels -> Image -> DetectLabels)
-> Lens DetectLabels DetectLabels Image Image
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectLabels' {Image
image :: Image
$sel:image:DetectLabels' :: DetectLabels -> Image
image} -> Image
image) (\s :: DetectLabels
s@DetectLabels' {} Image
a -> DetectLabels
s {$sel:image:DetectLabels' :: Image
image = Image
a} :: DetectLabels)

instance Core.AWSRequest DetectLabels where
  type AWSResponse DetectLabels = DetectLabelsResponse
  request :: DetectLabels -> Request DetectLabels
request = Service -> DetectLabels -> Request DetectLabels
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DetectLabels
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DetectLabels)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DetectLabels))
-> Logger
-> Service
-> Proxy DetectLabels
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DetectLabels)))
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 [Label]
-> Maybe OrientationCorrection
-> Maybe Text
-> Int
-> DetectLabelsResponse
DetectLabelsResponse'
            (Maybe [Label]
 -> Maybe OrientationCorrection
 -> Maybe Text
 -> Int
 -> DetectLabelsResponse)
-> Either String (Maybe [Label])
-> Either
     String
     (Maybe OrientationCorrection
      -> Maybe Text -> Int -> DetectLabelsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Label]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Labels" Either String (Maybe (Maybe [Label]))
-> Maybe [Label] -> Either String (Maybe [Label])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Label]
forall a. Monoid a => a
Prelude.mempty)
            Either
  String
  (Maybe OrientationCorrection
   -> Maybe Text -> Int -> DetectLabelsResponse)
-> Either String (Maybe OrientationCorrection)
-> Either String (Maybe Text -> Int -> DetectLabelsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe OrientationCorrection)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"OrientationCorrection")
            Either String (Maybe Text -> Int -> DetectLabelsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DetectLabelsResponse)
forall (f :: * -> *) a b. Applicative f => 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
"LabelModelVersion")
            Either String (Int -> DetectLabelsResponse)
-> Either String Int -> Either String DetectLabelsResponse
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 DetectLabels

instance Prelude.NFData DetectLabels

instance Core.ToHeaders DetectLabels where
  toHeaders :: DetectLabels -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DetectLabels -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"RekognitionService.DetectLabels" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON DetectLabels where
  toJSON :: DetectLabels -> Value
toJSON DetectLabels' {Maybe Double
Maybe Natural
Image
image :: Image
maxLabels :: Maybe Natural
minConfidence :: Maybe Double
$sel:image:DetectLabels' :: DetectLabels -> Image
$sel:maxLabels:DetectLabels' :: DetectLabels -> Maybe Natural
$sel:minConfidence:DetectLabels' :: DetectLabels -> Maybe Double
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"MinConfidence" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Double -> Pair) -> Maybe Double -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
minConfidence,
            (Text
"MaxLabels" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxLabels,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Image" Text -> Image -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Image
image)
          ]
      )

instance Core.ToPath DetectLabels where
  toPath :: DetectLabels -> ByteString
toPath = ByteString -> DetectLabels -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery DetectLabels where
  toQuery :: DetectLabels -> QueryString
toQuery = QueryString -> DetectLabels -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newDetectLabelsResponse' smart constructor.
data DetectLabelsResponse = DetectLabelsResponse'
  { -- | An array of labels for the real-world objects detected.
    DetectLabelsResponse -> Maybe [Label]
labels :: Prelude.Maybe [Label],
    -- | The value of @OrientationCorrection@ is always null.
    --
    -- If the input image is in .jpeg format, it might contain exchangeable
    -- image file format (Exif) metadata that includes the image\'s
    -- orientation. Amazon Rekognition uses this orientation information to
    -- perform image correction. The bounding box coordinates are translated to
    -- represent object locations after the orientation information in the Exif
    -- metadata is used to correct the image orientation. Images in .png format
    -- don\'t contain Exif metadata.
    --
    -- Amazon Rekognition doesn’t perform image correction for images in .png
    -- format and .jpeg images without orientation information in the image
    -- Exif metadata. The bounding box coordinates aren\'t translated and
    -- represent the object locations before the image is rotated.
    DetectLabelsResponse -> Maybe OrientationCorrection
orientationCorrection :: Prelude.Maybe OrientationCorrection,
    -- | Version number of the label detection model that was used to detect
    -- labels.
    DetectLabelsResponse -> Maybe Text
labelModelVersion :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DetectLabelsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DetectLabelsResponse -> DetectLabelsResponse -> Bool
(DetectLabelsResponse -> DetectLabelsResponse -> Bool)
-> (DetectLabelsResponse -> DetectLabelsResponse -> Bool)
-> Eq DetectLabelsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DetectLabelsResponse -> DetectLabelsResponse -> Bool
$c/= :: DetectLabelsResponse -> DetectLabelsResponse -> Bool
== :: DetectLabelsResponse -> DetectLabelsResponse -> Bool
$c== :: DetectLabelsResponse -> DetectLabelsResponse -> Bool
Prelude.Eq, ReadPrec [DetectLabelsResponse]
ReadPrec DetectLabelsResponse
Int -> ReadS DetectLabelsResponse
ReadS [DetectLabelsResponse]
(Int -> ReadS DetectLabelsResponse)
-> ReadS [DetectLabelsResponse]
-> ReadPrec DetectLabelsResponse
-> ReadPrec [DetectLabelsResponse]
-> Read DetectLabelsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DetectLabelsResponse]
$creadListPrec :: ReadPrec [DetectLabelsResponse]
readPrec :: ReadPrec DetectLabelsResponse
$creadPrec :: ReadPrec DetectLabelsResponse
readList :: ReadS [DetectLabelsResponse]
$creadList :: ReadS [DetectLabelsResponse]
readsPrec :: Int -> ReadS DetectLabelsResponse
$creadsPrec :: Int -> ReadS DetectLabelsResponse
Prelude.Read, Int -> DetectLabelsResponse -> ShowS
[DetectLabelsResponse] -> ShowS
DetectLabelsResponse -> String
(Int -> DetectLabelsResponse -> ShowS)
-> (DetectLabelsResponse -> String)
-> ([DetectLabelsResponse] -> ShowS)
-> Show DetectLabelsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetectLabelsResponse] -> ShowS
$cshowList :: [DetectLabelsResponse] -> ShowS
show :: DetectLabelsResponse -> String
$cshow :: DetectLabelsResponse -> String
showsPrec :: Int -> DetectLabelsResponse -> ShowS
$cshowsPrec :: Int -> DetectLabelsResponse -> ShowS
Prelude.Show, (forall x. DetectLabelsResponse -> Rep DetectLabelsResponse x)
-> (forall x. Rep DetectLabelsResponse x -> DetectLabelsResponse)
-> Generic DetectLabelsResponse
forall x. Rep DetectLabelsResponse x -> DetectLabelsResponse
forall x. DetectLabelsResponse -> Rep DetectLabelsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DetectLabelsResponse x -> DetectLabelsResponse
$cfrom :: forall x. DetectLabelsResponse -> Rep DetectLabelsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DetectLabelsResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'labels', 'detectLabelsResponse_labels' - An array of labels for the real-world objects detected.
--
-- 'orientationCorrection', 'detectLabelsResponse_orientationCorrection' - The value of @OrientationCorrection@ is always null.
--
-- If the input image is in .jpeg format, it might contain exchangeable
-- image file format (Exif) metadata that includes the image\'s
-- orientation. Amazon Rekognition uses this orientation information to
-- perform image correction. The bounding box coordinates are translated to
-- represent object locations after the orientation information in the Exif
-- metadata is used to correct the image orientation. Images in .png format
-- don\'t contain Exif metadata.
--
-- Amazon Rekognition doesn’t perform image correction for images in .png
-- format and .jpeg images without orientation information in the image
-- Exif metadata. The bounding box coordinates aren\'t translated and
-- represent the object locations before the image is rotated.
--
-- 'labelModelVersion', 'detectLabelsResponse_labelModelVersion' - Version number of the label detection model that was used to detect
-- labels.
--
-- 'httpStatus', 'detectLabelsResponse_httpStatus' - The response's http status code.
newDetectLabelsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DetectLabelsResponse
newDetectLabelsResponse :: Int -> DetectLabelsResponse
newDetectLabelsResponse Int
pHttpStatus_ =
  DetectLabelsResponse' :: Maybe [Label]
-> Maybe OrientationCorrection
-> Maybe Text
-> Int
-> DetectLabelsResponse
DetectLabelsResponse'
    { $sel:labels:DetectLabelsResponse' :: Maybe [Label]
labels = Maybe [Label]
forall a. Maybe a
Prelude.Nothing,
      $sel:orientationCorrection:DetectLabelsResponse' :: Maybe OrientationCorrection
orientationCorrection = Maybe OrientationCorrection
forall a. Maybe a
Prelude.Nothing,
      $sel:labelModelVersion:DetectLabelsResponse' :: Maybe Text
labelModelVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DetectLabelsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An array of labels for the real-world objects detected.
detectLabelsResponse_labels :: Lens.Lens' DetectLabelsResponse (Prelude.Maybe [Label])
detectLabelsResponse_labels :: (Maybe [Label] -> f (Maybe [Label]))
-> DetectLabelsResponse -> f DetectLabelsResponse
detectLabelsResponse_labels = (DetectLabelsResponse -> Maybe [Label])
-> (DetectLabelsResponse -> Maybe [Label] -> DetectLabelsResponse)
-> Lens
     DetectLabelsResponse
     DetectLabelsResponse
     (Maybe [Label])
     (Maybe [Label])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectLabelsResponse' {Maybe [Label]
labels :: Maybe [Label]
$sel:labels:DetectLabelsResponse' :: DetectLabelsResponse -> Maybe [Label]
labels} -> Maybe [Label]
labels) (\s :: DetectLabelsResponse
s@DetectLabelsResponse' {} Maybe [Label]
a -> DetectLabelsResponse
s {$sel:labels:DetectLabelsResponse' :: Maybe [Label]
labels = Maybe [Label]
a} :: DetectLabelsResponse) ((Maybe [Label] -> f (Maybe [Label]))
 -> DetectLabelsResponse -> f DetectLabelsResponse)
-> ((Maybe [Label] -> f (Maybe [Label]))
    -> Maybe [Label] -> f (Maybe [Label]))
-> (Maybe [Label] -> f (Maybe [Label]))
-> DetectLabelsResponse
-> f DetectLabelsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Label] [Label] [Label] [Label]
-> Iso
     (Maybe [Label]) (Maybe [Label]) (Maybe [Label]) (Maybe [Label])
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 [Label] [Label] [Label] [Label]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The value of @OrientationCorrection@ is always null.
--
-- If the input image is in .jpeg format, it might contain exchangeable
-- image file format (Exif) metadata that includes the image\'s
-- orientation. Amazon Rekognition uses this orientation information to
-- perform image correction. The bounding box coordinates are translated to
-- represent object locations after the orientation information in the Exif
-- metadata is used to correct the image orientation. Images in .png format
-- don\'t contain Exif metadata.
--
-- Amazon Rekognition doesn’t perform image correction for images in .png
-- format and .jpeg images without orientation information in the image
-- Exif metadata. The bounding box coordinates aren\'t translated and
-- represent the object locations before the image is rotated.
detectLabelsResponse_orientationCorrection :: Lens.Lens' DetectLabelsResponse (Prelude.Maybe OrientationCorrection)
detectLabelsResponse_orientationCorrection :: (Maybe OrientationCorrection -> f (Maybe OrientationCorrection))
-> DetectLabelsResponse -> f DetectLabelsResponse
detectLabelsResponse_orientationCorrection = (DetectLabelsResponse -> Maybe OrientationCorrection)
-> (DetectLabelsResponse
    -> Maybe OrientationCorrection -> DetectLabelsResponse)
-> Lens
     DetectLabelsResponse
     DetectLabelsResponse
     (Maybe OrientationCorrection)
     (Maybe OrientationCorrection)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectLabelsResponse' {Maybe OrientationCorrection
orientationCorrection :: Maybe OrientationCorrection
$sel:orientationCorrection:DetectLabelsResponse' :: DetectLabelsResponse -> Maybe OrientationCorrection
orientationCorrection} -> Maybe OrientationCorrection
orientationCorrection) (\s :: DetectLabelsResponse
s@DetectLabelsResponse' {} Maybe OrientationCorrection
a -> DetectLabelsResponse
s {$sel:orientationCorrection:DetectLabelsResponse' :: Maybe OrientationCorrection
orientationCorrection = Maybe OrientationCorrection
a} :: DetectLabelsResponse)

-- | Version number of the label detection model that was used to detect
-- labels.
detectLabelsResponse_labelModelVersion :: Lens.Lens' DetectLabelsResponse (Prelude.Maybe Prelude.Text)
detectLabelsResponse_labelModelVersion :: (Maybe Text -> f (Maybe Text))
-> DetectLabelsResponse -> f DetectLabelsResponse
detectLabelsResponse_labelModelVersion = (DetectLabelsResponse -> Maybe Text)
-> (DetectLabelsResponse -> Maybe Text -> DetectLabelsResponse)
-> Lens
     DetectLabelsResponse DetectLabelsResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectLabelsResponse' {Maybe Text
labelModelVersion :: Maybe Text
$sel:labelModelVersion:DetectLabelsResponse' :: DetectLabelsResponse -> Maybe Text
labelModelVersion} -> Maybe Text
labelModelVersion) (\s :: DetectLabelsResponse
s@DetectLabelsResponse' {} Maybe Text
a -> DetectLabelsResponse
s {$sel:labelModelVersion:DetectLabelsResponse' :: Maybe Text
labelModelVersion = Maybe Text
a} :: DetectLabelsResponse)

-- | The response's http status code.
detectLabelsResponse_httpStatus :: Lens.Lens' DetectLabelsResponse Prelude.Int
detectLabelsResponse_httpStatus :: (Int -> f Int) -> DetectLabelsResponse -> f DetectLabelsResponse
detectLabelsResponse_httpStatus = (DetectLabelsResponse -> Int)
-> (DetectLabelsResponse -> Int -> DetectLabelsResponse)
-> Lens DetectLabelsResponse DetectLabelsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectLabelsResponse' {Int
httpStatus :: Int
$sel:httpStatus:DetectLabelsResponse' :: DetectLabelsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DetectLabelsResponse
s@DetectLabelsResponse' {} Int
a -> DetectLabelsResponse
s {$sel:httpStatus:DetectLabelsResponse' :: Int
httpStatus = Int
a} :: DetectLabelsResponse)

instance Prelude.NFData DetectLabelsResponse