{-# 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.DetectCustomLabels
-- 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 custom labels in a supplied image by using an Amazon Rekognition
-- Custom Labels model.
--
-- You specify which version of a model version to use by using the
-- @ProjectVersionArn@ input parameter.
--
-- 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 that the model version detects on an image, the API
-- returns a (@CustomLabel@) object in an array (@CustomLabels@). Each
-- @CustomLabel@ object provides the label name (@Name@), the level of
-- confidence that the image contains the object (@Confidence@), and object
-- location information, if it exists, for the label on the image
-- (@Geometry@).
--
-- To filter labels that are returned, specify a value for @MinConfidence@.
-- @DetectCustomLabelsLabels@ only returns labels with a confidence that\'s
-- higher than the specified value. The value of @MinConfidence@ maps to
-- the assumed threshold values created during training. For more
-- information, see /Assumed threshold/ in the Amazon Rekognition Custom
-- Labels Developer Guide. Amazon Rekognition Custom Labels metrics
-- expresses an assumed threshold as a floating point value between 0-1.
-- The range of @MinConfidence@ normalizes the threshold value to a
-- percentage value (0-100). Confidence responses from @DetectCustomLabels@
-- are also returned as a percentage. You can use @MinConfidence@ to change
-- the precision and recall or your model. For more information, see
-- /Analyzing an image/ in the Amazon Rekognition Custom Labels Developer
-- Guide.
--
-- If you don\'t specify a value for @MinConfidence@, @DetectCustomLabels@
-- returns labels based on the assumed threshold of each label.
--
-- This is a stateless API operation. That is, the operation does not
-- persist any data.
--
-- This operation requires permissions to perform the
-- @rekognition:DetectCustomLabels@ action.
--
-- For more information, see /Analyzing an image/ in the Amazon Rekognition
-- Custom Labels Developer Guide.
module Amazonka.Rekognition.DetectCustomLabels
  ( -- * Creating a Request
    DetectCustomLabels (..),
    newDetectCustomLabels,

    -- * Request Lenses
    detectCustomLabels_minConfidence,
    detectCustomLabels_maxResults,
    detectCustomLabels_projectVersionArn,
    detectCustomLabels_image,

    -- * Destructuring the Response
    DetectCustomLabelsResponse (..),
    newDetectCustomLabelsResponse,

    -- * Response Lenses
    detectCustomLabelsResponse_customLabels,
    detectCustomLabelsResponse_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:/ 'newDetectCustomLabels' smart constructor.
data DetectCustomLabels = DetectCustomLabels'
  { -- | Specifies the minimum confidence level for the labels to return.
    -- @DetectCustomLabels@ doesn\'t return any labels with a confidence value
    -- that\'s lower than this specified value. If you specify a value of 0,
    -- @DetectCustomLabels@ returns all labels, regardless of the assumed
    -- threshold applied to each label. If you don\'t specify a value for
    -- @MinConfidence@, @DetectCustomLabels@ returns labels based on the
    -- assumed threshold of each label.
    DetectCustomLabels -> Maybe Double
minConfidence :: Prelude.Maybe Prelude.Double,
    -- | Maximum number of results you want the service to return in the
    -- response. The service returns the specified number of highest confidence
    -- labels ranked from highest confidence to lowest.
    DetectCustomLabels -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The ARN of the model version that you want to use.
    DetectCustomLabels -> Text
projectVersionArn :: Prelude.Text,
    DetectCustomLabels -> Image
image :: Image
  }
  deriving (DetectCustomLabels -> DetectCustomLabels -> Bool
(DetectCustomLabels -> DetectCustomLabels -> Bool)
-> (DetectCustomLabels -> DetectCustomLabels -> Bool)
-> Eq DetectCustomLabels
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DetectCustomLabels -> DetectCustomLabels -> Bool
$c/= :: DetectCustomLabels -> DetectCustomLabels -> Bool
== :: DetectCustomLabels -> DetectCustomLabels -> Bool
$c== :: DetectCustomLabels -> DetectCustomLabels -> Bool
Prelude.Eq, ReadPrec [DetectCustomLabels]
ReadPrec DetectCustomLabels
Int -> ReadS DetectCustomLabels
ReadS [DetectCustomLabels]
(Int -> ReadS DetectCustomLabels)
-> ReadS [DetectCustomLabels]
-> ReadPrec DetectCustomLabels
-> ReadPrec [DetectCustomLabels]
-> Read DetectCustomLabels
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DetectCustomLabels]
$creadListPrec :: ReadPrec [DetectCustomLabels]
readPrec :: ReadPrec DetectCustomLabels
$creadPrec :: ReadPrec DetectCustomLabels
readList :: ReadS [DetectCustomLabels]
$creadList :: ReadS [DetectCustomLabels]
readsPrec :: Int -> ReadS DetectCustomLabels
$creadsPrec :: Int -> ReadS DetectCustomLabels
Prelude.Read, Int -> DetectCustomLabels -> ShowS
[DetectCustomLabels] -> ShowS
DetectCustomLabels -> String
(Int -> DetectCustomLabels -> ShowS)
-> (DetectCustomLabels -> String)
-> ([DetectCustomLabels] -> ShowS)
-> Show DetectCustomLabels
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetectCustomLabels] -> ShowS
$cshowList :: [DetectCustomLabels] -> ShowS
show :: DetectCustomLabels -> String
$cshow :: DetectCustomLabels -> String
showsPrec :: Int -> DetectCustomLabels -> ShowS
$cshowsPrec :: Int -> DetectCustomLabels -> ShowS
Prelude.Show, (forall x. DetectCustomLabels -> Rep DetectCustomLabels x)
-> (forall x. Rep DetectCustomLabels x -> DetectCustomLabels)
-> Generic DetectCustomLabels
forall x. Rep DetectCustomLabels x -> DetectCustomLabels
forall x. DetectCustomLabels -> Rep DetectCustomLabels x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DetectCustomLabels x -> DetectCustomLabels
$cfrom :: forall x. DetectCustomLabels -> Rep DetectCustomLabels x
Prelude.Generic)

-- |
-- Create a value of 'DetectCustomLabels' 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', 'detectCustomLabels_minConfidence' - Specifies the minimum confidence level for the labels to return.
-- @DetectCustomLabels@ doesn\'t return any labels with a confidence value
-- that\'s lower than this specified value. If you specify a value of 0,
-- @DetectCustomLabels@ returns all labels, regardless of the assumed
-- threshold applied to each label. If you don\'t specify a value for
-- @MinConfidence@, @DetectCustomLabels@ returns labels based on the
-- assumed threshold of each label.
--
-- 'maxResults', 'detectCustomLabels_maxResults' - Maximum number of results you want the service to return in the
-- response. The service returns the specified number of highest confidence
-- labels ranked from highest confidence to lowest.
--
-- 'projectVersionArn', 'detectCustomLabels_projectVersionArn' - The ARN of the model version that you want to use.
--
-- 'image', 'detectCustomLabels_image' - Undocumented member.
newDetectCustomLabels ::
  -- | 'projectVersionArn'
  Prelude.Text ->
  -- | 'image'
  Image ->
  DetectCustomLabels
newDetectCustomLabels :: Text -> Image -> DetectCustomLabels
newDetectCustomLabels Text
pProjectVersionArn_ Image
pImage_ =
  DetectCustomLabels' :: Maybe Double
-> Maybe Natural -> Text -> Image -> DetectCustomLabels
DetectCustomLabels'
    { $sel:minConfidence:DetectCustomLabels' :: Maybe Double
minConfidence =
        Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DetectCustomLabels' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:projectVersionArn:DetectCustomLabels' :: Text
projectVersionArn = Text
pProjectVersionArn_,
      $sel:image:DetectCustomLabels' :: Image
image = Image
pImage_
    }

-- | Specifies the minimum confidence level for the labels to return.
-- @DetectCustomLabels@ doesn\'t return any labels with a confidence value
-- that\'s lower than this specified value. If you specify a value of 0,
-- @DetectCustomLabels@ returns all labels, regardless of the assumed
-- threshold applied to each label. If you don\'t specify a value for
-- @MinConfidence@, @DetectCustomLabels@ returns labels based on the
-- assumed threshold of each label.
detectCustomLabels_minConfidence :: Lens.Lens' DetectCustomLabels (Prelude.Maybe Prelude.Double)
detectCustomLabels_minConfidence :: (Maybe Double -> f (Maybe Double))
-> DetectCustomLabels -> f DetectCustomLabels
detectCustomLabels_minConfidence = (DetectCustomLabels -> Maybe Double)
-> (DetectCustomLabels -> Maybe Double -> DetectCustomLabels)
-> Lens
     DetectCustomLabels DetectCustomLabels (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectCustomLabels' {Maybe Double
minConfidence :: Maybe Double
$sel:minConfidence:DetectCustomLabels' :: DetectCustomLabels -> Maybe Double
minConfidence} -> Maybe Double
minConfidence) (\s :: DetectCustomLabels
s@DetectCustomLabels' {} Maybe Double
a -> DetectCustomLabels
s {$sel:minConfidence:DetectCustomLabels' :: Maybe Double
minConfidence = Maybe Double
a} :: DetectCustomLabels)

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

-- | The ARN of the model version that you want to use.
detectCustomLabels_projectVersionArn :: Lens.Lens' DetectCustomLabels Prelude.Text
detectCustomLabels_projectVersionArn :: (Text -> f Text) -> DetectCustomLabels -> f DetectCustomLabels
detectCustomLabels_projectVersionArn = (DetectCustomLabels -> Text)
-> (DetectCustomLabels -> Text -> DetectCustomLabels)
-> Lens DetectCustomLabels DetectCustomLabels Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectCustomLabels' {Text
projectVersionArn :: Text
$sel:projectVersionArn:DetectCustomLabels' :: DetectCustomLabels -> Text
projectVersionArn} -> Text
projectVersionArn) (\s :: DetectCustomLabels
s@DetectCustomLabels' {} Text
a -> DetectCustomLabels
s {$sel:projectVersionArn:DetectCustomLabels' :: Text
projectVersionArn = Text
a} :: DetectCustomLabels)

-- | Undocumented member.
detectCustomLabels_image :: Lens.Lens' DetectCustomLabels Image
detectCustomLabels_image :: (Image -> f Image) -> DetectCustomLabels -> f DetectCustomLabels
detectCustomLabels_image = (DetectCustomLabels -> Image)
-> (DetectCustomLabels -> Image -> DetectCustomLabels)
-> Lens DetectCustomLabels DetectCustomLabels Image Image
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectCustomLabels' {Image
image :: Image
$sel:image:DetectCustomLabels' :: DetectCustomLabels -> Image
image} -> Image
image) (\s :: DetectCustomLabels
s@DetectCustomLabels' {} Image
a -> DetectCustomLabels
s {$sel:image:DetectCustomLabels' :: Image
image = Image
a} :: DetectCustomLabels)

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

instance Prelude.NFData DetectCustomLabels

instance Core.ToHeaders DetectCustomLabels where
  toHeaders :: DetectCustomLabels -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DetectCustomLabels -> 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.DetectCustomLabels" ::
                          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 DetectCustomLabels where
  toJSON :: DetectCustomLabels -> Value
toJSON DetectCustomLabels' {Maybe Double
Maybe Natural
Text
Image
image :: Image
projectVersionArn :: Text
maxResults :: Maybe Natural
minConfidence :: Maybe Double
$sel:image:DetectCustomLabels' :: DetectCustomLabels -> Image
$sel:projectVersionArn:DetectCustomLabels' :: DetectCustomLabels -> Text
$sel:maxResults:DetectCustomLabels' :: DetectCustomLabels -> Maybe Natural
$sel:minConfidence:DetectCustomLabels' :: DetectCustomLabels -> 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
"MaxResults" 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
maxResults,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ProjectVersionArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
projectVersionArn),
            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 DetectCustomLabels where
  toPath :: DetectCustomLabels -> ByteString
toPath = ByteString -> DetectCustomLabels -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newDetectCustomLabelsResponse' smart constructor.
data DetectCustomLabelsResponse = DetectCustomLabelsResponse'
  { -- | An array of custom labels detected in the input image.
    DetectCustomLabelsResponse -> Maybe [CustomLabel]
customLabels :: Prelude.Maybe [CustomLabel],
    -- | The response's http status code.
    DetectCustomLabelsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DetectCustomLabelsResponse -> DetectCustomLabelsResponse -> Bool
(DetectCustomLabelsResponse -> DetectCustomLabelsResponse -> Bool)
-> (DetectCustomLabelsResponse
    -> DetectCustomLabelsResponse -> Bool)
-> Eq DetectCustomLabelsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DetectCustomLabelsResponse -> DetectCustomLabelsResponse -> Bool
$c/= :: DetectCustomLabelsResponse -> DetectCustomLabelsResponse -> Bool
== :: DetectCustomLabelsResponse -> DetectCustomLabelsResponse -> Bool
$c== :: DetectCustomLabelsResponse -> DetectCustomLabelsResponse -> Bool
Prelude.Eq, ReadPrec [DetectCustomLabelsResponse]
ReadPrec DetectCustomLabelsResponse
Int -> ReadS DetectCustomLabelsResponse
ReadS [DetectCustomLabelsResponse]
(Int -> ReadS DetectCustomLabelsResponse)
-> ReadS [DetectCustomLabelsResponse]
-> ReadPrec DetectCustomLabelsResponse
-> ReadPrec [DetectCustomLabelsResponse]
-> Read DetectCustomLabelsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DetectCustomLabelsResponse]
$creadListPrec :: ReadPrec [DetectCustomLabelsResponse]
readPrec :: ReadPrec DetectCustomLabelsResponse
$creadPrec :: ReadPrec DetectCustomLabelsResponse
readList :: ReadS [DetectCustomLabelsResponse]
$creadList :: ReadS [DetectCustomLabelsResponse]
readsPrec :: Int -> ReadS DetectCustomLabelsResponse
$creadsPrec :: Int -> ReadS DetectCustomLabelsResponse
Prelude.Read, Int -> DetectCustomLabelsResponse -> ShowS
[DetectCustomLabelsResponse] -> ShowS
DetectCustomLabelsResponse -> String
(Int -> DetectCustomLabelsResponse -> ShowS)
-> (DetectCustomLabelsResponse -> String)
-> ([DetectCustomLabelsResponse] -> ShowS)
-> Show DetectCustomLabelsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetectCustomLabelsResponse] -> ShowS
$cshowList :: [DetectCustomLabelsResponse] -> ShowS
show :: DetectCustomLabelsResponse -> String
$cshow :: DetectCustomLabelsResponse -> String
showsPrec :: Int -> DetectCustomLabelsResponse -> ShowS
$cshowsPrec :: Int -> DetectCustomLabelsResponse -> ShowS
Prelude.Show, (forall x.
 DetectCustomLabelsResponse -> Rep DetectCustomLabelsResponse x)
-> (forall x.
    Rep DetectCustomLabelsResponse x -> DetectCustomLabelsResponse)
-> Generic DetectCustomLabelsResponse
forall x.
Rep DetectCustomLabelsResponse x -> DetectCustomLabelsResponse
forall x.
DetectCustomLabelsResponse -> Rep DetectCustomLabelsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DetectCustomLabelsResponse x -> DetectCustomLabelsResponse
$cfrom :: forall x.
DetectCustomLabelsResponse -> Rep DetectCustomLabelsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DetectCustomLabelsResponse' 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:
--
-- 'customLabels', 'detectCustomLabelsResponse_customLabels' - An array of custom labels detected in the input image.
--
-- 'httpStatus', 'detectCustomLabelsResponse_httpStatus' - The response's http status code.
newDetectCustomLabelsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DetectCustomLabelsResponse
newDetectCustomLabelsResponse :: Int -> DetectCustomLabelsResponse
newDetectCustomLabelsResponse Int
pHttpStatus_ =
  DetectCustomLabelsResponse' :: Maybe [CustomLabel] -> Int -> DetectCustomLabelsResponse
DetectCustomLabelsResponse'
    { $sel:customLabels:DetectCustomLabelsResponse' :: Maybe [CustomLabel]
customLabels =
        Maybe [CustomLabel]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DetectCustomLabelsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An array of custom labels detected in the input image.
detectCustomLabelsResponse_customLabels :: Lens.Lens' DetectCustomLabelsResponse (Prelude.Maybe [CustomLabel])
detectCustomLabelsResponse_customLabels :: (Maybe [CustomLabel] -> f (Maybe [CustomLabel]))
-> DetectCustomLabelsResponse -> f DetectCustomLabelsResponse
detectCustomLabelsResponse_customLabels = (DetectCustomLabelsResponse -> Maybe [CustomLabel])
-> (DetectCustomLabelsResponse
    -> Maybe [CustomLabel] -> DetectCustomLabelsResponse)
-> Lens
     DetectCustomLabelsResponse
     DetectCustomLabelsResponse
     (Maybe [CustomLabel])
     (Maybe [CustomLabel])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectCustomLabelsResponse' {Maybe [CustomLabel]
customLabels :: Maybe [CustomLabel]
$sel:customLabels:DetectCustomLabelsResponse' :: DetectCustomLabelsResponse -> Maybe [CustomLabel]
customLabels} -> Maybe [CustomLabel]
customLabels) (\s :: DetectCustomLabelsResponse
s@DetectCustomLabelsResponse' {} Maybe [CustomLabel]
a -> DetectCustomLabelsResponse
s {$sel:customLabels:DetectCustomLabelsResponse' :: Maybe [CustomLabel]
customLabels = Maybe [CustomLabel]
a} :: DetectCustomLabelsResponse) ((Maybe [CustomLabel] -> f (Maybe [CustomLabel]))
 -> DetectCustomLabelsResponse -> f DetectCustomLabelsResponse)
-> ((Maybe [CustomLabel] -> f (Maybe [CustomLabel]))
    -> Maybe [CustomLabel] -> f (Maybe [CustomLabel]))
-> (Maybe [CustomLabel] -> f (Maybe [CustomLabel]))
-> DetectCustomLabelsResponse
-> f DetectCustomLabelsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [CustomLabel] [CustomLabel] [CustomLabel] [CustomLabel]
-> Iso
     (Maybe [CustomLabel])
     (Maybe [CustomLabel])
     (Maybe [CustomLabel])
     (Maybe [CustomLabel])
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 [CustomLabel] [CustomLabel] [CustomLabel] [CustomLabel]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData DetectCustomLabelsResponse