Skip to content

Commit 30b6e85

Browse files
committed
uploadwithresponse api
1 parent 89d3e3d commit 30b6e85

24 files changed

+389
-40
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"services": [
3+
{
4+
"serviceName": "S3",
5+
"type": "minor",
6+
"changeLogMessages": [
7+
"Added UploadWithResponseAsync methods to TransferUtility that return TransferUtilityUploadResponse with upload metadata",
8+
"Enhanced upload commands to return response objects with ETag, encryption details, and version information"
9+
]
10+
}
11+
]
12+
}

sdk/src/Services/S3/Custom/Transfer/Internal/AbortMultipartUploadsCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
namespace Amazon.S3.Transfer.Internal
3030
{
31-
internal partial class AbortMultipartUploadsCommand : BaseCommand
31+
internal partial class AbortMultipartUploadsCommand : BaseCommand<TransferUtilityAbortMultipartUploadsResponse>
3232
{
3333
IAmazonS3 _s3Client;
3434
string _bucketName;

sdk/src/Services/S3/Custom/Transfer/Internal/BaseCommand.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,12 @@
3030

3131
namespace Amazon.S3.Transfer.Internal
3232
{
33-
internal abstract partial class BaseCommand
33+
/// <summary>
34+
/// Generic base command that returns a typed response
35+
/// </summary>
36+
/// <typeparam name="TResponse">Type of response returned by the command</typeparam>
37+
internal abstract partial class BaseCommand<TResponse> where TResponse : class
3438
{
35-
public virtual object Return
36-
{
37-
get { return null; }
38-
}
39-
4039
protected GetObjectRequest ConvertToGetObjectRequest(BaseDownloadRequest request)
4140
{
4241
GetObjectRequest getRequest = new GetObjectRequest()

sdk/src/Services/S3/Custom/Transfer/Internal/DownloadCommand.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
namespace Amazon.S3.Transfer.Internal
3535
{
36-
internal partial class DownloadCommand : BaseCommand
36+
internal partial class DownloadCommand : BaseCommand<TransferUtilityDownloadResponse>
3737
{
3838
static int MAX_BACKOFF_IN_MILLISECONDS = (int)TimeSpan.FromSeconds(30).TotalMilliseconds;
3939

@@ -176,4 +176,3 @@ static ByteRange ByteRangeRemainingForDownload(string filepath)
176176
}
177177
}
178178
}
179-

sdk/src/Services/S3/Custom/Transfer/Internal/DownloadDirectoryCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
namespace Amazon.S3.Transfer.Internal
3535
{
36-
internal partial class DownloadDirectoryCommand : BaseCommand
36+
internal partial class DownloadDirectoryCommand : BaseCommand<TransferUtilityDownloadDirectoryResponse>
3737
{
3838
private readonly IAmazonS3 _s3Client;
3939
private readonly TransferUtilityDownloadDirectoryRequest _request;

sdk/src/Services/S3/Custom/Transfer/Internal/MultipartUploadCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ namespace Amazon.S3.Transfer.Internal
3737
/// <summary>
3838
/// The command to manage an upload using the S3 multipart API.
3939
/// </summary>
40-
internal partial class MultipartUploadCommand : BaseCommand
40+
internal partial class MultipartUploadCommand : BaseCommand<TransferUtilityUploadResponse>
4141
{
4242
IAmazonS3 _s3Client;
4343
long _partSize;

sdk/src/Services/S3/Custom/Transfer/Internal/OpenStreamCommand.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
namespace Amazon.S3.Transfer.Internal
3131
{
32-
internal partial class OpenStreamCommand : BaseCommand
32+
internal partial class OpenStreamCommand : BaseCommand<TransferUtilityOpenStreamResponse>
3333
{
3434
IAmazonS3 _s3Client;
3535
TransferUtilityOpenStreamRequest _request;
@@ -59,10 +59,5 @@ internal Stream ResponseStream
5959
{
6060
get { return this._responseStream; }
6161
}
62-
63-
public override object Return
64-
{
65-
get { return this.ResponseStream; }
66-
}
6762
}
6863
}

sdk/src/Services/S3/Custom/Transfer/Internal/SimpleUploadCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ namespace Amazon.S3.Transfer.Internal
3636
/// <summary>
3737
/// This command is for doing regular PutObject requests.
3838
/// </summary>
39-
internal partial class SimpleUploadCommand : BaseCommand
39+
internal partial class SimpleUploadCommand : BaseCommand<TransferUtilityUploadResponse>
4040
{
4141
IAmazonS3 _s3Client;
4242
TransferUtilityConfig _config;

sdk/src/Services/S3/Custom/Transfer/Internal/UploadDirectoryCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ namespace Amazon.S3.Transfer.Internal
3232
/// This command files all the files that meets the criteria specified in the TransferUtilityUploadDirectoryRequest request
3333
/// and uploads them.
3434
/// </summary>
35-
internal partial class UploadDirectoryCommand : BaseCommand
35+
internal partial class UploadDirectoryCommand : BaseCommand<TransferUtilityUploadDirectoryResponse>
3636
{
3737
TransferUtilityUploadDirectoryRequest _request;
3838
TransferUtility _utility;

sdk/src/Services/S3/Custom/Transfer/Internal/_async/AbortMultipartUploadsCommand.async.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
namespace Amazon.S3.Transfer.Internal
2626
{
27-
internal partial class AbortMultipartUploadsCommand : BaseCommand
27+
internal partial class AbortMultipartUploadsCommand : BaseCommand<TransferUtilityAbortMultipartUploadsResponse>
2828
{
2929
TransferUtilityConfig _config;
3030

@@ -36,7 +36,7 @@ internal AbortMultipartUploadsCommand(IAmazonS3 s3Client, string bucketName, Dat
3636
this._config = config;
3737
}
3838

39-
public override async Task ExecuteAsync(CancellationToken cancellationToken)
39+
public override async Task<TransferUtilityAbortMultipartUploadsResponse> ExecuteAsync(CancellationToken cancellationToken)
4040
{
4141
if (string.IsNullOrEmpty(this._bucketName))
4242
{
@@ -88,6 +88,8 @@ await asyncThrottler.WaitAsync(cancellationToken)
8888

8989
await WhenAllOrFirstExceptionAsync(pendingTasks,cancellationToken)
9090
.ConfigureAwait(continueOnCapturedContext: false);
91+
92+
return new TransferUtilityAbortMultipartUploadsResponse();
9193
}
9294
finally
9395
{

0 commit comments

Comments
 (0)