Skip to content

Commit

Permalink
Remove AWSClient EventLoop APIs (#553)
Browse files Browse the repository at this point in the history
* Remove AWSClient.execute calls with EventLoop

* Fix STSAssumeRole after removing EventLoop execute

* Fix AWSClient waiter code

* Remove commented out code

* Remove EL credential functions

* Merge async files with parent implementations

* Delete AWSClient+Waiter+async.swift

* Fix up paginate code

* Remove EventLoop from execute closure

* Changes requested in PR

* Update Sources/SotoCore/Waiters/AWSClient+Waiter.swift

Co-authored-by: Tim Condon <[email protected]>

---------

Co-authored-by: Tim Condon <[email protected]>
  • Loading branch information
adam-fowler and 0xTim authored Jun 19, 2023
1 parent d563f8b commit 88c019f
Show file tree
Hide file tree
Showing 12 changed files with 334 additions and 853 deletions.
11 changes: 4 additions & 7 deletions Sources/SotoCore/AWSClient+Paginate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ extension AWSClient {
public struct PaginatorSequence<Input: AWSPaginateToken, Output: AWSShape>: AsyncSequence where Input.Token: Equatable {
public typealias Element = Output
let input: Input
let command: (Input, Logger, EventLoop?) async throws -> Output
let command: (Input, Logger) async throws -> Output
let inputKey: KeyPath<Input, Input.Token?>?
let outputKey: KeyPath<Output, Input.Token?>
let moreResultsKey: KeyPath<Output, Bool?>?
let logger: Logger
let eventLoop: EventLoop?

/// Initialize PaginatorSequence
/// - Parameters:
Expand All @@ -43,20 +42,18 @@ extension AWSClient {
/// - eventLoop: EventLoop to run everything on
public init(
input: Input,
command: @escaping ((Input, Logger, EventLoop?) async throws -> Output),
command: @escaping ((Input, Logger) async throws -> Output),
inputKey: KeyPath<Input, Input.Token?>? = nil,
outputKey: KeyPath<Output, Input.Token?>,
moreResultsKey: KeyPath<Output, Bool?>? = nil,
logger: Logger = AWSClient.loggingDisabled,
on eventLoop: EventLoop? = nil
logger: Logger = AWSClient.loggingDisabled
) {
self.input = input
self.command = command
self.outputKey = outputKey
self.inputKey = inputKey
self.moreResultsKey = moreResultsKey
self.logger = AWSClient.loggingDisabled
self.eventLoop = eventLoop
}

/// Iterator for iterating over `PaginatorSequence`
Expand All @@ -71,7 +68,7 @@ extension AWSClient {

public mutating func next() async throws -> Output? {
if let input = input {
let output = try await self.sequence.command(input, self.sequence.logger, self.sequence.eventLoop)
let output = try await self.sequence.command(input, self.sequence.logger)
if let token = output[keyPath: sequence.outputKey],
sequence.inputKey == nil || token != input[keyPath: sequence.inputKey!],
sequence.moreResultsKey == nil || output[keyPath: sequence.moreResultsKey!] == true
Expand Down
Loading

0 comments on commit 88c019f

Please sign in to comment.