{-# 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.GetLabelDetection
-- 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)
--
-- Gets the label detection results of a Amazon Rekognition Video analysis
-- started by StartLabelDetection.
--
-- The label detection operation is started by a call to
-- StartLabelDetection which returns a job identifier (@JobId@). When the
-- label detection operation finishes, Amazon Rekognition publishes a
-- completion status to the Amazon Simple Notification Service topic
-- registered in the initial call to @StartlabelDetection@. To get the
-- results of the label detection operation, first check that the status
-- value published to the Amazon SNS topic is @SUCCEEDED@. If so, call
-- GetLabelDetection and pass the job identifier (@JobId@) from the initial
-- call to @StartLabelDetection@.
--
-- @GetLabelDetection@ returns an array of detected labels (@Labels@)
-- sorted by the time the labels were detected. You can also sort by the
-- label name by specifying @NAME@ for the @SortBy@ input parameter.
--
-- The labels returned include the label name, the percentage confidence in
-- the accuracy of the detected label, and the time the label was detected
-- in the video.
--
-- The returned labels also include bounding box information for common
-- objects, a hierarchical taxonomy of detected labels, and the version of
-- the label model used for detection.
--
-- Use MaxResults parameter to limit the number of labels returned. If
-- there are more results than specified in @MaxResults@, the value of
-- @NextToken@ in the operation response contains a pagination token for
-- getting the next set of results. To get the next page of results, call
-- @GetlabelDetection@ and populate the @NextToken@ request parameter with
-- the token value returned from the previous call to @GetLabelDetection@.
module Amazonka.Rekognition.GetLabelDetection
  ( -- * Creating a Request
    GetLabelDetection (..),
    newGetLabelDetection,

    -- * Request Lenses
    getLabelDetection_nextToken,
    getLabelDetection_maxResults,
    getLabelDetection_sortBy,
    getLabelDetection_jobId,

    -- * Destructuring the Response
    GetLabelDetectionResponse (..),
    newGetLabelDetectionResponse,

    -- * Response Lenses
    getLabelDetectionResponse_nextToken,
    getLabelDetectionResponse_videoMetadata,
    getLabelDetectionResponse_statusMessage,
    getLabelDetectionResponse_labels,
    getLabelDetectionResponse_jobStatus,
    getLabelDetectionResponse_labelModelVersion,
    getLabelDetectionResponse_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:/ 'newGetLabelDetection' smart constructor.
data GetLabelDetection = GetLabelDetection'
  { -- | If the previous response was incomplete (because there are more labels
    -- to retrieve), Amazon Rekognition Video returns a pagination token in the
    -- response. You can use this pagination token to retrieve the next set of
    -- labels.
    GetLabelDetection -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Maximum number of results to return per paginated call. The largest
    -- value you can specify is 1000. If you specify a value greater than 1000,
    -- a maximum of 1000 results is returned. The default value is 1000.
    GetLabelDetection -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | Sort to use for elements in the @Labels@ array. Use @TIMESTAMP@ to sort
    -- array elements by the time labels are detected. Use @NAME@ to
    -- alphabetically group elements for a label together. Within each label
    -- group, the array element are sorted by detection confidence. The default
    -- sort is by @TIMESTAMP@.
    GetLabelDetection -> Maybe LabelDetectionSortBy
sortBy :: Prelude.Maybe LabelDetectionSortBy,
    -- | Job identifier for the label detection operation for which you want
    -- results returned. You get the job identifer from an initial call to
    -- @StartlabelDetection@.
    GetLabelDetection -> Text
jobId :: Prelude.Text
  }
  deriving (GetLabelDetection -> GetLabelDetection -> Bool
(GetLabelDetection -> GetLabelDetection -> Bool)
-> (GetLabelDetection -> GetLabelDetection -> Bool)
-> Eq GetLabelDetection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetLabelDetection -> GetLabelDetection -> Bool
$c/= :: GetLabelDetection -> GetLabelDetection -> Bool
== :: GetLabelDetection -> GetLabelDetection -> Bool
$c== :: GetLabelDetection -> GetLabelDetection -> Bool
Prelude.Eq, ReadPrec [GetLabelDetection]
ReadPrec GetLabelDetection
Int -> ReadS GetLabelDetection
ReadS [GetLabelDetection]
(Int -> ReadS GetLabelDetection)
-> ReadS [GetLabelDetection]
-> ReadPrec GetLabelDetection
-> ReadPrec [GetLabelDetection]
-> Read GetLabelDetection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetLabelDetection]
$creadListPrec :: ReadPrec [GetLabelDetection]
readPrec :: ReadPrec GetLabelDetection
$creadPrec :: ReadPrec GetLabelDetection
readList :: ReadS [GetLabelDetection]
$creadList :: ReadS [GetLabelDetection]
readsPrec :: Int -> ReadS GetLabelDetection
$creadsPrec :: Int -> ReadS GetLabelDetection
Prelude.Read, Int -> GetLabelDetection -> ShowS
[GetLabelDetection] -> ShowS
GetLabelDetection -> String
(Int -> GetLabelDetection -> ShowS)
-> (GetLabelDetection -> String)
-> ([GetLabelDetection] -> ShowS)
-> Show GetLabelDetection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetLabelDetection] -> ShowS
$cshowList :: [GetLabelDetection] -> ShowS
show :: GetLabelDetection -> String
$cshow :: GetLabelDetection -> String
showsPrec :: Int -> GetLabelDetection -> ShowS
$cshowsPrec :: Int -> GetLabelDetection -> ShowS
Prelude.Show, (forall x. GetLabelDetection -> Rep GetLabelDetection x)
-> (forall x. Rep GetLabelDetection x -> GetLabelDetection)
-> Generic GetLabelDetection
forall x. Rep GetLabelDetection x -> GetLabelDetection
forall x. GetLabelDetection -> Rep GetLabelDetection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetLabelDetection x -> GetLabelDetection
$cfrom :: forall x. GetLabelDetection -> Rep GetLabelDetection x
Prelude.Generic)

-- |
-- Create a value of 'GetLabelDetection' 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:
--
-- 'nextToken', 'getLabelDetection_nextToken' - If the previous response was incomplete (because there are more labels
-- to retrieve), Amazon Rekognition Video returns a pagination token in the
-- response. You can use this pagination token to retrieve the next set of
-- labels.
--
-- 'maxResults', 'getLabelDetection_maxResults' - Maximum number of results to return per paginated call. The largest
-- value you can specify is 1000. If you specify a value greater than 1000,
-- a maximum of 1000 results is returned. The default value is 1000.
--
-- 'sortBy', 'getLabelDetection_sortBy' - Sort to use for elements in the @Labels@ array. Use @TIMESTAMP@ to sort
-- array elements by the time labels are detected. Use @NAME@ to
-- alphabetically group elements for a label together. Within each label
-- group, the array element are sorted by detection confidence. The default
-- sort is by @TIMESTAMP@.
--
-- 'jobId', 'getLabelDetection_jobId' - Job identifier for the label detection operation for which you want
-- results returned. You get the job identifer from an initial call to
-- @StartlabelDetection@.
newGetLabelDetection ::
  -- | 'jobId'
  Prelude.Text ->
  GetLabelDetection
newGetLabelDetection :: Text -> GetLabelDetection
newGetLabelDetection Text
pJobId_ =
  GetLabelDetection' :: Maybe Text
-> Maybe Natural
-> Maybe LabelDetectionSortBy
-> Text
-> GetLabelDetection
GetLabelDetection'
    { $sel:nextToken:GetLabelDetection' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:GetLabelDetection' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:sortBy:GetLabelDetection' :: Maybe LabelDetectionSortBy
sortBy = Maybe LabelDetectionSortBy
forall a. Maybe a
Prelude.Nothing,
      $sel:jobId:GetLabelDetection' :: Text
jobId = Text
pJobId_
    }

-- | If the previous response was incomplete (because there are more labels
-- to retrieve), Amazon Rekognition Video returns a pagination token in the
-- response. You can use this pagination token to retrieve the next set of
-- labels.
getLabelDetection_nextToken :: Lens.Lens' GetLabelDetection (Prelude.Maybe Prelude.Text)
getLabelDetection_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetLabelDetection -> f GetLabelDetection
getLabelDetection_nextToken = (GetLabelDetection -> Maybe Text)
-> (GetLabelDetection -> Maybe Text -> GetLabelDetection)
-> Lens
     GetLabelDetection GetLabelDetection (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLabelDetection' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetLabelDetection' :: GetLabelDetection -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetLabelDetection
s@GetLabelDetection' {} Maybe Text
a -> GetLabelDetection
s {$sel:nextToken:GetLabelDetection' :: Maybe Text
nextToken = Maybe Text
a} :: GetLabelDetection)

-- | Maximum number of results to return per paginated call. The largest
-- value you can specify is 1000. If you specify a value greater than 1000,
-- a maximum of 1000 results is returned. The default value is 1000.
getLabelDetection_maxResults :: Lens.Lens' GetLabelDetection (Prelude.Maybe Prelude.Natural)
getLabelDetection_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> GetLabelDetection -> f GetLabelDetection
getLabelDetection_maxResults = (GetLabelDetection -> Maybe Natural)
-> (GetLabelDetection -> Maybe Natural -> GetLabelDetection)
-> Lens
     GetLabelDetection GetLabelDetection (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLabelDetection' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetLabelDetection' :: GetLabelDetection -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetLabelDetection
s@GetLabelDetection' {} Maybe Natural
a -> GetLabelDetection
s {$sel:maxResults:GetLabelDetection' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetLabelDetection)

-- | Sort to use for elements in the @Labels@ array. Use @TIMESTAMP@ to sort
-- array elements by the time labels are detected. Use @NAME@ to
-- alphabetically group elements for a label together. Within each label
-- group, the array element are sorted by detection confidence. The default
-- sort is by @TIMESTAMP@.
getLabelDetection_sortBy :: Lens.Lens' GetLabelDetection (Prelude.Maybe LabelDetectionSortBy)
getLabelDetection_sortBy :: (Maybe LabelDetectionSortBy -> f (Maybe LabelDetectionSortBy))
-> GetLabelDetection -> f GetLabelDetection
getLabelDetection_sortBy = (GetLabelDetection -> Maybe LabelDetectionSortBy)
-> (GetLabelDetection
    -> Maybe LabelDetectionSortBy -> GetLabelDetection)
-> Lens
     GetLabelDetection
     GetLabelDetection
     (Maybe LabelDetectionSortBy)
     (Maybe LabelDetectionSortBy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLabelDetection' {Maybe LabelDetectionSortBy
sortBy :: Maybe LabelDetectionSortBy
$sel:sortBy:GetLabelDetection' :: GetLabelDetection -> Maybe LabelDetectionSortBy
sortBy} -> Maybe LabelDetectionSortBy
sortBy) (\s :: GetLabelDetection
s@GetLabelDetection' {} Maybe LabelDetectionSortBy
a -> GetLabelDetection
s {$sel:sortBy:GetLabelDetection' :: Maybe LabelDetectionSortBy
sortBy = Maybe LabelDetectionSortBy
a} :: GetLabelDetection)

-- | Job identifier for the label detection operation for which you want
-- results returned. You get the job identifer from an initial call to
-- @StartlabelDetection@.
getLabelDetection_jobId :: Lens.Lens' GetLabelDetection Prelude.Text
getLabelDetection_jobId :: (Text -> f Text) -> GetLabelDetection -> f GetLabelDetection
getLabelDetection_jobId = (GetLabelDetection -> Text)
-> (GetLabelDetection -> Text -> GetLabelDetection)
-> Lens GetLabelDetection GetLabelDetection Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLabelDetection' {Text
jobId :: Text
$sel:jobId:GetLabelDetection' :: GetLabelDetection -> Text
jobId} -> Text
jobId) (\s :: GetLabelDetection
s@GetLabelDetection' {} Text
a -> GetLabelDetection
s {$sel:jobId:GetLabelDetection' :: Text
jobId = Text
a} :: GetLabelDetection)

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

instance Prelude.NFData GetLabelDetection

instance Core.ToHeaders GetLabelDetection where
  toHeaders :: GetLabelDetection -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetLabelDetection -> 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.GetLabelDetection" ::
                          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 GetLabelDetection where
  toJSON :: GetLabelDetection -> Value
toJSON GetLabelDetection' {Maybe Natural
Maybe Text
Maybe LabelDetectionSortBy
Text
jobId :: Text
sortBy :: Maybe LabelDetectionSortBy
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:jobId:GetLabelDetection' :: GetLabelDetection -> Text
$sel:sortBy:GetLabelDetection' :: GetLabelDetection -> Maybe LabelDetectionSortBy
$sel:maxResults:GetLabelDetection' :: GetLabelDetection -> Maybe Natural
$sel:nextToken:GetLabelDetection' :: GetLabelDetection -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (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,
            (Text
"SortBy" Text -> LabelDetectionSortBy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (LabelDetectionSortBy -> Pair)
-> Maybe LabelDetectionSortBy -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LabelDetectionSortBy
sortBy,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"JobId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
jobId)
          ]
      )

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

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

-- | /See:/ 'newGetLabelDetectionResponse' smart constructor.
data GetLabelDetectionResponse = GetLabelDetectionResponse'
  { -- | If the response is truncated, Amazon Rekognition Video returns this
    -- token that you can use in the subsequent request to retrieve the next
    -- set of labels.
    GetLabelDetectionResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Information about a video that Amazon Rekognition Video analyzed.
    -- @Videometadata@ is returned in every page of paginated responses from a
    -- Amazon Rekognition video operation.
    GetLabelDetectionResponse -> Maybe VideoMetadata
videoMetadata :: Prelude.Maybe VideoMetadata,
    -- | If the job fails, @StatusMessage@ provides a descriptive error message.
    GetLabelDetectionResponse -> Maybe Text
statusMessage :: Prelude.Maybe Prelude.Text,
    -- | An array of labels detected in the video. Each element contains the
    -- detected label and the time, in milliseconds from the start of the
    -- video, that the label was detected.
    GetLabelDetectionResponse -> Maybe [LabelDetection]
labels :: Prelude.Maybe [LabelDetection],
    -- | The current status of the label detection job.
    GetLabelDetectionResponse -> Maybe VideoJobStatus
jobStatus :: Prelude.Maybe VideoJobStatus,
    -- | Version number of the label detection model that was used to detect
    -- labels.
    GetLabelDetectionResponse -> Maybe Text
labelModelVersion :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetLabelDetectionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetLabelDetectionResponse -> GetLabelDetectionResponse -> Bool
(GetLabelDetectionResponse -> GetLabelDetectionResponse -> Bool)
-> (GetLabelDetectionResponse -> GetLabelDetectionResponse -> Bool)
-> Eq GetLabelDetectionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetLabelDetectionResponse -> GetLabelDetectionResponse -> Bool
$c/= :: GetLabelDetectionResponse -> GetLabelDetectionResponse -> Bool
== :: GetLabelDetectionResponse -> GetLabelDetectionResponse -> Bool
$c== :: GetLabelDetectionResponse -> GetLabelDetectionResponse -> Bool
Prelude.Eq, ReadPrec [GetLabelDetectionResponse]
ReadPrec GetLabelDetectionResponse
Int -> ReadS GetLabelDetectionResponse
ReadS [GetLabelDetectionResponse]
(Int -> ReadS GetLabelDetectionResponse)
-> ReadS [GetLabelDetectionResponse]
-> ReadPrec GetLabelDetectionResponse
-> ReadPrec [GetLabelDetectionResponse]
-> Read GetLabelDetectionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetLabelDetectionResponse]
$creadListPrec :: ReadPrec [GetLabelDetectionResponse]
readPrec :: ReadPrec GetLabelDetectionResponse
$creadPrec :: ReadPrec GetLabelDetectionResponse
readList :: ReadS [GetLabelDetectionResponse]
$creadList :: ReadS [GetLabelDetectionResponse]
readsPrec :: Int -> ReadS GetLabelDetectionResponse
$creadsPrec :: Int -> ReadS GetLabelDetectionResponse
Prelude.Read, Int -> GetLabelDetectionResponse -> ShowS
[GetLabelDetectionResponse] -> ShowS
GetLabelDetectionResponse -> String
(Int -> GetLabelDetectionResponse -> ShowS)
-> (GetLabelDetectionResponse -> String)
-> ([GetLabelDetectionResponse] -> ShowS)
-> Show GetLabelDetectionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetLabelDetectionResponse] -> ShowS
$cshowList :: [GetLabelDetectionResponse] -> ShowS
show :: GetLabelDetectionResponse -> String
$cshow :: GetLabelDetectionResponse -> String
showsPrec :: Int -> GetLabelDetectionResponse -> ShowS
$cshowsPrec :: Int -> GetLabelDetectionResponse -> ShowS
Prelude.Show, (forall x.
 GetLabelDetectionResponse -> Rep GetLabelDetectionResponse x)
-> (forall x.
    Rep GetLabelDetectionResponse x -> GetLabelDetectionResponse)
-> Generic GetLabelDetectionResponse
forall x.
Rep GetLabelDetectionResponse x -> GetLabelDetectionResponse
forall x.
GetLabelDetectionResponse -> Rep GetLabelDetectionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetLabelDetectionResponse x -> GetLabelDetectionResponse
$cfrom :: forall x.
GetLabelDetectionResponse -> Rep GetLabelDetectionResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetLabelDetectionResponse' 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:
--
-- 'nextToken', 'getLabelDetectionResponse_nextToken' - If the response is truncated, Amazon Rekognition Video returns this
-- token that you can use in the subsequent request to retrieve the next
-- set of labels.
--
-- 'videoMetadata', 'getLabelDetectionResponse_videoMetadata' - Information about a video that Amazon Rekognition Video analyzed.
-- @Videometadata@ is returned in every page of paginated responses from a
-- Amazon Rekognition video operation.
--
-- 'statusMessage', 'getLabelDetectionResponse_statusMessage' - If the job fails, @StatusMessage@ provides a descriptive error message.
--
-- 'labels', 'getLabelDetectionResponse_labels' - An array of labels detected in the video. Each element contains the
-- detected label and the time, in milliseconds from the start of the
-- video, that the label was detected.
--
-- 'jobStatus', 'getLabelDetectionResponse_jobStatus' - The current status of the label detection job.
--
-- 'labelModelVersion', 'getLabelDetectionResponse_labelModelVersion' - Version number of the label detection model that was used to detect
-- labels.
--
-- 'httpStatus', 'getLabelDetectionResponse_httpStatus' - The response's http status code.
newGetLabelDetectionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetLabelDetectionResponse
newGetLabelDetectionResponse :: Int -> GetLabelDetectionResponse
newGetLabelDetectionResponse Int
pHttpStatus_ =
  GetLabelDetectionResponse' :: Maybe Text
-> Maybe VideoMetadata
-> Maybe Text
-> Maybe [LabelDetection]
-> Maybe VideoJobStatus
-> Maybe Text
-> Int
-> GetLabelDetectionResponse
GetLabelDetectionResponse'
    { $sel:nextToken:GetLabelDetectionResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:videoMetadata:GetLabelDetectionResponse' :: Maybe VideoMetadata
videoMetadata = Maybe VideoMetadata
forall a. Maybe a
Prelude.Nothing,
      $sel:statusMessage:GetLabelDetectionResponse' :: Maybe Text
statusMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:labels:GetLabelDetectionResponse' :: Maybe [LabelDetection]
labels = Maybe [LabelDetection]
forall a. Maybe a
Prelude.Nothing,
      $sel:jobStatus:GetLabelDetectionResponse' :: Maybe VideoJobStatus
jobStatus = Maybe VideoJobStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:labelModelVersion:GetLabelDetectionResponse' :: Maybe Text
labelModelVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetLabelDetectionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | If the response is truncated, Amazon Rekognition Video returns this
-- token that you can use in the subsequent request to retrieve the next
-- set of labels.
getLabelDetectionResponse_nextToken :: Lens.Lens' GetLabelDetectionResponse (Prelude.Maybe Prelude.Text)
getLabelDetectionResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetLabelDetectionResponse -> f GetLabelDetectionResponse
getLabelDetectionResponse_nextToken = (GetLabelDetectionResponse -> Maybe Text)
-> (GetLabelDetectionResponse
    -> Maybe Text -> GetLabelDetectionResponse)
-> Lens
     GetLabelDetectionResponse
     GetLabelDetectionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLabelDetectionResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetLabelDetectionResponse' :: GetLabelDetectionResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetLabelDetectionResponse
s@GetLabelDetectionResponse' {} Maybe Text
a -> GetLabelDetectionResponse
s {$sel:nextToken:GetLabelDetectionResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetLabelDetectionResponse)

-- | Information about a video that Amazon Rekognition Video analyzed.
-- @Videometadata@ is returned in every page of paginated responses from a
-- Amazon Rekognition video operation.
getLabelDetectionResponse_videoMetadata :: Lens.Lens' GetLabelDetectionResponse (Prelude.Maybe VideoMetadata)
getLabelDetectionResponse_videoMetadata :: (Maybe VideoMetadata -> f (Maybe VideoMetadata))
-> GetLabelDetectionResponse -> f GetLabelDetectionResponse
getLabelDetectionResponse_videoMetadata = (GetLabelDetectionResponse -> Maybe VideoMetadata)
-> (GetLabelDetectionResponse
    -> Maybe VideoMetadata -> GetLabelDetectionResponse)
-> Lens
     GetLabelDetectionResponse
     GetLabelDetectionResponse
     (Maybe VideoMetadata)
     (Maybe VideoMetadata)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLabelDetectionResponse' {Maybe VideoMetadata
videoMetadata :: Maybe VideoMetadata
$sel:videoMetadata:GetLabelDetectionResponse' :: GetLabelDetectionResponse -> Maybe VideoMetadata
videoMetadata} -> Maybe VideoMetadata
videoMetadata) (\s :: GetLabelDetectionResponse
s@GetLabelDetectionResponse' {} Maybe VideoMetadata
a -> GetLabelDetectionResponse
s {$sel:videoMetadata:GetLabelDetectionResponse' :: Maybe VideoMetadata
videoMetadata = Maybe VideoMetadata
a} :: GetLabelDetectionResponse)

-- | If the job fails, @StatusMessage@ provides a descriptive error message.
getLabelDetectionResponse_statusMessage :: Lens.Lens' GetLabelDetectionResponse (Prelude.Maybe Prelude.Text)
getLabelDetectionResponse_statusMessage :: (Maybe Text -> f (Maybe Text))
-> GetLabelDetectionResponse -> f GetLabelDetectionResponse
getLabelDetectionResponse_statusMessage = (GetLabelDetectionResponse -> Maybe Text)
-> (GetLabelDetectionResponse
    -> Maybe Text -> GetLabelDetectionResponse)
-> Lens
     GetLabelDetectionResponse
     GetLabelDetectionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLabelDetectionResponse' {Maybe Text
statusMessage :: Maybe Text
$sel:statusMessage:GetLabelDetectionResponse' :: GetLabelDetectionResponse -> Maybe Text
statusMessage} -> Maybe Text
statusMessage) (\s :: GetLabelDetectionResponse
s@GetLabelDetectionResponse' {} Maybe Text
a -> GetLabelDetectionResponse
s {$sel:statusMessage:GetLabelDetectionResponse' :: Maybe Text
statusMessage = Maybe Text
a} :: GetLabelDetectionResponse)

-- | An array of labels detected in the video. Each element contains the
-- detected label and the time, in milliseconds from the start of the
-- video, that the label was detected.
getLabelDetectionResponse_labels :: Lens.Lens' GetLabelDetectionResponse (Prelude.Maybe [LabelDetection])
getLabelDetectionResponse_labels :: (Maybe [LabelDetection] -> f (Maybe [LabelDetection]))
-> GetLabelDetectionResponse -> f GetLabelDetectionResponse
getLabelDetectionResponse_labels = (GetLabelDetectionResponse -> Maybe [LabelDetection])
-> (GetLabelDetectionResponse
    -> Maybe [LabelDetection] -> GetLabelDetectionResponse)
-> Lens
     GetLabelDetectionResponse
     GetLabelDetectionResponse
     (Maybe [LabelDetection])
     (Maybe [LabelDetection])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLabelDetectionResponse' {Maybe [LabelDetection]
labels :: Maybe [LabelDetection]
$sel:labels:GetLabelDetectionResponse' :: GetLabelDetectionResponse -> Maybe [LabelDetection]
labels} -> Maybe [LabelDetection]
labels) (\s :: GetLabelDetectionResponse
s@GetLabelDetectionResponse' {} Maybe [LabelDetection]
a -> GetLabelDetectionResponse
s {$sel:labels:GetLabelDetectionResponse' :: Maybe [LabelDetection]
labels = Maybe [LabelDetection]
a} :: GetLabelDetectionResponse) ((Maybe [LabelDetection] -> f (Maybe [LabelDetection]))
 -> GetLabelDetectionResponse -> f GetLabelDetectionResponse)
-> ((Maybe [LabelDetection] -> f (Maybe [LabelDetection]))
    -> Maybe [LabelDetection] -> f (Maybe [LabelDetection]))
-> (Maybe [LabelDetection] -> f (Maybe [LabelDetection]))
-> GetLabelDetectionResponse
-> f GetLabelDetectionResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [LabelDetection] [LabelDetection] [LabelDetection] [LabelDetection]
-> Iso
     (Maybe [LabelDetection])
     (Maybe [LabelDetection])
     (Maybe [LabelDetection])
     (Maybe [LabelDetection])
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
  [LabelDetection] [LabelDetection] [LabelDetection] [LabelDetection]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The current status of the label detection job.
getLabelDetectionResponse_jobStatus :: Lens.Lens' GetLabelDetectionResponse (Prelude.Maybe VideoJobStatus)
getLabelDetectionResponse_jobStatus :: (Maybe VideoJobStatus -> f (Maybe VideoJobStatus))
-> GetLabelDetectionResponse -> f GetLabelDetectionResponse
getLabelDetectionResponse_jobStatus = (GetLabelDetectionResponse -> Maybe VideoJobStatus)
-> (GetLabelDetectionResponse
    -> Maybe VideoJobStatus -> GetLabelDetectionResponse)
-> Lens
     GetLabelDetectionResponse
     GetLabelDetectionResponse
     (Maybe VideoJobStatus)
     (Maybe VideoJobStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLabelDetectionResponse' {Maybe VideoJobStatus
jobStatus :: Maybe VideoJobStatus
$sel:jobStatus:GetLabelDetectionResponse' :: GetLabelDetectionResponse -> Maybe VideoJobStatus
jobStatus} -> Maybe VideoJobStatus
jobStatus) (\s :: GetLabelDetectionResponse
s@GetLabelDetectionResponse' {} Maybe VideoJobStatus
a -> GetLabelDetectionResponse
s {$sel:jobStatus:GetLabelDetectionResponse' :: Maybe VideoJobStatus
jobStatus = Maybe VideoJobStatus
a} :: GetLabelDetectionResponse)

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

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

instance Prelude.NFData GetLabelDetectionResponse