Class: AWSCDK::LambdaEventSources::KinesisEventSourceProps

Inherits:
StreamEventSourceProps
  • Object
show all
Defined in:
lambda_event_sources/kinesis_event_source_props.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(starting_position:, batch_size: nil, enabled: nil, max_batching_window: nil, provisioned_poller_config: nil, bisect_batch_on_error: nil, filter_encryption: nil, filters: nil, max_record_age: nil, metrics_config: nil, on_failure: nil, parallelization_factor: nil, report_batch_item_failures: nil, retry_attempts: nil, tumbling_window: nil, starting_position_timestamp: nil) ⇒ KinesisEventSourceProps

Returns a new instance of KinesisEventSourceProps.

Parameters:

  • starting_position (AWSCDK::Lambda::StartingPosition)

    Where to begin consuming the stream.

  • batch_size (Numeric, nil) (defaults to: nil)

    The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function.

  • enabled (Boolean, nil) (defaults to: nil)

    If the stream event source mapping should be enabled.

  • max_batching_window (AWSCDK::Duration, nil) (defaults to: nil)

    The maximum amount of time to gather records before invoking the function.

  • provisioned_poller_config (AWSCDK::LambdaEventSources::ProvisionedPollerConfig, nil) (defaults to: nil)

    Configuration for provisioned pollers that read from the event source.

  • bisect_batch_on_error (Boolean, nil) (defaults to: nil)

    If the function returns an error, split the batch in two and retry.

  • filter_encryption (AWSCDK::KMS::IKey, nil) (defaults to: nil)

    Add Customer managed KMS key to encrypt Filter Criteria.

  • filters (Array<Hash{String => Object}>, nil) (defaults to: nil)

    Add filter criteria option.

  • max_record_age (AWSCDK::Duration, nil) (defaults to: nil)

    The maximum age of a record that Lambda sends to a function for processing.

  • metrics_config (AWSCDK::Lambda::MetricsConfig, nil) (defaults to: nil)

    Configuration for enhanced monitoring metrics collection When specified, enables collection of additional metrics for the stream event source.

  • on_failure (AWSCDK::Lambda::IEventSourceDlq, nil) (defaults to: nil)

    An Amazon S3, Amazon SQS queue or Amazon SNS topic destination for discarded records.

  • parallelization_factor (Numeric, nil) (defaults to: nil)

    The number of batches to process from each shard concurrently.

  • report_batch_item_failures (Boolean, nil) (defaults to: nil)

    Allow functions to return partially successful responses for a batch of records.

  • retry_attempts (Numeric, nil) (defaults to: nil)

    Maximum number of retry attempts.

  • tumbling_window (AWSCDK::Duration, nil) (defaults to: nil)

    The size of the tumbling windows to group records sent to DynamoDB or Kinesis Valid Range: 0 - 15 minutes.

  • starting_position_timestamp (Numeric, nil) (defaults to: nil)

    The time from which to start reading, in Unix time seconds.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lambda_event_sources/kinesis_event_source_props.rb', line 22

def initialize(starting_position:, batch_size: nil, enabled: nil, max_batching_window: nil, provisioned_poller_config: nil, bisect_batch_on_error: nil, filter_encryption: nil, filters: nil, max_record_age: nil, metrics_config: nil, on_failure: nil, parallelization_factor: nil, report_batch_item_failures: nil, retry_attempts: nil, tumbling_window: nil, starting_position_timestamp: nil)
  @starting_position = starting_position
  Jsii::Type.check_type(@starting_position, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLlN0YXJ0aW5nUG9zaXRpb24ifQ==")), "startingPosition")
  @batch_size = batch_size
  Jsii::Type.check_type(@batch_size, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "batchSize") unless @batch_size.nil?
  @enabled = enabled
  Jsii::Type.check_type(@enabled, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enabled") unless @enabled.nil?
  @max_batching_window = max_batching_window
  Jsii::Type.check_type(@max_batching_window, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "maxBatchingWindow") unless @max_batching_window.nil?
  @provisioned_poller_config = provisioned_poller_config.is_a?(Hash) ? ::AWSCDK::LambdaEventSources::ProvisionedPollerConfig.new(**provisioned_poller_config.transform_keys(&:to_sym)) : provisioned_poller_config
  Jsii::Type.check_type(@provisioned_poller_config, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhX2V2ZW50X3NvdXJjZXMuUHJvdmlzaW9uZWRQb2xsZXJDb25maWcifQ==")), "provisionedPollerConfig") unless @provisioned_poller_config.nil?
  @bisect_batch_on_error = bisect_batch_on_error
  Jsii::Type.check_type(@bisect_batch_on_error, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "bisectBatchOnError") unless @bisect_batch_on_error.nil?
  @filter_encryption = filter_encryption
  Jsii::Type.check_type(@filter_encryption, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfa21zLklLZXkifQ==")), "filterEncryption") unless @filter_encryption.nil?
  @filters = filters
  Jsii::Type.check_type(@filters, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsicHJpbWl0aXZlIjoiYW55In0sImtpbmQiOiJtYXAifX0sImtpbmQiOiJhcnJheSJ9fQ==")), "filters") unless @filters.nil?
  @max_record_age = max_record_age
  Jsii::Type.check_type(@max_record_age, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "maxRecordAge") unless @max_record_age.nil?
  @metrics_config = metrics_config.is_a?(Hash) ? ::AWSCDK::Lambda::MetricsConfig.new(**metrics_config.transform_keys(&:to_sym)) : metrics_config
  Jsii::Type.check_type(@metrics_config, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLk1ldHJpY3NDb25maWcifQ==")), "metricsConfig") unless @metrics_config.nil?
  @on_failure = on_failure
  Jsii::Type.check_type(@on_failure, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLklFdmVudFNvdXJjZURscSJ9")), "onFailure") unless @on_failure.nil?
  @parallelization_factor = parallelization_factor
  Jsii::Type.check_type(@parallelization_factor, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "parallelizationFactor") unless @parallelization_factor.nil?
  @report_batch_item_failures = report_batch_item_failures
  Jsii::Type.check_type(@report_batch_item_failures, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "reportBatchItemFailures") unless @report_batch_item_failures.nil?
  @retry_attempts = retry_attempts
  Jsii::Type.check_type(@retry_attempts, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "retryAttempts") unless @retry_attempts.nil?
  @tumbling_window = tumbling_window
  Jsii::Type.check_type(@tumbling_window, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "tumblingWindow") unless @tumbling_window.nil?
  @starting_position_timestamp = starting_position_timestamp
  Jsii::Type.check_type(@starting_position_timestamp, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "startingPositionTimestamp") unless @starting_position_timestamp.nil?
end

Instance Attribute Details

#batch_sizeNumeric? (readonly)

Note:

Default: 100

The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function.

Your function receives an event with all the retrieved records.

Valid Range:

  • Minimum value of 1
  • Maximum value of:

    • 1000 for DynamoEventSource
    • 10000 for KinesisEventSource, ManagedKafkaEventSource and SelfManagedKafkaEventSource

Returns:

  • (Numeric, nil)


76
77
78
# File 'lambda_event_sources/kinesis_event_source_props.rb', line 76

def batch_size
  @batch_size
end

#bisect_batch_on_errorBoolean? (readonly)

Note:

Default: false

If the function returns an error, split the batch in two and retry.

Returns:

  • (Boolean, nil)


103
104
105
# File 'lambda_event_sources/kinesis_event_source_props.rb', line 103

def bisect_batch_on_error
  @bisect_batch_on_error
end

#enabledBoolean? (readonly)

Note:

Default: true

If the stream event source mapping should be enabled.

Returns:

  • (Boolean, nil)


81
82
83
# File 'lambda_event_sources/kinesis_event_source_props.rb', line 81

def enabled
  @enabled
end

#filter_encryptionAWSCDK::KMS::IKey? (readonly)

Note:

Default: - none

Add Customer managed KMS key to encrypt Filter Criteria.



109
110
111
# File 'lambda_event_sources/kinesis_event_source_props.rb', line 109

def filter_encryption
  @filter_encryption
end

#filtersArray<Hash{String => Object}>? (readonly)

Note:

Default: - None

Add filter criteria option.

Returns:

  • (Array<Hash{String => Object}>, nil)


114
115
116
# File 'lambda_event_sources/kinesis_event_source_props.rb', line 114

def filters
  @filters
end

#max_batching_windowAWSCDK::Duration? (readonly)

Note:

Default: - Duration.seconds(0) for Kinesis, DynamoDB, and SQS event sources, Duration.millis(500) for MSK, self-managed Kafka, and Amazon MQ.

The maximum amount of time to gather records before invoking the function.

Maximum of Duration.minutes(5).



89
90
91
# File 'lambda_event_sources/kinesis_event_source_props.rb', line 89

def max_batching_window
  @max_batching_window
end

#max_record_ageAWSCDK::Duration? (readonly)

Note:

Default: -1

The maximum age of a record that Lambda sends to a function for processing.

Valid Range:

  • Minimum value of 60 seconds
  • Maximum value of 7 days

The default value is -1, which sets the maximum age to infinite. When the value is set to infinite, Lambda never discards old records. Record are valid until it expires in the event source.

Returns:



128
129
130
# File 'lambda_event_sources/kinesis_event_source_props.rb', line 128

def max_record_age
  @max_record_age
end

#metrics_configAWSCDK::Lambda::MetricsConfig? (readonly)

Note:

Default: - Enhanced monitoring is disabled

Configuration for enhanced monitoring metrics collection When specified, enables collection of additional metrics for the stream event source.



133
134
135
# File 'lambda_event_sources/kinesis_event_source_props.rb', line 133

def metrics_config
  @metrics_config
end

#on_failureAWSCDK::Lambda::IEventSourceDlq? (readonly)

Note:

Default: - discarded records are ignored

An Amazon S3, Amazon SQS queue or Amazon SNS topic destination for discarded records.



138
139
140
# File 'lambda_event_sources/kinesis_event_source_props.rb', line 138

def on_failure
  @on_failure
end

#parallelization_factorNumeric? (readonly)

Note:

Default: 1

The number of batches to process from each shard concurrently.

Valid Range:

  • Minimum value of 1
  • Maximum value of 10

Returns:

  • (Numeric, nil)


148
149
150
# File 'lambda_event_sources/kinesis_event_source_props.rb', line 148

def parallelization_factor
  @parallelization_factor
end

#provisioned_poller_configAWSCDK::LambdaEventSources::ProvisionedPollerConfig? (readonly)

Note:

Default: - no provisioned pollers

Configuration for provisioned pollers that read from the event source.

When specified, allows control over the minimum and maximum number of pollers that can be provisioned to process events from the source.



98
99
100
# File 'lambda_event_sources/kinesis_event_source_props.rb', line 98

def provisioned_poller_config
  @provisioned_poller_config
end

#report_batch_item_failuresBoolean? (readonly)

Note:

Default: false

Allow functions to return partially successful responses for a batch of records.



154
155
156
# File 'lambda_event_sources/kinesis_event_source_props.rb', line 154

def report_batch_item_failures
  @report_batch_item_failures
end

#retry_attemptsNumeric? (readonly)

Note:

Default: -1 (infinite retries)

Maximum number of retry attempts.

Set to -1 for infinite retries (until the record expires in the event source).

Valid Range: -1 (infinite) or 0 to 10000

Returns:

  • (Numeric, nil)


163
164
165
# File 'lambda_event_sources/kinesis_event_source_props.rb', line 163

def retry_attempts
  @retry_attempts
end

#starting_positionAWSCDK::Lambda::StartingPosition (readonly)

Where to begin consuming the stream.



60
61
62
# File 'lambda_event_sources/kinesis_event_source_props.rb', line 60

def starting_position
  @starting_position
end

#starting_position_timestampNumeric? (readonly)

Note:

Default: - no timestamp

The time from which to start reading, in Unix time seconds.

Returns:

  • (Numeric, nil)


173
174
175
# File 'lambda_event_sources/kinesis_event_source_props.rb', line 173

def starting_position_timestamp
  @starting_position_timestamp
end

#tumbling_windowAWSCDK::Duration? (readonly)

Note:

Default: - None

The size of the tumbling windows to group records sent to DynamoDB or Kinesis Valid Range: 0 - 15 minutes.

Returns:



168
169
170
# File 'lambda_event_sources/kinesis_event_source_props.rb', line 168

def tumbling_window
  @tumbling_window
end

Class Method Details

.jsii_propertiesObject



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lambda_event_sources/kinesis_event_source_props.rb', line 175

def self.jsii_properties
  {
    :starting_position => "startingPosition",
    :batch_size => "batchSize",
    :enabled => "enabled",
    :max_batching_window => "maxBatchingWindow",
    :provisioned_poller_config => "provisionedPollerConfig",
    :bisect_batch_on_error => "bisectBatchOnError",
    :filter_encryption => "filterEncryption",
    :filters => "filters",
    :max_record_age => "maxRecordAge",
    :metrics_config => "metricsConfig",
    :on_failure => "onFailure",
    :parallelization_factor => "parallelizationFactor",
    :report_batch_item_failures => "reportBatchItemFailures",
    :retry_attempts => "retryAttempts",
    :tumbling_window => "tumblingWindow",
    :starting_position_timestamp => "startingPositionTimestamp",
  }
end

Instance Method Details

#to_jsiiObject



196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'lambda_event_sources/kinesis_event_source_props.rb', line 196

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "startingPosition" => @starting_position,
    "batchSize" => @batch_size,
    "enabled" => @enabled,
    "maxBatchingWindow" => @max_batching_window,
    "provisionedPollerConfig" => @provisioned_poller_config,
    "bisectBatchOnError" => @bisect_batch_on_error,
    "filterEncryption" => @filter_encryption,
    "filters" => @filters,
    "maxRecordAge" => @max_record_age,
    "metricsConfig" => @metrics_config,
    "onFailure" => @on_failure,
    "parallelizationFactor" => @parallelization_factor,
    "reportBatchItemFailures" => @report_batch_item_failures,
    "retryAttempts" => @retry_attempts,
    "tumblingWindow" => @tumbling_window,
    "startingPositionTimestamp" => @starting_position_timestamp,
  })
  result.compact
end