{-# 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.CreateStreamProcessor
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates an Amazon Rekognition stream processor that you can use to
-- detect and recognize faces or to detect labels in a streaming video.
--
-- Amazon Rekognition Video is a consumer of live video from Amazon Kinesis
-- Video Streams. There are two different settings for stream processors in
-- Amazon Rekognition: detecting faces and detecting labels.
--
-- -   If you are creating a stream processor for detecting faces, you
--     provide as input a Kinesis video stream (@Input@) and a Kinesis data
--     stream (@Output@) stream. You also specify the face recognition
--     criteria in @Settings@. For example, the collection containing faces
--     that you want to recognize. After you have finished analyzing a
--     streaming video, use StopStreamProcessor to stop processing.
--
-- -   If you are creating a stream processor to detect labels, you provide
--     as input a Kinesis video stream (@Input@), Amazon S3 bucket
--     information (@Output@), and an Amazon SNS topic ARN
--     (@NotificationChannel@). You can also provide a KMS key ID to
--     encrypt the data sent to your Amazon S3 bucket. You specify what you
--     want to detect in @ConnectedHomeSettings@, such as people, packages
--     and people, or pets, people, and packages. You can also specify
--     where in the frame you want Amazon Rekognition to monitor with
--     @RegionsOfInterest@. When you run the StartStreamProcessor operation
--     on a label detection stream processor, you input start and stop
--     information to determine the length of the processing time.
--
-- Use @Name@ to assign an identifier for the stream processor. You use
-- @Name@ to manage the stream processor. For example, you can start
-- processing the source video by calling StartStreamProcessor with the
-- @Name@ field.
--
-- This operation requires permissions to perform the
-- @rekognition:CreateStreamProcessor@ action. If you want to tag your
-- stream processor, you also require permission to perform the
-- @rekognition:TagResource@ operation.
module Amazonka.Rekognition.CreateStreamProcessor
  ( -- * Creating a Request
    CreateStreamProcessor (..),
    newCreateStreamProcessor,

    -- * Request Lenses
    createStreamProcessor_dataSharingPreference,
    createStreamProcessor_kmsKeyId,
    createStreamProcessor_notificationChannel,
    createStreamProcessor_regionsOfInterest,
    createStreamProcessor_tags,
    createStreamProcessor_input,
    createStreamProcessor_output,
    createStreamProcessor_name,
    createStreamProcessor_settings,
    createStreamProcessor_roleArn,

    -- * Destructuring the Response
    CreateStreamProcessorResponse (..),
    newCreateStreamProcessorResponse,

    -- * Response Lenses
    createStreamProcessorResponse_streamProcessorArn,
    createStreamProcessorResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.Rekognition.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateStreamProcessor' smart constructor.
data CreateStreamProcessor = CreateStreamProcessor'
  { -- | Shows whether you are sharing data with Rekognition to improve model
    -- performance. You can choose this option at the account level or on a
    -- per-stream basis. Note that if you opt out at the account level this
    -- setting is ignored on individual streams.
    CreateStreamProcessor -> Maybe StreamProcessorDataSharingPreference
dataSharingPreference :: Prelude.Maybe StreamProcessorDataSharingPreference,
    -- | The identifier for your AWS Key Management Service key (AWS KMS key).
    -- This is an optional parameter for label detection stream processors and
    -- should not be used to create a face search stream processor. You can
    -- supply the Amazon Resource Name (ARN) of your KMS key, the ID of your
    -- KMS key, an alias for your KMS key, or an alias ARN. The key is used to
    -- encrypt results and data published to your Amazon S3 bucket, which
    -- includes image frames and hero images. Your source images are
    -- unaffected.
    CreateStreamProcessor -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    CreateStreamProcessor -> Maybe StreamProcessorNotificationChannel
notificationChannel :: Prelude.Maybe StreamProcessorNotificationChannel,
    -- | Specifies locations in the frames where Amazon Rekognition checks for
    -- objects or people. You can specify up to 10 regions of interest, and
    -- each region has either a polygon or a bounding box. This is an optional
    -- parameter for label detection stream processors and should not be used
    -- to create a face search stream processor.
    CreateStreamProcessor -> Maybe [RegionOfInterest]
regionsOfInterest :: Prelude.Maybe [RegionOfInterest],
    -- | A set of tags (key-value pairs) that you want to attach to the stream
    -- processor.
    CreateStreamProcessor -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | Kinesis video stream stream that provides the source streaming video. If
    -- you are using the AWS CLI, the parameter name is @StreamProcessorInput@.
    -- This is required for both face search and label detection stream
    -- processors.
    CreateStreamProcessor -> StreamProcessorInput
input :: StreamProcessorInput,
    -- | Kinesis data stream stream or Amazon S3 bucket location to which Amazon
    -- Rekognition Video puts the analysis results. If you are using the AWS
    -- CLI, the parameter name is @StreamProcessorOutput@. This must be a
    -- S3Destination of an Amazon S3 bucket that you own for a label detection
    -- stream processor or a Kinesis data stream ARN for a face search stream
    -- processor.
    CreateStreamProcessor -> StreamProcessorOutput
output :: StreamProcessorOutput,
    -- | An identifier you assign to the stream processor. You can use @Name@ to
    -- manage the stream processor. For example, you can get the current status
    -- of the stream processor by calling DescribeStreamProcessor. @Name@ is
    -- idempotent. This is required for both face search and label detection
    -- stream processors.
    CreateStreamProcessor -> Text
name :: Prelude.Text,
    -- | Input parameters used in a streaming video analyzed by a stream
    -- processor. You can use @FaceSearch@ to recognize faces in a streaming
    -- video, or you can use @ConnectedHome@ to detect labels.
    CreateStreamProcessor -> StreamProcessorSettings
settings :: StreamProcessorSettings,
    -- | The Amazon Resource Number (ARN) of the IAM role that allows access to
    -- the stream processor. The IAM role provides Rekognition read permissions
    -- for a Kinesis stream. It also provides write permissions to an Amazon S3
    -- bucket and Amazon Simple Notification Service topic for a label
    -- detection stream processor. This is required for both face search and
    -- label detection stream processors.
    CreateStreamProcessor -> Text
roleArn :: Prelude.Text
  }
  deriving (CreateStreamProcessor -> CreateStreamProcessor -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateStreamProcessor -> CreateStreamProcessor -> Bool
$c/= :: CreateStreamProcessor -> CreateStreamProcessor -> Bool
== :: CreateStreamProcessor -> CreateStreamProcessor -> Bool
$c== :: CreateStreamProcessor -> CreateStreamProcessor -> Bool
Prelude.Eq, ReadPrec [CreateStreamProcessor]
ReadPrec CreateStreamProcessor
Int -> ReadS CreateStreamProcessor
ReadS [CreateStreamProcessor]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateStreamProcessor]
$creadListPrec :: ReadPrec [CreateStreamProcessor]
readPrec :: ReadPrec CreateStreamProcessor
$creadPrec :: ReadPrec CreateStreamProcessor
readList :: ReadS [CreateStreamProcessor]
$creadList :: ReadS [CreateStreamProcessor]
readsPrec :: Int -> ReadS CreateStreamProcessor
$creadsPrec :: Int -> ReadS CreateStreamProcessor
Prelude.Read, Int -> CreateStreamProcessor -> ShowS
[CreateStreamProcessor] -> ShowS
CreateStreamProcessor -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateStreamProcessor] -> ShowS
$cshowList :: [CreateStreamProcessor] -> ShowS
show :: CreateStreamProcessor -> String
$cshow :: CreateStreamProcessor -> String
showsPrec :: Int -> CreateStreamProcessor -> ShowS
$cshowsPrec :: Int -> CreateStreamProcessor -> ShowS
Prelude.Show, forall x. Rep CreateStreamProcessor x -> CreateStreamProcessor
forall x. CreateStreamProcessor -> Rep CreateStreamProcessor x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateStreamProcessor x -> CreateStreamProcessor
$cfrom :: forall x. CreateStreamProcessor -> Rep CreateStreamProcessor x
Prelude.Generic)

-- |
-- Create a value of 'CreateStreamProcessor' 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:
--
-- 'dataSharingPreference', 'createStreamProcessor_dataSharingPreference' - Shows whether you are sharing data with Rekognition to improve model
-- performance. You can choose this option at the account level or on a
-- per-stream basis. Note that if you opt out at the account level this
-- setting is ignored on individual streams.
--
-- 'kmsKeyId', 'createStreamProcessor_kmsKeyId' - The identifier for your AWS Key Management Service key (AWS KMS key).
-- This is an optional parameter for label detection stream processors and
-- should not be used to create a face search stream processor. You can
-- supply the Amazon Resource Name (ARN) of your KMS key, the ID of your
-- KMS key, an alias for your KMS key, or an alias ARN. The key is used to
-- encrypt results and data published to your Amazon S3 bucket, which
-- includes image frames and hero images. Your source images are
-- unaffected.
--
-- 'notificationChannel', 'createStreamProcessor_notificationChannel' - Undocumented member.
--
-- 'regionsOfInterest', 'createStreamProcessor_regionsOfInterest' - Specifies locations in the frames where Amazon Rekognition checks for
-- objects or people. You can specify up to 10 regions of interest, and
-- each region has either a polygon or a bounding box. This is an optional
-- parameter for label detection stream processors and should not be used
-- to create a face search stream processor.
--
-- 'tags', 'createStreamProcessor_tags' - A set of tags (key-value pairs) that you want to attach to the stream
-- processor.
--
-- 'input', 'createStreamProcessor_input' - Kinesis video stream stream that provides the source streaming video. If
-- you are using the AWS CLI, the parameter name is @StreamProcessorInput@.
-- This is required for both face search and label detection stream
-- processors.
--
-- 'output', 'createStreamProcessor_output' - Kinesis data stream stream or Amazon S3 bucket location to which Amazon
-- Rekognition Video puts the analysis results. If you are using the AWS
-- CLI, the parameter name is @StreamProcessorOutput@. This must be a
-- S3Destination of an Amazon S3 bucket that you own for a label detection
-- stream processor or a Kinesis data stream ARN for a face search stream
-- processor.
--
-- 'name', 'createStreamProcessor_name' - An identifier you assign to the stream processor. You can use @Name@ to
-- manage the stream processor. For example, you can get the current status
-- of the stream processor by calling DescribeStreamProcessor. @Name@ is
-- idempotent. This is required for both face search and label detection
-- stream processors.
--
-- 'settings', 'createStreamProcessor_settings' - Input parameters used in a streaming video analyzed by a stream
-- processor. You can use @FaceSearch@ to recognize faces in a streaming
-- video, or you can use @ConnectedHome@ to detect labels.
--
-- 'roleArn', 'createStreamProcessor_roleArn' - The Amazon Resource Number (ARN) of the IAM role that allows access to
-- the stream processor. The IAM role provides Rekognition read permissions
-- for a Kinesis stream. It also provides write permissions to an Amazon S3
-- bucket and Amazon Simple Notification Service topic for a label
-- detection stream processor. This is required for both face search and
-- label detection stream processors.
newCreateStreamProcessor ::
  -- | 'input'
  StreamProcessorInput ->
  -- | 'output'
  StreamProcessorOutput ->
  -- | 'name'
  Prelude.Text ->
  -- | 'settings'
  StreamProcessorSettings ->
  -- | 'roleArn'
  Prelude.Text ->
  CreateStreamProcessor
newCreateStreamProcessor :: StreamProcessorInput
-> StreamProcessorOutput
-> Text
-> StreamProcessorSettings
-> Text
-> CreateStreamProcessor
newCreateStreamProcessor
  StreamProcessorInput
pInput_
  StreamProcessorOutput
pOutput_
  Text
pName_
  StreamProcessorSettings
pSettings_
  Text
pRoleArn_ =
    CreateStreamProcessor'
      { $sel:dataSharingPreference:CreateStreamProcessor' :: Maybe StreamProcessorDataSharingPreference
dataSharingPreference =
          forall a. Maybe a
Prelude.Nothing,
        $sel:kmsKeyId:CreateStreamProcessor' :: Maybe Text
kmsKeyId = forall a. Maybe a
Prelude.Nothing,
        $sel:notificationChannel:CreateStreamProcessor' :: Maybe StreamProcessorNotificationChannel
notificationChannel = forall a. Maybe a
Prelude.Nothing,
        $sel:regionsOfInterest:CreateStreamProcessor' :: Maybe [RegionOfInterest]
regionsOfInterest = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateStreamProcessor' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:input:CreateStreamProcessor' :: StreamProcessorInput
input = StreamProcessorInput
pInput_,
        $sel:output:CreateStreamProcessor' :: StreamProcessorOutput
output = StreamProcessorOutput
pOutput_,
        $sel:name:CreateStreamProcessor' :: Text
name = Text
pName_,
        $sel:settings:CreateStreamProcessor' :: StreamProcessorSettings
settings = StreamProcessorSettings
pSettings_,
        $sel:roleArn:CreateStreamProcessor' :: Text
roleArn = Text
pRoleArn_
      }

-- | Shows whether you are sharing data with Rekognition to improve model
-- performance. You can choose this option at the account level or on a
-- per-stream basis. Note that if you opt out at the account level this
-- setting is ignored on individual streams.
createStreamProcessor_dataSharingPreference :: Lens.Lens' CreateStreamProcessor (Prelude.Maybe StreamProcessorDataSharingPreference)
createStreamProcessor_dataSharingPreference :: Lens'
  CreateStreamProcessor (Maybe StreamProcessorDataSharingPreference)
createStreamProcessor_dataSharingPreference = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStreamProcessor' {Maybe StreamProcessorDataSharingPreference
dataSharingPreference :: Maybe StreamProcessorDataSharingPreference
$sel:dataSharingPreference:CreateStreamProcessor' :: CreateStreamProcessor -> Maybe StreamProcessorDataSharingPreference
dataSharingPreference} -> Maybe StreamProcessorDataSharingPreference
dataSharingPreference) (\s :: CreateStreamProcessor
s@CreateStreamProcessor' {} Maybe StreamProcessorDataSharingPreference
a -> CreateStreamProcessor
s {$sel:dataSharingPreference:CreateStreamProcessor' :: Maybe StreamProcessorDataSharingPreference
dataSharingPreference = Maybe StreamProcessorDataSharingPreference
a} :: CreateStreamProcessor)

-- | The identifier for your AWS Key Management Service key (AWS KMS key).
-- This is an optional parameter for label detection stream processors and
-- should not be used to create a face search stream processor. You can
-- supply the Amazon Resource Name (ARN) of your KMS key, the ID of your
-- KMS key, an alias for your KMS key, or an alias ARN. The key is used to
-- encrypt results and data published to your Amazon S3 bucket, which
-- includes image frames and hero images. Your source images are
-- unaffected.
createStreamProcessor_kmsKeyId :: Lens.Lens' CreateStreamProcessor (Prelude.Maybe Prelude.Text)
createStreamProcessor_kmsKeyId :: Lens' CreateStreamProcessor (Maybe Text)
createStreamProcessor_kmsKeyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStreamProcessor' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:CreateStreamProcessor' :: CreateStreamProcessor -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: CreateStreamProcessor
s@CreateStreamProcessor' {} Maybe Text
a -> CreateStreamProcessor
s {$sel:kmsKeyId:CreateStreamProcessor' :: Maybe Text
kmsKeyId = Maybe Text
a} :: CreateStreamProcessor)

-- | Undocumented member.
createStreamProcessor_notificationChannel :: Lens.Lens' CreateStreamProcessor (Prelude.Maybe StreamProcessorNotificationChannel)
createStreamProcessor_notificationChannel :: Lens'
  CreateStreamProcessor (Maybe StreamProcessorNotificationChannel)
createStreamProcessor_notificationChannel = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStreamProcessor' {Maybe StreamProcessorNotificationChannel
notificationChannel :: Maybe StreamProcessorNotificationChannel
$sel:notificationChannel:CreateStreamProcessor' :: CreateStreamProcessor -> Maybe StreamProcessorNotificationChannel
notificationChannel} -> Maybe StreamProcessorNotificationChannel
notificationChannel) (\s :: CreateStreamProcessor
s@CreateStreamProcessor' {} Maybe StreamProcessorNotificationChannel
a -> CreateStreamProcessor
s {$sel:notificationChannel:CreateStreamProcessor' :: Maybe StreamProcessorNotificationChannel
notificationChannel = Maybe StreamProcessorNotificationChannel
a} :: CreateStreamProcessor)

-- | Specifies locations in the frames where Amazon Rekognition checks for
-- objects or people. You can specify up to 10 regions of interest, and
-- each region has either a polygon or a bounding box. This is an optional
-- parameter for label detection stream processors and should not be used
-- to create a face search stream processor.
createStreamProcessor_regionsOfInterest :: Lens.Lens' CreateStreamProcessor (Prelude.Maybe [RegionOfInterest])
createStreamProcessor_regionsOfInterest :: Lens' CreateStreamProcessor (Maybe [RegionOfInterest])
createStreamProcessor_regionsOfInterest = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStreamProcessor' {Maybe [RegionOfInterest]
regionsOfInterest :: Maybe [RegionOfInterest]
$sel:regionsOfInterest:CreateStreamProcessor' :: CreateStreamProcessor -> Maybe [RegionOfInterest]
regionsOfInterest} -> Maybe [RegionOfInterest]
regionsOfInterest) (\s :: CreateStreamProcessor
s@CreateStreamProcessor' {} Maybe [RegionOfInterest]
a -> CreateStreamProcessor
s {$sel:regionsOfInterest:CreateStreamProcessor' :: Maybe [RegionOfInterest]
regionsOfInterest = Maybe [RegionOfInterest]
a} :: CreateStreamProcessor) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A set of tags (key-value pairs) that you want to attach to the stream
-- processor.
createStreamProcessor_tags :: Lens.Lens' CreateStreamProcessor (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createStreamProcessor_tags :: Lens' CreateStreamProcessor (Maybe (HashMap Text Text))
createStreamProcessor_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStreamProcessor' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateStreamProcessor' :: CreateStreamProcessor -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateStreamProcessor
s@CreateStreamProcessor' {} Maybe (HashMap Text Text)
a -> CreateStreamProcessor
s {$sel:tags:CreateStreamProcessor' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateStreamProcessor) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Kinesis video stream stream that provides the source streaming video. If
-- you are using the AWS CLI, the parameter name is @StreamProcessorInput@.
-- This is required for both face search and label detection stream
-- processors.
createStreamProcessor_input :: Lens.Lens' CreateStreamProcessor StreamProcessorInput
createStreamProcessor_input :: Lens' CreateStreamProcessor StreamProcessorInput
createStreamProcessor_input = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStreamProcessor' {StreamProcessorInput
input :: StreamProcessorInput
$sel:input:CreateStreamProcessor' :: CreateStreamProcessor -> StreamProcessorInput
input} -> StreamProcessorInput
input) (\s :: CreateStreamProcessor
s@CreateStreamProcessor' {} StreamProcessorInput
a -> CreateStreamProcessor
s {$sel:input:CreateStreamProcessor' :: StreamProcessorInput
input = StreamProcessorInput
a} :: CreateStreamProcessor)

-- | Kinesis data stream stream or Amazon S3 bucket location to which Amazon
-- Rekognition Video puts the analysis results. If you are using the AWS
-- CLI, the parameter name is @StreamProcessorOutput@. This must be a
-- S3Destination of an Amazon S3 bucket that you own for a label detection
-- stream processor or a Kinesis data stream ARN for a face search stream
-- processor.
createStreamProcessor_output :: Lens.Lens' CreateStreamProcessor StreamProcessorOutput
createStreamProcessor_output :: Lens' CreateStreamProcessor StreamProcessorOutput
createStreamProcessor_output = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStreamProcessor' {StreamProcessorOutput
output :: StreamProcessorOutput
$sel:output:CreateStreamProcessor' :: CreateStreamProcessor -> StreamProcessorOutput
output} -> StreamProcessorOutput
output) (\s :: CreateStreamProcessor
s@CreateStreamProcessor' {} StreamProcessorOutput
a -> CreateStreamProcessor
s {$sel:output:CreateStreamProcessor' :: StreamProcessorOutput
output = StreamProcessorOutput
a} :: CreateStreamProcessor)

-- | An identifier you assign to the stream processor. You can use @Name@ to
-- manage the stream processor. For example, you can get the current status
-- of the stream processor by calling DescribeStreamProcessor. @Name@ is
-- idempotent. This is required for both face search and label detection
-- stream processors.
createStreamProcessor_name :: Lens.Lens' CreateStreamProcessor Prelude.Text
createStreamProcessor_name :: Lens' CreateStreamProcessor Text
createStreamProcessor_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStreamProcessor' {Text
name :: Text
$sel:name:CreateStreamProcessor' :: CreateStreamProcessor -> Text
name} -> Text
name) (\s :: CreateStreamProcessor
s@CreateStreamProcessor' {} Text
a -> CreateStreamProcessor
s {$sel:name:CreateStreamProcessor' :: Text
name = Text
a} :: CreateStreamProcessor)

-- | Input parameters used in a streaming video analyzed by a stream
-- processor. You can use @FaceSearch@ to recognize faces in a streaming
-- video, or you can use @ConnectedHome@ to detect labels.
createStreamProcessor_settings :: Lens.Lens' CreateStreamProcessor StreamProcessorSettings
createStreamProcessor_settings :: Lens' CreateStreamProcessor StreamProcessorSettings
createStreamProcessor_settings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStreamProcessor' {StreamProcessorSettings
settings :: StreamProcessorSettings
$sel:settings:CreateStreamProcessor' :: CreateStreamProcessor -> StreamProcessorSettings
settings} -> StreamProcessorSettings
settings) (\s :: CreateStreamProcessor
s@CreateStreamProcessor' {} StreamProcessorSettings
a -> CreateStreamProcessor
s {$sel:settings:CreateStreamProcessor' :: StreamProcessorSettings
settings = StreamProcessorSettings
a} :: CreateStreamProcessor)

-- | The Amazon Resource Number (ARN) of the IAM role that allows access to
-- the stream processor. The IAM role provides Rekognition read permissions
-- for a Kinesis stream. It also provides write permissions to an Amazon S3
-- bucket and Amazon Simple Notification Service topic for a label
-- detection stream processor. This is required for both face search and
-- label detection stream processors.
createStreamProcessor_roleArn :: Lens.Lens' CreateStreamProcessor Prelude.Text
createStreamProcessor_roleArn :: Lens' CreateStreamProcessor Text
createStreamProcessor_roleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStreamProcessor' {Text
roleArn :: Text
$sel:roleArn:CreateStreamProcessor' :: CreateStreamProcessor -> Text
roleArn} -> Text
roleArn) (\s :: CreateStreamProcessor
s@CreateStreamProcessor' {} Text
a -> CreateStreamProcessor
s {$sel:roleArn:CreateStreamProcessor' :: Text
roleArn = Text
a} :: CreateStreamProcessor)

instance Core.AWSRequest CreateStreamProcessor where
  type
    AWSResponse CreateStreamProcessor =
      CreateStreamProcessorResponse
  request :: (Service -> Service)
-> CreateStreamProcessor -> Request CreateStreamProcessor
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateStreamProcessor
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateStreamProcessor)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> CreateStreamProcessorResponse
CreateStreamProcessorResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"StreamProcessorArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreateStreamProcessor where
  hashWithSalt :: Int -> CreateStreamProcessor -> Int
hashWithSalt Int
_salt CreateStreamProcessor' {Maybe [RegionOfInterest]
Maybe Text
Maybe (HashMap Text Text)
Maybe StreamProcessorDataSharingPreference
Maybe StreamProcessorNotificationChannel
Text
StreamProcessorInput
StreamProcessorOutput
StreamProcessorSettings
roleArn :: Text
settings :: StreamProcessorSettings
name :: Text
output :: StreamProcessorOutput
input :: StreamProcessorInput
tags :: Maybe (HashMap Text Text)
regionsOfInterest :: Maybe [RegionOfInterest]
notificationChannel :: Maybe StreamProcessorNotificationChannel
kmsKeyId :: Maybe Text
dataSharingPreference :: Maybe StreamProcessorDataSharingPreference
$sel:roleArn:CreateStreamProcessor' :: CreateStreamProcessor -> Text
$sel:settings:CreateStreamProcessor' :: CreateStreamProcessor -> StreamProcessorSettings
$sel:name:CreateStreamProcessor' :: CreateStreamProcessor -> Text
$sel:output:CreateStreamProcessor' :: CreateStreamProcessor -> StreamProcessorOutput
$sel:input:CreateStreamProcessor' :: CreateStreamProcessor -> StreamProcessorInput
$sel:tags:CreateStreamProcessor' :: CreateStreamProcessor -> Maybe (HashMap Text Text)
$sel:regionsOfInterest:CreateStreamProcessor' :: CreateStreamProcessor -> Maybe [RegionOfInterest]
$sel:notificationChannel:CreateStreamProcessor' :: CreateStreamProcessor -> Maybe StreamProcessorNotificationChannel
$sel:kmsKeyId:CreateStreamProcessor' :: CreateStreamProcessor -> Maybe Text
$sel:dataSharingPreference:CreateStreamProcessor' :: CreateStreamProcessor -> Maybe StreamProcessorDataSharingPreference
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe StreamProcessorDataSharingPreference
dataSharingPreference
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
kmsKeyId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe StreamProcessorNotificationChannel
notificationChannel
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [RegionOfInterest]
regionsOfInterest
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` StreamProcessorInput
input
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` StreamProcessorOutput
output
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` StreamProcessorSettings
settings
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
roleArn

instance Prelude.NFData CreateStreamProcessor where
  rnf :: CreateStreamProcessor -> ()
rnf CreateStreamProcessor' {Maybe [RegionOfInterest]
Maybe Text
Maybe (HashMap Text Text)
Maybe StreamProcessorDataSharingPreference
Maybe StreamProcessorNotificationChannel
Text
StreamProcessorInput
StreamProcessorOutput
StreamProcessorSettings
roleArn :: Text
settings :: StreamProcessorSettings
name :: Text
output :: StreamProcessorOutput
input :: StreamProcessorInput
tags :: Maybe (HashMap Text Text)
regionsOfInterest :: Maybe [RegionOfInterest]
notificationChannel :: Maybe StreamProcessorNotificationChannel
kmsKeyId :: Maybe Text
dataSharingPreference :: Maybe StreamProcessorDataSharingPreference
$sel:roleArn:CreateStreamProcessor' :: CreateStreamProcessor -> Text
$sel:settings:CreateStreamProcessor' :: CreateStreamProcessor -> StreamProcessorSettings
$sel:name:CreateStreamProcessor' :: CreateStreamProcessor -> Text
$sel:output:CreateStreamProcessor' :: CreateStreamProcessor -> StreamProcessorOutput
$sel:input:CreateStreamProcessor' :: CreateStreamProcessor -> StreamProcessorInput
$sel:tags:CreateStreamProcessor' :: CreateStreamProcessor -> Maybe (HashMap Text Text)
$sel:regionsOfInterest:CreateStreamProcessor' :: CreateStreamProcessor -> Maybe [RegionOfInterest]
$sel:notificationChannel:CreateStreamProcessor' :: CreateStreamProcessor -> Maybe StreamProcessorNotificationChannel
$sel:kmsKeyId:CreateStreamProcessor' :: CreateStreamProcessor -> Maybe Text
$sel:dataSharingPreference:CreateStreamProcessor' :: CreateStreamProcessor -> Maybe StreamProcessorDataSharingPreference
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe StreamProcessorDataSharingPreference
dataSharingPreference
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
kmsKeyId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe StreamProcessorNotificationChannel
notificationChannel
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [RegionOfInterest]
regionsOfInterest
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf StreamProcessorInput
input
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf StreamProcessorOutput
output
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf StreamProcessorSettings
settings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
roleArn

instance Data.ToHeaders CreateStreamProcessor where
  toHeaders :: CreateStreamProcessor -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"RekognitionService.CreateStreamProcessor" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON CreateStreamProcessor where
  toJSON :: CreateStreamProcessor -> Value
toJSON CreateStreamProcessor' {Maybe [RegionOfInterest]
Maybe Text
Maybe (HashMap Text Text)
Maybe StreamProcessorDataSharingPreference
Maybe StreamProcessorNotificationChannel
Text
StreamProcessorInput
StreamProcessorOutput
StreamProcessorSettings
roleArn :: Text
settings :: StreamProcessorSettings
name :: Text
output :: StreamProcessorOutput
input :: StreamProcessorInput
tags :: Maybe (HashMap Text Text)
regionsOfInterest :: Maybe [RegionOfInterest]
notificationChannel :: Maybe StreamProcessorNotificationChannel
kmsKeyId :: Maybe Text
dataSharingPreference :: Maybe StreamProcessorDataSharingPreference
$sel:roleArn:CreateStreamProcessor' :: CreateStreamProcessor -> Text
$sel:settings:CreateStreamProcessor' :: CreateStreamProcessor -> StreamProcessorSettings
$sel:name:CreateStreamProcessor' :: CreateStreamProcessor -> Text
$sel:output:CreateStreamProcessor' :: CreateStreamProcessor -> StreamProcessorOutput
$sel:input:CreateStreamProcessor' :: CreateStreamProcessor -> StreamProcessorInput
$sel:tags:CreateStreamProcessor' :: CreateStreamProcessor -> Maybe (HashMap Text Text)
$sel:regionsOfInterest:CreateStreamProcessor' :: CreateStreamProcessor -> Maybe [RegionOfInterest]
$sel:notificationChannel:CreateStreamProcessor' :: CreateStreamProcessor -> Maybe StreamProcessorNotificationChannel
$sel:kmsKeyId:CreateStreamProcessor' :: CreateStreamProcessor -> Maybe Text
$sel:dataSharingPreference:CreateStreamProcessor' :: CreateStreamProcessor -> Maybe StreamProcessorDataSharingPreference
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"DataSharingPreference" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe StreamProcessorDataSharingPreference
dataSharingPreference,
            (Key
"KmsKeyId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
kmsKeyId,
            (Key
"NotificationChannel" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe StreamProcessorNotificationChannel
notificationChannel,
            (Key
"RegionsOfInterest" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [RegionOfInterest]
regionsOfInterest,
            (Key
"Tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
            forall a. a -> Maybe a
Prelude.Just (Key
"Input" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= StreamProcessorInput
input),
            forall a. a -> Maybe a
Prelude.Just (Key
"Output" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= StreamProcessorOutput
output),
            forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
            forall a. a -> Maybe a
Prelude.Just (Key
"Settings" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= StreamProcessorSettings
settings),
            forall a. a -> Maybe a
Prelude.Just (Key
"RoleArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
roleArn)
          ]
      )

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

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

-- | /See:/ 'newCreateStreamProcessorResponse' smart constructor.
data CreateStreamProcessorResponse = CreateStreamProcessorResponse'
  { -- | Amazon Resource Number for the newly created stream processor.
    CreateStreamProcessorResponse -> Maybe Text
streamProcessorArn :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateStreamProcessorResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateStreamProcessorResponse
-> CreateStreamProcessorResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateStreamProcessorResponse
-> CreateStreamProcessorResponse -> Bool
$c/= :: CreateStreamProcessorResponse
-> CreateStreamProcessorResponse -> Bool
== :: CreateStreamProcessorResponse
-> CreateStreamProcessorResponse -> Bool
$c== :: CreateStreamProcessorResponse
-> CreateStreamProcessorResponse -> Bool
Prelude.Eq, ReadPrec [CreateStreamProcessorResponse]
ReadPrec CreateStreamProcessorResponse
Int -> ReadS CreateStreamProcessorResponse
ReadS [CreateStreamProcessorResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateStreamProcessorResponse]
$creadListPrec :: ReadPrec [CreateStreamProcessorResponse]
readPrec :: ReadPrec CreateStreamProcessorResponse
$creadPrec :: ReadPrec CreateStreamProcessorResponse
readList :: ReadS [CreateStreamProcessorResponse]
$creadList :: ReadS [CreateStreamProcessorResponse]
readsPrec :: Int -> ReadS CreateStreamProcessorResponse
$creadsPrec :: Int -> ReadS CreateStreamProcessorResponse
Prelude.Read, Int -> CreateStreamProcessorResponse -> ShowS
[CreateStreamProcessorResponse] -> ShowS
CreateStreamProcessorResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateStreamProcessorResponse] -> ShowS
$cshowList :: [CreateStreamProcessorResponse] -> ShowS
show :: CreateStreamProcessorResponse -> String
$cshow :: CreateStreamProcessorResponse -> String
showsPrec :: Int -> CreateStreamProcessorResponse -> ShowS
$cshowsPrec :: Int -> CreateStreamProcessorResponse -> ShowS
Prelude.Show, forall x.
Rep CreateStreamProcessorResponse x
-> CreateStreamProcessorResponse
forall x.
CreateStreamProcessorResponse
-> Rep CreateStreamProcessorResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateStreamProcessorResponse x
-> CreateStreamProcessorResponse
$cfrom :: forall x.
CreateStreamProcessorResponse
-> Rep CreateStreamProcessorResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateStreamProcessorResponse' 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:
--
-- 'streamProcessorArn', 'createStreamProcessorResponse_streamProcessorArn' - Amazon Resource Number for the newly created stream processor.
--
-- 'httpStatus', 'createStreamProcessorResponse_httpStatus' - The response's http status code.
newCreateStreamProcessorResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateStreamProcessorResponse
newCreateStreamProcessorResponse :: Int -> CreateStreamProcessorResponse
newCreateStreamProcessorResponse Int
pHttpStatus_ =
  CreateStreamProcessorResponse'
    { $sel:streamProcessorArn:CreateStreamProcessorResponse' :: Maybe Text
streamProcessorArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateStreamProcessorResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Amazon Resource Number for the newly created stream processor.
createStreamProcessorResponse_streamProcessorArn :: Lens.Lens' CreateStreamProcessorResponse (Prelude.Maybe Prelude.Text)
createStreamProcessorResponse_streamProcessorArn :: Lens' CreateStreamProcessorResponse (Maybe Text)
createStreamProcessorResponse_streamProcessorArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStreamProcessorResponse' {Maybe Text
streamProcessorArn :: Maybe Text
$sel:streamProcessorArn:CreateStreamProcessorResponse' :: CreateStreamProcessorResponse -> Maybe Text
streamProcessorArn} -> Maybe Text
streamProcessorArn) (\s :: CreateStreamProcessorResponse
s@CreateStreamProcessorResponse' {} Maybe Text
a -> CreateStreamProcessorResponse
s {$sel:streamProcessorArn:CreateStreamProcessorResponse' :: Maybe Text
streamProcessorArn = Maybe Text
a} :: CreateStreamProcessorResponse)

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

instance Prelude.NFData CreateStreamProcessorResponse where
  rnf :: CreateStreamProcessorResponse -> ()
rnf CreateStreamProcessorResponse' {Int
Maybe Text
httpStatus :: Int
streamProcessorArn :: Maybe Text
$sel:httpStatus:CreateStreamProcessorResponse' :: CreateStreamProcessorResponse -> Int
$sel:streamProcessorArn:CreateStreamProcessorResponse' :: CreateStreamProcessorResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
streamProcessorArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus