{-# 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.StartSegmentDetection
-- 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)
--
-- Starts asynchronous detection of segment detection in a stored video.
--
-- Amazon Rekognition Video can detect segments in a video stored in an
-- Amazon S3 bucket. Use Video to specify the bucket name and the filename
-- of the video. @StartSegmentDetection@ returns a job identifier (@JobId@)
-- which you use to get the results of the operation. When segment
-- detection is finished, Amazon Rekognition Video publishes a completion
-- status to the Amazon Simple Notification Service topic that you specify
-- in @NotificationChannel@.
--
-- You can use the @Filters@ (StartSegmentDetectionFilters) input parameter
-- to specify the minimum detection confidence returned in the response.
-- Within @Filters@, use @ShotFilter@ (StartShotDetectionFilter) to filter
-- detected shots. Use @TechnicalCueFilter@
-- (StartTechnicalCueDetectionFilter) to filter technical cues.
--
-- To get the results of the segment detection operation, first check that
-- the status value published to the Amazon SNS topic is @SUCCEEDED@. if
-- so, call GetSegmentDetection and pass the job identifier (@JobId@) from
-- the initial call to @StartSegmentDetection@.
--
-- For more information, see Detecting Video Segments in Stored Video in
-- the Amazon Rekognition Developer Guide.
module Amazonka.Rekognition.StartSegmentDetection
  ( -- * Creating a Request
    StartSegmentDetection (..),
    newStartSegmentDetection,

    -- * Request Lenses
    startSegmentDetection_jobTag,
    startSegmentDetection_filters,
    startSegmentDetection_notificationChannel,
    startSegmentDetection_clientRequestToken,
    startSegmentDetection_video,
    startSegmentDetection_segmentTypes,

    -- * Destructuring the Response
    StartSegmentDetectionResponse (..),
    newStartSegmentDetectionResponse,

    -- * Response Lenses
    startSegmentDetectionResponse_jobId,
    startSegmentDetectionResponse_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:/ 'newStartSegmentDetection' smart constructor.
data StartSegmentDetection = StartSegmentDetection'
  { -- | An identifier you specify that\'s returned in the completion
    -- notification that\'s published to your Amazon Simple Notification
    -- Service topic. For example, you can use @JobTag@ to group related jobs
    -- and identify them in the completion notification.
    StartSegmentDetection -> Maybe Text
jobTag :: Prelude.Maybe Prelude.Text,
    -- | Filters for technical cue or shot detection.
    StartSegmentDetection -> Maybe StartSegmentDetectionFilters
filters :: Prelude.Maybe StartSegmentDetectionFilters,
    -- | The ARN of the Amazon SNS topic to which you want Amazon Rekognition
    -- Video to publish the completion status of the segment detection
    -- operation. Note that the Amazon SNS topic must have a topic name that
    -- begins with /AmazonRekognition/ if you are using the
    -- AmazonRekognitionServiceRole permissions policy to access the topic.
    StartSegmentDetection -> Maybe NotificationChannel
notificationChannel :: Prelude.Maybe NotificationChannel,
    -- | Idempotent token used to identify the start request. If you use the same
    -- token with multiple @StartSegmentDetection@ requests, the same @JobId@
    -- is returned. Use @ClientRequestToken@ to prevent the same job from being
    -- accidently started more than once.
    StartSegmentDetection -> Maybe Text
clientRequestToken :: Prelude.Maybe Prelude.Text,
    StartSegmentDetection -> Video
video :: Video,
    -- | An array of segment types to detect in the video. Valid values are
    -- TECHNICAL_CUE and SHOT.
    StartSegmentDetection -> NonEmpty SegmentType
segmentTypes :: Prelude.NonEmpty SegmentType
  }
  deriving (StartSegmentDetection -> StartSegmentDetection -> Bool
(StartSegmentDetection -> StartSegmentDetection -> Bool)
-> (StartSegmentDetection -> StartSegmentDetection -> Bool)
-> Eq StartSegmentDetection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartSegmentDetection -> StartSegmentDetection -> Bool
$c/= :: StartSegmentDetection -> StartSegmentDetection -> Bool
== :: StartSegmentDetection -> StartSegmentDetection -> Bool
$c== :: StartSegmentDetection -> StartSegmentDetection -> Bool
Prelude.Eq, ReadPrec [StartSegmentDetection]
ReadPrec StartSegmentDetection
Int -> ReadS StartSegmentDetection
ReadS [StartSegmentDetection]
(Int -> ReadS StartSegmentDetection)
-> ReadS [StartSegmentDetection]
-> ReadPrec StartSegmentDetection
-> ReadPrec [StartSegmentDetection]
-> Read StartSegmentDetection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartSegmentDetection]
$creadListPrec :: ReadPrec [StartSegmentDetection]
readPrec :: ReadPrec StartSegmentDetection
$creadPrec :: ReadPrec StartSegmentDetection
readList :: ReadS [StartSegmentDetection]
$creadList :: ReadS [StartSegmentDetection]
readsPrec :: Int -> ReadS StartSegmentDetection
$creadsPrec :: Int -> ReadS StartSegmentDetection
Prelude.Read, Int -> StartSegmentDetection -> ShowS
[StartSegmentDetection] -> ShowS
StartSegmentDetection -> String
(Int -> StartSegmentDetection -> ShowS)
-> (StartSegmentDetection -> String)
-> ([StartSegmentDetection] -> ShowS)
-> Show StartSegmentDetection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartSegmentDetection] -> ShowS
$cshowList :: [StartSegmentDetection] -> ShowS
show :: StartSegmentDetection -> String
$cshow :: StartSegmentDetection -> String
showsPrec :: Int -> StartSegmentDetection -> ShowS
$cshowsPrec :: Int -> StartSegmentDetection -> ShowS
Prelude.Show, (forall x. StartSegmentDetection -> Rep StartSegmentDetection x)
-> (forall x. Rep StartSegmentDetection x -> StartSegmentDetection)
-> Generic StartSegmentDetection
forall x. Rep StartSegmentDetection x -> StartSegmentDetection
forall x. StartSegmentDetection -> Rep StartSegmentDetection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartSegmentDetection x -> StartSegmentDetection
$cfrom :: forall x. StartSegmentDetection -> Rep StartSegmentDetection x
Prelude.Generic)

-- |
-- Create a value of 'StartSegmentDetection' 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:
--
-- 'jobTag', 'startSegmentDetection_jobTag' - An identifier you specify that\'s returned in the completion
-- notification that\'s published to your Amazon Simple Notification
-- Service topic. For example, you can use @JobTag@ to group related jobs
-- and identify them in the completion notification.
--
-- 'filters', 'startSegmentDetection_filters' - Filters for technical cue or shot detection.
--
-- 'notificationChannel', 'startSegmentDetection_notificationChannel' - The ARN of the Amazon SNS topic to which you want Amazon Rekognition
-- Video to publish the completion status of the segment detection
-- operation. Note that the Amazon SNS topic must have a topic name that
-- begins with /AmazonRekognition/ if you are using the
-- AmazonRekognitionServiceRole permissions policy to access the topic.
--
-- 'clientRequestToken', 'startSegmentDetection_clientRequestToken' - Idempotent token used to identify the start request. If you use the same
-- token with multiple @StartSegmentDetection@ requests, the same @JobId@
-- is returned. Use @ClientRequestToken@ to prevent the same job from being
-- accidently started more than once.
--
-- 'video', 'startSegmentDetection_video' - Undocumented member.
--
-- 'segmentTypes', 'startSegmentDetection_segmentTypes' - An array of segment types to detect in the video. Valid values are
-- TECHNICAL_CUE and SHOT.
newStartSegmentDetection ::
  -- | 'video'
  Video ->
  -- | 'segmentTypes'
  Prelude.NonEmpty SegmentType ->
  StartSegmentDetection
newStartSegmentDetection :: Video -> NonEmpty SegmentType -> StartSegmentDetection
newStartSegmentDetection Video
pVideo_ NonEmpty SegmentType
pSegmentTypes_ =
  StartSegmentDetection' :: Maybe Text
-> Maybe StartSegmentDetectionFilters
-> Maybe NotificationChannel
-> Maybe Text
-> Video
-> NonEmpty SegmentType
-> StartSegmentDetection
StartSegmentDetection'
    { $sel:jobTag:StartSegmentDetection' :: Maybe Text
jobTag = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:filters:StartSegmentDetection' :: Maybe StartSegmentDetectionFilters
filters = Maybe StartSegmentDetectionFilters
forall a. Maybe a
Prelude.Nothing,
      $sel:notificationChannel:StartSegmentDetection' :: Maybe NotificationChannel
notificationChannel = Maybe NotificationChannel
forall a. Maybe a
Prelude.Nothing,
      $sel:clientRequestToken:StartSegmentDetection' :: Maybe Text
clientRequestToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:video:StartSegmentDetection' :: Video
video = Video
pVideo_,
      $sel:segmentTypes:StartSegmentDetection' :: NonEmpty SegmentType
segmentTypes = Tagged (NonEmpty SegmentType) (Identity (NonEmpty SegmentType))
-> Tagged (NonEmpty SegmentType) (Identity (NonEmpty SegmentType))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty SegmentType) (Identity (NonEmpty SegmentType))
 -> Tagged (NonEmpty SegmentType) (Identity (NonEmpty SegmentType)))
-> NonEmpty SegmentType -> NonEmpty SegmentType
forall t b. AReview t b -> b -> t
Lens.# NonEmpty SegmentType
pSegmentTypes_
    }

-- | An identifier you specify that\'s returned in the completion
-- notification that\'s published to your Amazon Simple Notification
-- Service topic. For example, you can use @JobTag@ to group related jobs
-- and identify them in the completion notification.
startSegmentDetection_jobTag :: Lens.Lens' StartSegmentDetection (Prelude.Maybe Prelude.Text)
startSegmentDetection_jobTag :: (Maybe Text -> f (Maybe Text))
-> StartSegmentDetection -> f StartSegmentDetection
startSegmentDetection_jobTag = (StartSegmentDetection -> Maybe Text)
-> (StartSegmentDetection -> Maybe Text -> StartSegmentDetection)
-> Lens
     StartSegmentDetection
     StartSegmentDetection
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSegmentDetection' {Maybe Text
jobTag :: Maybe Text
$sel:jobTag:StartSegmentDetection' :: StartSegmentDetection -> Maybe Text
jobTag} -> Maybe Text
jobTag) (\s :: StartSegmentDetection
s@StartSegmentDetection' {} Maybe Text
a -> StartSegmentDetection
s {$sel:jobTag:StartSegmentDetection' :: Maybe Text
jobTag = Maybe Text
a} :: StartSegmentDetection)

-- | Filters for technical cue or shot detection.
startSegmentDetection_filters :: Lens.Lens' StartSegmentDetection (Prelude.Maybe StartSegmentDetectionFilters)
startSegmentDetection_filters :: (Maybe StartSegmentDetectionFilters
 -> f (Maybe StartSegmentDetectionFilters))
-> StartSegmentDetection -> f StartSegmentDetection
startSegmentDetection_filters = (StartSegmentDetection -> Maybe StartSegmentDetectionFilters)
-> (StartSegmentDetection
    -> Maybe StartSegmentDetectionFilters -> StartSegmentDetection)
-> Lens
     StartSegmentDetection
     StartSegmentDetection
     (Maybe StartSegmentDetectionFilters)
     (Maybe StartSegmentDetectionFilters)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSegmentDetection' {Maybe StartSegmentDetectionFilters
filters :: Maybe StartSegmentDetectionFilters
$sel:filters:StartSegmentDetection' :: StartSegmentDetection -> Maybe StartSegmentDetectionFilters
filters} -> Maybe StartSegmentDetectionFilters
filters) (\s :: StartSegmentDetection
s@StartSegmentDetection' {} Maybe StartSegmentDetectionFilters
a -> StartSegmentDetection
s {$sel:filters:StartSegmentDetection' :: Maybe StartSegmentDetectionFilters
filters = Maybe StartSegmentDetectionFilters
a} :: StartSegmentDetection)

-- | The ARN of the Amazon SNS topic to which you want Amazon Rekognition
-- Video to publish the completion status of the segment detection
-- operation. Note that the Amazon SNS topic must have a topic name that
-- begins with /AmazonRekognition/ if you are using the
-- AmazonRekognitionServiceRole permissions policy to access the topic.
startSegmentDetection_notificationChannel :: Lens.Lens' StartSegmentDetection (Prelude.Maybe NotificationChannel)
startSegmentDetection_notificationChannel :: (Maybe NotificationChannel -> f (Maybe NotificationChannel))
-> StartSegmentDetection -> f StartSegmentDetection
startSegmentDetection_notificationChannel = (StartSegmentDetection -> Maybe NotificationChannel)
-> (StartSegmentDetection
    -> Maybe NotificationChannel -> StartSegmentDetection)
-> Lens
     StartSegmentDetection
     StartSegmentDetection
     (Maybe NotificationChannel)
     (Maybe NotificationChannel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSegmentDetection' {Maybe NotificationChannel
notificationChannel :: Maybe NotificationChannel
$sel:notificationChannel:StartSegmentDetection' :: StartSegmentDetection -> Maybe NotificationChannel
notificationChannel} -> Maybe NotificationChannel
notificationChannel) (\s :: StartSegmentDetection
s@StartSegmentDetection' {} Maybe NotificationChannel
a -> StartSegmentDetection
s {$sel:notificationChannel:StartSegmentDetection' :: Maybe NotificationChannel
notificationChannel = Maybe NotificationChannel
a} :: StartSegmentDetection)

-- | Idempotent token used to identify the start request. If you use the same
-- token with multiple @StartSegmentDetection@ requests, the same @JobId@
-- is returned. Use @ClientRequestToken@ to prevent the same job from being
-- accidently started more than once.
startSegmentDetection_clientRequestToken :: Lens.Lens' StartSegmentDetection (Prelude.Maybe Prelude.Text)
startSegmentDetection_clientRequestToken :: (Maybe Text -> f (Maybe Text))
-> StartSegmentDetection -> f StartSegmentDetection
startSegmentDetection_clientRequestToken = (StartSegmentDetection -> Maybe Text)
-> (StartSegmentDetection -> Maybe Text -> StartSegmentDetection)
-> Lens
     StartSegmentDetection
     StartSegmentDetection
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSegmentDetection' {Maybe Text
clientRequestToken :: Maybe Text
$sel:clientRequestToken:StartSegmentDetection' :: StartSegmentDetection -> Maybe Text
clientRequestToken} -> Maybe Text
clientRequestToken) (\s :: StartSegmentDetection
s@StartSegmentDetection' {} Maybe Text
a -> StartSegmentDetection
s {$sel:clientRequestToken:StartSegmentDetection' :: Maybe Text
clientRequestToken = Maybe Text
a} :: StartSegmentDetection)

-- | Undocumented member.
startSegmentDetection_video :: Lens.Lens' StartSegmentDetection Video
startSegmentDetection_video :: (Video -> f Video)
-> StartSegmentDetection -> f StartSegmentDetection
startSegmentDetection_video = (StartSegmentDetection -> Video)
-> (StartSegmentDetection -> Video -> StartSegmentDetection)
-> Lens StartSegmentDetection StartSegmentDetection Video Video
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSegmentDetection' {Video
video :: Video
$sel:video:StartSegmentDetection' :: StartSegmentDetection -> Video
video} -> Video
video) (\s :: StartSegmentDetection
s@StartSegmentDetection' {} Video
a -> StartSegmentDetection
s {$sel:video:StartSegmentDetection' :: Video
video = Video
a} :: StartSegmentDetection)

-- | An array of segment types to detect in the video. Valid values are
-- TECHNICAL_CUE and SHOT.
startSegmentDetection_segmentTypes :: Lens.Lens' StartSegmentDetection (Prelude.NonEmpty SegmentType)
startSegmentDetection_segmentTypes :: (NonEmpty SegmentType -> f (NonEmpty SegmentType))
-> StartSegmentDetection -> f StartSegmentDetection
startSegmentDetection_segmentTypes = (StartSegmentDetection -> NonEmpty SegmentType)
-> (StartSegmentDetection
    -> NonEmpty SegmentType -> StartSegmentDetection)
-> Lens
     StartSegmentDetection
     StartSegmentDetection
     (NonEmpty SegmentType)
     (NonEmpty SegmentType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSegmentDetection' {NonEmpty SegmentType
segmentTypes :: NonEmpty SegmentType
$sel:segmentTypes:StartSegmentDetection' :: StartSegmentDetection -> NonEmpty SegmentType
segmentTypes} -> NonEmpty SegmentType
segmentTypes) (\s :: StartSegmentDetection
s@StartSegmentDetection' {} NonEmpty SegmentType
a -> StartSegmentDetection
s {$sel:segmentTypes:StartSegmentDetection' :: NonEmpty SegmentType
segmentTypes = NonEmpty SegmentType
a} :: StartSegmentDetection) ((NonEmpty SegmentType -> f (NonEmpty SegmentType))
 -> StartSegmentDetection -> f StartSegmentDetection)
-> ((NonEmpty SegmentType -> f (NonEmpty SegmentType))
    -> NonEmpty SegmentType -> f (NonEmpty SegmentType))
-> (NonEmpty SegmentType -> f (NonEmpty SegmentType))
-> StartSegmentDetection
-> f StartSegmentDetection
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty SegmentType -> f (NonEmpty SegmentType))
-> NonEmpty SegmentType -> f (NonEmpty SegmentType)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest StartSegmentDetection where
  type
    AWSResponse StartSegmentDetection =
      StartSegmentDetectionResponse
  request :: StartSegmentDetection -> Request StartSegmentDetection
request = Service -> StartSegmentDetection -> Request StartSegmentDetection
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy StartSegmentDetection
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StartSegmentDetection)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse StartSegmentDetection))
-> Logger
-> Service
-> Proxy StartSegmentDetection
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StartSegmentDetection)))
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 -> Int -> StartSegmentDetectionResponse
StartSegmentDetectionResponse'
            (Maybe Text -> Int -> StartSegmentDetectionResponse)
-> Either String (Maybe Text)
-> Either String (Int -> StartSegmentDetectionResponse)
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
"JobId")
            Either String (Int -> StartSegmentDetectionResponse)
-> Either String Int -> Either String StartSegmentDetectionResponse
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 StartSegmentDetection

instance Prelude.NFData StartSegmentDetection

instance Core.ToHeaders StartSegmentDetection where
  toHeaders :: StartSegmentDetection -> ResponseHeaders
toHeaders =
    ResponseHeaders -> StartSegmentDetection -> 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.StartSegmentDetection" ::
                          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 StartSegmentDetection where
  toJSON :: StartSegmentDetection -> Value
toJSON StartSegmentDetection' {Maybe Text
Maybe NotificationChannel
Maybe StartSegmentDetectionFilters
NonEmpty SegmentType
Video
segmentTypes :: NonEmpty SegmentType
video :: Video
clientRequestToken :: Maybe Text
notificationChannel :: Maybe NotificationChannel
filters :: Maybe StartSegmentDetectionFilters
jobTag :: Maybe Text
$sel:segmentTypes:StartSegmentDetection' :: StartSegmentDetection -> NonEmpty SegmentType
$sel:video:StartSegmentDetection' :: StartSegmentDetection -> Video
$sel:clientRequestToken:StartSegmentDetection' :: StartSegmentDetection -> Maybe Text
$sel:notificationChannel:StartSegmentDetection' :: StartSegmentDetection -> Maybe NotificationChannel
$sel:filters:StartSegmentDetection' :: StartSegmentDetection -> Maybe StartSegmentDetectionFilters
$sel:jobTag:StartSegmentDetection' :: StartSegmentDetection -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"JobTag" 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
jobTag,
            (Text
"Filters" Text -> StartSegmentDetectionFilters -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (StartSegmentDetectionFilters -> Pair)
-> Maybe StartSegmentDetectionFilters -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe StartSegmentDetectionFilters
filters,
            (Text
"NotificationChannel" Text -> NotificationChannel -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NotificationChannel -> Pair)
-> Maybe NotificationChannel -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe NotificationChannel
notificationChannel,
            (Text
"ClientRequestToken" 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
clientRequestToken,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Video" Text -> Video -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Video
video),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"SegmentTypes" Text -> NonEmpty SegmentType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty SegmentType
segmentTypes)
          ]
      )

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

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

-- | /See:/ 'newStartSegmentDetectionResponse' smart constructor.
data StartSegmentDetectionResponse = StartSegmentDetectionResponse'
  { -- | Unique identifier for the segment detection job. The @JobId@ is returned
    -- from @StartSegmentDetection@.
    StartSegmentDetectionResponse -> Maybe Text
jobId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    StartSegmentDetectionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (StartSegmentDetectionResponse
-> StartSegmentDetectionResponse -> Bool
(StartSegmentDetectionResponse
 -> StartSegmentDetectionResponse -> Bool)
-> (StartSegmentDetectionResponse
    -> StartSegmentDetectionResponse -> Bool)
-> Eq StartSegmentDetectionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartSegmentDetectionResponse
-> StartSegmentDetectionResponse -> Bool
$c/= :: StartSegmentDetectionResponse
-> StartSegmentDetectionResponse -> Bool
== :: StartSegmentDetectionResponse
-> StartSegmentDetectionResponse -> Bool
$c== :: StartSegmentDetectionResponse
-> StartSegmentDetectionResponse -> Bool
Prelude.Eq, ReadPrec [StartSegmentDetectionResponse]
ReadPrec StartSegmentDetectionResponse
Int -> ReadS StartSegmentDetectionResponse
ReadS [StartSegmentDetectionResponse]
(Int -> ReadS StartSegmentDetectionResponse)
-> ReadS [StartSegmentDetectionResponse]
-> ReadPrec StartSegmentDetectionResponse
-> ReadPrec [StartSegmentDetectionResponse]
-> Read StartSegmentDetectionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartSegmentDetectionResponse]
$creadListPrec :: ReadPrec [StartSegmentDetectionResponse]
readPrec :: ReadPrec StartSegmentDetectionResponse
$creadPrec :: ReadPrec StartSegmentDetectionResponse
readList :: ReadS [StartSegmentDetectionResponse]
$creadList :: ReadS [StartSegmentDetectionResponse]
readsPrec :: Int -> ReadS StartSegmentDetectionResponse
$creadsPrec :: Int -> ReadS StartSegmentDetectionResponse
Prelude.Read, Int -> StartSegmentDetectionResponse -> ShowS
[StartSegmentDetectionResponse] -> ShowS
StartSegmentDetectionResponse -> String
(Int -> StartSegmentDetectionResponse -> ShowS)
-> (StartSegmentDetectionResponse -> String)
-> ([StartSegmentDetectionResponse] -> ShowS)
-> Show StartSegmentDetectionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartSegmentDetectionResponse] -> ShowS
$cshowList :: [StartSegmentDetectionResponse] -> ShowS
show :: StartSegmentDetectionResponse -> String
$cshow :: StartSegmentDetectionResponse -> String
showsPrec :: Int -> StartSegmentDetectionResponse -> ShowS
$cshowsPrec :: Int -> StartSegmentDetectionResponse -> ShowS
Prelude.Show, (forall x.
 StartSegmentDetectionResponse
 -> Rep StartSegmentDetectionResponse x)
-> (forall x.
    Rep StartSegmentDetectionResponse x
    -> StartSegmentDetectionResponse)
-> Generic StartSegmentDetectionResponse
forall x.
Rep StartSegmentDetectionResponse x
-> StartSegmentDetectionResponse
forall x.
StartSegmentDetectionResponse
-> Rep StartSegmentDetectionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartSegmentDetectionResponse x
-> StartSegmentDetectionResponse
$cfrom :: forall x.
StartSegmentDetectionResponse
-> Rep StartSegmentDetectionResponse x
Prelude.Generic)

-- |
-- Create a value of 'StartSegmentDetectionResponse' 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:
--
-- 'jobId', 'startSegmentDetectionResponse_jobId' - Unique identifier for the segment detection job. The @JobId@ is returned
-- from @StartSegmentDetection@.
--
-- 'httpStatus', 'startSegmentDetectionResponse_httpStatus' - The response's http status code.
newStartSegmentDetectionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StartSegmentDetectionResponse
newStartSegmentDetectionResponse :: Int -> StartSegmentDetectionResponse
newStartSegmentDetectionResponse Int
pHttpStatus_ =
  StartSegmentDetectionResponse' :: Maybe Text -> Int -> StartSegmentDetectionResponse
StartSegmentDetectionResponse'
    { $sel:jobId:StartSegmentDetectionResponse' :: Maybe Text
jobId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:StartSegmentDetectionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Unique identifier for the segment detection job. The @JobId@ is returned
-- from @StartSegmentDetection@.
startSegmentDetectionResponse_jobId :: Lens.Lens' StartSegmentDetectionResponse (Prelude.Maybe Prelude.Text)
startSegmentDetectionResponse_jobId :: (Maybe Text -> f (Maybe Text))
-> StartSegmentDetectionResponse -> f StartSegmentDetectionResponse
startSegmentDetectionResponse_jobId = (StartSegmentDetectionResponse -> Maybe Text)
-> (StartSegmentDetectionResponse
    -> Maybe Text -> StartSegmentDetectionResponse)
-> Lens
     StartSegmentDetectionResponse
     StartSegmentDetectionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSegmentDetectionResponse' {Maybe Text
jobId :: Maybe Text
$sel:jobId:StartSegmentDetectionResponse' :: StartSegmentDetectionResponse -> Maybe Text
jobId} -> Maybe Text
jobId) (\s :: StartSegmentDetectionResponse
s@StartSegmentDetectionResponse' {} Maybe Text
a -> StartSegmentDetectionResponse
s {$sel:jobId:StartSegmentDetectionResponse' :: Maybe Text
jobId = Maybe Text
a} :: StartSegmentDetectionResponse)

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

instance Prelude.NFData StartSegmentDetectionResponse