Swiftpack.co - Package - swift-aws/aws-sdk-swift-core

aws-sdk-swift-core

Swift 5.0 Codecov Result

A Core Framework for AWSSDKSwift

This is the underlying driver for executing requests to AWS, but you should likely use one of the libraries provided by the package above instead of this! Documentation can be found here.

Swift NIO

This client utilizes Swift NIO to power its interactions with AWS. It returns an EventLoopFuture in order to allow non-blocking frameworks to use this code. Please see the Swift NIO documentation for more details, and please let us know via an Issue if you have questions!

Compatibility

Versions 4.x of aws-sdk-swift-core are dependent on swift-nio 2, this means certain libraries/frameworks that are dependent on an earlier version of swift-nio will not work with version 4 of aws-sdk-swift-core. Version 3.x of the aws-sdk-swift-core can be used if you need to use an earlier version of swift-nio. For instance Vapor 3 uses swift-nio 1.13 so you can only use versions 3.x of aws-sdk-swift-core with Vapor 3. Below is a compatibility table for versions 3 and 4 of aws-sdk-swift-core.

| Version | Swift | MacOS | iOS | Linux | Vapor | |---------|-------|-------|--------|--------------------|--------| | 3.x | 4.2 - | ✓ | | Ubuntu 14.04-18.04 | 3.0 | | 4.x | 5.0 - | ✓ | 12.0 - | Ubuntu 14.04-18.04 | 4.0 |

Example Package.swift

// swift-tools-version:5.0
import PackageDescription

let package = Package(
    name: "MyAWSTool",
    dependencies: [
        .package(url: "https://github.com/swift-aws/aws-sdk-swift", from: "4.0.0"),
    ],
    targets: [
        .target(
            name: "MyAWSTool",
            dependencies: ["CloudFront", "ELB", "IAM",  "S3"]),
        .testTarget(
            name: "MyAWSToolTests",
            dependencies: ["MyAWSTool"]),
    ]
)

License

aws-sdk-swift-core is released under the MIT license. See LICENSE for details.

Github

link
Stars: 57
Help us keep the lights on

Releases

3.5.0 - Nov 27, 2019

Adam Fowler:

  • Use AWSClient.eventLoopGroup in HTTPClient
  • Added swift build github action

4.0.0 - Nov 22, 2019

Major version changes

  • aws-sdk-swift-core now requires Swift 5.0 or later.
  • We are now using Swift NIO 2.x. If you are dependent on a package using Swift NIO 1.14 or earlier eg Vapor 3, do not update to this version of aws-sdk-swift-core.
  • Re-worked HTTPClient so can work with NIO transport services. This means aws-sdk-swift-core works on iOS.
  • AWSClient.init() requires a EventLoopGroupProvider parameter, an enum with which you can provide your own eventLoopGroup for aws-sdk-swift-core to use, or use the one internal to AWSClient.

Other changes

  • If processing an XML response, ensure the header values in the response are also processed.
  • Tests now compile in release.
  • If AWSClient is initialised with accessKeyId and secretAccessKey set to "" then requests are sent to AWS unsigned. This gives access to AWS services such as CognitoIdentityProvider without credentials.
  • Refactored MetaDataService.

3.4.0 - Oct 14, 2019

  • Fixed issue with compiling for Swift 5.1 on Linux.
  • Rename XMLContainerCodingMap to XMLCodable.
  • Move ShapeEncoding and Location enums inside AWSShapeMember.
  • Move Request, Response and HTTPClientError inside HTTPClient.
  • Remove middlewares and amzTarget parameters from AWSRequest.init(). These are applied elsewhere.

3.3.0 - Sep 17, 2019

  • Added AWSLoggingMiddleware which logs raw requests sent to AWS and raw responses received back.
  • Changed restjson protocol Content-Type header to be 'application/json'.
  • Created AWSResponse struct which holds a processed response.
  • Middleware now has the ability to edit the contents of a AWSResponse.
  • Separated service signing name from service endpoint name as these can sometimes be different. This affects V4.Signer.init() where the service parameter has been renamed to signingName.
  • If response has a payload path then create top level objects to contain the response json or xml.
  • Mac uses CommonCrypto for SHA256, HMAC and MD5 calculations.
  • Added AWSClient.signURL() to return a signed URL.
  • AWSErrorType now conforms to CustomStringConvertible.
  • Add additional methods for decoding timestamps (HTTP date format and seconds from UNIX epoch time).
  • AWSClient.send() functions don't throw errors so have removed throws from them.
  • Min/max collection length validation errors output the length and not the full collection.
  • String pattern validation does not expect the whole string to match the pattern.

3.2.0 - Aug 17, 2019

  • If dictionary decoder expects an array but doesn't find one then stick object found inside an array. Fixes issue in API Gateway where single element arrays are just returned as the element.
  • AWSClient.init() has a new sessionToken parameter.
  • Add session tokens to headers before constructing authorization header.
  • XML Parser ignores newlines as well as whitespace in between XML nodes.
  • Don't encode single or double quotation marks in XML
  • Added general purpose validation code to be used by auto-generated validate() functions in aws-sdk-swift.
  • Added AWSShape.idempotencyToken() for auto-generating idempotency tokens.
  • Added support for OpenSSL 1.1 while still supporting earlier versions.
  • New me-south-1 region is available.
  • Added the ability to edit response bodies before they are decoded into an AWSShape.