PaginatorSequence
Used to access paginated results.
struct PaginatorSequence<Input, Output> where Input : AWSPaginateToken, Output : AWSShape, Input.Token : Equatable
Used to access paginated results.
struct PaginatorSequence<Input, Output> where Input : AWSPaginateToken, Output : AWSShape, Input.Token : Equatable
import SotoCore
final class AWSClient
Client managing communication with AWS services
protocol AWSPaginateToken : AWSShape
Protocol for all AWSShapes that can be paginated. Adds an initialiser that does a copy but inserts a new integer based pagination token
protocol AWSShape : Sendable
Protocol for the input and output objects for all AWS service commands.
associatedtype Token
protocol Equatable
A type that can be compared for value equality.
init(credentialProvider credentialProviderFactory: CredentialProviderFactory = .default, retryPolicy retryPolicyFactory: RetryPolicyFactory = .default, middleware: some AWSMiddlewareProtocol, options: Options = Options(), httpClient: AWSHTTPClient = HTTPClient.shared, logger: Logger = AWSClient.loggingDisabled)
Initialize an AWSClient struct
init(credentialProvider credentialProviderFactory: CredentialProviderFactory = .default, retryPolicy retryPolicyFactory: RetryPolicyFactory = .default, options: Options = Options(), httpClient: AWSHTTPClient = HTTPClient.shared, logger: Logger = AWSClient.loggingDisabled)
Initialize an AWSClient struct
static let loggingDisabled: Logger
Default logger that logs nothing
let credentialProvider: CredentialProvider
AWS credentials provider
let httpClient: AWSHTTPClient
HTTP client used by AWSClient
let logger: Logger
Logger used for non-request based output
let middleware: AWSMiddlewareProtocol
Middleware code to be applied to requests and responses
func execute<Output>(operation operationName: String, path: String, httpMethod: HTTPMethod, serviceConfig: AWSServiceConfig, input: some AWSEncodableShape, hostPrefix: String? = nil, logger: Logger = AWSClient.loggingDisabled) async throws -> Output where Output : AWSDecodableShape
Execute a request with an input object and return the output object generated from the response
func execute(operation operationName: String, path: String, httpMethod: HTTPMethod, serviceConfig: AWSServiceConfig, input: some AWSEncodableShape, hostPrefix: String? = nil, logger: Logger = AWSClient.loggingDisabled) async throws
Execute a request with an input object and an empty response
func execute<Output>(operation operationName: String, path: String, httpMethod: HTTPMethod, serviceConfig: AWSServiceConfig, logger: Logger = AWSClient.loggingDisabled) async throws -> Output where Output : AWSDecodableShape
Execute an empty request and return the output object generated from the response
func execute(operation operationName: String, path: String, httpMethod: HTTPMethod, serviceConfig: AWSServiceConfig, logger: Logger = AWSClient.loggingDisabled) async throws
Execute an empty request and an empty response
func getCredential(logger: Logger = AWSClient.loggingDisabled) async throws -> Credential
Get credential used by client
func shutdown() async throws
Shutdown AWSClient asynchronously.
func signHeaders(url: URL, httpMethod: HTTPMethod, headers: HTTPHeaders = HTTPHeaders(), body: AWSHTTPBody, serviceConfig: AWSServiceConfig, logger: Logger = AWSClient.loggingDisabled) async throws -> HTTPHeaders
Generate signed headers
func signURL(url: URL, httpMethod: HTTPMethod, headers: HTTPHeaders = HTTPHeaders(), expires: TimeAmount, serviceConfig: AWSServiceConfig, logger: Logger = AWSClient.loggingDisabled) async throws -> URL
Generate a signed URL
func syncShutdown() throws
Shutdown client synchronously.
func waitUntil<Input, Output>(_ input: Input, waiter: Waiter<Input, Output>, maxWaitTime: TimeAmount? = nil, logger: Logger = AWSClient.loggingDisabled) async throws where Input : Sendable, Output : Sendable
Returns when waiter polling returns a success state or returns an error if the polling returns an error or timesout
struct ClientError
Errors returned by AWSClient
code
struct Options
Additional options
struct Waiter<Input, Output> where Input : Sendable, Output : Sendable
A waiter is a client side abstraction used to poll a resource until a desired state is reached
enum WaiterState
Waiter state
protocol AsyncSequence<Element, Failure>
A type that provides asynchronous, sequential, iterated access to its elements.
init(input: Input, 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)
Initialize PaginatorSequence
func makeAsyncIterator() -> AsyncIterator
Make async iterator
struct AsyncIterator
Iterator for iterating over PaginatorSequence
typealias Element = Output
func allSatisfy(_ predicate: (Self.Element) async throws -> Bool) async rethrows -> Bool
Returns a Boolean value that indicates whether all elements produced by the asynchronous sequence satisfy the given predicate.
func collect(upTo maxBytes: Int) async throws -> ByteBuffer
Accumulates an AsyncSequence
of ByteBuffer
s into a single ByteBuffer
.
func collect(upTo maxBytes: Int, into accumulationBuffer: inout ByteBuffer) async throws
Accumulates an AsyncSequence
of ByteBuffer
s into a single accumulationBuffer
.
@preconcurrency func compactMap<ElementOfResult>(_ transform: @escaping (Self.Element) async -> ElementOfResult?) -> AsyncCompactMapSequence<Self, ElementOfResult>
Creates an asynchronous sequence that maps the given closure over the asynchronous sequence’s elements, omitting results that don’t return a value.
@preconcurrency func compactMap<ElementOfResult>(_ transform: @escaping (Self.Element) async throws -> ElementOfResult?) -> AsyncThrowingCompactMapSequence<Self, ElementOfResult>
Creates an asynchronous sequence that maps an error-throwing closure over the base sequence’s elements, omitting results that don’t return a value.
func contains(_ search: Self.Element) async rethrows -> Bool
Returns a Boolean value that indicates whether the asynchronous sequence contains the given element.
func contains(where predicate: (Self.Element) async throws -> Bool) async rethrows -> Bool
Returns a Boolean value that indicates whether the asynchronous sequence contains an element that satisfies the given predicate.
@preconcurrency func drop(while predicate: @escaping (Self.Element) async -> Bool) -> AsyncDropWhileSequence<Self>
Omits elements from the base asynchronous sequence until a given closure returns false, after which it passes through all remaining elements.
func dropFirst(_ count: Int = 1) -> AsyncDropFirstSequence<Self>
Omits a specified number of elements from the base asynchronous sequence, then passes through all remaining elements.
@preconcurrency func filter(_ isIncluded: @escaping (Self.Element) async -> Bool) -> AsyncFilterSequence<Self>
Creates an asynchronous sequence that contains, in order, the elements of the base sequence that satisfy the given predicate.
func first(where predicate: (Self.Element) async throws -> Bool) async rethrows -> Self.Element?
Returns the first element of the sequence that satisfies the given predicate.
func fixedSizeSequence(chunkSize: Int) -> FixedSizeByteBufferAsyncSequence<Self>
Return an AsyncSequence that returns ByteBuffers of a fixed size
@preconcurrency func flatMap<SegmentOfResult>(_ transform: @escaping (Self.Element) async throws -> SegmentOfResult) -> AsyncThrowingFlatMapSequence<Self, SegmentOfResult> where SegmentOfResult : AsyncSequence
Creates an asynchronous sequence that concatenates the results of calling the given error-throwing transformation with each element of this sequence.
@preconcurrency func flatMap<SegmentOfResult>(_ transform: @escaping (Self.Element) async -> SegmentOfResult) -> AsyncFlatMapSequence<Self, SegmentOfResult> where SegmentOfResult : AsyncSequence, Self.Failure == SegmentOfResult.Failure
Creates an asynchronous sequence that concatenates the results of calling the given transformation with each element of this sequence.
@preconcurrency func flatMap<SegmentOfResult>(_ transform: @escaping (Self.Element) async -> SegmentOfResult) -> AsyncFlatMapSequence<Self, SegmentOfResult> where SegmentOfResult : AsyncSequence, SegmentOfResult.Failure == Never
Creates an asynchronous sequence that concatenates the results of calling the given transformation with each element of this sequence.
@preconcurrency func flatMap<SegmentOfResult>(_ transform: @escaping (Self.Element) async -> SegmentOfResult) -> AsyncFlatMapSequence<Self, SegmentOfResult> where SegmentOfResult : AsyncSequence, Self.Failure == Never, SegmentOfResult.Failure == Never
Creates an asynchronous sequence that concatenates the results of calling the given transformation with each element of this sequence.
@preconcurrency func map<Transformed>(_ transform: @escaping (Self.Element) async -> Transformed) -> AsyncMapSequence<Self, Transformed>
Creates an asynchronous sequence that maps the given closure over the asynchronous sequence’s elements.
@preconcurrency func map<Transformed>(_ transform: @escaping (Self.Element) async throws -> Transformed) -> AsyncThrowingMapSequence<Self, Transformed>
Creates an asynchronous sequence that maps the given error-throwing closure over the asynchronous sequence’s elements.
@warn_unqualified_access func max() async rethrows -> Self.Element?
Returns the maximum element in an asynchronous sequence of comparable elements.
@warn_unqualified_access func max(by areInIncreasingOrder: (Self.Element, Self.Element) async throws -> Bool) async rethrows -> Self.Element?
Returns the maximum element in the asynchronous sequence, using the given predicate as the comparison between elements.
@warn_unqualified_access func min() async rethrows -> Self.Element?
Returns the minimum element in an asynchronous sequence of comparable elements.
@warn_unqualified_access func min(by areInIncreasingOrder: (Self.Element, Self.Element) async throws -> Bool) async rethrows -> Self.Element?
Returns the minimum element in the asynchronous sequence, using the given predicate as the comparison between elements.
func prefix(_ count: Int) -> AsyncPrefixSequence<Self>
Returns an asynchronous sequence, up to the specified maximum length, containing the initial elements of the base asynchronous sequence.
@preconcurrency func prefix(while predicate: @escaping (Self.Element) async -> Bool) rethrows -> AsyncPrefixWhileSequence<Self>
Returns an asynchronous sequence, containing the initial, consecutive elements of the base sequence that satisfy the given predicate.
func reduce<Result>(_ initialResult: Result, _ nextPartialResult: (Result, Self.Element) async throws -> Result) async rethrows -> Result
Returns the result of combining the elements of the asynchronous sequence using the given closure.
func reduce<Result>(into initialResult: Result, _ updateAccumulatingResult: (inout Result, Self.Element) async throws -> Void) async rethrows -> Result
Returns the result of combining the elements of the asynchronous sequence using the given closure, given a mutable initial value.