Soto v6

Soto version 6.0.0 has been released. While this release includes a number of major changes many of these are internal and should not require much change from users of Soto. Upgrading to v6 should not be too painful.

Code Generation

Smithy

The big change that v6 brings in is how we generate the AWS service API files. A couple of years back AWS introduced Smithy: a new language for defining services and SDKs. They are now providing models for all of their services using this new language. All new AWS SDKs are using the Smithy models as the source for code generation. I imagine at some point AWS will stop publishing the old json model format. Smithy has a number of advantages, one of the main ones being it has a published specification. This makes source code generation considerably easier. From v6 onwards the Soto AWS service API files are generated from the Smithy files.

Along with the change to the service model format, we have moved the code generator out of the Soto repository into it's own repo: soto-codegenerator.

Given we using a completely new source for service definitions there are some changes which have filtered into the generated files. Three services are no longer generated: SimpleDB, ImportExport, MobileAnalytics. A number of the service names have changed, if the name included "Service" in it before this has been removed and in some places capitalisation of various characters has changed.

Cleanup

With this being a major release we have used this chance to clean up some variable and enum naming during code generation. Enums are now camel case, previously they were all lowercase. Variables that start with an uppercase acronym now capitalise correctly. Previously it would lowercase the first letter of the acronym and the rest would be left uppercase. This led to many variables being prefixed with aWS. These now have the prefix aws.

HTTP Client

The AWSHTTPClient protocol is no longer public. The library now requires that you use AsyncHTTPClient from swift server team. This change has been implemented to reduce the API surface of Soto and to allow us more flexibility in how we integrate the HTTP client with the rest of the project.

Swift Concurrency

Version 5 of Soto included async/await versions of many of the APIs. Version 6 extends this, with a look to the future as well. There are new async versions of the S3 multipart upload/download functions. The big change though is adding Sendable protocol conformance to all the relevant public objects. This means Soto should be ready for Swift 6 when Sendable conformance is to be required for all async code. In general this is an additive change and will not affect the end user but it does impact APIs where the user provides a closure eg AWSPayload.stream. In these cases the closure will now have to be @Sendable.

Changes

Here is a full list of changes in Soto v6.

Major

  • Generate service files from Smithy model files.

  • Move Code Generator into its own repo soto-codegenerator.

  • AWSHTTPClient, AWSHTTPRequest, AWSHTTPResponse are no longer public symbols. User required to use AsyncHTTPClient as an HTTP client.

  • Add Sendable Conformance to all relevant objects/protocols. This includes AWSClient, AWSService, CredentialProvider and AWSShape.

  • Add support for automatic HTTP checksum calculation (crc32, crc32c, sha1 and sha256) where checksum tests are supported (S3).

  • Added AWSBase64Data to store base64 encoded data. This is to replace all instances of Data in AWS service API input/output shapes.

  • Move _payloadOptions to AWSShape and rename to _options.

  • AWSResponse.headers type is now NIOHTTP1.HTTPHeaders instead of [String: Any].

  • AWSPayload.stream has the byteBufferAllocator parameter removed as it is no longer used.

  • Added final to all Shapes that are classes.

  • S3: Select Object Content code now uses crc32 from SotoCore, instead of importing zlib. Target CSotoZlib has been removed.

Minor

  • Add xmlNamespace to AWSServiceConfig.

  • Add AWSShape option .checksumRequired which calculates a checksum of the payload and places it in the relevant header.

  • Add AWSShape option .md5ChecksumHeader which indicates the shape has a MD5-Content header which will be calculated if the service config has option .calculateMD5 set to true.

  • Add Location.hostname which is used for placing content in the hostname.

  • Add Location.headerPrefix which is used for placing a dictionary into multiple headers with the keys prefixed by a string. This was part of the S3 middleware but has now been generalised.

  • Added async version of AWSClient.shutdown.

  • Where operation input struct has deprecated members add an additional init which doesn't include deprecated members and deprecate old init.

  • S3: MD5 checksums are no longer automatically calculated (unless required). You can re-enable the automatic calculation of MD5 checksums using the S3 service option .calculateMD5.

  • S3: Added async versions of Multipart Upload/download functions

  • S3: Send Expect: 100-continue header to cancel large uploads early if AWS know they are going to fail.

Patch

  • Remove retry on NIOConnectionError as AsyncHTTPClient does this for us.

  • Only retry on HTTPClient.remoteConnectionClosed in debug builds as this could retry non-idempotent calls even when they have been successful.

  • Set user-agent header to "Soto/6.0".

  • Fix V4 Signing bug where sequential spaces have to be removed from header values when building canonical request.

  • S3: S3RequestMiddleware now preserves trailing "/" when reconstructing URL

  • S3: Percent encode additional characters in URL paths, to support S3 like services that require this.

9 Likes