|
| 1 | +import Foundation |
| 2 | +import NIO |
| 3 | + |
| 4 | +/// https://github.com/aws/aws-lambda-go/blob/master/events/dynamodb.go |
| 5 | +public struct DynamoDB { |
| 6 | + |
| 7 | + public enum KeyType: String { |
| 8 | + case hash = "HASH" |
| 9 | + case range = "RANGE" |
| 10 | + } |
| 11 | + |
| 12 | + public enum OperationType: String { |
| 13 | + case insert = "INSERT" |
| 14 | + case modify = "MODIFY" |
| 15 | + case remove = "REMOVE" |
| 16 | + } |
| 17 | + |
| 18 | + public enum SharedIteratorType: String { |
| 19 | + case trimHorizon = "TRIM_HORIZON" |
| 20 | + case latest = "LATEST" |
| 21 | + case atSequenceNumber = "AT_SEQUENCE_NUMBER" |
| 22 | + case afterSequenceNumber = "AFTER_SEQUENCE_NUMBER" |
| 23 | + } |
| 24 | + |
| 25 | + public enum StreamStatus: String { |
| 26 | + case enabling = "ENABLING" |
| 27 | + case enabled = "ENABLED" |
| 28 | + case disabling = "DISABLING" |
| 29 | + case disabled = "DISABLED" |
| 30 | + } |
| 31 | + |
| 32 | + public enum StreamViewType: String, Codable { |
| 33 | + /// the entire item, as it appeared after it was modified. |
| 34 | + case newImage = "NEW_IMAGE" |
| 35 | + /// the entire item, as it appeared before it was modified. |
| 36 | + case oldImage = "OLD_IMAGE" |
| 37 | + /// both the new and the old item images of the item. |
| 38 | + case newAndOldImages = "NEW_AND_OLD_IMAGES" |
| 39 | + /// only the key attributes of the modified item. |
| 40 | + case keysOnly = "KEYS_ONLY" |
| 41 | + } |
| 42 | + |
| 43 | + public struct Event { |
| 44 | + let awsRegion: String |
| 45 | +// let |
| 46 | + } |
| 47 | + |
| 48 | + public struct StreamRecord { |
| 49 | + /// The approximate date and time when the stream record was created, in UNIX |
| 50 | + /// epoch time (http://www.epochconverter.com/) format. |
| 51 | + let approximateCreationDateTime: Date |
| 52 | + |
| 53 | + /// The primary key attribute(s) for the DynamoDB item that was modified. |
| 54 | + let keys: [String: AttributeValue] |
| 55 | + |
| 56 | + /// The item in the DynamoDB table as it appeared after it was modified. |
| 57 | + let newImage: [String: AttributeValue] |
| 58 | + |
| 59 | + /// The item in the DynamoDB table as it appeared before it was modified. |
| 60 | + let oldImage: [String: AttributeValue] |
| 61 | + |
| 62 | + /// The sequence number of the stream record. |
| 63 | + let sequenceNumber: String |
| 64 | + |
| 65 | + /// The size of the stream record, in bytes. |
| 66 | + let sizeBytes: Int64 |
| 67 | + |
| 68 | + /// The type of data from the modified DynamoDB item that was captured in this |
| 69 | + /// stream record. |
| 70 | + let streamViewType: StreamViewType |
| 71 | + } |
| 72 | + |
| 73 | +} |
0 commit comments