A manually created forked subset of the official AWS SDK
(from aws-sdk-net) limited to the S3
type Amazon.S3.Transfer.TransferUtility
, required supporting types, and relevant tests. The parts that are forked retain a package reference dependency to the original AWS SDK but expose alternate implementations of the forked functionality.
-
discard functionality annotated with
ObsoleteAttribute
-
use
async
functionality by default- discard synchronous functionality exposed by contracts
- uses
Task
instead ofThread
patterns
-
prefer modern
C#
syntax to that of the original source code -
enabled Nullable reference types (i.e.
#nullable enable
)- code has been refactored to successfully build / test with them enabled
-
coalesce
partial
definitions where possible -
annotate forked type definitions with
AmazonSdkForkAttribute
- documents the
tag
of the forked version of the original source - documents source files and namespaces
- documents what type or types in the original source are relevant to the annotated type including:
- directly analogous definitions
- multiple in the case of
partial
definitions
- multiple in the case of
- non-analogous definitions from which any code was sourced
- directly analogous definitions
- can be used by scripts to reconstitute an original file structure for diff purposes
- documents the
-
expose
private
functionality for extensible types- changed modifier to
protected
- changed modifier to
-
expose
internal
functionality- changed modifier to
protected
for extensible types - exposed remaining
internal
to a list of known assemblies viaInternalsVisibleToAttribute
- changed modifier to
-
modify functionality with
virtual
to make it extensible -
correct, improv, and add additional
XML Documentation
-
prefer future-proof value types in exposed contracts and signatures
Examples:
Nullable<T>
is used instead of sentinelT
values that representnull
DateTimeOffset
instead ofDateTime
uint
instead ofint
when value cannot be negativeulong
instead oflong
when value cannot be negative
NOTE the underlying
aws sdk
reference may not yet make use of these and in that case they fallback to those value types for internal calls to that SDK -
change namespaces to match extracted subset functionality as well as the containing solution
-
change logging to use
Serilog
- changed
Amazon.Runtime.Internal.Util.Logger
toSerilog.ILogger
- changed
Consuming applications should set the static property Allos.Amazon.Sdk.TonicLogger.BaseLogger
to the desired Serilog.ILogger
to hook into this library's internal logging
The tests use the AWS
credentials file to authenticate with S3
NOTE The credentials file is typically located at
~/.aws/credentials
on Unix-like systems, or%USERPROFILE%\.aws\credentials
on WindowsSee also: sso-configure-profile-token-auto-sso
In the definition for Allos.Amazon.Sdk.Tests.IntegrationTests.Tests.TestBase
on which the property TestAwsCredentialsProfileName
should be set to a profile name that exists in the local credential file.
NOTE a default could also be hardcoded in the private field
_testAwsCredentialsProfileName
The original Amazon.S3.Transfer.TransferUtility
would never fire Amazon.Runtime.Internal.IAmazonWebServiceRequest.StreamUploadProgressCallback
events when uploading a Stream
where one or more of the following was true:
Stream.CanSeek
==false
Stream.Length
wouldthrow
This limitation has been addressed by including one ore more additional types and patching some of the original type implementations as follows:
- [Forked, Patched]
EventStream
- Forked an additional type
EventStream
and enhanced theOnRead
event it publishes
- Forked an additional type
- [Patched]
SimpleUploadCommand
- Patched the construction of
PutObjectRequest
to attach aProgressHandler
along with anEventStream
- Disconnected the existing event registration to
StreamUploadProgressCallback
- Registered a handler on
ProgressHandler
that receives an enhanced implementation ofUploadProgressArgs
that removes the above limitations on this code path
- Patched the construction of
- [Patched]
MultipartUploadCommand
- Patched the construction of
UploadPartRequest
to attach aProgressHandler
along with anEventStream
- Disconnected the existing event registration to
StreamUploadProgressCallback
- Registered a handler on
ProgressHandler
that receives an enhanced implementation ofUploadProgressArgs
that removes the above limitations on this code path
- Patched the construction of
- [Patched]
**TransferUtility
- Patched
UploadAsync
to handle a new edge case specific toMultipartUploadCommand
andStream
instances that were previously subject to the above limitations
- Patched
The combination of these patches yields progress update events without limitations.