Skip to content

Commit 880bf7e

Browse files
committed
fix: update apis to new versions of Soto
1 parent 6691263 commit 880bf7e

File tree

8 files changed

+26
-49
lines changed

8 files changed

+26
-49
lines changed

Sources/App/ASG/ASGClient.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ public protocol ASGClientRepresentable {
55
func updateTags(_ tags: [AutoScaling.Tag]) async throws
66
}
77

8-
public struct ASGClient<Provider: ASGProvider>: ASGClientRepresentable {
8+
public struct ASGClient: ASGClientRepresentable {
99
let logger: Logger
10-
let provider: Provider
10+
let provider: AutoScaling
1111

12-
public init(logger: Logger, provider: Provider) {
12+
public init(logger: Logger, provider: AutoScaling) {
1313
self.logger = logger
1414
self.provider = provider
1515
}

Sources/App/ASG/ASGProvider.swift

Lines changed: 0 additions & 13 deletions
This file was deleted.

Sources/App/AWSClient.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import Foundation
2+
import NIO
3+
import SotoCore
4+
5+
extension AWSClient {
6+
public func shutdown(eventLoop: EventLoop) -> EventLoopFuture<Void> {
7+
let promise = eventLoop.makePromise(of: Void.self)
8+
9+
promise.completeWithTask {
10+
try await self.shutdown()
11+
}
12+
13+
return promise.futureResult
14+
}
15+
}

Sources/App/Application.swift

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import AsyncHTTPClient
12
import AWSLambdaRuntime
23
import Models
34
import SotoCore
@@ -14,8 +15,7 @@ public struct Application {
1415
self.context = context
1516

1617
self.awsClient = AWSClient(
17-
httpClientProvider: .createNewWithEventLoopGroup(self.context.eventLoop),
18-
logger: self.context.logger
18+
httpClient: HTTPClient(eventLoopGroup: self.context.eventLoop), logger: self.context.logger
1919
)
2020
self.context.terminator.register(name: "\(type(of: AWSClient.self))", handler: self.awsClient.shutdown)
2121

@@ -44,13 +44,3 @@ public struct Application {
4444
}
4545
}
4646
}
47-
48-
extension AWSClient {
49-
func shutdown(eventLoop: EventLoop) -> EventLoopFuture<Void> {
50-
let promise = eventLoop.makePromise(of: Void.self)
51-
52-
promise.completeWithTask { try await self.shutdown() }
53-
54-
return promise.futureResult
55-
}
56-
}

Sources/App/EKS/EKSClient.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ public protocol EKSClientRepresentable {
44
func describeNodeGroup(name: String, clusterName: String) async throws -> EKS.Nodegroup
55
}
66

7-
public struct EKSClient<Provider: EKSProvider>: EKSClientRepresentable {
7+
public struct EKSClient: EKSClientRepresentable {
88
let logger: Logger
9-
let provider: Provider
9+
let provider: EKS
1010

11-
public init(logger: Logger, provider: Provider) {
11+
public init(logger: Logger, provider: EKS) {
1212
self.logger = logger
1313
self.provider = provider
1414
}

Sources/App/EKS/EKSProvider.swift

Lines changed: 0 additions & 15 deletions
This file was deleted.

Sources/Command/run.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import App
22
import ArgumentParser
3+
import AsyncHTTPClient
34
import Foundation
45
import Models
56
import NIO
@@ -27,8 +28,7 @@ struct Command: AsyncParsableCommand {
2728
let eventLoop = MultiThreadedEventLoopGroup(numberOfThreads: System.coreCount)
2829

2930
let awsClient = AWSClient(
30-
httpClientProvider: .createNewWithEventLoopGroup(eventLoop),
31-
logger: logger
31+
httpClient: HTTPClient(eventLoopGroup: eventLoop), logger: logger
3232
)
3333

3434
defer {

lambda.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# ================================
22
# Build image
33
# ================================
4-
FROM swift:5.9-bionic as builder
4+
FROM swift:5.9-amazonlinux2 as builder
55

66
# Set up a build area
77
WORKDIR /build

0 commit comments

Comments
 (0)