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 Firehose data.
///
[DataContract]
public class KinesisAnalyticsFirehoseInputPreprocessingEvent
{
///
/// 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 FirehoseRecord
{
///
/// 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 = "kinesisFirehoseRecordMetadata")]
#if NETCOREAPP3_1
[System.Text.Json.Serialization.JsonPropertyName("kinesisFirehoseRecordMetadata")]
#endif
public KinesisFirehoseRecordMetadata RecordMetadata { get; set; }
///
///
///
[DataContract]
public class KinesisFirehoseRecordMetadata
{
///
/// The approximate time the record was sent to Kinesis Firehose.
///
[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 Firehose in epoch.
///
[DataMember(Name = "approximateArrivalTimestamp")]
#if NETCOREAPP3_1
[System.Text.Json.Serialization.JsonPropertyName("approximateArrivalTimestamp")]
#endif
public long ApproximateArrivalEpoch { 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;
}
}
}
}