Class CfnEventSourceMapping

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IInspectable, ITaggableV2, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-11-21T06:34:10.343Z") @Stability(Stable) public class CfnEventSourceMapping extends CfnResource implements IInspectable, ITaggableV2
The AWS::Lambda::EventSourceMapping resource creates a mapping between an event source and an AWS Lambda function.

Lambda reads items from the event source and triggers the function.

For details about each event source type, see the following topics. In particular, each of the topics describes the required and optional parameters for the specific event source.

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.lambda.*;
 CfnEventSourceMapping cfnEventSourceMapping = CfnEventSourceMapping.Builder.create(this, "MyCfnEventSourceMapping")
         .functionName("functionName")
         // the properties below are optional
         .amazonManagedKafkaEventSourceConfig(AmazonManagedKafkaEventSourceConfigProperty.builder()
                 .consumerGroupId("consumerGroupId")
                 .build())
         .batchSize(123)
         .bisectBatchOnFunctionError(false)
         .destinationConfig(DestinationConfigProperty.builder()
                 .onFailure(OnFailureProperty.builder()
                         .destination("destination")
                         .build())
                 .build())
         .documentDbEventSourceConfig(DocumentDBEventSourceConfigProperty.builder()
                 .collectionName("collectionName")
                 .databaseName("databaseName")
                 .fullDocument("fullDocument")
                 .build())
         .enabled(false)
         .eventSourceArn("eventSourceArn")
         .filterCriteria(FilterCriteriaProperty.builder()
                 .filters(List.of(FilterProperty.builder()
                         .pattern("pattern")
                         .build()))
                 .build())
         .functionResponseTypes(List.of("functionResponseTypes"))
         .kmsKeyArn("kmsKeyArn")
         .maximumBatchingWindowInSeconds(123)
         .maximumRecordAgeInSeconds(123)
         .maximumRetryAttempts(123)
         .metricsConfig(MetricsConfigProperty.builder()
                 .metrics(List.of("metrics"))
                 .build())
         .parallelizationFactor(123)
         .provisionedPollerConfig(ProvisionedPollerConfigProperty.builder()
                 .maximumPollers(123)
                 .minimumPollers(123)
                 .build())
         .queues(List.of("queues"))
         .scalingConfig(ScalingConfigProperty.builder()
                 .maximumConcurrency(123)
                 .build())
         .selfManagedEventSource(SelfManagedEventSourceProperty.builder()
                 .endpoints(EndpointsProperty.builder()
                         .kafkaBootstrapServers(List.of("kafkaBootstrapServers"))
                         .build())
                 .build())
         .selfManagedKafkaEventSourceConfig(SelfManagedKafkaEventSourceConfigProperty.builder()
                 .consumerGroupId("consumerGroupId")
                 .build())
         .sourceAccessConfigurations(List.of(SourceAccessConfigurationProperty.builder()
                 .type("type")
                 .uri("uri")
                 .build()))
         .startingPosition("startingPosition")
         .startingPositionTimestamp(123)
         .tags(List.of(CfnTag.builder()
                 .key("key")
                 .value("value")
                 .build()))
         .topics(List.of("topics"))
         .tumblingWindowInSeconds(123)
         .build();
 

See Also:
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnEventSourceMapping

      protected CfnEventSourceMapping(software.amazon.jsii.JsiiObjectRef objRef)
    • CfnEventSourceMapping

      protected CfnEventSourceMapping(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CfnEventSourceMapping

      @Stability(Stable) public CfnEventSourceMapping(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnEventSourceMappingProps props)
      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
      props - Resource properties. This parameter is required.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector - tree inspector to collect and process attributes. This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrEventSourceMappingArn

      @Stability(Stable) @NotNull public String getAttrEventSourceMappingArn()
      The Amazon Resource Name (ARN) of the event source mapping resource.
    • getAttrId

      @Stability(Stable) @NotNull public String getAttrId()
      Event Source Mapping Identifier UUID.
    • getCdkTagManager

      @Stability(Stable) @NotNull public TagManager getCdkTagManager()
      Tag Manager which manages the tags for this resource.
      Specified by:
      getCdkTagManager in interface ITaggableV2
    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getFunctionName

      @Stability(Stable) @NotNull public String getFunctionName()
      The name of the Lambda function.
    • setFunctionName

      @Stability(Stable) public void setFunctionName(@NotNull String value)
      The name of the Lambda function.
    • getAmazonManagedKafkaEventSourceConfig

      @Stability(Stable) @Nullable public Object getAmazonManagedKafkaEventSourceConfig()
      Specific configuration settings for an MSK event source.
    • setAmazonManagedKafkaEventSourceConfig

      @Stability(Stable) public void setAmazonManagedKafkaEventSourceConfig(@Nullable IResolvable value)
      Specific configuration settings for an MSK event source.
    • setAmazonManagedKafkaEventSourceConfig

      @Stability(Stable) public void setAmazonManagedKafkaEventSourceConfig(@Nullable CfnEventSourceMapping.AmazonManagedKafkaEventSourceConfigProperty value)
      Specific configuration settings for an MSK event source.
    • getBatchSize

      @Stability(Stable) @Nullable public Number getBatchSize()
      The maximum number of items to retrieve in a single batch.
    • setBatchSize

      @Stability(Stable) public void setBatchSize(@Nullable Number value)
      The maximum number of items to retrieve in a single batch.
    • getBisectBatchOnFunctionError

      @Stability(Stable) @Nullable public Object getBisectBatchOnFunctionError()
      (Streams) If the function returns an error, split the batch in two and retry.
    • setBisectBatchOnFunctionError

      @Stability(Stable) public void setBisectBatchOnFunctionError(@Nullable Boolean value)
      (Streams) If the function returns an error, split the batch in two and retry.
    • setBisectBatchOnFunctionError

      @Stability(Stable) public void setBisectBatchOnFunctionError(@Nullable IResolvable value)
      (Streams) If the function returns an error, split the batch in two and retry.
    • getDestinationConfig

      @Stability(Stable) @Nullable public Object getDestinationConfig()
      A configuration object that specifies the destination of an event after Lambda processes it.
    • setDestinationConfig

      @Stability(Stable) public void setDestinationConfig(@Nullable IResolvable value)
      A configuration object that specifies the destination of an event after Lambda processes it.
    • setDestinationConfig

      @Stability(Stable) public void setDestinationConfig(@Nullable CfnEventSourceMapping.DestinationConfigProperty value)
      A configuration object that specifies the destination of an event after Lambda processes it.
    • getDocumentDbEventSourceConfig

      @Stability(Stable) @Nullable public Object getDocumentDbEventSourceConfig()
      Document db event source config.
    • setDocumentDbEventSourceConfig

      @Stability(Stable) public void setDocumentDbEventSourceConfig(@Nullable IResolvable value)
      Document db event source config.
    • setDocumentDbEventSourceConfig

      @Stability(Stable) public void setDocumentDbEventSourceConfig(@Nullable CfnEventSourceMapping.DocumentDBEventSourceConfigProperty value)
      Document db event source config.
    • getEnabled

      @Stability(Stable) @Nullable public Object getEnabled()
      Disables the event source mapping to pause polling and invocation.
    • setEnabled

      @Stability(Stable) public void setEnabled(@Nullable Boolean value)
      Disables the event source mapping to pause polling and invocation.
    • setEnabled

      @Stability(Stable) public void setEnabled(@Nullable IResolvable value)
      Disables the event source mapping to pause polling and invocation.
    • getEventSourceArn

      @Stability(Stable) @Nullable public String getEventSourceArn()
      The Amazon Resource Name (ARN) of the event source.
    • setEventSourceArn

      @Stability(Stable) public void setEventSourceArn(@Nullable String value)
      The Amazon Resource Name (ARN) of the event source.
    • getFilterCriteria

      @Stability(Stable) @Nullable public Object getFilterCriteria()
      The filter criteria to control event filtering.
    • setFilterCriteria

      @Stability(Stable) public void setFilterCriteria(@Nullable IResolvable value)
      The filter criteria to control event filtering.
    • setFilterCriteria

      @Stability(Stable) public void setFilterCriteria(@Nullable CfnEventSourceMapping.FilterCriteriaProperty value)
      The filter criteria to control event filtering.
    • getFunctionResponseTypes

      @Stability(Stable) @Nullable public List<String> getFunctionResponseTypes()
      (Streams) A list of response types supported by the function.
    • setFunctionResponseTypes

      @Stability(Stable) public void setFunctionResponseTypes(@Nullable List<String> value)
      (Streams) A list of response types supported by the function.
    • getKmsKeyArn

      @Stability(Stable) @Nullable public String getKmsKeyArn()
      The Amazon Resource Name (ARN) of the KMS key.
    • setKmsKeyArn

      @Stability(Stable) public void setKmsKeyArn(@Nullable String value)
      The Amazon Resource Name (ARN) of the KMS key.
    • getMaximumBatchingWindowInSeconds

      @Stability(Stable) @Nullable public Number getMaximumBatchingWindowInSeconds()
      (Streams) The maximum amount of time to gather records before invoking the function, in seconds.
    • setMaximumBatchingWindowInSeconds

      @Stability(Stable) public void setMaximumBatchingWindowInSeconds(@Nullable Number value)
      (Streams) The maximum amount of time to gather records before invoking the function, in seconds.
    • getMaximumRecordAgeInSeconds

      @Stability(Stable) @Nullable public Number getMaximumRecordAgeInSeconds()
      (Streams) The maximum age of a record that Lambda sends to a function for processing.
    • setMaximumRecordAgeInSeconds

      @Stability(Stable) public void setMaximumRecordAgeInSeconds(@Nullable Number value)
      (Streams) The maximum age of a record that Lambda sends to a function for processing.
    • getMaximumRetryAttempts

      @Stability(Stable) @Nullable public Number getMaximumRetryAttempts()
      (Streams) The maximum number of times to retry when the function returns an error.
    • setMaximumRetryAttempts

      @Stability(Stable) public void setMaximumRetryAttempts(@Nullable Number value)
      (Streams) The maximum number of times to retry when the function returns an error.
    • getMetricsConfig

      @Stability(Stable) @Nullable public Object getMetricsConfig()
      Metrics config for Event Source Mapping Metrics.
    • setMetricsConfig

      @Stability(Stable) public void setMetricsConfig(@Nullable IResolvable value)
      Metrics config for Event Source Mapping Metrics.
    • setMetricsConfig

      @Stability(Stable) public void setMetricsConfig(@Nullable CfnEventSourceMapping.MetricsConfigProperty value)
      Metrics config for Event Source Mapping Metrics.
    • getParallelizationFactor

      @Stability(Stable) @Nullable public Number getParallelizationFactor()
      (Streams) The number of batches to process from each shard concurrently.
    • setParallelizationFactor

      @Stability(Stable) public void setParallelizationFactor(@Nullable Number value)
      (Streams) The number of batches to process from each shard concurrently.
    • getProvisionedPollerConfig

      @Stability(Stable) @Nullable public Object getProvisionedPollerConfig()
      ProvisionedPollerConfig.
    • setProvisionedPollerConfig

      @Stability(Stable) public void setProvisionedPollerConfig(@Nullable IResolvable value)
      ProvisionedPollerConfig.
    • setProvisionedPollerConfig

      @Stability(Stable) public void setProvisionedPollerConfig(@Nullable CfnEventSourceMapping.ProvisionedPollerConfigProperty value)
      ProvisionedPollerConfig.
    • getQueues

      @Stability(Stable) @Nullable public List<String> getQueues()
      (ActiveMQ) A list of ActiveMQ queues.
    • setQueues

      @Stability(Stable) public void setQueues(@Nullable List<String> value)
      (ActiveMQ) A list of ActiveMQ queues.
    • getScalingConfig

      @Stability(Stable) @Nullable public Object getScalingConfig()
      The scaling configuration for the event source.
    • setScalingConfig

      @Stability(Stable) public void setScalingConfig(@Nullable IResolvable value)
      The scaling configuration for the event source.
    • setScalingConfig

      @Stability(Stable) public void setScalingConfig(@Nullable CfnEventSourceMapping.ScalingConfigProperty value)
      The scaling configuration for the event source.
    • getSelfManagedEventSource

      @Stability(Stable) @Nullable public Object getSelfManagedEventSource()
      The configuration used by AWS Lambda to access a self-managed event source.
    • setSelfManagedEventSource

      @Stability(Stable) public void setSelfManagedEventSource(@Nullable IResolvable value)
      The configuration used by AWS Lambda to access a self-managed event source.
    • setSelfManagedEventSource

      @Stability(Stable) public void setSelfManagedEventSource(@Nullable CfnEventSourceMapping.SelfManagedEventSourceProperty value)
      The configuration used by AWS Lambda to access a self-managed event source.
    • getSelfManagedKafkaEventSourceConfig

      @Stability(Stable) @Nullable public Object getSelfManagedKafkaEventSourceConfig()
      Specific configuration settings for a Self-Managed Apache Kafka event source.
    • setSelfManagedKafkaEventSourceConfig

      @Stability(Stable) public void setSelfManagedKafkaEventSourceConfig(@Nullable IResolvable value)
      Specific configuration settings for a Self-Managed Apache Kafka event source.
    • setSelfManagedKafkaEventSourceConfig

      @Stability(Stable) public void setSelfManagedKafkaEventSourceConfig(@Nullable CfnEventSourceMapping.SelfManagedKafkaEventSourceConfigProperty value)
      Specific configuration settings for a Self-Managed Apache Kafka event source.
    • getSourceAccessConfigurations

      @Stability(Stable) @Nullable public Object getSourceAccessConfigurations()
      A list of SourceAccessConfiguration.
    • setSourceAccessConfigurations

      @Stability(Stable) public void setSourceAccessConfigurations(@Nullable IResolvable value)
      A list of SourceAccessConfiguration.
    • setSourceAccessConfigurations

      @Stability(Stable) public void setSourceAccessConfigurations(@Nullable List<Object> value)
      A list of SourceAccessConfiguration.
    • getStartingPosition

      @Stability(Stable) @Nullable public String getStartingPosition()
      The position in a stream from which to start reading.
    • setStartingPosition

      @Stability(Stable) public void setStartingPosition(@Nullable String value)
      The position in a stream from which to start reading.
    • getStartingPositionTimestamp

      @Stability(Stable) @Nullable public Number getStartingPositionTimestamp()
      With StartingPosition set to AT_TIMESTAMP, the time from which to start reading, in Unix time seconds.
    • setStartingPositionTimestamp

      @Stability(Stable) public void setStartingPositionTimestamp(@Nullable Number value)
      With StartingPosition set to AT_TIMESTAMP, the time from which to start reading, in Unix time seconds.
    • getTags

      @Stability(Stable) @Nullable public List<CfnTag> getTags()
      A list of tags to apply to event source mapping resource.
    • setTags

      @Stability(Stable) public void setTags(@Nullable List<CfnTag> value)
      A list of tags to apply to event source mapping resource.
    • getTopics

      @Stability(Stable) @Nullable public List<String> getTopics()
      (Kafka) A list of Kafka topics.
    • setTopics

      @Stability(Stable) public void setTopics(@Nullable List<String> value)
      (Kafka) A list of Kafka topics.
    • getTumblingWindowInSeconds

      @Stability(Stable) @Nullable public Number getTumblingWindowInSeconds()
      (Streams) Tumbling window (non-overlapping time window) duration to perform aggregations.
    • setTumblingWindowInSeconds

      @Stability(Stable) public void setTumblingWindowInSeconds(@Nullable Number value)
      (Streams) Tumbling window (non-overlapping time window) duration to perform aggregations.