Skip to content

Commit

Permalink
Merge pull request #636 from aws/rework-serialization
Browse files Browse the repository at this point in the history
Rework Amazon.Lambda.Serialization.SystemTextJson
  • Loading branch information
normj authored Apr 28, 2020
2 parents 01ae34a + 0f0f1a3 commit bfb2cbb
Show file tree
Hide file tree
Showing 18 changed files with 423 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<Import Project="..\..\..\buildtools\common.props" />

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>netstandard2.0;netcoreapp3.1</TargetFrameworks>
<Description>Amazon Lambda .NET Core support - Application Load Balancer package.</Description>
<AssemblyTitle>Amazon.Lambda.ApplicationLoadBalancerEvents</AssemblyTitle>
<VersionPrefix>1.0.0</VersionPrefix>
<VersionPrefix>2.0.0</VersionPrefix>
<AssemblyName>Amazon.Lambda.ApplicationLoadBalancerEvents</AssemblyName>
<PackageId>Amazon.Lambda.ApplicationLoadBalancerEvents</PackageId>
<PackageTags>AWS;Amazon;Lambda</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,56 @@ public class ApplicationLoadBalancerResponse
/// The HTTP status code for the request
/// </summary>
[DataMember(Name = "statusCode")]
#if NETCOREAPP3_1
[System.Text.Json.Serialization.JsonPropertyName("statusCode")]
#endif
public int StatusCode { get; set; }

/// <summary>
/// The HTTP status description for the request
/// </summary>
[DataMember(Name = "statusDescription")]
#if NETCOREAPP3_1
[System.Text.Json.Serialization.JsonPropertyName("statusDescription")]
#endif
public string StatusDescription { get; set; }

/// <summary>
/// The Http headers return in the response
/// Note: Use this property when "Multi value headers" is disabled on ELB Target Group.
/// </summary>
[DataMember(Name = "headers")]
#if NETCOREAPP3_1
[System.Text.Json.Serialization.JsonPropertyName("headers")]
#endif
public IDictionary<string, string> Headers { get; set; }

/// <summary>
/// The Http headers return in the response
/// Note: Use this property when "Multi value headers" is enabled on ELB Target Group.
/// </summary>
[DataMember(Name = "multiValueHeaders")]
#if NETCOREAPP3_1
[System.Text.Json.Serialization.JsonPropertyName("multiValueHeaders")]
#endif
public IDictionary<string, IList<string>> MultiValueHeaders { get; set; }

/// <summary>
/// The response body
/// </summary>
[DataMember(Name = "body")]
#if NETCOREAPP3_1
[System.Text.Json.Serialization.JsonPropertyName("body")]
#endif
public string Body { get; set; }

/// <summary>
/// Flag indicating whether the body should be treated as a base64-encoded string
/// </summary>
[DataMember(Name = "isBase64Encoded")]
#if NETCOREAPP3_1
[System.Text.Json.Serialization.JsonPropertyName("isBase64Encoded")]
#endif
public bool IsBase64Encoded { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ protected string ErrorReport(Exception e)
#if NETCOREAPP_2_1
[LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))]
#elif NETCOREAPP_3_1
[LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.LambdaJsonSerializer))]
[LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))]
#endif
public virtual async Task<TRESPONSE> FunctionHandlerAsync(TREQUEST request, ILambdaContext lambdaContext)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,10 @@
<TargetFrameworks>netstandard2.0;netcoreapp3.1</TargetFrameworks>
<Description>Amazon Lambda .NET Core support - Amazon Kinesis Analytics package.</Description>
<AssemblyTitle>Amazon.Lambda.KinesisAnalyticsEvents</AssemblyTitle>
<VersionPrefix>2.0.0</VersionPrefix>
<VersionPrefix>2.1.0</VersionPrefix>
<AssemblyName>Amazon.Lambda.KinesisAnalyticsEvents</AssemblyName>
<PackageId>Amazon.Lambda.KinesisAnalyticsEvents</PackageId>
<PackageTags>AWS;Amazon;Lambda;KinesisAnalytics</PackageTags>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<DefineConstants>NETCOREAPP_3_1</DefineConstants>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.3'">
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.1.1" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public class KinesisAnalyticsInputPreprocessingResponse
/// The records.
/// </value>
[DataMember(Name = "records")]
#if NETCOREAPP_3_1
[System.Text.Json.Serialization.JsonPropertyName("records")]
#if NETCOREAPP3_1
[System.Text.Json.Serialization.JsonPropertyName("records")]
#endif
public IList<Record> Records { get; set; }

Expand All @@ -51,7 +51,7 @@ public class Record
/// The record identifier.
/// </value>
[DataMember(Name = "recordId")]
#if NETCOREAPP_3_1
#if NETCOREAPP3_1
[System.Text.Json.Serialization.JsonPropertyName("recordId")]
#endif
public string RecordId { get; set; }
Expand All @@ -63,7 +63,7 @@ public class Record
/// The result.
/// </value>
[DataMember(Name = "result")]
#if NETCOREAPP_3_1
#if NETCOREAPP3_1
[System.Text.Json.Serialization.JsonPropertyName("result")]
#endif
public string Result { get; set; }
Expand All @@ -75,7 +75,7 @@ public class Record
/// The base64 encoded data.
/// </value>
[DataMember(Name = "data")]
#if NETCOREAPP_3_1
#if NETCOREAPP3_1
[System.Text.Json.Serialization.JsonPropertyName("data")]
#endif
public string Base64EncodedData { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public class LambdaDeliveryRecordMetadata
/// The base64 encoded data.
/// </value>
[DataMember(Name = "data")]
#if NETCOREAPP_3_1
#if NETCOREAPP3_1
[System.Text.Json.Serialization.JsonPropertyName("data")]
#endif
public string Base64EncodedData { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public class KinesisAnalyticsOutputDeliveryResponse
/// The records.
/// </value>
[DataMember(Name = "records")]
#if NETCOREAPP3_1
[System.Text.Json.Serialization.JsonPropertyName("records")]
#endif
public IList<Record> Records { get; set; }

/// <summary>
Expand All @@ -43,6 +46,9 @@ public class Record
/// The record identifier.
/// </value>
[DataMember(Name = "recordId")]
#if NETCOREAPP3_1
[System.Text.Json.Serialization.JsonPropertyName("recordId")]
#endif
public string RecordId { get; set; }

/// <summary>
Expand All @@ -52,6 +58,9 @@ public class Record
/// The result.
/// </value>
[DataMember(Name = "result")]
#if NETCOREAPP3_1
[System.Text.Json.Serialization.JsonPropertyName("result")]
#endif
public string Result { get; set; }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public DateTime ApproximateArrivalTimestamp
/// The base64 encoded data.
/// </value>
[DataMember(Name = "data")]
#if NETCOREAPP_3_1
#if NETCOREAPP3_1
[System.Text.Json.Serialization.JsonPropertyName("data")]
#endif
public string Base64EncodedData { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public class KinesisFirehoseResponse
/// 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>
Expand All @@ -46,6 +49,9 @@ public class FirehoseRecord
///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>
Expand All @@ -72,6 +78,9 @@ public class FirehoseRecord
/// </list>
/// </summary>
[DataMember(Name = "result")]
#if NETCOREAPP_3_1
[System.Text.Json.Serialization.JsonPropertyName("result")]
#endif
public string Result { get; set; }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@

<PropertyGroup>
<Description>Amazon Lambda .NET Core support - Amazon Lex package.</Description>
<TargetFrameworks>netstandard1.3;netstandard2.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netcoreapp3.1</TargetFrameworks>
<AssemblyTitle>Amazon.Lambda.LexEvents</AssemblyTitle>
<VersionPrefix>1.1.0</VersionPrefix>
<VersionPrefix>2.0.0</VersionPrefix>
<AssemblyName>Amazon.Lambda.LexEvents</AssemblyName>
<PackageId>Amazon.Lambda.LexEvents</PackageId>
<PackageTags>AWS;Amazon;Lambda;Lex</PackageTags>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.3'">
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.1.1" />
</ItemGroup>

</Project>
Loading

0 comments on commit bfb2cbb

Please sign in to comment.