import { Duration } from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { KafkaEventSpecSource } from './kafka-event-spec'; /** * Wrapper for all metadata of a topic. */ export interface KafkaTopicMetaData { /** * The event specs of the events on that topic * @deprecated Events are no longer provided through this construct. Specify the event in the catalog-info.yaml. See the Backstage documentation for more information. */ readonly events?: KafkaEventSpecSource[] | undefined; /** * Describes the intent of the topic. This might be information about the events on that topic * or additional information about the producer and the context of the events. */ readonly description: string; } /** * Wrapper for all meta data of a v4 topic spec. */ export interface KafkaTopicMetaDataV4 { /** * The event specs of the events on that topic * @deprecated Events are no longer provided through this construct. Specify the event in the catalog-info.yaml. See the Backstage documentation for more information. */ readonly events?: KafkaEventSpecSource[] | undefined; /** * Describes the intent of the topic. This might be information about the events on that topic * or additional information about the producer and the context of the events. */ readonly description: string; /** * Indicates if a topic is meant for component internal usage only or if other services could * use it too. */ readonly audience: TopicAudience; /** * Indicates if the producer will restore the data in case of a disaster or not. */ readonly recoveryPolicy: TopicRecoveryPolicy; } /** * Read and write permissions for the topic. * * strings are matched against the CNAME of the certificate of the Kafka clients. */ export interface KafkaAclStatement { /** * List of clients that should get write permissions */ readonly write: string[]; /** * List of clients that should get read permissions */ readonly read: string[]; /** * List of clients that should get delete permissions. * * Attention: Only use Deletion policy if you know what you are doing! * This is only necessary for KStream and allows the application to delete messages and the topic.
* If you just want to "delete" a message on a log compacted topic, you should not set this permission and send a tombstone message instead. * * @jsii ignore */ readonly delete?: string[]; } /** * Wrapper for all log compaction related properties. */ export interface LogCompactionProperties { /** * The amount of time to retain delete tombstone markers for log compacted topics; * The soft limit is 10 days but can be increased upon requests. * @defaultValue 1 day */ readonly deleteRetention?: Duration; } /** * The current service limits are configured in the topic manager. * If you need to increase the limits for your service, please contact CLAID. */ export interface KafkaTopicProps { /** * The unique name of the topic; has to match pattern [A-Za-z0-9.-]+ */ readonly name: string; /** * Defines degree of parallelism of the topic; should be increased for * large expected loads (e.g., 25 for rio.asset-iot-events). * The soft limit is 10 partitions but can be increased upon requests. * Partitions are a limited resource and cannot be decreased. * @defaultValue 3 */ readonly numberOfPartitions?: number; /** * Defines degree of replication of messages; has to be between 1 and the number of brokers (currently 3). * @defaultValue 3 */ readonly replicationFactor?: number; /** * Time how long messages are retained on Kafka cluster; * * For most cases, 7 days (604800000 ms) is recommended; up to 30 days may be considered * only for exceptional scenarios with specific requirements and can lead to increased Kafka storage costs. * The soft limit is 3 to 30 days. * @defaultValue 7 days */ readonly retention?: Duration; /** * If set to 'false, the topic's data will be deleted on Kafka 10 days after stack deletion. * If set to 'true', it will be deleted immediately after stack deletion. * @defaultValue false */ readonly instantDeletionEnabled?: boolean; /** * The metadata of the topic. */ readonly metadata: KafkaTopicMetaData; /** * The permissions to access to the topic's data. */ readonly acl: KafkaAclStatement; /** * Specify whether the topic is log compacted or not. */ readonly isLogCompacted: boolean; /** * Must only be provided if 'isLogCompacted' is 'true'. * @defaultValue undefined */ readonly logCompactionProperties?: LogCompactionProperties; /** * The maximum compaction lag in milliseconds. * * The maximum time a message can be delayed before it is compacted. * @defaultValue 9223372036854775807 */ readonly maxCompactionLagMs?: number; } /** * The current service limits are configured in the topic manager. * If you need to increase the limits for your service, please contact CLAID. */ export interface KafkaTopicV4Props { /** * The unique name of the topic; has to match pattern [A-Za-z0-9.-]+ */ readonly name: string; /** * Defines degree of parallelism of the topic; should be increased for * large expected loads (e.g., 25 for rio.asset-iot-events). * The soft limit is 10 partitions but can be increased upon requests. * Partitions are a limited resource and cannot be decreased. * @defaultValue 3 */ readonly numberOfPartitions?: number; /** * Defines degree of replication of messages; has to be between 1 and the number of brokers (currently 3). * @defaultValue 3 */ readonly replicationFactor?: number; /** * Time how long messages are retained on Kafka cluster; * * For most cases, 7 days (604800000 ms) is recommended; up to 30 days may be considered * only for exceptional scenarios with specific requirements and can lead to increased Kafka storage costs. * The soft limit is 3 to 30 days but can be increased upon requests. * @defaultValue 7 days */ readonly retention?: Duration; /** * If set to 'false, the topic's data will be deleted on Kafka 10 days after stack deletion. * If set to 'true', it will be deleted immediately after stack deletion. * @defaultValue false */ readonly instantDeletionEnabled?: boolean; /** * The metadata of the topic. */ readonly metadata: KafkaTopicMetaDataV4; /** * The permissions to access to the topic's data. */ readonly acl: KafkaAclStatement; /** * Specify whether the topic is log compacted or not. */ readonly isLogCompacted: boolean; /** * Must only be provided if 'isLogCompacted' is 'true'. * @defaultValue undefined */ readonly logCompactionProperties?: LogCompactionProperties; /** * Specify whether the topic should be backed up automatically or not. * It could just be enabled, if the topic is compacted and the RecoveryPolicy is 'recoverable'. * * @defaultValue undefined */ readonly managedBackupEnabled?: boolean; /** * The maximum compaction lag in milliseconds. * * The maximum time a message can be delayed before it is compacted. * @defaultValue 9223372036854775807 */ readonly maxCompactionLagMs?: number; } /** * The Topics target audience */ export type TopicAudience = 'component-internal' | 'company-internal'; /** * The Topics recovery policy guaranteed by the producer */ export type TopicRecoveryPolicy = 'none' | 'recoverable'; /** * Construct to create a kafka topic. * * @deprecated use {@link KafkaTopicV4} instead */ export declare class KafkaTopic extends Construct { constructor(scope: Construct, id: string, props: KafkaTopicProps); } /** * Construct to create a kafka topic. */ export declare class KafkaTopicV4 extends Construct { constructor(scope: Construct, id: string, props: KafkaTopicV4Props); }