{-# 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.GetContentModeration
-- 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 inappropriate, unwanted, or offensive content analysis results
-- for a Amazon Rekognition Video analysis started by
-- StartContentModeration. For a list of moderation labels in Amazon
-- Rekognition, see
-- <https://docs.aws.amazon.com/rekognition/latest/dg/moderation.html#moderation-api Using the image and video moderation APIs>.
--
-- Amazon Rekognition Video inappropriate or offensive content detection in
-- a stored video is an asynchronous operation. You start analysis by
-- calling StartContentModeration which returns a job identifier (@JobId@).
-- When analysis finishes, Amazon Rekognition Video publishes a completion
-- status to the Amazon Simple Notification Service topic registered in the
-- initial call to @StartContentModeration@. To get the results of the
-- content analysis, first check that the status value published to the
-- Amazon SNS topic is @SUCCEEDED@. If so, call @GetContentModeration@ and
-- pass the job identifier (@JobId@) from the initial call to
-- @StartContentModeration@.
--
-- For more information, see Working with Stored Videos in the Amazon
-- Rekognition Devlopers Guide.
--
-- @GetContentModeration@ returns detected inappropriate, unwanted, or
-- offensive content moderation labels, and the time they are detected, in
-- an array, @ModerationLabels@, of ContentModerationDetection objects.
--
-- By default, the moderated labels are returned sorted by time, in
-- milliseconds from the start of the video. You can also sort them by
-- moderated label by specifying @NAME@ for the @SortBy@ input parameter.
--
-- Since video analysis can return a large number of results, use the
-- @MaxResults@ parameter to limit the number of labels returned in a
-- single call to @GetContentModeration@. 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 @GetContentModeration@
-- and populate the @NextToken@ request parameter with the value of
-- @NextToken@ returned from the previous call to @GetContentModeration@.
--
-- For more information, see Content moderation in the Amazon Rekognition
-- Developer Guide.
module Amazonka.Rekognition.GetContentModeration
  ( -- * Creating a Request
    GetContentModeration (..),
    newGetContentModeration,

    -- * Request Lenses
    getContentModeration_nextToken,
    getContentModeration_maxResults,
    getContentModeration_sortBy,
    getContentModeration_jobId,

    -- * Destructuring the Response
    GetContentModerationResponse (..),
    newGetContentModerationResponse,

    -- * Response Lenses
    getContentModerationResponse_nextToken,
    getContentModerationResponse_videoMetadata,
    getContentModerationResponse_statusMessage,
    getContentModerationResponse_jobStatus,
    getContentModerationResponse_moderationModelVersion,
    getContentModerationResponse_moderationLabels,
    getContentModerationResponse_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:/ 'newGetContentModeration' smart constructor.
data GetContentModeration = GetContentModeration'
  { -- | If the previous response was incomplete (because there is more data to
    -- retrieve), Amazon Rekognition returns a pagination token in the
    -- response. You can use this pagination token to retrieve the next set of
    -- content moderation labels.
    GetContentModeration -> 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.
    GetContentModeration -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | Sort to use for elements in the @ModerationLabelDetections@ 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@.
    GetContentModeration -> Maybe ContentModerationSortBy
sortBy :: Prelude.Maybe ContentModerationSortBy,
    -- | The identifier for the inappropriate, unwanted, or offensive content
    -- moderation job. Use @JobId@ to identify the job in a subsequent call to
    -- @GetContentModeration@.
    GetContentModeration -> Text
jobId :: Prelude.Text
  }
  deriving (GetContentModeration -> GetContentModeration -> Bool
(GetContentModeration -> GetContentModeration -> Bool)
-> (GetContentModeration -> GetContentModeration -> Bool)
-> Eq GetContentModeration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetContentModeration -> GetContentModeration -> Bool
$c/= :: GetContentModeration -> GetContentModeration -> Bool
== :: GetContentModeration -> GetContentModeration -> Bool
$c== :: GetContentModeration -> GetContentModeration -> Bool
Prelude.Eq, ReadPrec [GetContentModeration]
ReadPrec GetContentModeration
Int -> ReadS GetContentModeration
ReadS [GetContentModeration]
(Int -> ReadS GetContentModeration)
-> ReadS [GetContentModeration]
-> ReadPrec GetContentModeration
-> ReadPrec [GetContentModeration]
-> Read GetContentModeration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetContentModeration]
$creadListPrec :: ReadPrec [GetContentModeration]
readPrec :: ReadPrec GetContentModeration
$creadPrec :: ReadPrec GetContentModeration
readList :: ReadS [GetContentModeration]
$creadList :: ReadS [GetContentModeration]
readsPrec :: Int -> ReadS GetContentModeration
$creadsPrec :: Int -> ReadS GetContentModeration
Prelude.Read, Int -> GetContentModeration -> ShowS
[GetContentModeration] -> ShowS
GetContentModeration -> String
(Int -> GetContentModeration -> ShowS)
-> (GetContentModeration -> String)
-> ([GetContentModeration] -> ShowS)
-> Show GetContentModeration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetContentModeration] -> ShowS
$cshowList :: [GetContentModeration] -> ShowS
show :: GetContentModeration -> String
$cshow :: GetContentModeration -> String
showsPrec :: Int -> GetContentModeration -> ShowS
$cshowsPrec :: Int -> GetContentModeration -> ShowS
Prelude.Show, (forall x. GetContentModeration -> Rep GetContentModeration x)
-> (forall x. Rep GetContentModeration x -> GetContentModeration)
-> Generic GetContentModeration
forall x. Rep GetContentModeration x -> GetContentModeration
forall x. GetContentModeration -> Rep GetContentModeration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetContentModeration x -> GetContentModeration
$cfrom :: forall x. GetContentModeration -> Rep GetContentModeration x
Prelude.Generic)

-- |
-- Create a value of 'GetContentModeration' 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', 'getContentModeration_nextToken' - If the previous response was incomplete (because there is more data to
-- retrieve), Amazon Rekognition returns a pagination token in the
-- response. You can use this pagination token to retrieve the next set of
-- content moderation labels.
--
-- 'maxResults', 'getContentModeration_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', 'getContentModeration_sortBy' - Sort to use for elements in the @ModerationLabelDetections@ 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', 'getContentModeration_jobId' - The identifier for the inappropriate, unwanted, or offensive content
-- moderation job. Use @JobId@ to identify the job in a subsequent call to
-- @GetContentModeration@.
newGetContentModeration ::
  -- | 'jobId'
  Prelude.Text ->
  GetContentModeration
newGetContentModeration :: Text -> GetContentModeration
newGetContentModeration Text
pJobId_ =
  GetContentModeration' :: Maybe Text
-> Maybe Natural
-> Maybe ContentModerationSortBy
-> Text
-> GetContentModeration
GetContentModeration'
    { $sel:nextToken:GetContentModeration' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:GetContentModeration' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:sortBy:GetContentModeration' :: Maybe ContentModerationSortBy
sortBy = Maybe ContentModerationSortBy
forall a. Maybe a
Prelude.Nothing,
      $sel:jobId:GetContentModeration' :: Text
jobId = Text
pJobId_
    }

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

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

-- | Sort to use for elements in the @ModerationLabelDetections@ 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@.
getContentModeration_sortBy :: Lens.Lens' GetContentModeration (Prelude.Maybe ContentModerationSortBy)
getContentModeration_sortBy :: (Maybe ContentModerationSortBy
 -> f (Maybe ContentModerationSortBy))
-> GetContentModeration -> f GetContentModeration
getContentModeration_sortBy = (GetContentModeration -> Maybe ContentModerationSortBy)
-> (GetContentModeration
    -> Maybe ContentModerationSortBy -> GetContentModeration)
-> Lens
     GetContentModeration
     GetContentModeration
     (Maybe ContentModerationSortBy)
     (Maybe ContentModerationSortBy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetContentModeration' {Maybe ContentModerationSortBy
sortBy :: Maybe ContentModerationSortBy
$sel:sortBy:GetContentModeration' :: GetContentModeration -> Maybe ContentModerationSortBy
sortBy} -> Maybe ContentModerationSortBy
sortBy) (\s :: GetContentModeration
s@GetContentModeration' {} Maybe ContentModerationSortBy
a -> GetContentModeration
s {$sel:sortBy:GetContentModeration' :: Maybe ContentModerationSortBy
sortBy = Maybe ContentModerationSortBy
a} :: GetContentModeration)

-- | The identifier for the inappropriate, unwanted, or offensive content
-- moderation job. Use @JobId@ to identify the job in a subsequent call to
-- @GetContentModeration@.
getContentModeration_jobId :: Lens.Lens' GetContentModeration Prelude.Text
getContentModeration_jobId :: (Text -> f Text) -> GetContentModeration -> f GetContentModeration
getContentModeration_jobId = (GetContentModeration -> Text)
-> (GetContentModeration -> Text -> GetContentModeration)
-> Lens GetContentModeration GetContentModeration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetContentModeration' {Text
jobId :: Text
$sel:jobId:GetContentModeration' :: GetContentModeration -> Text
jobId} -> Text
jobId) (\s :: GetContentModeration
s@GetContentModeration' {} Text
a -> GetContentModeration
s {$sel:jobId:GetContentModeration' :: Text
jobId = Text
a} :: GetContentModeration)

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

instance Prelude.NFData GetContentModeration

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

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

-- | /See:/ 'newGetContentModerationResponse' smart constructor.
data GetContentModerationResponse = GetContentModerationResponse'
  { -- | 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 content moderation labels.
    GetContentModerationResponse -> 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
    -- @GetContentModeration@.
    GetContentModerationResponse -> Maybe VideoMetadata
videoMetadata :: Prelude.Maybe VideoMetadata,
    -- | If the job fails, @StatusMessage@ provides a descriptive error message.
    GetContentModerationResponse -> Maybe Text
statusMessage :: Prelude.Maybe Prelude.Text,
    -- | The current status of the content moderation analysis job.
    GetContentModerationResponse -> Maybe VideoJobStatus
jobStatus :: Prelude.Maybe VideoJobStatus,
    -- | Version number of the moderation detection model that was used to detect
    -- inappropriate, unwanted, or offensive content.
    GetContentModerationResponse -> Maybe Text
moderationModelVersion :: Prelude.Maybe Prelude.Text,
    -- | The detected inappropriate, unwanted, or offensive content moderation
    -- labels and the time(s) they were detected.
    GetContentModerationResponse -> Maybe [ContentModerationDetection]
moderationLabels :: Prelude.Maybe [ContentModerationDetection],
    -- | The response's http status code.
    GetContentModerationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetContentModerationResponse
-> GetContentModerationResponse -> Bool
(GetContentModerationResponse
 -> GetContentModerationResponse -> Bool)
-> (GetContentModerationResponse
    -> GetContentModerationResponse -> Bool)
-> Eq GetContentModerationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetContentModerationResponse
-> GetContentModerationResponse -> Bool
$c/= :: GetContentModerationResponse
-> GetContentModerationResponse -> Bool
== :: GetContentModerationResponse
-> GetContentModerationResponse -> Bool
$c== :: GetContentModerationResponse
-> GetContentModerationResponse -> Bool
Prelude.Eq, ReadPrec [GetContentModerationResponse]
ReadPrec GetContentModerationResponse
Int -> ReadS GetContentModerationResponse
ReadS [GetContentModerationResponse]
(Int -> ReadS GetContentModerationResponse)
-> ReadS [GetContentModerationResponse]
-> ReadPrec GetContentModerationResponse
-> ReadPrec [GetContentModerationResponse]
-> Read GetContentModerationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetContentModerationResponse]
$creadListPrec :: ReadPrec [GetContentModerationResponse]
readPrec :: ReadPrec GetContentModerationResponse
$creadPrec :: ReadPrec GetContentModerationResponse
readList :: ReadS [GetContentModerationResponse]
$creadList :: ReadS [GetContentModerationResponse]
readsPrec :: Int -> ReadS GetContentModerationResponse
$creadsPrec :: Int -> ReadS GetContentModerationResponse
Prelude.Read, Int -> GetContentModerationResponse -> ShowS
[GetContentModerationResponse] -> ShowS
GetContentModerationResponse -> String
(Int -> GetContentModerationResponse -> ShowS)
-> (GetContentModerationResponse -> String)
-> ([GetContentModerationResponse] -> ShowS)
-> Show GetContentModerationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetContentModerationResponse] -> ShowS
$cshowList :: [GetContentModerationResponse] -> ShowS
show :: GetContentModerationResponse -> String
$cshow :: GetContentModerationResponse -> String
showsPrec :: Int -> GetContentModerationResponse -> ShowS
$cshowsPrec :: Int -> GetContentModerationResponse -> ShowS
Prelude.Show, (forall x.
 GetContentModerationResponse -> Rep GetContentModerationResponse x)
-> (forall x.
    Rep GetContentModerationResponse x -> GetContentModerationResponse)
-> Generic GetContentModerationResponse
forall x.
Rep GetContentModerationResponse x -> GetContentModerationResponse
forall x.
GetContentModerationResponse -> Rep GetContentModerationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetContentModerationResponse x -> GetContentModerationResponse
$cfrom :: forall x.
GetContentModerationResponse -> Rep GetContentModerationResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetContentModerationResponse' 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', 'getContentModerationResponse_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 content moderation labels.
--
-- 'videoMetadata', 'getContentModerationResponse_videoMetadata' - Information about a video that Amazon Rekognition analyzed.
-- @Videometadata@ is returned in every page of paginated responses from
-- @GetContentModeration@.
--
-- 'statusMessage', 'getContentModerationResponse_statusMessage' - If the job fails, @StatusMessage@ provides a descriptive error message.
--
-- 'jobStatus', 'getContentModerationResponse_jobStatus' - The current status of the content moderation analysis job.
--
-- 'moderationModelVersion', 'getContentModerationResponse_moderationModelVersion' - Version number of the moderation detection model that was used to detect
-- inappropriate, unwanted, or offensive content.
--
-- 'moderationLabels', 'getContentModerationResponse_moderationLabels' - The detected inappropriate, unwanted, or offensive content moderation
-- labels and the time(s) they were detected.
--
-- 'httpStatus', 'getContentModerationResponse_httpStatus' - The response's http status code.
newGetContentModerationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetContentModerationResponse
newGetContentModerationResponse :: Int -> GetContentModerationResponse
newGetContentModerationResponse Int
pHttpStatus_ =
  GetContentModerationResponse' :: Maybe Text
-> Maybe VideoMetadata
-> Maybe Text
-> Maybe VideoJobStatus
-> Maybe Text
-> Maybe [ContentModerationDetection]
-> Int
-> GetContentModerationResponse
GetContentModerationResponse'
    { $sel:nextToken:GetContentModerationResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:videoMetadata:GetContentModerationResponse' :: Maybe VideoMetadata
videoMetadata = Maybe VideoMetadata
forall a. Maybe a
Prelude.Nothing,
      $sel:statusMessage:GetContentModerationResponse' :: Maybe Text
statusMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:jobStatus:GetContentModerationResponse' :: Maybe VideoJobStatus
jobStatus = Maybe VideoJobStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:moderationModelVersion:GetContentModerationResponse' :: Maybe Text
moderationModelVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:moderationLabels:GetContentModerationResponse' :: Maybe [ContentModerationDetection]
moderationLabels = Maybe [ContentModerationDetection]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetContentModerationResponse' :: 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 content moderation labels.
getContentModerationResponse_nextToken :: Lens.Lens' GetContentModerationResponse (Prelude.Maybe Prelude.Text)
getContentModerationResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetContentModerationResponse -> f GetContentModerationResponse
getContentModerationResponse_nextToken = (GetContentModerationResponse -> Maybe Text)
-> (GetContentModerationResponse
    -> Maybe Text -> GetContentModerationResponse)
-> Lens
     GetContentModerationResponse
     GetContentModerationResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetContentModerationResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetContentModerationResponse' :: GetContentModerationResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetContentModerationResponse
s@GetContentModerationResponse' {} Maybe Text
a -> GetContentModerationResponse
s {$sel:nextToken:GetContentModerationResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetContentModerationResponse)

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

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

-- | The current status of the content moderation analysis job.
getContentModerationResponse_jobStatus :: Lens.Lens' GetContentModerationResponse (Prelude.Maybe VideoJobStatus)
getContentModerationResponse_jobStatus :: (Maybe VideoJobStatus -> f (Maybe VideoJobStatus))
-> GetContentModerationResponse -> f GetContentModerationResponse
getContentModerationResponse_jobStatus = (GetContentModerationResponse -> Maybe VideoJobStatus)
-> (GetContentModerationResponse
    -> Maybe VideoJobStatus -> GetContentModerationResponse)
-> Lens
     GetContentModerationResponse
     GetContentModerationResponse
     (Maybe VideoJobStatus)
     (Maybe VideoJobStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetContentModerationResponse' {Maybe VideoJobStatus
jobStatus :: Maybe VideoJobStatus
$sel:jobStatus:GetContentModerationResponse' :: GetContentModerationResponse -> Maybe VideoJobStatus
jobStatus} -> Maybe VideoJobStatus
jobStatus) (\s :: GetContentModerationResponse
s@GetContentModerationResponse' {} Maybe VideoJobStatus
a -> GetContentModerationResponse
s {$sel:jobStatus:GetContentModerationResponse' :: Maybe VideoJobStatus
jobStatus = Maybe VideoJobStatus
a} :: GetContentModerationResponse)

-- | Version number of the moderation detection model that was used to detect
-- inappropriate, unwanted, or offensive content.
getContentModerationResponse_moderationModelVersion :: Lens.Lens' GetContentModerationResponse (Prelude.Maybe Prelude.Text)
getContentModerationResponse_moderationModelVersion :: (Maybe Text -> f (Maybe Text))
-> GetContentModerationResponse -> f GetContentModerationResponse
getContentModerationResponse_moderationModelVersion = (GetContentModerationResponse -> Maybe Text)
-> (GetContentModerationResponse
    -> Maybe Text -> GetContentModerationResponse)
-> Lens
     GetContentModerationResponse
     GetContentModerationResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetContentModerationResponse' {Maybe Text
moderationModelVersion :: Maybe Text
$sel:moderationModelVersion:GetContentModerationResponse' :: GetContentModerationResponse -> Maybe Text
moderationModelVersion} -> Maybe Text
moderationModelVersion) (\s :: GetContentModerationResponse
s@GetContentModerationResponse' {} Maybe Text
a -> GetContentModerationResponse
s {$sel:moderationModelVersion:GetContentModerationResponse' :: Maybe Text
moderationModelVersion = Maybe Text
a} :: GetContentModerationResponse)

-- | The detected inappropriate, unwanted, or offensive content moderation
-- labels and the time(s) they were detected.
getContentModerationResponse_moderationLabels :: Lens.Lens' GetContentModerationResponse (Prelude.Maybe [ContentModerationDetection])
getContentModerationResponse_moderationLabels :: (Maybe [ContentModerationDetection]
 -> f (Maybe [ContentModerationDetection]))
-> GetContentModerationResponse -> f GetContentModerationResponse
getContentModerationResponse_moderationLabels = (GetContentModerationResponse
 -> Maybe [ContentModerationDetection])
-> (GetContentModerationResponse
    -> Maybe [ContentModerationDetection]
    -> GetContentModerationResponse)
-> Lens
     GetContentModerationResponse
     GetContentModerationResponse
     (Maybe [ContentModerationDetection])
     (Maybe [ContentModerationDetection])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetContentModerationResponse' {Maybe [ContentModerationDetection]
moderationLabels :: Maybe [ContentModerationDetection]
$sel:moderationLabels:GetContentModerationResponse' :: GetContentModerationResponse -> Maybe [ContentModerationDetection]
moderationLabels} -> Maybe [ContentModerationDetection]
moderationLabels) (\s :: GetContentModerationResponse
s@GetContentModerationResponse' {} Maybe [ContentModerationDetection]
a -> GetContentModerationResponse
s {$sel:moderationLabels:GetContentModerationResponse' :: Maybe [ContentModerationDetection]
moderationLabels = Maybe [ContentModerationDetection]
a} :: GetContentModerationResponse) ((Maybe [ContentModerationDetection]
  -> f (Maybe [ContentModerationDetection]))
 -> GetContentModerationResponse -> f GetContentModerationResponse)
-> ((Maybe [ContentModerationDetection]
     -> f (Maybe [ContentModerationDetection]))
    -> Maybe [ContentModerationDetection]
    -> f (Maybe [ContentModerationDetection]))
-> (Maybe [ContentModerationDetection]
    -> f (Maybe [ContentModerationDetection]))
-> GetContentModerationResponse
-> f GetContentModerationResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ContentModerationDetection]
  [ContentModerationDetection]
  [ContentModerationDetection]
  [ContentModerationDetection]
-> Iso
     (Maybe [ContentModerationDetection])
     (Maybe [ContentModerationDetection])
     (Maybe [ContentModerationDetection])
     (Maybe [ContentModerationDetection])
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
  [ContentModerationDetection]
  [ContentModerationDetection]
  [ContentModerationDetection]
  [ContentModerationDetection]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData GetContentModerationResponse