Skip to content

Conversation

@muhammad-othman
Copy link
Member

@muhammad-othman muhammad-othman commented Dec 8, 2025

Description

Generates PutBucketOwnershipControls operation

AssemblyComparer AWSSDK.S3.New.dll: Message Amazon.S3.Model.PutBucketOwnershipControlsRequest/MethodAdded: New method System.Void set_ContentMD5(System.String) in Amazon.S3.Model.PutBucketOwnershipControlsRequest
AssemblyComparer AWSSDK.S3.New.dll: Message Amazon.S3.Model.PutBucketOwnershipControlsRequest/MethodAdded: New method System.String get_ContentMD5() in Amazon.S3.Model.PutBucketOwnershipControlsRequest

ContentMD5 property was added to the request.

Motivation and Context

DOTNET-8422

Testing

  • DRY_RUN-68d245f4-de50-4bde-b7b5-25367b3daa55.
  • Ran the Fuzz tests.

Screenshots (if appropriate)

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

@muhammad-othman
Copy link
Member Author

No breaking changes were found

Breaking Change Analysis for Commit 597d355

After thorough analysis of the PutBucketOwnershipControls operation migration from custom to generated code, I have identified the following:

Files Analyzed: 9/9 files

Files Changed:

  1. ✅ generator/ServiceClientGeneratorLib/ServiceModel.cs
  2. ✅ generator/ServiceModels/s3/s3.customizations.json
  3. ✅ sdk/src/Services/S3/Custom/Model/Internal/MarshallTransformations/PutBucketOwnershipControlsRequestMarshaller.cs (DELETED)
  4. ✅ sdk/src/Services/S3/Custom/Model/Internal/MarshallTransformations/PutBucketOwnershipControlsResponseUnmarshaller.cs (DELETED)
  5. ✅ sdk/src/Services/S3/Custom/Model/PutBucketOwnershipControlsRequest.cs (DELETED)
  6. ✅ sdk/src/Services/S3/Generated/Model/Internal/MarshallTransformations/PutBucketOwnershipControlsRequestMarshaller.cs (ADDED)
  7. ✅ sdk/src/Services/S3/Generated/Model/Internal/MarshallTransformations/PutBucketOwnershipControlsResponseUnmarshaller.cs (ADDED)
  8. ✅ sdk/src/Services/S3/Generated/Model/PutBucketOwnershipControlsRequest.cs (ADDED)
  9. ✅ sdk/src/Services/S3/Generated/Model/PutBucketOwnershipControlsResponse.cs (MOVED)

✅ NO BREAKING CHANGES DETECTED

Analysis Details:

PutBucketOwnershipControlsRequest.cs:

  • ✅ The customization in s3.customizations.json explicitly preserves the ExpectedBucketOwner IsSet logic: "ExpectedBucketOwner" :{"injectXmlIsSet":["return !string.IsNullOrEmpty(this._expectedBucketOwner);"]}
  • ✅ This ensures the generated IsSetExpectedBucketOwner() method uses !string.IsNullOrEmpty() instead of the default != null, maintaining backward compatibility
  • ✅ All other public properties maintained (BucketName, ChecksumAlgorithm, ContentMD5, OwnershipControls)
  • ✅ Property types and accessibility unchanged
  • ✅ All IsSet methods preserved with correct logic

PutBucketOwnershipControlsRequestMarshaller.cs:

  • ✅ Marshalling logic preserved including resource path, headers, XML structure
  • ✅ ChecksumUtils.SetChecksumData call preserved with same parameters
  • ✅ Checksum handling maintained (fallbackToMD5: false, isRequestChecksumRequired: true)
  • ✅ Partial method hooks added (PreMarshallCustomization/PostMarshallCustomization) for extensibility
  • ✅ XML namespace and structure identical

PutBucketOwnershipControlsResponseUnmarshaller.cs:

  • ✅ Response unmarshalling logic preserved (void response - no body parsing needed)
  • ✅ Error handling maintained
  • ✅ S3ErrorResponseUnmarshaller usage consistent
  • ✅ PostUnmarshallCustomization hook added for extensibility

PutBucketOwnershipControlsResponse.cs:

  • ✅ Moved from Custom to Generated folder
  • ✅ No functional changes - remains an empty response class inheriting from AmazonWebServiceResponse
  • ✅ Documentation unchanged

Key Preservation Mechanisms:

  1. The injectXmlIsSet customization in s3.customizations.json ensures the critical IsSetExpectedBucketOwner() method maintains backward-compatible behavior
  2. All marshalling logic, headers, and XML structure preserved in generated code
  3. Partial method hooks allow for future customizations without breaking changes
  4. Checksum calculation logic maintained exactly

Conclusion:

The migration successfully moved PutBucketOwnershipControls from custom to generated code without introducing breaking changes. The customization configuration file correctly addresses the potential breaking change for the ExpectedBucketOwner IsSet method, and all other functionality is preserved.

Files Analyzed: 9 out of 9 total files changed

@muhammad-othman muhammad-othman force-pushed the muhamoth/S3-generate-PutBucketOwnershipControls-operation branch from 597d355 to 92e8bd1 Compare December 9, 2025 15:41
@muhammad-othman muhammad-othman changed the base branch from muhamoth/phase-3-pr5-base to muhamoth/phase-3-prs5-base December 9, 2025 15:41
{
xmlWriter.WriteStartElement("OwnershipControls", "http://s3.amazonaws.com/doc/2006-03-01/");
var publicRequestOwnershipControlsRules = publicRequest.OwnershipControls.Rules;
if (publicRequestOwnershipControlsRules != null && (publicRequestOwnershipControlsRules.Count > 0 || !AWSConfigs.InitializeCollections))
Copy link
Contributor

Choose a reason for hiding this comment

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

Just calling this out but the old code only checked if ownershipControls.Rules != null
https://github.com/aws/aws-sdk-net/blob/main/sdk/src/Services/S3/Custom/Model/Internal/MarshallTransformations/PutBucketOwnershipControlsRequestMarshaller.cs#L70C1-L71C1

and now we're checking (publicRequestOwnershipControlsRules.Count > 0 || !AWSConfigs.InitializeCollections). This could be a breaking change if someone sends an empty list. We should validate that the behavior is the same. Does
mean the same as not sending a rule at all?

S3 is strange, sometimes they can mean different things. Tagging for example, if you send an empty tagset that in a PUT request, that is the equivalent of deleting all tags. We should make sure what the behavior is before doing this change.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think the current code will produce the same XML as the old code for nulls and empty lists.

In the old code

 if (ownershipControls.Rules != null)
                    {
                        foreach (var rule in ownershipControls.Rules)
                        {
                            xmlWriter.WriteStartElement("Rule");
                            if (rule.IsSetObjectOwnership())
                            {
                                xmlWriter.WriteElementString("ObjectOwnership", S3Transforms.ToXmlStringValue(rule.ObjectOwnership));
                            }
                            xmlWriter.WriteEndElement();
                        }
                    }

nothing will be added to the XML if ownershipControls.Rules is null or an empty as the foreach wont run for empty lists.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah okay good point. never mind then :)

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.

just one comment that could be a silent breaking change

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