All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.awsnative.lambda.kotlin.EventSourceMapping.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.awsnative.lambda.kotlin

import com.pulumi.awsnative.lambda.kotlin.enums.EventSourceMappingFunctionResponseTypesItem
import com.pulumi.awsnative.lambda.kotlin.outputs.EventSourceMappingAmazonManagedKafkaEventSourceConfig
import com.pulumi.awsnative.lambda.kotlin.outputs.EventSourceMappingDestinationConfig
import com.pulumi.awsnative.lambda.kotlin.outputs.EventSourceMappingDocumentDbEventSourceConfig
import com.pulumi.awsnative.lambda.kotlin.outputs.EventSourceMappingFilterCriteria
import com.pulumi.awsnative.lambda.kotlin.outputs.EventSourceMappingScalingConfig
import com.pulumi.awsnative.lambda.kotlin.outputs.EventSourceMappingSelfManagedEventSource
import com.pulumi.awsnative.lambda.kotlin.outputs.EventSourceMappingSelfManagedKafkaEventSourceConfig
import com.pulumi.awsnative.lambda.kotlin.outputs.EventSourceMappingSourceAccessConfiguration
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.Double
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.awsnative.lambda.kotlin.enums.EventSourceMappingFunctionResponseTypesItem.Companion.toKotlin as eventSourceMappingFunctionResponseTypesItemToKotlin
import com.pulumi.awsnative.lambda.kotlin.outputs.EventSourceMappingAmazonManagedKafkaEventSourceConfig.Companion.toKotlin as eventSourceMappingAmazonManagedKafkaEventSourceConfigToKotlin
import com.pulumi.awsnative.lambda.kotlin.outputs.EventSourceMappingDestinationConfig.Companion.toKotlin as eventSourceMappingDestinationConfigToKotlin
import com.pulumi.awsnative.lambda.kotlin.outputs.EventSourceMappingDocumentDbEventSourceConfig.Companion.toKotlin as eventSourceMappingDocumentDbEventSourceConfigToKotlin
import com.pulumi.awsnative.lambda.kotlin.outputs.EventSourceMappingFilterCriteria.Companion.toKotlin as eventSourceMappingFilterCriteriaToKotlin
import com.pulumi.awsnative.lambda.kotlin.outputs.EventSourceMappingScalingConfig.Companion.toKotlin as eventSourceMappingScalingConfigToKotlin
import com.pulumi.awsnative.lambda.kotlin.outputs.EventSourceMappingSelfManagedEventSource.Companion.toKotlin as eventSourceMappingSelfManagedEventSourceToKotlin
import com.pulumi.awsnative.lambda.kotlin.outputs.EventSourceMappingSelfManagedKafkaEventSourceConfig.Companion.toKotlin as eventSourceMappingSelfManagedKafkaEventSourceConfigToKotlin
import com.pulumi.awsnative.lambda.kotlin.outputs.EventSourceMappingSourceAccessConfiguration.Companion.toKotlin as eventSourceMappingSourceAccessConfigurationToKotlin

/**
 * Builder for [EventSourceMapping].
 */
@PulumiTagMarker
public class EventSourceMappingResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: EventSourceMappingArgs = EventSourceMappingArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend EventSourceMappingArgsBuilder.() -> Unit) {
        val builder = EventSourceMappingArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): EventSourceMapping {
        val builtJavaResource = com.pulumi.awsnative.lambda.EventSourceMapping(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return EventSourceMapping(builtJavaResource)
    }
}

/**
 * The ``AWS::Lambda::EventSourceMapping`` resource creates a mapping between an event source and an LAMlong function. LAM 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.
 *   +   [Configuring a Dynamo DB stream as an event source](https://docs.aws.amazon.com/lambda/latest/dg/with-ddb.html#services-dynamodb-eventsourcemapping)
 *   +   [Configuring a Kinesis stream as an event source](https://docs.aws.amazon.com/lambda/latest/dg/with-kinesis.html#services-kinesis-eventsourcemapping)
 *   +   [Configuring an SQS queue as an event source](https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html#events-sqs-eventsource)
 *   +   [Configuring an MQ broker as an event source](https://docs.aws.amazon.com/lambda/latest/dg/with-mq.html#services-mq-eventsourcemapping)
 *   +   [Configuring MSK as an event source](https://docs.aws.amazon.com/lambda/latest/dg/with-msk.html)
 *   +   [Configuring Self-Managed Apache Kafka as an event source](https://docs.aws.amazon.com/lambda/latest/dg/kafka-smaa.html)
 *   +   [Configuring Amazon DocumentDB as an event source](https://docs.aws.amazon.com/lambda/latest/dg/with-documentdb.html)
 */
public class EventSourceMapping internal constructor(
    override val javaResource: com.pulumi.awsnative.lambda.EventSourceMapping,
) : KotlinCustomResource(javaResource, EventSourceMappingMapper) {
    /**
     * Specific configuration settings for an Amazon Managed Streaming for Apache Kafka (Amazon MSK) event source.
     */
    public val amazonManagedKafkaEventSourceConfig:
        Output?
        get() = javaResource.amazonManagedKafkaEventSourceConfig().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    eventSourceMappingAmazonManagedKafkaEventSourceConfigToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The event source mapping's ID.
     */
    public val awsId: Output
        get() = javaResource.awsId().applyValue({ args0 -> args0 })

    /**
     * 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 10,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.
     *   +   *Amazon MQ (ActiveMQ and RabbitMQ)* – Default 100. Max 10,000.
     *   +   *DocumentDB* – Default 100. Max 10,000.
     */
    public val batchSize: Output?
        get() = javaResource.batchSize().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * (Kinesis and DynamoDB Streams only) If the function returns an error, split the batch in two and retry. The default value is false.
     */
    public val bisectBatchOnFunctionError: Output?
        get() = javaResource.bisectBatchOnFunctionError().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * (Kinesis, DynamoDB Streams, Amazon MSK, and self-managed Apache Kafka event sources only) A configuration object that specifies the destination of an event after Lambda processes it.
     */
    public val destinationConfig: Output?
        get() = javaResource.destinationConfig().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> eventSourceMappingDestinationConfigToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * Specific configuration settings for a DocumentDB event source.
     */
    public val documentDbEventSourceConfig: Output?
        get() = javaResource.documentDbEventSourceConfig().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    eventSourceMappingDocumentDbEventSourceConfigToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * When true, the event source mapping is active. When false, Lambda pauses polling and invocation.
     *  Default: True
     */
    public val enabled: Output?
        get() = javaResource.enabled().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * 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 or the ARN of the VPC connection (for [cross-account event source mappings](https://docs.aws.amazon.com/lambda/latest/dg/with-msk.html#msk-multi-vpc)).
     *   +   *Amazon MQ* – The ARN of the broker.
     *   +   *Amazon DocumentDB* – The ARN of the DocumentDB change stream.
     */
    public val eventSourceArn: Output?
        get() = javaResource.eventSourceArn().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * An object that defines the filter criteria that determine whether Lambda should process an event. For more information, see [Lambda event filtering](https://docs.aws.amazon.com/lambda/latest/dg/invocation-eventfiltering.html).
     */
    public val filterCriteria: Output?
        get() = javaResource.filterCriteria().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> eventSourceMappingFilterCriteriaToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The name or ARN 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.
     */
    public val functionName: Output
        get() = javaResource.functionName().applyValue({ args0 -> args0 })

    /**
     * (Streams and SQS) A list of current response type enums applied to the event source mapping.
     *  Valid Values: ``ReportBatchItemFailures``
     */
    public val functionResponseTypes: Output>?
        get() = javaResource.functionResponseTypes().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        eventSourceMappingFunctionResponseTypesItemToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * The ARN of the AWS Key Management Service ( AWS KMS ) customer managed key that Lambda uses to encrypt your function's [filter criteria](https://docs.aws.amazon.com/lambda/latest/dg/invocation-eventfiltering.html#filtering-basics) .
     */
    public val kmsKeyArn: Output?
        get() = javaResource.kmsKeyArn().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The maximum amount of time, in seconds, that Lambda spends gathering records before invoking the function.
     *   *Default (, , event sources)*: 0
     *   *Default (, Kafka, , event sources)*: 500 ms
     *   *Related setting:* For SQS event sources, when you set ``BatchSize`` to a value greater than 10, you must set ``MaximumBatchingWindowInSeconds`` to at least 1.
     */
    public val maximumBatchingWindowInSeconds: Output?
        get() = javaResource.maximumBatchingWindowInSeconds().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * (Kinesis and DynamoDB Streams only) Discard records older than the specified age. The default value is -1, which sets the maximum age to infinite. When the value is set to infinite, Lambda never discards old records.
     *   The minimum valid value for maximum record age is 60s. Although values less than 60 and greater than -1 fall within the parameter's absolute range, they are not allowed
     */
    public val maximumRecordAgeInSeconds: Output?
        get() = javaResource.maximumRecordAgeInSeconds().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * (Kinesis and DynamoDB Streams only) Discard records after the specified number of retries. The default value is -1, which sets the maximum number of retries to infinite. When MaximumRetryAttempts is infinite, Lambda retries failed records until the record expires in the event source.
     */
    public val maximumRetryAttempts: Output?
        get() = javaResource.maximumRetryAttempts().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * (Kinesis and DynamoDB Streams only) The number of batches to process concurrently from each shard. The default value is 1.
     */
    public val parallelizationFactor: Output?
        get() = javaResource.parallelizationFactor().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * (Amazon MQ) The name of the Amazon MQ broker destination queue to consume.
     */
    public val queues: Output>?
        get() = javaResource.queues().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

    /**
     * (Amazon SQS only) The scaling configuration for the event source. For more information, see [Configuring maximum concurrency for Amazon SQS event sources](https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html#events-sqs-max-concurrency).
     */
    public val scalingConfig: Output?
        get() = javaResource.scalingConfig().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> eventSourceMappingScalingConfigToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The self-managed Apache Kafka cluster for your event source.
     */
    public val selfManagedEventSource: Output?
        get() = javaResource.selfManagedEventSource().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    eventSourceMappingSelfManagedEventSourceToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Specific configuration settings for a self-managed Apache Kafka event source.
     */
    public val selfManagedKafkaEventSourceConfig:
        Output?
        get() = javaResource.selfManagedKafkaEventSourceConfig().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    eventSourceMappingSelfManagedKafkaEventSourceConfigToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * An array of the authentication protocol, VPC components, or virtual host to secure and define your event source.
     */
    public val sourceAccessConfigurations: Output>?
        get() = javaResource.sourceAccessConfigurations().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        eventSourceMappingSourceAccessConfigurationToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * The position in a stream from which to start reading. Required for Amazon Kinesis and Amazon DynamoDB.
     *   +   *LATEST* - Read only new records.
     *   +   *TRIM_HORIZON* - Process all available records.
     *   +   *AT_TIMESTAMP* - Specify a time from which to start reading records.
     */
    public val startingPosition: Output?
        get() = javaResource.startingPosition().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * With ``StartingPosition`` set to ``AT_TIMESTAMP``, the time from which to start reading, in Unix time seconds. ``StartingPositionTimestamp`` cannot be in the future.
     */
    public val startingPositionTimestamp: Output?
        get() = javaResource.startingPositionTimestamp().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name of the Kafka topic.
     */
    public val topics: Output>?
        get() = javaResource.topics().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

    /**
     * (Kinesis and DynamoDB Streams only) The duration in seconds of a processing window for DynamoDB and Kinesis Streams event sources. A value of 0 seconds indicates no tumbling window.
     */
    public val tumblingWindowInSeconds: Output?
        get() = javaResource.tumblingWindowInSeconds().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

public object EventSourceMappingMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.awsnative.lambda.EventSourceMapping::class == javaResource::class

    override fun map(javaResource: Resource): EventSourceMapping = EventSourceMapping(
        javaResource as
            com.pulumi.awsnative.lambda.EventSourceMapping,
    )
}

/**
 * @see [EventSourceMapping].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [EventSourceMapping].
 */
public suspend fun eventSourceMapping(
    name: String,
    block: suspend EventSourceMappingResourceBuilder.() -> Unit,
): EventSourceMapping {
    val builder = EventSourceMappingResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [EventSourceMapping].
 * @param name The _unique_ name of the resulting resource.
 */
public fun eventSourceMapping(name: String): EventSourceMapping {
    val builder = EventSourceMappingResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy