Skip to content

Commit 6976d22

Browse files
authored
Merge pull request #1237 from jcstorms1/master
remove S3 SDK deps
2 parents a467db6 + bc30f90 commit 6976d22

File tree

3 files changed

+222
-12
lines changed

3 files changed

+222
-12
lines changed

Libraries/src/Amazon.Lambda.S3Events/Amazon.Lambda.S3Events.csproj

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,12 @@
44

55
<PropertyGroup>
66
<Description>Amazon Lambda .NET Core support - S3Events package.</Description>
7-
<TargetFrameworks>netstandard2.0;netcoreapp3.1</TargetFrameworks>
7+
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
88
<AssemblyTitle>Amazon.Lambda.S3Events</AssemblyTitle>
99
<VersionPrefix>2.0.1</VersionPrefix>
1010
<AssemblyName>Amazon.Lambda.S3Events</AssemblyName>
1111
<PackageId>Amazon.Lambda.S3Events</PackageId>
1212
<PackageTags>AWS;Amazon;Lambda</PackageTags>
1313
</PropertyGroup>
1414

15-
<ItemGroup>
16-
<PackageReference Include="AWSSDK.S3" Version="3.7.0" />
17-
</ItemGroup>
18-
1915
</Project>

Libraries/src/Amazon.Lambda.S3Events/README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
# Amazon.Lambda.S3Events
22

3-
This package contains classes that can be used as input types for Lambda functions that process Amazon Simple Storage Service (Amazon S3) events.
4-
5-
This package has a dependency on the [AWS SDK for .NET package AWSSDK.S3](https://www.nuget.org/packages/AWSSDK.S3/) in order to use the `Amazon.S3.Util.S3EventNotification` type.
3+
This package contains classes that can be used as input types for Lambda functions that process Amazon Simple Storage Service (Amazon S3) events.
64

75
# Serialization
86

97
If you are using this package with Amazon Lambda but are not also using `Amazon.Lambda.Serialization.Json`, be aware that two properties require custom serialization. These properties are both part of the `Amazon.S3.Util.S3EventNotification+ResponseElementsEntity` class.
108
1. `XAmzRequestId` should be treated as `x-amz-request-id`
119
2. `XAmzId2` should be treated as `x-amz-id-2`
1210

13-
A Newtonsoft.Json `IContractResolver` implementation which handles this custom serialization is located in [Amazon.Lambda.Serialization.Json\AwsResolver.cs](../Amazon.Lambda.Serialization.Json/AwsResolver.cs), consult this source for more information.
11+
A Newtonsoft.Json `IContractResolver` implementation which handles this custom serialization is located in [Amazon.Lambda.Serialization.Json\AwsResolver.cs](../Amazon.Lambda.Serialization.Json/AwsResolver.cs), consult this source for more information.
1412

1513
# Sample Function
1614

Lines changed: 219 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,227 @@
11
namespace Amazon.Lambda.S3Events
22
{
3-
using Amazon.S3.Util;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Runtime.Serialization;
46

57
/// <summary>
68
/// AWS S3 event
79
/// http://docs.aws.amazon.com/lambda/latest/dg/with-s3.html
810
/// http://docs.aws.amazon.com/lambda/latest/dg/eventsources.html#eventsources-s3-put
911
/// </summary>
10-
public class S3Event : S3EventNotification { }
11-
}
12+
13+
public class S3Event
14+
{
15+
16+
/// <summary>
17+
/// Gets and sets the records for the S3 event notification
18+
/// </summary>
19+
public List<S3EventNotificationRecord> Records { get; set; }
20+
21+
/// <summary>
22+
/// The class holds the user identity properties.
23+
/// </summary>
24+
public class UserIdentityEntity
25+
{
26+
/// <summary>
27+
/// Gets and sets the PrincipalId property.
28+
/// </summary>
29+
public string PrincipalId { get; set; }
30+
}
31+
32+
/// <summary>
33+
/// This class contains the identity information for an S3 bucket.
34+
/// </summary>
35+
public class S3BucketEntity
36+
{
37+
/// <summary>
38+
/// Gets and sets the name of the bucket.
39+
/// </summary>
40+
public string Name { get; set; }
41+
42+
/// <summary>
43+
/// Gets and sets the bucket owner id.
44+
/// </summary>
45+
public UserIdentityEntity OwnerIdentity { get; set; }
46+
47+
/// <summary>
48+
/// Gets and sets the S3 bucket arn.
49+
/// </summary>
50+
public string Arn { get; set; }
51+
}
52+
53+
/// <summary>
54+
/// This class contains the information for an object in S3.
55+
/// </summary>
56+
public class S3ObjectEntity
57+
{
58+
/// <summary>
59+
/// Gets and sets the key for the object stored in S3.
60+
/// </summary>
61+
public string Key { get; set; }
62+
63+
/// <summary>
64+
/// Gets and sets the size of the object in S3.
65+
/// </summary>
66+
public long Size { get; set; }
67+
68+
/// <summary>
69+
/// Gets and sets the etag of the object. This can be used to determine if the object has changed.
70+
/// </summary>
71+
public string ETag { get; set; }
72+
73+
/// <summary>
74+
/// Gets and sets the version id of the object in S3.
75+
/// </summary>
76+
public string VersionId { get; set; }
77+
78+
/// <summary>
79+
/// Gets and sets the sequencer a string representation of a hexadecimal value used to determine event sequence, only used with PUTs and DELETEs.
80+
/// </summary>
81+
public string Sequencer { get; set; }
82+
}
83+
84+
/// <summary>
85+
/// Gets and sets the meta information describing S3.
86+
/// </summary>
87+
public class S3Entity
88+
{
89+
/// <summary>
90+
/// Gets and sets the ConfigurationId. This ID can be found in the bucket notification configuration.
91+
/// </summary>
92+
public string ConfigurationId { get; set; }
93+
94+
/// <summary>
95+
/// Gets and sets the Bucket property.
96+
/// </summary>
97+
public S3BucketEntity Bucket { get; set; }
98+
99+
/// <summary>
100+
/// Gets and sets the Object property.
101+
/// </summary>
102+
public S3ObjectEntity Object { get; set; }
103+
104+
/// <summary>
105+
/// Gets and sets the S3SchemaVersion property.
106+
/// </summary>
107+
public string S3SchemaVersion { get; set; }
108+
}
109+
110+
/// <summary>
111+
/// The class holds the request parameters
112+
/// </summary>
113+
public class RequestParametersEntity
114+
{
115+
/// <summary>
116+
/// Gets and sets the SourceIPAddress. This is the ip address where the request came from.
117+
/// </summary>
118+
public string SourceIPAddress { get; set; }
119+
}
120+
121+
/// <summary>
122+
/// This class holds the response elements.
123+
/// </summary>
124+
125+
[DataContract]
126+
public class ResponseElementsEntity
127+
{
128+
/// <summary>
129+
/// Gets and sets the XAmzId2 Property. This is the Amazon S3 host that processed the request.
130+
/// </summary>
131+
[DataMember(Name = "x-amz-id-2", EmitDefaultValue = false)]
132+
[System.Text.Json.Serialization.JsonPropertyName("x-amz-id-2")]
133+
public string XAmzId2 { get; set; }
134+
135+
/// <summary>
136+
/// Gets and sets the XAmzRequestId. This is the Amazon S3 generated request ID.
137+
/// </summary>
138+
[DataMember(Name = "x-amz-request-id", EmitDefaultValue = false)]
139+
[System.Text.Json.Serialization.JsonPropertyName("x-amz-request-id")]
140+
public string XAmzRequestId { get; set; }
141+
}
142+
143+
/// <summary>
144+
/// The class holds the glacier event data elements.
145+
/// </summary>
146+
public class S3GlacierEventDataEntity
147+
{
148+
/// <summary>
149+
/// Gets and sets the RestoreEventData property.
150+
/// </summary>
151+
public S3RestoreEventDataEntity RestoreEventData { get; set; }
152+
}
153+
154+
/// <summary>
155+
/// The class holds the restore event data elements.
156+
/// </summary>
157+
public class S3RestoreEventDataEntity
158+
{
159+
/// <summary>
160+
/// Gets and sets the LifecycleRestorationExpiryTime the time when the object restoration will be expired.
161+
/// </summary>
162+
public DateTime LifecycleRestorationExpiryTime { get; set; }
163+
164+
/// <summary>
165+
/// Gets and sets the LifecycleRestoreStorageClass the source storage class for restore.
166+
/// </summary>
167+
public string LifecycleRestoreStorageClass { get; set; }
168+
}
169+
170+
/// <summary>
171+
/// The class holds the event notification.
172+
/// </summary>
173+
public class S3EventNotificationRecord
174+
{
175+
/// <summary>
176+
/// Gets and sets the AwsRegion property.
177+
/// </summary>
178+
public string AwsRegion { get; set; }
179+
180+
/// <summary>
181+
/// Gets and sets the EventName property. This identities what type of event occurred.
182+
/// For example for an object just put in S3 this will be set to EventType.ObjectCreatedPut.
183+
/// </summary>
184+
public string EventName { get; set; }
185+
186+
/// <summary>
187+
/// Gets and sets the EventSource property.
188+
/// </summary>
189+
public string EventSource { get; set; }
190+
191+
/// <summary>
192+
/// Gets and sets the EventTime property. The time when S3 finished processing the request.
193+
/// </summary>
194+
public DateTime EventTime { get; set; }
195+
196+
/// <summary>
197+
/// Gets and sets the EventVersion property.
198+
/// </summary>
199+
public string EventVersion { get; set; }
200+
201+
/// <summary>
202+
/// Gets and sets the RequestParameters property.
203+
/// </summary>
204+
public RequestParametersEntity RequestParameters { get; set; }
205+
206+
/// <summary>
207+
/// Gets and sets the ResponseElements property.
208+
/// </summary>
209+
public ResponseElementsEntity ResponseElements { get; set; }
210+
211+
/// <summary>
212+
/// Gets and sets the S3 property.
213+
/// </summary>
214+
public S3Entity S3 { get; set; }
215+
216+
/// <summary>
217+
/// Gets and sets the UserIdentity property.
218+
/// </summary>
219+
public UserIdentityEntity UserIdentity { get; set; }
220+
221+
/// <summary>
222+
/// Get and sets the GlacierEventData property.
223+
/// </summary>
224+
public S3GlacierEventDataEntity GlacierEventData { get; set; }
225+
}
226+
}
227+
}

0 commit comments

Comments
 (0)