forked from aws/aws-lambda-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
KinesisFirehoseResponse.cs
105 lines (96 loc) · 4.02 KB
/
KinesisFirehoseResponse.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
namespace Amazon.Lambda.KinesisFirehoseEvents
{
/// <summary>
/// The response for the Lambda functions handling Kinesis Firehose transformations.
/// </summary>
[DataContract]
public class KinesisFirehoseResponse
{
/// <summary>
/// The record was transformed successfully.
/// </summary>
public const string TRANSFORMED_STATE_OK = "Ok";
/// <summary>
/// The record was dropped intentionally by your processing logic.
/// </summary>
public const string TRANSFORMED_STATE_DROPPED = "Dropped";
/// <summary>
/// The record could not be transformed.
/// </summary>
public const string TRANSFORMED_STATE_PROCESSINGFAILED = "ProcessingFailed";
/// <summary>
/// The transformed records from the KinesisFirehoseEvent.
/// </summary>
[DataMember(Name = "records")]
#if NETCOREAPP_3_1
[System.Text.Json.Serialization.JsonPropertyName("records")]
#endif
public IList<FirehoseRecord> Records { get; set; }
/// <summary>
/// The transformed records after processing KinesisFirehoseEvent.Records
/// </summary>
[DataContract]
public class FirehoseRecord
{
/// <summary>
///The record ID is passed from Firehose to Lambda during the invocation. The transformed record must
///contain the same record ID. Any mismatch between the ID of the original record and the ID of the
///transformed record is treated as a data transformation failure.
/// </summary>
[DataMember(Name = "recordId")]
#if NETCOREAPP_3_1
[System.Text.Json.Serialization.JsonPropertyName("recordId")]
#endif
public string RecordId { get; set; }
/// <summary>
/// The status of the data transformation of the record. The possible values are: "Ok"
/// (the record was transformed successfully), "Dropped" (the record was dropped intentionally
/// by your processing logic), and "ProcessingFailed" (the record could not be transformed).
/// If a record has a status of "Ok" or "Dropped", Firehose considers it successfully
/// processed. Otherwise, Firehose considers it unsuccessfully processed.
///
/// Possible values:
/// <list type="table">
/// <item>
/// <term>Ok</term>
/// <description>The record was transformed successfully</description>
/// </item>
/// <item>
/// <term>Dropped</term>
/// <description>The record was dropped intentionally by your processing logic</description>
/// </item>
/// <item>
/// <term>ProcessingFailed</term>
/// <description>The record could not be transformed</description>
/// </item>
/// </list>
/// </summary>
[DataMember(Name = "result")]
#if NETCOREAPP_3_1
[System.Text.Json.Serialization.JsonPropertyName("result")]
#endif
public string Result { get; set; }
/// <summary>
/// The transformed data payload, after base64-encoding.
/// </summary>
[DataMember(Name = "data")]
#if NETCOREAPP_3_1
[System.Text.Json.Serialization.JsonPropertyName("data")]
#endif
public string Base64EncodedData { get; set; }
/// <summary>
/// Base64 encodes the data and sets the Base64EncodedData property.
/// </summary>
/// <param name="data">The data to be base64 encoded.</param>
public void EncodeData(string data)
{
this.Base64EncodedData = Convert.ToBase64String(Encoding.UTF8.GetBytes(data));
}
}
}
}