Skip to content

Conversation

GarrettBeatty
Copy link
Contributor

@GarrettBeatty GarrettBeatty commented Oct 14, 2025

Description

This change creates a TransferUtilityUploadResponse class. This class contains the common fields between PutObjectResponse and CompleteMultipartUploadResponse. The reason it contains the common fields between PutObjectResponse and CompleteMultipartUploadResponse is because this same object should be utilized in both regular upload and multi part upload (as per the SEP).

This class will be used in #4059 and #4061 Where for progress events (e.g. UploadCompleted), we return a TransferUtilityUploadResponse object as part of it. This class will also be used when we create new apis as part of SEP compliance (UploadWithResponseAsync). it will be the return value of this function (instead of void like the existing UploadAsync).

TranserUtilityUploadRequest req = ... 
TransferUtilityUploadResponse response = transferUtility.UploadWithResponse(req)

In order to create this TransferUtilityUploadResponse class, I have created a conversion function MapPutObjectResponse which maps the PutObjectResponse to the TransferUtilityUploadResponse. Eventually, this class will also contain a MapCompletemultipartResponse function as well #4060

In order to comply with the SEP and ensure that all fields are mapped, I have added unit tests which read the mapping.json file from the SEP and validate that each of them get mapped in my conversion function between the two classes.

Motivation and Context

  1. DOTNET-8275

Testing

  1. Unit tests
  2. 4728749f-fc1d-45b4-a2a3-3605bf5dcd60 dry run pass

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have read the README document
  • I have added tests to cover my changes
  • All new and existing tests passed

License

  • I confirm that this pull request can be released under the Apache 2 license

@GarrettBeatty GarrettBeatty requested a review from Copilot October 14, 2025 17:42
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for mapping PutObjectResponse to TransferUtilityUploadResponse in the AWS S3 SDK, enabling consistent property exposure across upload operations.

Key changes:

  • Creates a new TransferUtilityUploadResponse class with comprehensive property mappings
  • Implements ResponseMapper utility for PutObjectResponse to TransferUtilityUploadResponse conversion
  • Adds extensive test coverage with JSON configuration-driven validation

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
TransferUtilityUploadResponse.cs New response class with properties mapped from S3 upload responses
ResponseMapper.cs Internal utility class for mapping PutObjectResponse to TransferUtilityUploadResponse
ResponseMapperTests.cs Comprehensive test suite with configuration-driven validation
mapping.json Configuration defining field mappings between S3 request/response types
property-aliases.json Property name aliases for backward compatibility
mapping-schema.json JSON schema for validating mapping configuration structure
AssemblyInfo.cs Added InternalsVisibleTo attributes for test access
433a9a6d-b8ea-4676-b763-70711e8288e4.json Dev config file specifying patch-level change

@GarrettBeatty GarrettBeatty changed the base branch from getobject to development October 14, 2025 22:28
@GarrettBeatty GarrettBeatty force-pushed the gcbeatty/tuuploadresponse branch 2 times, most recently from 72d85c3 to 2dffdee Compare October 16, 2025 19:14
@GarrettBeatty GarrettBeatty marked this pull request as ready for review October 17, 2025 13:50
[assembly: InternalsVisibleTo("AWSSDK.UnitTests.DynamoDBv2.NetFramework, PublicKey=0024000004800000940000000602000000240000525341310004000001000100db5f59f098d27276c7833875a6263a3cc74ab17ba9a9df0b52aedbe7252745db7274d5271fd79c1f08f668ecfa8eaab5626fa76adc811d3c8fc55859b0d09d3bc0a84eecd0ba891f2b8a2fc55141cdcc37c2053d53491e650a479967c3622762977900eddbf1252ed08a2413f00a28f3a0752a81203f03ccb7f684db373518b4")]
[assembly: InternalsVisibleTo("AWSSDK.UnitTests.NetFramework, PublicKey=0024000004800000940000000602000000240000525341310004000001000100db5f59f098d27276c7833875a6263a3cc74ab17ba9a9df0b52aedbe7252745db7274d5271fd79c1f08f668ecfa8eaab5626fa76adc811d3c8fc55859b0d09d3bc0a84eecd0ba891f2b8a2fc55141cdcc37c2053d53491e650a479967c3622762977900eddbf1252ed08a2413f00a28f3a0752a81203f03ccb7f684db373518b4")]
<# } #>
<# if (this.Config.AssemblyTitle=="AWSSDK.S3") { #>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is added so we can test the internal ResponseMapper class i made

/// Contains unified response fields from both simple uploads (PutObjectResponse)
/// and multipart uploads (CompleteMultipartUploadResponse).
/// </summary>
public class TransferUtilityUploadResponse : AmazonWebServiceResponse
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right now if we release this change to development, the customer can access this class even though it wont really be used for anything until the next PRs. which i think should go in the feature branch. wondering if we should target feature/transfermanager for this change even though its not a runtime change?

@@ -0,0 +1,10 @@
{
"PropertyAliases": {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.net's property values are slightly different than whats in the mapping so i made another mapping to the .net values. the reason i didnt modify the original mapping.json is so we can copy and paste it from the SEP code directly if we ever need to update it

{
ValidateResponseDefinitionCompleteness<GetObjectResponse>(
new[] { "Definition", "DownloadResponse", "GetObjectResponse" },
"GetObjectResponse",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wondering if we should be updating GetObjectResponse soon/now instead of doing this to match the model? e.g. ContentType is in the HeaderCollection property currently. but the model https://github.com/aws/aws-sdk-net/blob/main/generator/ServiceModels/s3/s3-2006-03-01.api.json#L4575 i think maps it to its own attribute @philasmar @peterrsongg ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also this test case isnt really needed as part of this work. i added it just for completeness sake. its validating that getobjectresponse has all of the expected fields in the mapping.json

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GarrettBeatty yeah, if it is mapped to a property on the output then we should follow the model, especially if it isn't there right now.

Copy link
Contributor Author

@GarrettBeatty GarrettBeatty Oct 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think i might just remove this test case because we dont need to copy content type to transferutilityuploadresponse anyway, so this test case really isnt validating anything important

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ended up removing this since if we update the getobjectresponse model anyway it will be backward compatible so the fields we have now are fine and we dont need a test for it

@GarrettBeatty GarrettBeatty changed the base branch from development to feature/transfermanager October 17, 2025 18:02
@GarrettBeatty GarrettBeatty changed the base branch from feature/transfermanager to development October 17, 2025 18:02
Copy link
Contributor

@peterrsongg peterrsongg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks good, but I have a question.

You're not actually calling MapPutObjectResponse anywhere in this PR. So where does the mapping actually happen? Is that going to be part of another PR?

@peterrsongg
Copy link
Contributor

Approved, based on assumption that the actual mapping will happen in another PR (unless my read of this is mistaken)

@GarrettBeatty
Copy link
Contributor Author

Change looks good, but I have a question.

You're not actually calling MapPutObjectResponse anywhere in this PR. So where does the mapping actually happen? Is that going to be part of another PR?

yes - description of the PR has links to the ones that will call it

update assemblyinfo

fix assembly info

Add debug logging

embed resource

add debug logging

fix test data

remove schema

remove uneeded tests
@GarrettBeatty GarrettBeatty force-pushed the gcbeatty/tuuploadresponse branch from 35dddc2 to 4f9bdfa Compare October 18, 2025 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants