Path: redb-route/redb.Route.S3/Fluent/S3Dsl.Endpoints.cs Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.S3/Fluent/S3Dsl.Endpoints.cs ---- using System.Text; using redb.Route.Abstractions; namespace redb.Route.S3; /// Consumer, producer, encryption, presigned-URL and streaming-upload verbs of . public sealed partial class S3Builder { // ═══════════════════════════════════════════════════════════════════ // CONSUMER // ═══════════════════════════════════════════════════════════════════ /// Polling delay in milliseconds between scans. Default 60000. public S3Builder Delay(int ms) { _delay = ms.ToString(); return this; } /// Polling delay from an expression. public S3Builder Delay(IExpression ms) { _delay = ms.ToTemplateString(); return this; } /// Initial delay before first poll in milliseconds. Default 1000. public S3Builder InitialDelay(int ms) { _initialDelay = ms.ToString(); return this; } /// Initial delay from an expression. public S3Builder InitialDelay(IExpression ms) { _initialDelay = ms.ToTemplateString(); return this; } /// Max objects per poll. 0 = unlimited. Default 10. public S3Builder MaxMessagesPerPoll(int max) { _maxMessagesPerPoll = max.ToString(); return this; } /// Max objects per poll from an expression. public S3Builder MaxMessagesPerPoll(IExpression max) { _maxMessagesPerPoll = max.ToTemplateString(); return this; } /// Delete objects from S3 after successful consumption. Default true. public S3Builder DeleteAfterRead(bool delete = true) { _deleteAfterRead = delete; return this; } /// Move objects to destination bucket after consumption instead of deleting. public S3Builder MoveAfterRead(string destinationBucket, string? prefix = null, string? suffix = null) { _moveAfterRead = true; _destinationBucket = destinationBucket; _destinationBucketPrefix = prefix; _destinationBucketSuffix = suffix; return this; } /// Remove source prefix from key when moving objects. public S3Builder RemovePrefixOnMove() { _removePrefixOnMove = true; return this; } /// Consume only a specific object by key name. public S3Builder FileName(string name) { _fileName = name; return this; } /// Glob pattern to include (e.g. "*.csv", "data/*.json"). public S3Builder Include(string pattern) { _include = pattern; return this; } /// Glob pattern to exclude (e.g. "*.tmp"). public S3Builder Exclude(string pattern) { _exclude = pattern; return this; } /// Send empty exchange when poll returns no objects (heartbeat). public S3Builder SendEmptyMessageWhenIdle() { _sendEmptyMessageWhenIdle = true; return this; } /// Done file marker pattern (e.g. "${file:name}.done"). public S3Builder DoneFileName(string pattern) { _doneFileName = pattern; return this; } /// Done file marker from an expression. public S3Builder DoneFileName(IExpression pattern) { _doneFileName = pattern.ToTemplateString(); return this; } /// Sort order: None, Key, KeyDesc, LastModified, LastModifiedDesc, Size, SizeDesc. public S3Builder SortBy(S3SortBy sort) { _sortBy = sort.ToString(); return this; } /// Minimum object age in milliseconds before consumption. public S3Builder MinAge(long ms) { _minAge = ms.ToString(); return this; } /// Minimum object age from an expression. public S3Builder MinAge(IExpression ms) { _minAge = ms.ToTemplateString(); return this; } /// Maximum object age in milliseconds. 0 = no limit. public S3Builder MaxAge(long ms) { _maxAge = ms.ToString(); return this; } /// Maximum object age from an expression. public S3Builder MaxAge(IExpression ms) { _maxAge = ms.ToTemplateString(); return this; } /// Enable idempotent consumer (key = object Key + ETag + Size). public S3Builder Idempotent() { _idempotent = true; return this; } /// Named IIdempotentRepository from the context registry (survives restarts). public S3Builder IdempotentRepository(string name) { _idempotentRepository = name; return this; } // ═══════════════════════════════════════════════════════════════════ // PRODUCER // ═══════════════════════════════════════════════════════════════════ /// Dynamic object key name for upload. Supports expressions. public S3Builder KeyName(string name) { _keyName = name; return this; } /// Dynamic object key from an expression (e.g. Header("fileName")). public S3Builder KeyName(IExpression name) { _keyName = name.ToTemplateString(); return this; } /// S3 storage class (STANDARD, GLACIER, INTELLIGENT_TIERING, etc.). public S3Builder StorageClass(string storageClass) { _storageClass = storageClass; return this; } /// Content-Type for uploaded objects. Empty = auto-detect. public S3Builder ContentType(string contentType) { _contentType = contentType; return this; } /// Content-Disposition for uploaded objects. public S3Builder ContentDisposition(string disposition) { _contentDisposition = disposition; return this; } /// Content-Encoding for uploaded objects (e.g. "gzip"). public S3Builder ContentEncoding(string encoding) { _contentEncoding = encoding; return this; } /// Cache-Control header for uploaded objects. public S3Builder CacheControl(string cacheControl) { _cacheControl = cacheControl; return this; } /// Canned ACL for uploaded objects. public S3Builder CannedAcl(S3CannedAcl acl) { _cannedAcl = acl.ToString(); return this; } /// Enable multipart upload for large files. public S3Builder MultiPartUpload() { _multiPartUpload = true; return this; } /// Part size in bytes for multipart upload. Minimum 5 MB. Default 25 MB. public S3Builder PartSize(long bytes) { _partSize = bytes.ToString(); return this; } /// Conditional write — fail if object already exists. public S3Builder ConditionalWrite() { _conditionalWrite = true; return this; } // ═══════════════════════════════════════════════════════════════════ // ENCRYPTION (convenience methods) // ═══════════════════════════════════════════════════════════════════ /// Enable SSE-S3 encryption (AES-256, managed by AWS). public S3Builder UseAes256Encryption() { _serverSideEncryption = S3ServerSideEncryption.Aes256.ToString(); return this; } /// Enable SSE-KMS encryption with the given AWS KMS key ID. public S3Builder UseKmsEncryption(string kmsKeyId) { _serverSideEncryption = S3ServerSideEncryption.AwsKms.ToString(); _kmsKeyId = kmsKeyId; return this; } /// Enable SSE-C encryption with customer-provided key material. public S3Builder UseCustomerEncryption(string algorithm, string keyId, string? keyMD5 = null) { _serverSideEncryption = S3ServerSideEncryption.CustomerKey.ToString(); _customerAlgorithm = algorithm; _customerKeyId = keyId; _customerKeyMD5 = keyMD5; return this; } // ═══════════════════════════════════════════════════════════════════ // PRESIGNED URL // ═══════════════════════════════════════════════════════════════════ /// Presigned URL expiration in milliseconds. Default 3600000 (1h). public S3Builder PresignedUrlExpiration(long ms) { _presignedUrlExpiration = ms.ToString(); return this; } // Streaming Upload verbs removed in the options sweep: the mode was never // implemented, and accumulate-then-write belongs to the core Aggregate(...) EIP. // ═══════════════════════════════════════════════════════════════════ // METADATA // ═══════════════════════════════════════════════════════════════════ /// User metadata as comma-separated key=value pairs (e.g. "author=redb,env=prod"). public S3Builder Metadata(string kvPairs) { _metadata = kvPairs; return this; } }