Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add trimming support for RuntimeSupport, SystemTextJson serializer and Lambda event packages #1596

Merged
merged 5 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ public class APIGatewayCustomAuthorizerPolicy
/// <summary>
/// Gets or sets the IAM API version.
/// </summary>
#if NETCOREAPP_3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("Version")]
#endif
public string Version { get; set; } = "2012-10-17";

/// <summary>
/// Gets or sets a list of IAM policy statements to apply.
/// </summary>
#if NETCOREAPP_3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("Statement")]
#endif
public List<IAMPolicyStatement> Statement { get; set; } = new List<IAMPolicyStatement>();
Expand All @@ -31,23 +31,23 @@ public class IAMPolicyStatement
/// <summary>
/// Gets or sets the effect the statement has.
/// </summary>
#if NETCOREAPP_3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("Effect")]
#endif
public string Effect { get; set; } = "Allow";

/// <summary>
/// Gets or sets the action/s the statement has.
/// </summary>
#if NETCOREAPP_3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("Action")]
#endif
public HashSet<string> Action { get; set; }

/// <summary>
/// Gets or sets the resources the statement applies to.
/// </summary>
#if NETCOREAPP_3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("Resource")]
#endif
public HashSet<string> Resource { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class APIGatewayCustomAuthorizerResponse
/// Gets or sets the ID of the principal.
/// </summary>
[DataMember(Name = "principalId")]
#if NETCOREAPP_3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("principalId")]
#endif
public string PrincipalID { get; set; }
Expand All @@ -21,7 +21,7 @@ public class APIGatewayCustomAuthorizerResponse
/// Gets or sets the <see cref="APIGatewayCustomAuthorizerPolicy"/> policy document.
/// </summary>
[DataMember(Name = "policyDocument")]
#if NETCOREAPP_3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("policyDocument")]
#endif
public APIGatewayCustomAuthorizerPolicy PolicyDocument { get; set; } = new APIGatewayCustomAuthorizerPolicy();
Expand All @@ -30,7 +30,7 @@ public class APIGatewayCustomAuthorizerResponse
/// Gets or sets the <see cref="APIGatewayCustomAuthorizerContext"/> property.
/// </summary>
[DataMember(Name = "context")]
#if NETCOREAPP_3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("context")]
#endif
public APIGatewayCustomAuthorizerContextOutput Context { get; set; }
Expand All @@ -39,7 +39,7 @@ public class APIGatewayCustomAuthorizerResponse
/// Gets or sets the usageIdentifierKey.
/// </summary>
[DataMember(Name = "usageIdentifierKey")]
#if NETCOREAPP_3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("usageIdentifierKey")]
#endif
public string UsageIdentifierKey { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class APIGatewayCustomAuthorizerV2IamResponse
/// Gets or sets the ID of the principal.
/// </summary>
[DataMember(Name = "principalId")]
#if NETCOREAPP_3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("principalId")]
#endif
public string PrincipalID { get; set; }
Expand All @@ -23,7 +23,7 @@ public class APIGatewayCustomAuthorizerV2IamResponse
/// Gets or sets the <see cref="APIGatewayCustomAuthorizerPolicy"/> policy document.
/// </summary>
[DataMember(Name = "policyDocument")]
#if NETCOREAPP_3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("policyDocument")]
#endif
public APIGatewayCustomAuthorizerPolicy PolicyDocument { get; set; } = new APIGatewayCustomAuthorizerPolicy();
Expand All @@ -32,7 +32,7 @@ public class APIGatewayCustomAuthorizerV2IamResponse
/// Gets or sets the <see cref="APIGatewayCustomAuthorizerContext"/> property.
/// </summary>
[DataMember(Name = "context")]
#if NETCOREAPP_3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("context")]
#endif
public Dictionary<string, object> Context { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class APIGatewayCustomAuthorizerV2SimpleResponse
/// Gets or sets authorization result.
/// </summary>
[DataMember(Name = "isAuthorized")]
#if NETCOREAPP_3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("isAuthorized")]
#endif
public bool IsAuthorized { get; set; }
Expand All @@ -23,7 +23,7 @@ public class APIGatewayCustomAuthorizerV2SimpleResponse
/// Gets or sets the <see cref="APIGatewayCustomAuthorizerContext"/> property.
/// </summary>
[DataMember(Name = "context")]
#if NETCOREAPP_3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("context")]
#endif
public Dictionary<string, object> Context { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class APIGatewayHttpApiV2ProxyResponse
/// The HTTP status code for the request
/// </summary>
[DataMember(Name = "statusCode")]
#if NETCOREAPP_3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("statusCode")]
#endif
public int StatusCode { get; set; }
Expand All @@ -26,7 +26,7 @@ public class APIGatewayHttpApiV2ProxyResponse
/// The Http headers returned in the response. Multiple header values set for the the same header should be separate by a comma.
/// </summary>
[DataMember(Name = "headers")]
#if NETCOREAPP_3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("headers")]
#endif
public IDictionary<string, string> Headers { get; set; }
Expand Down Expand Up @@ -67,7 +67,7 @@ public void SetHeaderValues(string headerName, IEnumerable<string> values, bool
/// The cookies returned in the response.
/// </summary>
[DataMember(Name = "cookies")]
#if NETCOREAPP_3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("cookies")]
#endif
public string[] Cookies { get; set; }
Expand All @@ -76,7 +76,7 @@ public void SetHeaderValues(string headerName, IEnumerable<string> values, bool
/// The response body
/// </summary>
[DataMember(Name = "body")]
#if NETCOREAPP_3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("body")]
#endif
public string Body { get; set; }
Expand All @@ -85,7 +85,7 @@ public void SetHeaderValues(string headerName, IEnumerable<string> values, bool
/// Flag indicating whether the body should be treated as a base64-encoded string
/// </summary>
[DataMember(Name = "isBase64Encoded")]
#if NETCOREAPP_3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("isBase64Encoded")]
#endif
public bool IsBase64Encoded { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class APIGatewayProxyResponse
/// The HTTP status code for the request
/// </summary>
[DataMember(Name = "statusCode")]
#if NETCOREAPP_3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("statusCode")]
#endif
public int StatusCode { get; set; }
Expand All @@ -25,7 +25,7 @@ public class APIGatewayProxyResponse
/// before returning back the headers to the caller.
/// </summary>
[DataMember(Name = "headers")]
#if NETCOREAPP_3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("headers")]
#endif
public IDictionary<string, string> Headers { get; set; }
Expand All @@ -36,7 +36,7 @@ public class APIGatewayProxyResponse
/// before returning back the headers to the caller.
/// </summary>
[DataMember(Name = "multiValueHeaders")]
#if NETCOREAPP_3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("multiValueHeaders")]
#endif
public IDictionary<string, IList<string>> MultiValueHeaders { get; set; }
Expand All @@ -45,7 +45,7 @@ public class APIGatewayProxyResponse
/// The response body
/// </summary>
[DataMember(Name = "body")]
#if NETCOREAPP_3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("body")]
#endif
public string Body { get; set; }
Expand All @@ -54,7 +54,7 @@ public class APIGatewayProxyResponse
/// Flag indicating whether the body should be treated as a base64-encoded string
/// </summary>
[DataMember(Name = "isBase64Encoded")]
#if NETCOREAPP_3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("isBase64Encoded")]
#endif
public bool IsBase64Encoded { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<Import Project="..\..\..\buildtools\common.props" />

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netcoreapp3.1;net8.0</TargetFrameworks>
<Description>Amazon Lambda .NET Core support - API Gateway package.</Description>
<AssemblyTitle>Amazon.Lambda.APIGatewayEvents</AssemblyTitle>
<VersionPrefix>2.6.0</VersionPrefix>
<VersionPrefix>2.7.0</VersionPrefix>
<AssemblyName>Amazon.Lambda.APIGatewayEvents</AssemblyName>
<PackageId>Amazon.Lambda.APIGatewayEvents</PackageId>
<PackageTags>AWS;Amazon;Lambda</PackageTags>
Expand All @@ -17,9 +17,6 @@
<DefineConstants>NETSTANDARD_2_0</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<DefineConstants>NETCOREAPP_3_1</DefineConstants>
</PropertyGroup>
<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\"/>
</ItemGroup>
Expand All @@ -28,4 +25,8 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0'">
<WarningsAsErrors>IL2026,IL2067,IL2075</WarningsAsErrors>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
<Import Project="..\..\..\buildtools\common.props" />

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netcoreapp3.1;net8.0</TargetFrameworks>
<Description>Amazon Lambda .NET Core support - Application Load Balancer package.</Description>
<AssemblyTitle>Amazon.Lambda.ApplicationLoadBalancerEvents</AssemblyTitle>
<VersionPrefix>2.1.0</VersionPrefix>
<VersionPrefix>2.2.0</VersionPrefix>
<AssemblyName>Amazon.Lambda.ApplicationLoadBalancerEvents</AssemblyName>
<PackageId>Amazon.Lambda.ApplicationLoadBalancerEvents</PackageId>
<PackageTags>AWS;Amazon;Lambda</PackageTags>
</PropertyGroup>


<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0'">
<WarningsAsErrors>IL2026,IL2067,IL2075</WarningsAsErrors>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class ApplicationLoadBalancerResponse
/// The HTTP status code for the request
/// </summary>
[DataMember(Name = "statusCode")]
#if NETCOREAPP3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("statusCode")]
#endif
public int StatusCode { get; set; }
Expand All @@ -23,7 +23,7 @@ public class ApplicationLoadBalancerResponse
/// The HTTP status description for the request
/// </summary>
[DataMember(Name = "statusDescription")]
#if NETCOREAPP3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("statusDescription")]
#endif
public string StatusDescription { get; set; }
Expand All @@ -33,7 +33,7 @@ public class ApplicationLoadBalancerResponse
/// Note: Use this property when "Multi value headers" is disabled on ELB Target Group.
/// </summary>
[DataMember(Name = "headers")]
#if NETCOREAPP3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("headers")]
#endif
public IDictionary<string, string> Headers { get; set; }
Expand All @@ -43,7 +43,7 @@ public class ApplicationLoadBalancerResponse
/// Note: Use this property when "Multi value headers" is enabled on ELB Target Group.
/// </summary>
[DataMember(Name = "multiValueHeaders")]
#if NETCOREAPP3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("multiValueHeaders")]
#endif
public IDictionary<string, IList<string>> MultiValueHeaders { get; set; }
Expand All @@ -52,7 +52,7 @@ public class ApplicationLoadBalancerResponse
/// The response body
/// </summary>
[DataMember(Name = "body")]
#if NETCOREAPP3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("body")]
#endif
public string Body { get; set; }
Expand All @@ -61,7 +61,7 @@ public class ApplicationLoadBalancerResponse
/// Flag indicating whether the body should be treated as a base64-encoded string
/// </summary>
[DataMember(Name = "isBase64Encoded")]
#if NETCOREAPP3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("isBase64Encoded")]
#endif
public bool IsBase64Encoded { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
<Import Project="..\..\..\buildtools\common.props" />

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netcoreapp3.1;net8.0</TargetFrameworks>
<Description>Amazon Lambda .NET Core support - CloudWatchEvents package.</Description>
<AssemblyTitle>Amazon.Lambda.CloudWatchEvents</AssemblyTitle>
<VersionPrefix>4.3.0</VersionPrefix>
<VersionPrefix>4.4.0</VersionPrefix>
<AssemblyName>Amazon.Lambda.CloudWatchEvents</AssemblyName>
<PackageId>Amazon.Lambda.CloudWatchEvents</PackageId>
<PackageTags>AWS;Amazon;Lambda</PackageTags>
</PropertyGroup>

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

<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0'">
<WarningsAsErrors>IL2026,IL2067,IL2075</WarningsAsErrors>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public class CloudWatchEvent<T>
/// For example, ScheduledEvent will be null
/// For example, ECSEvent could be "ECS Container Instance State Change" or "ECS Task State Change"
/// </summary>
#if NETCOREAPP_3_1
[System.Text.Json.Serialization.JsonPropertyName("detail-type")]
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("detail-type")]
#endif
public string DetailType { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class S3Object
/// The version ID of the object.
/// </summary>
[DataMember(Name = "version-id")]
#if NETCOREAPP_3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("version-id")]
#endif
public string VersionId { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class S3ObjectCreate : S3ObjectEventDetails
/// The source IP of the API request.
/// </summary>
[DataMember(Name = "source-ip-address")]
#if NETCOREAPP_3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("source-ip-address")]
#endif
public string SourceIpAddress { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class S3ObjectDelete : S3ObjectEventDetails
/// The source IP of the API request.
/// </summary>
[DataMember(Name = "source-ip-address")]
#if NETCOREAPP_3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("source-ip-address")]
#endif
public string SourceIpAddress { get; set; }
Expand All @@ -27,7 +27,7 @@ public class S3ObjectDelete : S3ObjectEventDetails
/// The type of object deletion event.
/// </summary>
[DataMember(Name = "deletion-type")]
#if NETCOREAPP_3_1
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("deletion-type")]
#endif
public string DeletionType { get; set; }
Expand Down
Loading
Loading