Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion .swiftformat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# file options

--swiftversion 5.1
--swiftversion 5.0
--exclude .build

# format options
Expand Down
3 changes: 1 addition & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.2
// swift-tools-version:5.0

import PackageDescription

Expand Down Expand Up @@ -36,7 +36,6 @@ let package = Package(
.product(name: "NIOFoundationCompat", package: "swift-nio"),
]),
.testTarget(name: "AWSLambdaRuntimeTests", dependencies: [
.byName(name: "AWSLambdaRuntimeCore"),
.byName(name: "AWSLambdaRuntime"),
]),
.target(name: "AWSLambdaEvents", dependencies: []),
Expand Down
88 changes: 44 additions & 44 deletions Sources/AWSLambdaEvents/AWSRegion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,56 +26,56 @@ public struct AWSRegion: RawRepresentable, Equatable {
}

static var all: [AWSRegion] = [
Self.ap_northeast_1,
Self.ap_northeast_2,
Self.ap_east_1,
Self.ap_southeast_1,
Self.ap_southeast_2,
Self.ap_south_1,
Self.cn_north_1,
Self.cn_northwest_1,
Self.eu_north_1,
Self.eu_west_1,
Self.eu_west_2,
Self.eu_west_3,
Self.eu_central_1,
Self.us_east_1,
Self.us_east_2,
Self.us_west_1,
Self.us_west_2,
Self.us_gov_east_1,
Self.us_gov_west_1,
Self.ca_central_1,
Self.sa_east_1,
Self.me_south_1,
AWSRegion.ap_northeast_1,
AWSRegion.ap_northeast_2,
AWSRegion.ap_east_1,
AWSRegion.ap_southeast_1,
AWSRegion.ap_southeast_2,
AWSRegion.ap_south_1,
AWSRegion.cn_north_1,
AWSRegion.cn_northwest_1,
AWSRegion.eu_north_1,
AWSRegion.eu_west_1,
AWSRegion.eu_west_2,
AWSRegion.eu_west_3,
AWSRegion.eu_central_1,
AWSRegion.us_east_1,
AWSRegion.us_east_2,
AWSRegion.us_west_1,
AWSRegion.us_west_2,
AWSRegion.us_gov_east_1,
AWSRegion.us_gov_west_1,
AWSRegion.ca_central_1,
AWSRegion.sa_east_1,
AWSRegion.me_south_1,
]

public static var ap_northeast_1: Self { AWSRegion(rawValue: "ap-northeast-1")! }
public static var ap_northeast_2: Self { AWSRegion(rawValue: "ap-northeast-2")! }
public static var ap_east_1: Self { AWSRegion(rawValue: "ap-east-1")! }
public static var ap_southeast_1: Self { AWSRegion(rawValue: "ap-southeast-1")! }
public static var ap_southeast_2: Self { AWSRegion(rawValue: "ap-southeast-2")! }
public static var ap_south_1: Self { AWSRegion(rawValue: "ap-south-1")! }
public static var ap_northeast_1: AWSRegion { return AWSRegion(rawValue: "ap-northeast-1")! }
public static var ap_northeast_2: AWSRegion { return AWSRegion(rawValue: "ap-northeast-2")! }
public static var ap_east_1: AWSRegion { return AWSRegion(rawValue: "ap-east-1")! }
public static var ap_southeast_1: AWSRegion { return AWSRegion(rawValue: "ap-southeast-1")! }
public static var ap_southeast_2: AWSRegion { return AWSRegion(rawValue: "ap-southeast-2")! }
public static var ap_south_1: AWSRegion { return AWSRegion(rawValue: "ap-south-1")! }

public static var cn_north_1: Self { AWSRegion(rawValue: "cn-north-1")! }
public static var cn_northwest_1: Self { AWSRegion(rawValue: "cn-northwest-1")! }
public static var cn_north_1: AWSRegion { return AWSRegion(rawValue: "cn-north-1")! }
public static var cn_northwest_1: AWSRegion { return AWSRegion(rawValue: "cn-northwest-1")! }

public static var eu_north_1: Self { AWSRegion(rawValue: "eu-north-1")! }
public static var eu_west_1: Self { AWSRegion(rawValue: "eu-west-1")! }
public static var eu_west_2: Self { AWSRegion(rawValue: "eu-west-2")! }
public static var eu_west_3: Self { AWSRegion(rawValue: "eu-west-3")! }
public static var eu_central_1: Self { AWSRegion(rawValue: "eu-central-1")! }
public static var eu_north_1: AWSRegion { return AWSRegion(rawValue: "eu-north-1")! }
public static var eu_west_1: AWSRegion { return AWSRegion(rawValue: "eu-west-1")! }
public static var eu_west_2: AWSRegion { return AWSRegion(rawValue: "eu-west-2")! }
public static var eu_west_3: AWSRegion { return AWSRegion(rawValue: "eu-west-3")! }
public static var eu_central_1: AWSRegion { return AWSRegion(rawValue: "eu-central-1")! }

public static var us_east_1: Self { AWSRegion(rawValue: "us-east-1")! }
public static var us_east_2: Self { AWSRegion(rawValue: "us-east-2")! }
public static var us_west_1: Self { AWSRegion(rawValue: "us-west-1")! }
public static var us_west_2: Self { AWSRegion(rawValue: "us-west-2")! }
public static var us_gov_east_1: Self { AWSRegion(rawValue: "us-gov-east-1")! }
public static var us_gov_west_1: Self { AWSRegion(rawValue: "us-gov-west-1")! }
public static var us_east_1: AWSRegion { return AWSRegion(rawValue: "us-east-1")! }
public static var us_east_2: AWSRegion { return AWSRegion(rawValue: "us-east-2")! }
public static var us_west_1: AWSRegion { return AWSRegion(rawValue: "us-west-1")! }
public static var us_west_2: AWSRegion { return AWSRegion(rawValue: "us-west-2")! }
public static var us_gov_east_1: AWSRegion { return AWSRegion(rawValue: "us-gov-east-1")! }
public static var us_gov_west_1: AWSRegion { return AWSRegion(rawValue: "us-gov-west-1")! }

public static var ca_central_1: Self { AWSRegion(rawValue: "ca-central-1")! }
public static var sa_east_1: Self { AWSRegion(rawValue: "sa-east-1")! }
public static var me_south_1: Self { AWSRegion(rawValue: "me-south-1")! }
public static var ca_central_1: AWSRegion { return AWSRegion(rawValue: "ca-central-1")! }
public static var sa_east_1: AWSRegion { return AWSRegion(rawValue: "sa-east-1")! }
public static var me_south_1: AWSRegion { return AWSRegion(rawValue: "me-south-1")! }
}

extension AWSRegion: Codable {
Expand Down
12 changes: 6 additions & 6 deletions Sources/AWSLambdaEvents/Cloudwatch.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ import struct Foundation.Date
typealias EventBridge = Cloudwatch

public protocol CloudwatchDetail: Decodable {
static var name: String { get }
static var typeName: String { get }
}

public extension CloudwatchDetail {
var detailType: String {
Self.name
return Self.typeName
}
}

Expand Down Expand Up @@ -65,7 +65,7 @@ public enum Cloudwatch {
self.resources = try container.decode([String].self, forKey: .resources)

let detailType = try container.decode(String.self, forKey: .detailType)
guard detailType.lowercased() == Detail.name.lowercased() else {
guard detailType.lowercased() == Detail.typeName.lowercased() else {
throw DetailTypeMismatch(name: detailType, type: Detail.self)
}

Expand All @@ -77,13 +77,13 @@ public enum Cloudwatch {

public typealias ScheduledEvent = Event<Scheduled>
public struct Scheduled: CloudwatchDetail {
public static let name = "Scheduled Event"
public static let typeName = "Scheduled Event"
}

public enum EC2 {
public typealias InstanceStateChangeNotificationEvent = Event<InstanceStateChangeNotification>
public struct InstanceStateChangeNotification: CloudwatchDetail {
public static let name = "EC2 Instance State-change Notification"
public static let typeName = "EC2 Instance State-change Notification"

public enum State: String, Codable {
case running
Expand All @@ -104,7 +104,7 @@ public enum Cloudwatch {

public typealias SpotInstanceInterruptionNoticeEvent = Event<SpotInstanceInterruptionNotice>
public struct SpotInstanceInterruptionNotice: CloudwatchDetail {
public static let name = "EC2 Spot Instance Interruption Warning"
public static let typeName = "EC2 Spot Instance Interruption Warning"

public enum Action: String, Codable {
case hibernate
Expand Down
Loading