{-# 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.Lambda.CreateEventSourceMapping
-- 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)
--
-- Creates a mapping between an event source and an Lambda function. Lambda
-- reads items from the event source and triggers the function.
--
-- For details about each event source type, see the following topics.
--
-- -   <https://docs.aws.amazon.com/lambda/latest/dg/with-ddb.html#services-dynamodb-eventsourcemapping Configuring a Dynamo DB stream as an event source>
--
-- -   <https://docs.aws.amazon.com/lambda/latest/dg/with-kinesis.html#services-kinesis-eventsourcemapping Configuring a Kinesis stream as an event source>
--
-- -   <https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html#events-sqs-eventsource Configuring an Amazon SQS queue as an event source>
--
-- -   <https://docs.aws.amazon.com/lambda/latest/dg/with-mq.html#services-mq-eventsourcemapping Configuring an MQ broker as an event source>
--
-- -   <https://docs.aws.amazon.com/lambda/latest/dg/with-msk.html Configuring MSK as an event source>
--
-- -   <https://docs.aws.amazon.com/lambda/latest/dg/kafka-smaa.html Configuring Self-Managed Apache Kafka as an event source>
--
-- The following error handling options are only available for stream
-- sources (DynamoDB and Kinesis):
--
-- -   @BisectBatchOnFunctionError@ - If the function returns an error,
--     split the batch in two and retry.
--
-- -   @DestinationConfig@ - Send discarded records to an Amazon SQS queue
--     or Amazon SNS topic.
--
-- -   @MaximumRecordAgeInSeconds@ - Discard records older than the
--     specified age. The default value is infinite (-1). When set to
--     infinite (-1), failed records are retried until the record expires
--
-- -   @MaximumRetryAttempts@ - Discard records after the specified number
--     of retries. The default value is infinite (-1). When set to infinite
--     (-1), failed records are retried until the record expires.
--
-- -   @ParallelizationFactor@ - Process multiple batches from each shard
--     concurrently.
module Amazonka.Lambda.CreateEventSourceMapping
  ( -- * Creating a Request
    CreateEventSourceMapping (..),
    newCreateEventSourceMapping,

    -- * Request Lenses
    createEventSourceMapping_eventSourceArn,
    createEventSourceMapping_startingPositionTimestamp,
    createEventSourceMapping_topics,
    createEventSourceMapping_queues,
    createEventSourceMapping_enabled,
    createEventSourceMapping_bisectBatchOnFunctionError,
    createEventSourceMapping_parallelizationFactor,
    createEventSourceMapping_maximumRetryAttempts,
    createEventSourceMapping_batchSize,
    createEventSourceMapping_maximumBatchingWindowInSeconds,
    createEventSourceMapping_sourceAccessConfigurations,
    createEventSourceMapping_maximumRecordAgeInSeconds,
    createEventSourceMapping_functionResponseTypes,
    createEventSourceMapping_tumblingWindowInSeconds,
    createEventSourceMapping_selfManagedEventSource,
    createEventSourceMapping_destinationConfig,
    createEventSourceMapping_startingPosition,
    createEventSourceMapping_functionName,

    -- * Destructuring the Response
    EventSourceMappingConfiguration (..),
    newEventSourceMappingConfiguration,

    -- * Response Lenses
    eventSourceMappingConfiguration_eventSourceArn,
    eventSourceMappingConfiguration_state,
    eventSourceMappingConfiguration_startingPositionTimestamp,
    eventSourceMappingConfiguration_functionArn,
    eventSourceMappingConfiguration_topics,
    eventSourceMappingConfiguration_queues,
    eventSourceMappingConfiguration_bisectBatchOnFunctionError,
    eventSourceMappingConfiguration_uuid,
    eventSourceMappingConfiguration_parallelizationFactor,
    eventSourceMappingConfiguration_lastProcessingResult,
    eventSourceMappingConfiguration_maximumRetryAttempts,
    eventSourceMappingConfiguration_batchSize,
    eventSourceMappingConfiguration_stateTransitionReason,
    eventSourceMappingConfiguration_maximumBatchingWindowInSeconds,
    eventSourceMappingConfiguration_sourceAccessConfigurations,
    eventSourceMappingConfiguration_maximumRecordAgeInSeconds,
    eventSourceMappingConfiguration_functionResponseTypes,
    eventSourceMappingConfiguration_tumblingWindowInSeconds,
    eventSourceMappingConfiguration_selfManagedEventSource,
    eventSourceMappingConfiguration_lastModified,
    eventSourceMappingConfiguration_destinationConfig,
    eventSourceMappingConfiguration_startingPosition,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.Lambda.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateEventSourceMapping' smart constructor.
data CreateEventSourceMapping = CreateEventSourceMapping'
  { -- | The Amazon Resource Name (ARN) of the event source.
    --
    -- -   __Amazon Kinesis__ - The ARN of the data stream or a stream
    --     consumer.
    --
    -- -   __Amazon DynamoDB Streams__ - The ARN of the stream.
    --
    -- -   __Amazon Simple Queue Service__ - The ARN of the queue.
    --
    -- -   __Amazon Managed Streaming for Apache Kafka__ - The ARN of the
    --     cluster.
    CreateEventSourceMapping -> Maybe Text
eventSourceArn :: Prelude.Maybe Prelude.Text,
    -- | With @StartingPosition@ set to @AT_TIMESTAMP@, the time from which to
    -- start reading.
    CreateEventSourceMapping -> Maybe POSIX
startingPositionTimestamp :: Prelude.Maybe Core.POSIX,
    -- | The name of the Kafka topic.
    CreateEventSourceMapping -> Maybe (NonEmpty Text)
topics :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | (MQ) The name of the Amazon MQ broker destination queue to consume.
    CreateEventSourceMapping -> Maybe (NonEmpty Text)
queues :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | When true, the event source mapping is active. When false, Lambda pauses
    -- polling and invocation.
    --
    -- Default: True
    CreateEventSourceMapping -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
    -- | (Streams only) If the function returns an error, split the batch in two
    -- and retry.
    CreateEventSourceMapping -> Maybe Bool
bisectBatchOnFunctionError :: Prelude.Maybe Prelude.Bool,
    -- | (Streams only) The number of batches to process from each shard
    -- concurrently.
    CreateEventSourceMapping -> Maybe Natural
parallelizationFactor :: Prelude.Maybe Prelude.Natural,
    -- | (Streams only) Discard records after the specified number of retries.
    -- The default value is infinite (-1). When set to infinite (-1), failed
    -- records will be retried until the record expires.
    CreateEventSourceMapping -> Maybe Int
maximumRetryAttempts :: Prelude.Maybe Prelude.Int,
    -- | The maximum number of records in each batch that Lambda pulls from your
    -- stream or queue and sends to your function. Lambda passes all of the
    -- records in the batch to the function in a single call, up to the payload
    -- limit for synchronous invocation (6 MB).
    --
    -- -   __Amazon Kinesis__ - Default 100. Max 10,000.
    --
    -- -   __Amazon DynamoDB Streams__ - Default 100. Max 1,000.
    --
    -- -   __Amazon Simple Queue Service__ - Default 10. For standard queues
    --     the max is 10,000. For FIFO queues the max is 10.
    --
    -- -   __Amazon Managed Streaming for Apache Kafka__ - Default 100. Max
    --     10,000.
    --
    -- -   __Self-Managed Apache Kafka__ - Default 100. Max 10,000.
    CreateEventSourceMapping -> Maybe Natural
batchSize :: Prelude.Maybe Prelude.Natural,
    -- | (Streams and Amazon SQS standard queues) The maximum amount of time, in
    -- seconds, that Lambda spends gathering records before invoking the
    -- function.
    --
    -- Default: 0
    --
    -- Related setting: When you set @BatchSize@ to a value greater than 10,
    -- you must set @MaximumBatchingWindowInSeconds@ to at least 1.
    CreateEventSourceMapping -> Maybe Natural
maximumBatchingWindowInSeconds :: Prelude.Maybe Prelude.Natural,
    -- | An array of authentication protocols or VPC components required to
    -- secure your event source.
    CreateEventSourceMapping -> Maybe [SourceAccessConfiguration]
sourceAccessConfigurations :: Prelude.Maybe [SourceAccessConfiguration],
    -- | (Streams only) Discard records older than the specified age. The default
    -- value is infinite (-1).
    CreateEventSourceMapping -> Maybe Int
maximumRecordAgeInSeconds :: Prelude.Maybe Prelude.Int,
    -- | (Streams only) A list of current response type enums applied to the
    -- event source mapping.
    CreateEventSourceMapping -> Maybe [FunctionResponseType]
functionResponseTypes :: Prelude.Maybe [FunctionResponseType],
    -- | (Streams only) The duration in seconds of a processing window. The range
    -- is between 1 second up to 900 seconds.
    CreateEventSourceMapping -> Maybe Natural
tumblingWindowInSeconds :: Prelude.Maybe Prelude.Natural,
    -- | The Self-Managed Apache Kafka cluster to send records.
    CreateEventSourceMapping -> Maybe SelfManagedEventSource
selfManagedEventSource :: Prelude.Maybe SelfManagedEventSource,
    -- | (Streams only) An Amazon SQS queue or Amazon SNS topic destination for
    -- discarded records.
    CreateEventSourceMapping -> Maybe DestinationConfig
destinationConfig :: Prelude.Maybe DestinationConfig,
    -- | The position in a stream from which to start reading. Required for
    -- Amazon Kinesis, Amazon DynamoDB, and Amazon MSK Streams sources.
    -- @AT_TIMESTAMP@ is only supported for Amazon Kinesis streams.
    CreateEventSourceMapping -> Maybe EventSourcePosition
startingPosition :: Prelude.Maybe EventSourcePosition,
    -- | The name of the Lambda function.
    --
    -- __Name formats__
    --
    -- -   __Function name__ - @MyFunction@.
    --
    -- -   __Function ARN__ -
    --     @arn:aws:lambda:us-west-2:123456789012:function:MyFunction@.
    --
    -- -   __Version or Alias ARN__ -
    --     @arn:aws:lambda:us-west-2:123456789012:function:MyFunction:PROD@.
    --
    -- -   __Partial ARN__ - @123456789012:function:MyFunction@.
    --
    -- The length constraint applies only to the full ARN. If you specify only
    -- the function name, it\'s limited to 64 characters in length.
    CreateEventSourceMapping -> Text
functionName :: Prelude.Text
  }
  deriving (CreateEventSourceMapping -> CreateEventSourceMapping -> Bool
(CreateEventSourceMapping -> CreateEventSourceMapping -> Bool)
-> (CreateEventSourceMapping -> CreateEventSourceMapping -> Bool)
-> Eq CreateEventSourceMapping
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateEventSourceMapping -> CreateEventSourceMapping -> Bool
$c/= :: CreateEventSourceMapping -> CreateEventSourceMapping -> Bool
== :: CreateEventSourceMapping -> CreateEventSourceMapping -> Bool
$c== :: CreateEventSourceMapping -> CreateEventSourceMapping -> Bool
Prelude.Eq, ReadPrec [CreateEventSourceMapping]
ReadPrec CreateEventSourceMapping
Int -> ReadS CreateEventSourceMapping
ReadS [CreateEventSourceMapping]
(Int -> ReadS CreateEventSourceMapping)
-> ReadS [CreateEventSourceMapping]
-> ReadPrec CreateEventSourceMapping
-> ReadPrec [CreateEventSourceMapping]
-> Read CreateEventSourceMapping
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateEventSourceMapping]
$creadListPrec :: ReadPrec [CreateEventSourceMapping]
readPrec :: ReadPrec CreateEventSourceMapping
$creadPrec :: ReadPrec CreateEventSourceMapping
readList :: ReadS [CreateEventSourceMapping]
$creadList :: ReadS [CreateEventSourceMapping]
readsPrec :: Int -> ReadS CreateEventSourceMapping
$creadsPrec :: Int -> ReadS CreateEventSourceMapping
Prelude.Read, Int -> CreateEventSourceMapping -> ShowS
[CreateEventSourceMapping] -> ShowS
CreateEventSourceMapping -> String
(Int -> CreateEventSourceMapping -> ShowS)
-> (CreateEventSourceMapping -> String)
-> ([CreateEventSourceMapping] -> ShowS)
-> Show CreateEventSourceMapping
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateEventSourceMapping] -> ShowS
$cshowList :: [CreateEventSourceMapping] -> ShowS
show :: CreateEventSourceMapping -> String
$cshow :: CreateEventSourceMapping -> String
showsPrec :: Int -> CreateEventSourceMapping -> ShowS
$cshowsPrec :: Int -> CreateEventSourceMapping -> ShowS
Prelude.Show, (forall x.
 CreateEventSourceMapping -> Rep CreateEventSourceMapping x)
-> (forall x.
    Rep CreateEventSourceMapping x -> CreateEventSourceMapping)
-> Generic CreateEventSourceMapping
forall x.
Rep CreateEventSourceMapping x -> CreateEventSourceMapping
forall x.
CreateEventSourceMapping -> Rep CreateEventSourceMapping x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateEventSourceMapping x -> CreateEventSourceMapping
$cfrom :: forall x.
CreateEventSourceMapping -> Rep CreateEventSourceMapping x
Prelude.Generic)

-- |
-- Create a value of 'CreateEventSourceMapping' 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:
--
-- 'eventSourceArn', 'createEventSourceMapping_eventSourceArn' - The Amazon Resource Name (ARN) of the event source.
--
-- -   __Amazon Kinesis__ - The ARN of the data stream or a stream
--     consumer.
--
-- -   __Amazon DynamoDB Streams__ - The ARN of the stream.
--
-- -   __Amazon Simple Queue Service__ - The ARN of the queue.
--
-- -   __Amazon Managed Streaming for Apache Kafka__ - The ARN of the
--     cluster.
--
-- 'startingPositionTimestamp', 'createEventSourceMapping_startingPositionTimestamp' - With @StartingPosition@ set to @AT_TIMESTAMP@, the time from which to
-- start reading.
--
-- 'topics', 'createEventSourceMapping_topics' - The name of the Kafka topic.
--
-- 'queues', 'createEventSourceMapping_queues' - (MQ) The name of the Amazon MQ broker destination queue to consume.
--
-- 'enabled', 'createEventSourceMapping_enabled' - When true, the event source mapping is active. When false, Lambda pauses
-- polling and invocation.
--
-- Default: True
--
-- 'bisectBatchOnFunctionError', 'createEventSourceMapping_bisectBatchOnFunctionError' - (Streams only) If the function returns an error, split the batch in two
-- and retry.
--
-- 'parallelizationFactor', 'createEventSourceMapping_parallelizationFactor' - (Streams only) The number of batches to process from each shard
-- concurrently.
--
-- 'maximumRetryAttempts', 'createEventSourceMapping_maximumRetryAttempts' - (Streams only) Discard records after the specified number of retries.
-- The default value is infinite (-1). When set to infinite (-1), failed
-- records will be retried until the record expires.
--
-- 'batchSize', 'createEventSourceMapping_batchSize' - The maximum number of records in each batch that Lambda pulls from your
-- stream or queue and sends to your function. Lambda passes all of the
-- records in the batch to the function in a single call, up to the payload
-- limit for synchronous invocation (6 MB).
--
-- -   __Amazon Kinesis__ - Default 100. Max 10,000.
--
-- -   __Amazon DynamoDB Streams__ - Default 100. Max 1,000.
--
-- -   __Amazon Simple Queue Service__ - Default 10. For standard queues
--     the max is 10,000. For FIFO queues the max is 10.
--
-- -   __Amazon Managed Streaming for Apache Kafka__ - Default 100. Max
--     10,000.
--
-- -   __Self-Managed Apache Kafka__ - Default 100. Max 10,000.
--
-- 'maximumBatchingWindowInSeconds', 'createEventSourceMapping_maximumBatchingWindowInSeconds' - (Streams and Amazon SQS standard queues) The maximum amount of time, in
-- seconds, that Lambda spends gathering records before invoking the
-- function.
--
-- Default: 0
--
-- Related setting: When you set @BatchSize@ to a value greater than 10,
-- you must set @MaximumBatchingWindowInSeconds@ to at least 1.
--
-- 'sourceAccessConfigurations', 'createEventSourceMapping_sourceAccessConfigurations' - An array of authentication protocols or VPC components required to
-- secure your event source.
--
-- 'maximumRecordAgeInSeconds', 'createEventSourceMapping_maximumRecordAgeInSeconds' - (Streams only) Discard records older than the specified age. The default
-- value is infinite (-1).
--
-- 'functionResponseTypes', 'createEventSourceMapping_functionResponseTypes' - (Streams only) A list of current response type enums applied to the
-- event source mapping.
--
-- 'tumblingWindowInSeconds', 'createEventSourceMapping_tumblingWindowInSeconds' - (Streams only) The duration in seconds of a processing window. The range
-- is between 1 second up to 900 seconds.
--
-- 'selfManagedEventSource', 'createEventSourceMapping_selfManagedEventSource' - The Self-Managed Apache Kafka cluster to send records.
--
-- 'destinationConfig', 'createEventSourceMapping_destinationConfig' - (Streams only) An Amazon SQS queue or Amazon SNS topic destination for
-- discarded records.
--
-- 'startingPosition', 'createEventSourceMapping_startingPosition' - The position in a stream from which to start reading. Required for
-- Amazon Kinesis, Amazon DynamoDB, and Amazon MSK Streams sources.
-- @AT_TIMESTAMP@ is only supported for Amazon Kinesis streams.
--
-- 'functionName', 'createEventSourceMapping_functionName' - The name of the Lambda function.
--
-- __Name formats__
--
-- -   __Function name__ - @MyFunction@.
--
-- -   __Function ARN__ -
--     @arn:aws:lambda:us-west-2:123456789012:function:MyFunction@.
--
-- -   __Version or Alias ARN__ -
--     @arn:aws:lambda:us-west-2:123456789012:function:MyFunction:PROD@.
--
-- -   __Partial ARN__ - @123456789012:function:MyFunction@.
--
-- The length constraint applies only to the full ARN. If you specify only
-- the function name, it\'s limited to 64 characters in length.
newCreateEventSourceMapping ::
  -- | 'functionName'
  Prelude.Text ->
  CreateEventSourceMapping
newCreateEventSourceMapping :: Text -> CreateEventSourceMapping
newCreateEventSourceMapping Text
pFunctionName_ =
  CreateEventSourceMapping' :: Maybe Text
-> Maybe POSIX
-> Maybe (NonEmpty Text)
-> Maybe (NonEmpty Text)
-> Maybe Bool
-> Maybe Bool
-> Maybe Natural
-> Maybe Int
-> Maybe Natural
-> Maybe Natural
-> Maybe [SourceAccessConfiguration]
-> Maybe Int
-> Maybe [FunctionResponseType]
-> Maybe Natural
-> Maybe SelfManagedEventSource
-> Maybe DestinationConfig
-> Maybe EventSourcePosition
-> Text
-> CreateEventSourceMapping
CreateEventSourceMapping'
    { $sel:eventSourceArn:CreateEventSourceMapping' :: Maybe Text
eventSourceArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:startingPositionTimestamp:CreateEventSourceMapping' :: Maybe POSIX
startingPositionTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:topics:CreateEventSourceMapping' :: Maybe (NonEmpty Text)
topics = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:queues:CreateEventSourceMapping' :: Maybe (NonEmpty Text)
queues = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:enabled:CreateEventSourceMapping' :: Maybe Bool
enabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:bisectBatchOnFunctionError:CreateEventSourceMapping' :: Maybe Bool
bisectBatchOnFunctionError = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:parallelizationFactor:CreateEventSourceMapping' :: Maybe Natural
parallelizationFactor = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:maximumRetryAttempts:CreateEventSourceMapping' :: Maybe Int
maximumRetryAttempts = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:batchSize:CreateEventSourceMapping' :: Maybe Natural
batchSize = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:maximumBatchingWindowInSeconds:CreateEventSourceMapping' :: Maybe Natural
maximumBatchingWindowInSeconds = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:sourceAccessConfigurations:CreateEventSourceMapping' :: Maybe [SourceAccessConfiguration]
sourceAccessConfigurations = Maybe [SourceAccessConfiguration]
forall a. Maybe a
Prelude.Nothing,
      $sel:maximumRecordAgeInSeconds:CreateEventSourceMapping' :: Maybe Int
maximumRecordAgeInSeconds = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:functionResponseTypes:CreateEventSourceMapping' :: Maybe [FunctionResponseType]
functionResponseTypes = Maybe [FunctionResponseType]
forall a. Maybe a
Prelude.Nothing,
      $sel:tumblingWindowInSeconds:CreateEventSourceMapping' :: Maybe Natural
tumblingWindowInSeconds = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:selfManagedEventSource:CreateEventSourceMapping' :: Maybe SelfManagedEventSource
selfManagedEventSource = Maybe SelfManagedEventSource
forall a. Maybe a
Prelude.Nothing,
      $sel:destinationConfig:CreateEventSourceMapping' :: Maybe DestinationConfig
destinationConfig = Maybe DestinationConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:startingPosition:CreateEventSourceMapping' :: Maybe EventSourcePosition
startingPosition = Maybe EventSourcePosition
forall a. Maybe a
Prelude.Nothing,
      $sel:functionName:CreateEventSourceMapping' :: Text
functionName = Text
pFunctionName_
    }

-- | The Amazon Resource Name (ARN) of the event source.
--
-- -   __Amazon Kinesis__ - The ARN of the data stream or a stream
--     consumer.
--
-- -   __Amazon DynamoDB Streams__ - The ARN of the stream.
--
-- -   __Amazon Simple Queue Service__ - The ARN of the queue.
--
-- -   __Amazon Managed Streaming for Apache Kafka__ - The ARN of the
--     cluster.
createEventSourceMapping_eventSourceArn :: Lens.Lens' CreateEventSourceMapping (Prelude.Maybe Prelude.Text)
createEventSourceMapping_eventSourceArn :: (Maybe Text -> f (Maybe Text))
-> CreateEventSourceMapping -> f CreateEventSourceMapping
createEventSourceMapping_eventSourceArn = (CreateEventSourceMapping -> Maybe Text)
-> (CreateEventSourceMapping
    -> Maybe Text -> CreateEventSourceMapping)
-> Lens
     CreateEventSourceMapping
     CreateEventSourceMapping
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEventSourceMapping' {Maybe Text
eventSourceArn :: Maybe Text
$sel:eventSourceArn:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe Text
eventSourceArn} -> Maybe Text
eventSourceArn) (\s :: CreateEventSourceMapping
s@CreateEventSourceMapping' {} Maybe Text
a -> CreateEventSourceMapping
s {$sel:eventSourceArn:CreateEventSourceMapping' :: Maybe Text
eventSourceArn = Maybe Text
a} :: CreateEventSourceMapping)

-- | With @StartingPosition@ set to @AT_TIMESTAMP@, the time from which to
-- start reading.
createEventSourceMapping_startingPositionTimestamp :: Lens.Lens' CreateEventSourceMapping (Prelude.Maybe Prelude.UTCTime)
createEventSourceMapping_startingPositionTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateEventSourceMapping -> f CreateEventSourceMapping
createEventSourceMapping_startingPositionTimestamp = (CreateEventSourceMapping -> Maybe POSIX)
-> (CreateEventSourceMapping
    -> Maybe POSIX -> CreateEventSourceMapping)
-> Lens
     CreateEventSourceMapping
     CreateEventSourceMapping
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEventSourceMapping' {Maybe POSIX
startingPositionTimestamp :: Maybe POSIX
$sel:startingPositionTimestamp:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe POSIX
startingPositionTimestamp} -> Maybe POSIX
startingPositionTimestamp) (\s :: CreateEventSourceMapping
s@CreateEventSourceMapping' {} Maybe POSIX
a -> CreateEventSourceMapping
s {$sel:startingPositionTimestamp:CreateEventSourceMapping' :: Maybe POSIX
startingPositionTimestamp = Maybe POSIX
a} :: CreateEventSourceMapping) ((Maybe POSIX -> f (Maybe POSIX))
 -> CreateEventSourceMapping -> f CreateEventSourceMapping)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateEventSourceMapping
-> f CreateEventSourceMapping
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The name of the Kafka topic.
createEventSourceMapping_topics :: Lens.Lens' CreateEventSourceMapping (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
createEventSourceMapping_topics :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateEventSourceMapping -> f CreateEventSourceMapping
createEventSourceMapping_topics = (CreateEventSourceMapping -> Maybe (NonEmpty Text))
-> (CreateEventSourceMapping
    -> Maybe (NonEmpty Text) -> CreateEventSourceMapping)
-> Lens
     CreateEventSourceMapping
     CreateEventSourceMapping
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEventSourceMapping' {Maybe (NonEmpty Text)
topics :: Maybe (NonEmpty Text)
$sel:topics:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe (NonEmpty Text)
topics} -> Maybe (NonEmpty Text)
topics) (\s :: CreateEventSourceMapping
s@CreateEventSourceMapping' {} Maybe (NonEmpty Text)
a -> CreateEventSourceMapping
s {$sel:topics:CreateEventSourceMapping' :: Maybe (NonEmpty Text)
topics = Maybe (NonEmpty Text)
a} :: CreateEventSourceMapping) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> CreateEventSourceMapping -> f CreateEventSourceMapping)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateEventSourceMapping
-> f CreateEventSourceMapping
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
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
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | (MQ) The name of the Amazon MQ broker destination queue to consume.
createEventSourceMapping_queues :: Lens.Lens' CreateEventSourceMapping (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
createEventSourceMapping_queues :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateEventSourceMapping -> f CreateEventSourceMapping
createEventSourceMapping_queues = (CreateEventSourceMapping -> Maybe (NonEmpty Text))
-> (CreateEventSourceMapping
    -> Maybe (NonEmpty Text) -> CreateEventSourceMapping)
-> Lens
     CreateEventSourceMapping
     CreateEventSourceMapping
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEventSourceMapping' {Maybe (NonEmpty Text)
queues :: Maybe (NonEmpty Text)
$sel:queues:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe (NonEmpty Text)
queues} -> Maybe (NonEmpty Text)
queues) (\s :: CreateEventSourceMapping
s@CreateEventSourceMapping' {} Maybe (NonEmpty Text)
a -> CreateEventSourceMapping
s {$sel:queues:CreateEventSourceMapping' :: Maybe (NonEmpty Text)
queues = Maybe (NonEmpty Text)
a} :: CreateEventSourceMapping) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> CreateEventSourceMapping -> f CreateEventSourceMapping)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateEventSourceMapping
-> f CreateEventSourceMapping
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
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
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | When true, the event source mapping is active. When false, Lambda pauses
-- polling and invocation.
--
-- Default: True
createEventSourceMapping_enabled :: Lens.Lens' CreateEventSourceMapping (Prelude.Maybe Prelude.Bool)
createEventSourceMapping_enabled :: (Maybe Bool -> f (Maybe Bool))
-> CreateEventSourceMapping -> f CreateEventSourceMapping
createEventSourceMapping_enabled = (CreateEventSourceMapping -> Maybe Bool)
-> (CreateEventSourceMapping
    -> Maybe Bool -> CreateEventSourceMapping)
-> Lens
     CreateEventSourceMapping
     CreateEventSourceMapping
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEventSourceMapping' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: CreateEventSourceMapping
s@CreateEventSourceMapping' {} Maybe Bool
a -> CreateEventSourceMapping
s {$sel:enabled:CreateEventSourceMapping' :: Maybe Bool
enabled = Maybe Bool
a} :: CreateEventSourceMapping)

-- | (Streams only) If the function returns an error, split the batch in two
-- and retry.
createEventSourceMapping_bisectBatchOnFunctionError :: Lens.Lens' CreateEventSourceMapping (Prelude.Maybe Prelude.Bool)
createEventSourceMapping_bisectBatchOnFunctionError :: (Maybe Bool -> f (Maybe Bool))
-> CreateEventSourceMapping -> f CreateEventSourceMapping
createEventSourceMapping_bisectBatchOnFunctionError = (CreateEventSourceMapping -> Maybe Bool)
-> (CreateEventSourceMapping
    -> Maybe Bool -> CreateEventSourceMapping)
-> Lens
     CreateEventSourceMapping
     CreateEventSourceMapping
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEventSourceMapping' {Maybe Bool
bisectBatchOnFunctionError :: Maybe Bool
$sel:bisectBatchOnFunctionError:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe Bool
bisectBatchOnFunctionError} -> Maybe Bool
bisectBatchOnFunctionError) (\s :: CreateEventSourceMapping
s@CreateEventSourceMapping' {} Maybe Bool
a -> CreateEventSourceMapping
s {$sel:bisectBatchOnFunctionError:CreateEventSourceMapping' :: Maybe Bool
bisectBatchOnFunctionError = Maybe Bool
a} :: CreateEventSourceMapping)

-- | (Streams only) The number of batches to process from each shard
-- concurrently.
createEventSourceMapping_parallelizationFactor :: Lens.Lens' CreateEventSourceMapping (Prelude.Maybe Prelude.Natural)
createEventSourceMapping_parallelizationFactor :: (Maybe Natural -> f (Maybe Natural))
-> CreateEventSourceMapping -> f CreateEventSourceMapping
createEventSourceMapping_parallelizationFactor = (CreateEventSourceMapping -> Maybe Natural)
-> (CreateEventSourceMapping
    -> Maybe Natural -> CreateEventSourceMapping)
-> Lens
     CreateEventSourceMapping
     CreateEventSourceMapping
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEventSourceMapping' {Maybe Natural
parallelizationFactor :: Maybe Natural
$sel:parallelizationFactor:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe Natural
parallelizationFactor} -> Maybe Natural
parallelizationFactor) (\s :: CreateEventSourceMapping
s@CreateEventSourceMapping' {} Maybe Natural
a -> CreateEventSourceMapping
s {$sel:parallelizationFactor:CreateEventSourceMapping' :: Maybe Natural
parallelizationFactor = Maybe Natural
a} :: CreateEventSourceMapping)

-- | (Streams only) Discard records after the specified number of retries.
-- The default value is infinite (-1). When set to infinite (-1), failed
-- records will be retried until the record expires.
createEventSourceMapping_maximumRetryAttempts :: Lens.Lens' CreateEventSourceMapping (Prelude.Maybe Prelude.Int)
createEventSourceMapping_maximumRetryAttempts :: (Maybe Int -> f (Maybe Int))
-> CreateEventSourceMapping -> f CreateEventSourceMapping
createEventSourceMapping_maximumRetryAttempts = (CreateEventSourceMapping -> Maybe Int)
-> (CreateEventSourceMapping
    -> Maybe Int -> CreateEventSourceMapping)
-> Lens
     CreateEventSourceMapping
     CreateEventSourceMapping
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEventSourceMapping' {Maybe Int
maximumRetryAttempts :: Maybe Int
$sel:maximumRetryAttempts:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe Int
maximumRetryAttempts} -> Maybe Int
maximumRetryAttempts) (\s :: CreateEventSourceMapping
s@CreateEventSourceMapping' {} Maybe Int
a -> CreateEventSourceMapping
s {$sel:maximumRetryAttempts:CreateEventSourceMapping' :: Maybe Int
maximumRetryAttempts = Maybe Int
a} :: CreateEventSourceMapping)

-- | The maximum number of records in each batch that Lambda pulls from your
-- stream or queue and sends to your function. Lambda passes all of the
-- records in the batch to the function in a single call, up to the payload
-- limit for synchronous invocation (6 MB).
--
-- -   __Amazon Kinesis__ - Default 100. Max 10,000.
--
-- -   __Amazon DynamoDB Streams__ - Default 100. Max 1,000.
--
-- -   __Amazon Simple Queue Service__ - Default 10. For standard queues
--     the max is 10,000. For FIFO queues the max is 10.
--
-- -   __Amazon Managed Streaming for Apache Kafka__ - Default 100. Max
--     10,000.
--
-- -   __Self-Managed Apache Kafka__ - Default 100. Max 10,000.
createEventSourceMapping_batchSize :: Lens.Lens' CreateEventSourceMapping (Prelude.Maybe Prelude.Natural)
createEventSourceMapping_batchSize :: (Maybe Natural -> f (Maybe Natural))
-> CreateEventSourceMapping -> f CreateEventSourceMapping
createEventSourceMapping_batchSize = (CreateEventSourceMapping -> Maybe Natural)
-> (CreateEventSourceMapping
    -> Maybe Natural -> CreateEventSourceMapping)
-> Lens
     CreateEventSourceMapping
     CreateEventSourceMapping
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEventSourceMapping' {Maybe Natural
batchSize :: Maybe Natural
$sel:batchSize:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe Natural
batchSize} -> Maybe Natural
batchSize) (\s :: CreateEventSourceMapping
s@CreateEventSourceMapping' {} Maybe Natural
a -> CreateEventSourceMapping
s {$sel:batchSize:CreateEventSourceMapping' :: Maybe Natural
batchSize = Maybe Natural
a} :: CreateEventSourceMapping)

-- | (Streams and Amazon SQS standard queues) The maximum amount of time, in
-- seconds, that Lambda spends gathering records before invoking the
-- function.
--
-- Default: 0
--
-- Related setting: When you set @BatchSize@ to a value greater than 10,
-- you must set @MaximumBatchingWindowInSeconds@ to at least 1.
createEventSourceMapping_maximumBatchingWindowInSeconds :: Lens.Lens' CreateEventSourceMapping (Prelude.Maybe Prelude.Natural)
createEventSourceMapping_maximumBatchingWindowInSeconds :: (Maybe Natural -> f (Maybe Natural))
-> CreateEventSourceMapping -> f CreateEventSourceMapping
createEventSourceMapping_maximumBatchingWindowInSeconds = (CreateEventSourceMapping -> Maybe Natural)
-> (CreateEventSourceMapping
    -> Maybe Natural -> CreateEventSourceMapping)
-> Lens
     CreateEventSourceMapping
     CreateEventSourceMapping
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEventSourceMapping' {Maybe Natural
maximumBatchingWindowInSeconds :: Maybe Natural
$sel:maximumBatchingWindowInSeconds:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe Natural
maximumBatchingWindowInSeconds} -> Maybe Natural
maximumBatchingWindowInSeconds) (\s :: CreateEventSourceMapping
s@CreateEventSourceMapping' {} Maybe Natural
a -> CreateEventSourceMapping
s {$sel:maximumBatchingWindowInSeconds:CreateEventSourceMapping' :: Maybe Natural
maximumBatchingWindowInSeconds = Maybe Natural
a} :: CreateEventSourceMapping)

-- | An array of authentication protocols or VPC components required to
-- secure your event source.
createEventSourceMapping_sourceAccessConfigurations :: Lens.Lens' CreateEventSourceMapping (Prelude.Maybe [SourceAccessConfiguration])
createEventSourceMapping_sourceAccessConfigurations :: (Maybe [SourceAccessConfiguration]
 -> f (Maybe [SourceAccessConfiguration]))
-> CreateEventSourceMapping -> f CreateEventSourceMapping
createEventSourceMapping_sourceAccessConfigurations = (CreateEventSourceMapping -> Maybe [SourceAccessConfiguration])
-> (CreateEventSourceMapping
    -> Maybe [SourceAccessConfiguration] -> CreateEventSourceMapping)
-> Lens
     CreateEventSourceMapping
     CreateEventSourceMapping
     (Maybe [SourceAccessConfiguration])
     (Maybe [SourceAccessConfiguration])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEventSourceMapping' {Maybe [SourceAccessConfiguration]
sourceAccessConfigurations :: Maybe [SourceAccessConfiguration]
$sel:sourceAccessConfigurations:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe [SourceAccessConfiguration]
sourceAccessConfigurations} -> Maybe [SourceAccessConfiguration]
sourceAccessConfigurations) (\s :: CreateEventSourceMapping
s@CreateEventSourceMapping' {} Maybe [SourceAccessConfiguration]
a -> CreateEventSourceMapping
s {$sel:sourceAccessConfigurations:CreateEventSourceMapping' :: Maybe [SourceAccessConfiguration]
sourceAccessConfigurations = Maybe [SourceAccessConfiguration]
a} :: CreateEventSourceMapping) ((Maybe [SourceAccessConfiguration]
  -> f (Maybe [SourceAccessConfiguration]))
 -> CreateEventSourceMapping -> f CreateEventSourceMapping)
-> ((Maybe [SourceAccessConfiguration]
     -> f (Maybe [SourceAccessConfiguration]))
    -> Maybe [SourceAccessConfiguration]
    -> f (Maybe [SourceAccessConfiguration]))
-> (Maybe [SourceAccessConfiguration]
    -> f (Maybe [SourceAccessConfiguration]))
-> CreateEventSourceMapping
-> f CreateEventSourceMapping
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [SourceAccessConfiguration]
  [SourceAccessConfiguration]
  [SourceAccessConfiguration]
  [SourceAccessConfiguration]
-> Iso
     (Maybe [SourceAccessConfiguration])
     (Maybe [SourceAccessConfiguration])
     (Maybe [SourceAccessConfiguration])
     (Maybe [SourceAccessConfiguration])
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
  [SourceAccessConfiguration]
  [SourceAccessConfiguration]
  [SourceAccessConfiguration]
  [SourceAccessConfiguration]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | (Streams only) Discard records older than the specified age. The default
-- value is infinite (-1).
createEventSourceMapping_maximumRecordAgeInSeconds :: Lens.Lens' CreateEventSourceMapping (Prelude.Maybe Prelude.Int)
createEventSourceMapping_maximumRecordAgeInSeconds :: (Maybe Int -> f (Maybe Int))
-> CreateEventSourceMapping -> f CreateEventSourceMapping
createEventSourceMapping_maximumRecordAgeInSeconds = (CreateEventSourceMapping -> Maybe Int)
-> (CreateEventSourceMapping
    -> Maybe Int -> CreateEventSourceMapping)
-> Lens
     CreateEventSourceMapping
     CreateEventSourceMapping
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEventSourceMapping' {Maybe Int
maximumRecordAgeInSeconds :: Maybe Int
$sel:maximumRecordAgeInSeconds:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe Int
maximumRecordAgeInSeconds} -> Maybe Int
maximumRecordAgeInSeconds) (\s :: CreateEventSourceMapping
s@CreateEventSourceMapping' {} Maybe Int
a -> CreateEventSourceMapping
s {$sel:maximumRecordAgeInSeconds:CreateEventSourceMapping' :: Maybe Int
maximumRecordAgeInSeconds = Maybe Int
a} :: CreateEventSourceMapping)

-- | (Streams only) A list of current response type enums applied to the
-- event source mapping.
createEventSourceMapping_functionResponseTypes :: Lens.Lens' CreateEventSourceMapping (Prelude.Maybe [FunctionResponseType])
createEventSourceMapping_functionResponseTypes :: (Maybe [FunctionResponseType] -> f (Maybe [FunctionResponseType]))
-> CreateEventSourceMapping -> f CreateEventSourceMapping
createEventSourceMapping_functionResponseTypes = (CreateEventSourceMapping -> Maybe [FunctionResponseType])
-> (CreateEventSourceMapping
    -> Maybe [FunctionResponseType] -> CreateEventSourceMapping)
-> Lens
     CreateEventSourceMapping
     CreateEventSourceMapping
     (Maybe [FunctionResponseType])
     (Maybe [FunctionResponseType])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEventSourceMapping' {Maybe [FunctionResponseType]
functionResponseTypes :: Maybe [FunctionResponseType]
$sel:functionResponseTypes:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe [FunctionResponseType]
functionResponseTypes} -> Maybe [FunctionResponseType]
functionResponseTypes) (\s :: CreateEventSourceMapping
s@CreateEventSourceMapping' {} Maybe [FunctionResponseType]
a -> CreateEventSourceMapping
s {$sel:functionResponseTypes:CreateEventSourceMapping' :: Maybe [FunctionResponseType]
functionResponseTypes = Maybe [FunctionResponseType]
a} :: CreateEventSourceMapping) ((Maybe [FunctionResponseType] -> f (Maybe [FunctionResponseType]))
 -> CreateEventSourceMapping -> f CreateEventSourceMapping)
-> ((Maybe [FunctionResponseType]
     -> f (Maybe [FunctionResponseType]))
    -> Maybe [FunctionResponseType]
    -> f (Maybe [FunctionResponseType]))
-> (Maybe [FunctionResponseType]
    -> f (Maybe [FunctionResponseType]))
-> CreateEventSourceMapping
-> f CreateEventSourceMapping
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [FunctionResponseType]
  [FunctionResponseType]
  [FunctionResponseType]
  [FunctionResponseType]
-> Iso
     (Maybe [FunctionResponseType])
     (Maybe [FunctionResponseType])
     (Maybe [FunctionResponseType])
     (Maybe [FunctionResponseType])
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
  [FunctionResponseType]
  [FunctionResponseType]
  [FunctionResponseType]
  [FunctionResponseType]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | (Streams only) The duration in seconds of a processing window. The range
-- is between 1 second up to 900 seconds.
createEventSourceMapping_tumblingWindowInSeconds :: Lens.Lens' CreateEventSourceMapping (Prelude.Maybe Prelude.Natural)
createEventSourceMapping_tumblingWindowInSeconds :: (Maybe Natural -> f (Maybe Natural))
-> CreateEventSourceMapping -> f CreateEventSourceMapping
createEventSourceMapping_tumblingWindowInSeconds = (CreateEventSourceMapping -> Maybe Natural)
-> (CreateEventSourceMapping
    -> Maybe Natural -> CreateEventSourceMapping)
-> Lens
     CreateEventSourceMapping
     CreateEventSourceMapping
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEventSourceMapping' {Maybe Natural
tumblingWindowInSeconds :: Maybe Natural
$sel:tumblingWindowInSeconds:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe Natural
tumblingWindowInSeconds} -> Maybe Natural
tumblingWindowInSeconds) (\s :: CreateEventSourceMapping
s@CreateEventSourceMapping' {} Maybe Natural
a -> CreateEventSourceMapping
s {$sel:tumblingWindowInSeconds:CreateEventSourceMapping' :: Maybe Natural
tumblingWindowInSeconds = Maybe Natural
a} :: CreateEventSourceMapping)

-- | The Self-Managed Apache Kafka cluster to send records.
createEventSourceMapping_selfManagedEventSource :: Lens.Lens' CreateEventSourceMapping (Prelude.Maybe SelfManagedEventSource)
createEventSourceMapping_selfManagedEventSource :: (Maybe SelfManagedEventSource -> f (Maybe SelfManagedEventSource))
-> CreateEventSourceMapping -> f CreateEventSourceMapping
createEventSourceMapping_selfManagedEventSource = (CreateEventSourceMapping -> Maybe SelfManagedEventSource)
-> (CreateEventSourceMapping
    -> Maybe SelfManagedEventSource -> CreateEventSourceMapping)
-> Lens
     CreateEventSourceMapping
     CreateEventSourceMapping
     (Maybe SelfManagedEventSource)
     (Maybe SelfManagedEventSource)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEventSourceMapping' {Maybe SelfManagedEventSource
selfManagedEventSource :: Maybe SelfManagedEventSource
$sel:selfManagedEventSource:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe SelfManagedEventSource
selfManagedEventSource} -> Maybe SelfManagedEventSource
selfManagedEventSource) (\s :: CreateEventSourceMapping
s@CreateEventSourceMapping' {} Maybe SelfManagedEventSource
a -> CreateEventSourceMapping
s {$sel:selfManagedEventSource:CreateEventSourceMapping' :: Maybe SelfManagedEventSource
selfManagedEventSource = Maybe SelfManagedEventSource
a} :: CreateEventSourceMapping)

-- | (Streams only) An Amazon SQS queue or Amazon SNS topic destination for
-- discarded records.
createEventSourceMapping_destinationConfig :: Lens.Lens' CreateEventSourceMapping (Prelude.Maybe DestinationConfig)
createEventSourceMapping_destinationConfig :: (Maybe DestinationConfig -> f (Maybe DestinationConfig))
-> CreateEventSourceMapping -> f CreateEventSourceMapping
createEventSourceMapping_destinationConfig = (CreateEventSourceMapping -> Maybe DestinationConfig)
-> (CreateEventSourceMapping
    -> Maybe DestinationConfig -> CreateEventSourceMapping)
-> Lens
     CreateEventSourceMapping
     CreateEventSourceMapping
     (Maybe DestinationConfig)
     (Maybe DestinationConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEventSourceMapping' {Maybe DestinationConfig
destinationConfig :: Maybe DestinationConfig
$sel:destinationConfig:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe DestinationConfig
destinationConfig} -> Maybe DestinationConfig
destinationConfig) (\s :: CreateEventSourceMapping
s@CreateEventSourceMapping' {} Maybe DestinationConfig
a -> CreateEventSourceMapping
s {$sel:destinationConfig:CreateEventSourceMapping' :: Maybe DestinationConfig
destinationConfig = Maybe DestinationConfig
a} :: CreateEventSourceMapping)

-- | The position in a stream from which to start reading. Required for
-- Amazon Kinesis, Amazon DynamoDB, and Amazon MSK Streams sources.
-- @AT_TIMESTAMP@ is only supported for Amazon Kinesis streams.
createEventSourceMapping_startingPosition :: Lens.Lens' CreateEventSourceMapping (Prelude.Maybe EventSourcePosition)
createEventSourceMapping_startingPosition :: (Maybe EventSourcePosition -> f (Maybe EventSourcePosition))
-> CreateEventSourceMapping -> f CreateEventSourceMapping
createEventSourceMapping_startingPosition = (CreateEventSourceMapping -> Maybe EventSourcePosition)
-> (CreateEventSourceMapping
    -> Maybe EventSourcePosition -> CreateEventSourceMapping)
-> Lens
     CreateEventSourceMapping
     CreateEventSourceMapping
     (Maybe EventSourcePosition)
     (Maybe EventSourcePosition)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEventSourceMapping' {Maybe EventSourcePosition
startingPosition :: Maybe EventSourcePosition
$sel:startingPosition:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe EventSourcePosition
startingPosition} -> Maybe EventSourcePosition
startingPosition) (\s :: CreateEventSourceMapping
s@CreateEventSourceMapping' {} Maybe EventSourcePosition
a -> CreateEventSourceMapping
s {$sel:startingPosition:CreateEventSourceMapping' :: Maybe EventSourcePosition
startingPosition = Maybe EventSourcePosition
a} :: CreateEventSourceMapping)

-- | The name of the Lambda function.
--
-- __Name formats__
--
-- -   __Function name__ - @MyFunction@.
--
-- -   __Function ARN__ -
--     @arn:aws:lambda:us-west-2:123456789012:function:MyFunction@.
--
-- -   __Version or Alias ARN__ -
--     @arn:aws:lambda:us-west-2:123456789012:function:MyFunction:PROD@.
--
-- -   __Partial ARN__ - @123456789012:function:MyFunction@.
--
-- The length constraint applies only to the full ARN. If you specify only
-- the function name, it\'s limited to 64 characters in length.
createEventSourceMapping_functionName :: Lens.Lens' CreateEventSourceMapping Prelude.Text
createEventSourceMapping_functionName :: (Text -> f Text)
-> CreateEventSourceMapping -> f CreateEventSourceMapping
createEventSourceMapping_functionName = (CreateEventSourceMapping -> Text)
-> (CreateEventSourceMapping -> Text -> CreateEventSourceMapping)
-> Lens CreateEventSourceMapping CreateEventSourceMapping Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEventSourceMapping' {Text
functionName :: Text
$sel:functionName:CreateEventSourceMapping' :: CreateEventSourceMapping -> Text
functionName} -> Text
functionName) (\s :: CreateEventSourceMapping
s@CreateEventSourceMapping' {} Text
a -> CreateEventSourceMapping
s {$sel:functionName:CreateEventSourceMapping' :: Text
functionName = Text
a} :: CreateEventSourceMapping)

instance Core.AWSRequest CreateEventSourceMapping where
  type
    AWSResponse CreateEventSourceMapping =
      EventSourceMappingConfiguration
  request :: CreateEventSourceMapping -> Request CreateEventSourceMapping
request = Service
-> CreateEventSourceMapping -> Request CreateEventSourceMapping
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateEventSourceMapping
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateEventSourceMapping)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateEventSourceMapping))
-> Logger
-> Service
-> Proxy CreateEventSourceMapping
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateEventSourceMapping)))
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 -> Object -> Either String EventSourceMappingConfiguration
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)

instance Prelude.Hashable CreateEventSourceMapping

instance Prelude.NFData CreateEventSourceMapping

instance Core.ToHeaders CreateEventSourceMapping where
  toHeaders :: CreateEventSourceMapping -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateEventSourceMapping -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToJSON CreateEventSourceMapping where
  toJSON :: CreateEventSourceMapping -> Value
toJSON CreateEventSourceMapping' {Maybe Bool
Maybe Int
Maybe Natural
Maybe [FunctionResponseType]
Maybe [SourceAccessConfiguration]
Maybe (NonEmpty Text)
Maybe Text
Maybe POSIX
Maybe EventSourcePosition
Maybe DestinationConfig
Maybe SelfManagedEventSource
Text
functionName :: Text
startingPosition :: Maybe EventSourcePosition
destinationConfig :: Maybe DestinationConfig
selfManagedEventSource :: Maybe SelfManagedEventSource
tumblingWindowInSeconds :: Maybe Natural
functionResponseTypes :: Maybe [FunctionResponseType]
maximumRecordAgeInSeconds :: Maybe Int
sourceAccessConfigurations :: Maybe [SourceAccessConfiguration]
maximumBatchingWindowInSeconds :: Maybe Natural
batchSize :: Maybe Natural
maximumRetryAttempts :: Maybe Int
parallelizationFactor :: Maybe Natural
bisectBatchOnFunctionError :: Maybe Bool
enabled :: Maybe Bool
queues :: Maybe (NonEmpty Text)
topics :: Maybe (NonEmpty Text)
startingPositionTimestamp :: Maybe POSIX
eventSourceArn :: Maybe Text
$sel:functionName:CreateEventSourceMapping' :: CreateEventSourceMapping -> Text
$sel:startingPosition:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe EventSourcePosition
$sel:destinationConfig:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe DestinationConfig
$sel:selfManagedEventSource:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe SelfManagedEventSource
$sel:tumblingWindowInSeconds:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe Natural
$sel:functionResponseTypes:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe [FunctionResponseType]
$sel:maximumRecordAgeInSeconds:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe Int
$sel:sourceAccessConfigurations:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe [SourceAccessConfiguration]
$sel:maximumBatchingWindowInSeconds:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe Natural
$sel:batchSize:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe Natural
$sel:maximumRetryAttempts:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe Int
$sel:parallelizationFactor:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe Natural
$sel:bisectBatchOnFunctionError:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe Bool
$sel:enabled:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe Bool
$sel:queues:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe (NonEmpty Text)
$sel:topics:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe (NonEmpty Text)
$sel:startingPositionTimestamp:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe POSIX
$sel:eventSourceArn:CreateEventSourceMapping' :: CreateEventSourceMapping -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"EventSourceArn" 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
eventSourceArn,
            (Text
"StartingPositionTimestamp" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
startingPositionTimestamp,
            (Text
"Topics" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
topics,
            (Text
"Queues" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
queues,
            (Text
"Enabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
enabled,
            (Text
"BisectBatchOnFunctionError" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
bisectBatchOnFunctionError,
            (Text
"ParallelizationFactor" 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
parallelizationFactor,
            (Text
"MaximumRetryAttempts" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maximumRetryAttempts,
            (Text
"BatchSize" 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
batchSize,
            (Text
"MaximumBatchingWindowInSeconds" 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
maximumBatchingWindowInSeconds,
            (Text
"SourceAccessConfigurations" Text -> [SourceAccessConfiguration] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([SourceAccessConfiguration] -> Pair)
-> Maybe [SourceAccessConfiguration] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [SourceAccessConfiguration]
sourceAccessConfigurations,
            (Text
"MaximumRecordAgeInSeconds" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maximumRecordAgeInSeconds,
            (Text
"FunctionResponseTypes" Text -> [FunctionResponseType] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([FunctionResponseType] -> Pair)
-> Maybe [FunctionResponseType] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [FunctionResponseType]
functionResponseTypes,
            (Text
"TumblingWindowInSeconds" 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
tumblingWindowInSeconds,
            (Text
"SelfManagedEventSource" Text -> SelfManagedEventSource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (SelfManagedEventSource -> Pair)
-> Maybe SelfManagedEventSource -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SelfManagedEventSource
selfManagedEventSource,
            (Text
"DestinationConfig" Text -> DestinationConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (DestinationConfig -> Pair)
-> Maybe DestinationConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DestinationConfig
destinationConfig,
            (Text
"StartingPosition" Text -> EventSourcePosition -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (EventSourcePosition -> Pair)
-> Maybe EventSourcePosition -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EventSourcePosition
startingPosition,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"FunctionName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
functionName)
          ]
      )

instance Core.ToPath CreateEventSourceMapping where
  toPath :: CreateEventSourceMapping -> ByteString
toPath =
    ByteString -> CreateEventSourceMapping -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/2015-03-31/event-source-mappings/"

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