using System; using System.Collections.Generic; using System.Runtime.Serialization; namespace Amazon.Lambda.KinesisAnalyticsEvents { /// /// This class represents the event from Kinesis Analytics application to preprocess Kinesis stream data. /// [DataContract] public class KinesisAnalyticsStreamsInputPreprocessingEvent { /// /// Gets or sets the invocation identifier. /// /// /// The invocation identifier. /// [DataMember(Name = "invocationId")] public string InvocationId { get; set; } /// /// Gets or sets the application arn. /// /// /// The application arn. /// [DataMember(Name = "applicationArn")] public string ApplicationArn { get; set; } /// /// Gets or sets the stream arn. /// /// /// The stream arn. /// [DataMember(Name = "streamArn")] public string StreamArn { get; set; } /// /// Gets or sets the records. /// /// /// The records. /// [DataMember(Name = "records")] public IList Records { get; set; } /// /// /// [DataContract] public class StreamsRecord { /// /// Gets or sets the record identifier. /// /// /// The record identifier. /// [DataMember(Name = "recordId")] public string RecordId { get; set; } /// /// Gets or sets the record metadata. /// /// /// The record metadata. /// [DataMember(Name = "kinesisStreamRecordMetadata")] #if NETCOREAPP3_1 [System.Text.Json.Serialization.JsonPropertyName("kinesisStreamRecordMetadata")] #endif public KinesisStreamRecordMetadata RecordMetadata { get; set; } /// /// /// [DataContract] public class KinesisStreamRecordMetadata { /// /// Gets or sets the sequence number. /// /// /// The sequence number. /// [DataMember(Name = "sequenceNumber")] public string SequenceNumber { get; set; } /// /// Gets or sets the partition key. /// /// /// The partition key. /// [DataMember(Name = "partitionKey")] public string PartitionKey { get; set; } /// /// The approximate time the record was sent to Kinesis Steam. /// [IgnoreDataMember] #if NETCOREAPP3_1 [System.Text.Json.Serialization.JsonIgnore] #endif public DateTime ApproximateArrivalTimestamp { get { var epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); return epoch.AddMilliseconds(ApproximateArrivalEpoch); } } /// /// The approximate time the record was sent to Kinesis stream in epoch. /// [DataMember(Name = "approximateArrivalTimestamp")] #if NETCOREAPP3_1 [System.Text.Json.Serialization.JsonPropertyName("approximateArrivalTimestamp")] #endif public long ApproximateArrivalEpoch { get; set; } /// /// Gets or sets the shard identifier. /// /// /// The shard identifier. /// [DataMember(Name = "shardId")] public string ShardId { get; set; } } /// /// Gets or sets the base64 encoded data. /// /// /// The base64 encoded data. /// [DataMember(Name = "data")] #if NETCOREAPP3_1 [System.Text.Json.Serialization.JsonPropertyName("data")] #endif public string Base64EncodedData { get; set; } /// /// Base64 decodes the Base64EncodedData property. /// /// public string DecodeData() { var decodedData = System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(this.Base64EncodedData)); return decodedData; } } } }