{-# 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.GetFaceSearch
-- 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 face search results for Amazon Rekognition Video face search
-- started by StartFaceSearch. The search returns faces in a collection
-- that match the faces of persons detected in a video. It also includes
-- the time(s) that faces are matched in the video.
--
-- Face search in a video is an asynchronous operation. You start face
-- search by calling to StartFaceSearch which returns a job identifier
-- (@JobId@). When the search operation finishes, Amazon Rekognition Video
-- publishes a completion status to the Amazon Simple Notification Service
-- topic registered in the initial call to @StartFaceSearch@. To get the
-- search results, first check that the status value published to the
-- Amazon SNS topic is @SUCCEEDED@. If so, call @GetFaceSearch@ and pass
-- the job identifier (@JobId@) from the initial call to @StartFaceSearch@.
--
-- For more information, see Searching Faces in a Collection in the Amazon
-- Rekognition Developer Guide.
--
-- The search results are retured in an array, @Persons@, of PersonMatch
-- objects. Each@PersonMatch@ element contains details about the matching
-- faces in the input collection, person information (facial attributes,
-- bounding boxes, and person identifer) for the matched person, and the
-- time the person was matched in the video.
--
-- @GetFaceSearch@ only returns the default facial attributes
-- (@BoundingBox@, @Confidence@, @Landmarks@, @Pose@, and @Quality@). The
-- other facial attributes listed in the @Face@ object of the following
-- response syntax are not returned. For more information, see FaceDetail
-- in the Amazon Rekognition Developer Guide.
--
-- By default, the @Persons@ array is sorted by the time, in milliseconds
-- from the start of the video, persons are matched. You can also sort by
-- persons by specifying @INDEX@ for the @SORTBY@ input parameter.
module Amazonka.Rekognition.GetFaceSearch
  ( -- * Creating a Request
    GetFaceSearch (..),
    newGetFaceSearch,

    -- * Request Lenses
    getFaceSearch_nextToken,
    getFaceSearch_maxResults,
    getFaceSearch_sortBy,
    getFaceSearch_jobId,

    -- * Destructuring the Response
    GetFaceSearchResponse (..),
    newGetFaceSearchResponse,

    -- * Response Lenses
    getFaceSearchResponse_nextToken,
    getFaceSearchResponse_videoMetadata,
    getFaceSearchResponse_statusMessage,
    getFaceSearchResponse_jobStatus,
    getFaceSearchResponse_persons,
    getFaceSearchResponse_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:/ 'newGetFaceSearch' smart constructor.
data GetFaceSearch = GetFaceSearch'
  { -- | If the previous response was incomplete (because there is more search
    -- results to retrieve), Amazon Rekognition Video returns a pagination
    -- token in the response. You can use this pagination token to retrieve the
    -- next set of search results.
    GetFaceSearch -> 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.
    GetFaceSearch -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | Sort to use for grouping faces in the response. Use @TIMESTAMP@ to group
    -- faces by the time that they are recognized. Use @INDEX@ to sort by
    -- recognized faces.
    GetFaceSearch -> Maybe FaceSearchSortBy
sortBy :: Prelude.Maybe FaceSearchSortBy,
    -- | The job identifer for the search request. You get the job identifier
    -- from an initial call to @StartFaceSearch@.
    GetFaceSearch -> Text
jobId :: Prelude.Text
  }
  deriving (GetFaceSearch -> GetFaceSearch -> Bool
(GetFaceSearch -> GetFaceSearch -> Bool)
-> (GetFaceSearch -> GetFaceSearch -> Bool) -> Eq GetFaceSearch
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetFaceSearch -> GetFaceSearch -> Bool
$c/= :: GetFaceSearch -> GetFaceSearch -> Bool
== :: GetFaceSearch -> GetFaceSearch -> Bool
$c== :: GetFaceSearch -> GetFaceSearch -> Bool
Prelude.Eq, ReadPrec [GetFaceSearch]
ReadPrec GetFaceSearch
Int -> ReadS GetFaceSearch
ReadS [GetFaceSearch]
(Int -> ReadS GetFaceSearch)
-> ReadS [GetFaceSearch]
-> ReadPrec GetFaceSearch
-> ReadPrec [GetFaceSearch]
-> Read GetFaceSearch
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetFaceSearch]
$creadListPrec :: ReadPrec [GetFaceSearch]
readPrec :: ReadPrec GetFaceSearch
$creadPrec :: ReadPrec GetFaceSearch
readList :: ReadS [GetFaceSearch]
$creadList :: ReadS [GetFaceSearch]
readsPrec :: Int -> ReadS GetFaceSearch
$creadsPrec :: Int -> ReadS GetFaceSearch
Prelude.Read, Int -> GetFaceSearch -> ShowS
[GetFaceSearch] -> ShowS
GetFaceSearch -> String
(Int -> GetFaceSearch -> ShowS)
-> (GetFaceSearch -> String)
-> ([GetFaceSearch] -> ShowS)
-> Show GetFaceSearch
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetFaceSearch] -> ShowS
$cshowList :: [GetFaceSearch] -> ShowS
show :: GetFaceSearch -> String
$cshow :: GetFaceSearch -> String
showsPrec :: Int -> GetFaceSearch -> ShowS
$cshowsPrec :: Int -> GetFaceSearch -> ShowS
Prelude.Show, (forall x. GetFaceSearch -> Rep GetFaceSearch x)
-> (forall x. Rep GetFaceSearch x -> GetFaceSearch)
-> Generic GetFaceSearch
forall x. Rep GetFaceSearch x -> GetFaceSearch
forall x. GetFaceSearch -> Rep GetFaceSearch x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetFaceSearch x -> GetFaceSearch
$cfrom :: forall x. GetFaceSearch -> Rep GetFaceSearch x
Prelude.Generic)

-- |
-- Create a value of 'GetFaceSearch' 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', 'getFaceSearch_nextToken' - If the previous response was incomplete (because there is more search
-- results to retrieve), Amazon Rekognition Video returns a pagination
-- token in the response. You can use this pagination token to retrieve the
-- next set of search results.
--
-- 'maxResults', 'getFaceSearch_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', 'getFaceSearch_sortBy' - Sort to use for grouping faces in the response. Use @TIMESTAMP@ to group
-- faces by the time that they are recognized. Use @INDEX@ to sort by
-- recognized faces.
--
-- 'jobId', 'getFaceSearch_jobId' - The job identifer for the search request. You get the job identifier
-- from an initial call to @StartFaceSearch@.
newGetFaceSearch ::
  -- | 'jobId'
  Prelude.Text ->
  GetFaceSearch
newGetFaceSearch :: Text -> GetFaceSearch
newGetFaceSearch Text
pJobId_ =
  GetFaceSearch' :: Maybe Text
-> Maybe Natural -> Maybe FaceSearchSortBy -> Text -> GetFaceSearch
GetFaceSearch'
    { $sel:nextToken:GetFaceSearch' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:GetFaceSearch' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:sortBy:GetFaceSearch' :: Maybe FaceSearchSortBy
sortBy = Maybe FaceSearchSortBy
forall a. Maybe a
Prelude.Nothing,
      $sel:jobId:GetFaceSearch' :: Text
jobId = Text
pJobId_
    }

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

-- | 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.
getFaceSearch_maxResults :: Lens.Lens' GetFaceSearch (Prelude.Maybe Prelude.Natural)
getFaceSearch_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> GetFaceSearch -> f GetFaceSearch
getFaceSearch_maxResults = (GetFaceSearch -> Maybe Natural)
-> (GetFaceSearch -> Maybe Natural -> GetFaceSearch)
-> Lens GetFaceSearch GetFaceSearch (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFaceSearch' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetFaceSearch' :: GetFaceSearch -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetFaceSearch
s@GetFaceSearch' {} Maybe Natural
a -> GetFaceSearch
s {$sel:maxResults:GetFaceSearch' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetFaceSearch)

-- | Sort to use for grouping faces in the response. Use @TIMESTAMP@ to group
-- faces by the time that they are recognized. Use @INDEX@ to sort by
-- recognized faces.
getFaceSearch_sortBy :: Lens.Lens' GetFaceSearch (Prelude.Maybe FaceSearchSortBy)
getFaceSearch_sortBy :: (Maybe FaceSearchSortBy -> f (Maybe FaceSearchSortBy))
-> GetFaceSearch -> f GetFaceSearch
getFaceSearch_sortBy = (GetFaceSearch -> Maybe FaceSearchSortBy)
-> (GetFaceSearch -> Maybe FaceSearchSortBy -> GetFaceSearch)
-> Lens
     GetFaceSearch
     GetFaceSearch
     (Maybe FaceSearchSortBy)
     (Maybe FaceSearchSortBy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFaceSearch' {Maybe FaceSearchSortBy
sortBy :: Maybe FaceSearchSortBy
$sel:sortBy:GetFaceSearch' :: GetFaceSearch -> Maybe FaceSearchSortBy
sortBy} -> Maybe FaceSearchSortBy
sortBy) (\s :: GetFaceSearch
s@GetFaceSearch' {} Maybe FaceSearchSortBy
a -> GetFaceSearch
s {$sel:sortBy:GetFaceSearch' :: Maybe FaceSearchSortBy
sortBy = Maybe FaceSearchSortBy
a} :: GetFaceSearch)

-- | The job identifer for the search request. You get the job identifier
-- from an initial call to @StartFaceSearch@.
getFaceSearch_jobId :: Lens.Lens' GetFaceSearch Prelude.Text
getFaceSearch_jobId :: (Text -> f Text) -> GetFaceSearch -> f GetFaceSearch
getFaceSearch_jobId = (GetFaceSearch -> Text)
-> (GetFaceSearch -> Text -> GetFaceSearch)
-> Lens GetFaceSearch GetFaceSearch Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFaceSearch' {Text
jobId :: Text
$sel:jobId:GetFaceSearch' :: GetFaceSearch -> Text
jobId} -> Text
jobId) (\s :: GetFaceSearch
s@GetFaceSearch' {} Text
a -> GetFaceSearch
s {$sel:jobId:GetFaceSearch' :: Text
jobId = Text
a} :: GetFaceSearch)

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

instance Prelude.NFData GetFaceSearch

instance Core.ToHeaders GetFaceSearch where
  toHeaders :: GetFaceSearch -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetFaceSearch -> 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.GetFaceSearch" ::
                          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 GetFaceSearch where
  toJSON :: GetFaceSearch -> Value
toJSON GetFaceSearch' {Maybe Natural
Maybe Text
Maybe FaceSearchSortBy
Text
jobId :: Text
sortBy :: Maybe FaceSearchSortBy
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:jobId:GetFaceSearch' :: GetFaceSearch -> Text
$sel:sortBy:GetFaceSearch' :: GetFaceSearch -> Maybe FaceSearchSortBy
$sel:maxResults:GetFaceSearch' :: GetFaceSearch -> Maybe Natural
$sel:nextToken:GetFaceSearch' :: GetFaceSearch -> 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 -> FaceSearchSortBy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (FaceSearchSortBy -> Pair) -> Maybe FaceSearchSortBy -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FaceSearchSortBy
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 GetFaceSearch where
  toPath :: GetFaceSearch -> ByteString
toPath = ByteString -> GetFaceSearch -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newGetFaceSearchResponse' smart constructor.
data GetFaceSearchResponse = GetFaceSearchResponse'
  { -- | 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 search results.
    GetFaceSearchResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Information about a video that Amazon Rekognition analyzed.
    -- @Videometadata@ is returned in every page of paginated responses from a
    -- Amazon Rekognition Video operation.
    GetFaceSearchResponse -> Maybe VideoMetadata
videoMetadata :: Prelude.Maybe VideoMetadata,
    -- | If the job fails, @StatusMessage@ provides a descriptive error message.
    GetFaceSearchResponse -> Maybe Text
statusMessage :: Prelude.Maybe Prelude.Text,
    -- | The current status of the face search job.
    GetFaceSearchResponse -> Maybe VideoJobStatus
jobStatus :: Prelude.Maybe VideoJobStatus,
    -- | An array of persons, PersonMatch, in the video whose face(s) match the
    -- face(s) in an Amazon Rekognition collection. It also includes time
    -- information for when persons are matched in the video. You specify the
    -- input collection in an initial call to @StartFaceSearch@. Each @Persons@
    -- element includes a time the person was matched, face match details
    -- (@FaceMatches@) for matching faces in the collection, and person
    -- information (@Person@) for the matched person.
    GetFaceSearchResponse -> Maybe [PersonMatch]
persons :: Prelude.Maybe [PersonMatch],
    -- | The response's http status code.
    GetFaceSearchResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetFaceSearchResponse -> GetFaceSearchResponse -> Bool
(GetFaceSearchResponse -> GetFaceSearchResponse -> Bool)
-> (GetFaceSearchResponse -> GetFaceSearchResponse -> Bool)
-> Eq GetFaceSearchResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetFaceSearchResponse -> GetFaceSearchResponse -> Bool
$c/= :: GetFaceSearchResponse -> GetFaceSearchResponse -> Bool
== :: GetFaceSearchResponse -> GetFaceSearchResponse -> Bool
$c== :: GetFaceSearchResponse -> GetFaceSearchResponse -> Bool
Prelude.Eq, ReadPrec [GetFaceSearchResponse]
ReadPrec GetFaceSearchResponse
Int -> ReadS GetFaceSearchResponse
ReadS [GetFaceSearchResponse]
(Int -> ReadS GetFaceSearchResponse)
-> ReadS [GetFaceSearchResponse]
-> ReadPrec GetFaceSearchResponse
-> ReadPrec [GetFaceSearchResponse]
-> Read GetFaceSearchResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetFaceSearchResponse]
$creadListPrec :: ReadPrec [GetFaceSearchResponse]
readPrec :: ReadPrec GetFaceSearchResponse
$creadPrec :: ReadPrec GetFaceSearchResponse
readList :: ReadS [GetFaceSearchResponse]
$creadList :: ReadS [GetFaceSearchResponse]
readsPrec :: Int -> ReadS GetFaceSearchResponse
$creadsPrec :: Int -> ReadS GetFaceSearchResponse
Prelude.Read, Int -> GetFaceSearchResponse -> ShowS
[GetFaceSearchResponse] -> ShowS
GetFaceSearchResponse -> String
(Int -> GetFaceSearchResponse -> ShowS)
-> (GetFaceSearchResponse -> String)
-> ([GetFaceSearchResponse] -> ShowS)
-> Show GetFaceSearchResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetFaceSearchResponse] -> ShowS
$cshowList :: [GetFaceSearchResponse] -> ShowS
show :: GetFaceSearchResponse -> String
$cshow :: GetFaceSearchResponse -> String
showsPrec :: Int -> GetFaceSearchResponse -> ShowS
$cshowsPrec :: Int -> GetFaceSearchResponse -> ShowS
Prelude.Show, (forall x. GetFaceSearchResponse -> Rep GetFaceSearchResponse x)
-> (forall x. Rep GetFaceSearchResponse x -> GetFaceSearchResponse)
-> Generic GetFaceSearchResponse
forall x. Rep GetFaceSearchResponse x -> GetFaceSearchResponse
forall x. GetFaceSearchResponse -> Rep GetFaceSearchResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetFaceSearchResponse x -> GetFaceSearchResponse
$cfrom :: forall x. GetFaceSearchResponse -> Rep GetFaceSearchResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetFaceSearchResponse' 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', 'getFaceSearchResponse_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 search results.
--
-- 'videoMetadata', 'getFaceSearchResponse_videoMetadata' - Information about a video that Amazon Rekognition analyzed.
-- @Videometadata@ is returned in every page of paginated responses from a
-- Amazon Rekognition Video operation.
--
-- 'statusMessage', 'getFaceSearchResponse_statusMessage' - If the job fails, @StatusMessage@ provides a descriptive error message.
--
-- 'jobStatus', 'getFaceSearchResponse_jobStatus' - The current status of the face search job.
--
-- 'persons', 'getFaceSearchResponse_persons' - An array of persons, PersonMatch, in the video whose face(s) match the
-- face(s) in an Amazon Rekognition collection. It also includes time
-- information for when persons are matched in the video. You specify the
-- input collection in an initial call to @StartFaceSearch@. Each @Persons@
-- element includes a time the person was matched, face match details
-- (@FaceMatches@) for matching faces in the collection, and person
-- information (@Person@) for the matched person.
--
-- 'httpStatus', 'getFaceSearchResponse_httpStatus' - The response's http status code.
newGetFaceSearchResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetFaceSearchResponse
newGetFaceSearchResponse :: Int -> GetFaceSearchResponse
newGetFaceSearchResponse Int
pHttpStatus_ =
  GetFaceSearchResponse' :: Maybe Text
-> Maybe VideoMetadata
-> Maybe Text
-> Maybe VideoJobStatus
-> Maybe [PersonMatch]
-> Int
-> GetFaceSearchResponse
GetFaceSearchResponse'
    { $sel:nextToken:GetFaceSearchResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:videoMetadata:GetFaceSearchResponse' :: Maybe VideoMetadata
videoMetadata = Maybe VideoMetadata
forall a. Maybe a
Prelude.Nothing,
      $sel:statusMessage:GetFaceSearchResponse' :: Maybe Text
statusMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:jobStatus:GetFaceSearchResponse' :: Maybe VideoJobStatus
jobStatus = Maybe VideoJobStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:persons:GetFaceSearchResponse' :: Maybe [PersonMatch]
persons = Maybe [PersonMatch]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetFaceSearchResponse' :: 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 search results.
getFaceSearchResponse_nextToken :: Lens.Lens' GetFaceSearchResponse (Prelude.Maybe Prelude.Text)
getFaceSearchResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetFaceSearchResponse -> f GetFaceSearchResponse
getFaceSearchResponse_nextToken = (GetFaceSearchResponse -> Maybe Text)
-> (GetFaceSearchResponse -> Maybe Text -> GetFaceSearchResponse)
-> Lens
     GetFaceSearchResponse
     GetFaceSearchResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFaceSearchResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetFaceSearchResponse' :: GetFaceSearchResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetFaceSearchResponse
s@GetFaceSearchResponse' {} Maybe Text
a -> GetFaceSearchResponse
s {$sel:nextToken:GetFaceSearchResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetFaceSearchResponse)

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

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

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

-- | An array of persons, PersonMatch, in the video whose face(s) match the
-- face(s) in an Amazon Rekognition collection. It also includes time
-- information for when persons are matched in the video. You specify the
-- input collection in an initial call to @StartFaceSearch@. Each @Persons@
-- element includes a time the person was matched, face match details
-- (@FaceMatches@) for matching faces in the collection, and person
-- information (@Person@) for the matched person.
getFaceSearchResponse_persons :: Lens.Lens' GetFaceSearchResponse (Prelude.Maybe [PersonMatch])
getFaceSearchResponse_persons :: (Maybe [PersonMatch] -> f (Maybe [PersonMatch]))
-> GetFaceSearchResponse -> f GetFaceSearchResponse
getFaceSearchResponse_persons = (GetFaceSearchResponse -> Maybe [PersonMatch])
-> (GetFaceSearchResponse
    -> Maybe [PersonMatch] -> GetFaceSearchResponse)
-> Lens
     GetFaceSearchResponse
     GetFaceSearchResponse
     (Maybe [PersonMatch])
     (Maybe [PersonMatch])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFaceSearchResponse' {Maybe [PersonMatch]
persons :: Maybe [PersonMatch]
$sel:persons:GetFaceSearchResponse' :: GetFaceSearchResponse -> Maybe [PersonMatch]
persons} -> Maybe [PersonMatch]
persons) (\s :: GetFaceSearchResponse
s@GetFaceSearchResponse' {} Maybe [PersonMatch]
a -> GetFaceSearchResponse
s {$sel:persons:GetFaceSearchResponse' :: Maybe [PersonMatch]
persons = Maybe [PersonMatch]
a} :: GetFaceSearchResponse) ((Maybe [PersonMatch] -> f (Maybe [PersonMatch]))
 -> GetFaceSearchResponse -> f GetFaceSearchResponse)
-> ((Maybe [PersonMatch] -> f (Maybe [PersonMatch]))
    -> Maybe [PersonMatch] -> f (Maybe [PersonMatch]))
-> (Maybe [PersonMatch] -> f (Maybe [PersonMatch]))
-> GetFaceSearchResponse
-> f GetFaceSearchResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [PersonMatch] [PersonMatch] [PersonMatch] [PersonMatch]
-> Iso
     (Maybe [PersonMatch])
     (Maybe [PersonMatch])
     (Maybe [PersonMatch])
     (Maybe [PersonMatch])
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 [PersonMatch] [PersonMatch] [PersonMatch] [PersonMatch]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData GetFaceSearchResponse