Skip to content

Conversation

@muhammad-othman
Copy link
Member

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

Description

Generates CopyObject S3 operation

AssemblyComparer AWSSDK.S3.New.dll: Message Amazon.S3.Model.CopyObjectRequest/MethodAdded: New method System.Void set_CacheControl(System.String) in Amazon.S3.Model.CopyObjectRequest
AssemblyComparer AWSSDK.S3.New.dll: Message Amazon.S3.Model.CopyObjectRequest/MethodAdded: New method System.Void set_GrantRead(System.String) in Amazon.S3.Model.CopyObjectRequest
AssemblyComparer AWSSDK.S3.New.dll: Message Amazon.S3.Model.CopyObjectRequest/MethodAdded: New method System.Void set_ContentEncoding(System.String) in Amazon.S3.Model.CopyObjectRequest
AssemblyComparer AWSSDK.S3.New.dll: Message Amazon.S3.Model.CopyObjectRequest/MethodAdded: New method System.Void set_GrantFullControl(System.String) in Amazon.S3.Model.CopyObjectRequest
AssemblyComparer AWSSDK.S3.New.dll: Message Amazon.S3.Model.CopyObjectRequest/MethodAdded: New method System.Void set_ContentLanguage(System.String) in Amazon.S3.Model.CopyObjectRequest
AssemblyComparer AWSSDK.S3.New.dll: Message Amazon.S3.Model.CopyObjectRequest/MethodAdded: New method System.String get_GrantRead() in Amazon.S3.Model.CopyObjectRequest
AssemblyComparer AWSSDK.S3.New.dll: Message Amazon.S3.Model.CopyObjectRequest/MethodAdded: New method System.String get_ContentDisposition() in Amazon.S3.Model.CopyObjectRequest
AssemblyComparer AWSSDK.S3.New.dll: Message Amazon.S3.Model.CopyObjectRequest/MethodAdded: New method System.Void set_GrantReadACP(System.String) in Amazon.S3.Model.CopyObjectRequest
AssemblyComparer AWSSDK.S3.New.dll: Message Amazon.S3.Model.CopyObjectRequest/MethodAdded: New method System.Void set_GrantWriteACP(System.String) in Amazon.S3.Model.CopyObjectRequest
AssemblyComparer AWSSDK.S3.New.dll: Message Amazon.S3.Model.CopyObjectRequest/MethodAdded: New method System.Void set_ContentDisposition(System.String) in Amazon.S3.Model.CopyObjectRequest
AssemblyComparer AWSSDK.S3.New.dll: Message Amazon.S3.Model.CopyObjectRequest/MethodAdded: New method System.String get_GrantFullControl() in Amazon.S3.Model.CopyObjectRequest
AssemblyComparer AWSSDK.S3.New.dll: Message Amazon.S3.Model.CopyObjectRequest/MethodAdded: New method System.String get_CacheControl() in Amazon.S3.Model.CopyObjectRequest
AssemblyComparer AWSSDK.S3.New.dll: Message Amazon.S3.Model.CopyObjectRequest/MethodAdded: New method System.Void set_Headers(Amazon.S3.Model.HeadersCollection) in Amazon.S3.Model.CopyObjectRequest
AssemblyComparer AWSSDK.S3.New.dll: Message Amazon.S3.Model.CopyObjectRequest/MethodAdded: New method System.String get_Expires() in Amazon.S3.Model.CopyObjectRequest
AssemblyComparer AWSSDK.S3.New.dll: Message Amazon.S3.Model.CopyObjectRequest/MethodAdded: New method System.String get_ContentEncoding() in Amazon.S3.Model.CopyObjectRequest
AssemblyComparer AWSSDK.S3.New.dll: Message Amazon.S3.Model.CopyObjectRequest/MethodAdded: New method System.String get_ContentLanguage() in Amazon.S3.Model.CopyObjectRequest
AssemblyComparer AWSSDK.S3.New.dll: Message Amazon.S3.Model.CopyObjectRequest/MethodAdded: New method System.Void set_Metadata(Amazon.S3.Model.MetadataCollection) in Amazon.S3.Model.CopyObjectRequest        
AssemblyComparer AWSSDK.S3.New.dll: Message Amazon.S3.Model.CopyObjectRequest/MethodAdded: New method System.Void set_Expires(System.String) in Amazon.S3.Model.CopyObjectRequest
AssemblyComparer AWSSDK.S3.New.dll: Message Amazon.S3.Model.CopyObjectRequest/MethodAdded: New method System.String get_GrantWriteACP() in Amazon.S3.Model.CopyObjectRequest
AssemblyComparer AWSSDK.S3.New.dll: Message Amazon.S3.Model.CopyObjectRequest/MethodAdded: New method System.String get_GrantReadACP() in Amazon.S3.Model.CopyObjectRequest
AssemblyComparer AWSSDK.S3.New.dll: Message Amazon.S3.Model.ObjectNotInActiveTierErrorException/TypeAdded: New type Amazon.S3.Model.ObjectNotInActiveTierErrorException

New properties were 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

Copy link
Contributor

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 generates the S3 CopyObject operation by migrating from custom implementation to generated code. The changes consolidate marshalling logic, refactor ACL handling, and add comprehensive customizations for the operation's request and response models.

Key changes:

  • Migrated CopyObject operation from custom to generated implementation
  • Refactored ACL request marshalling into reusable HeaderACLRequestMarshaller utility
  • Added extensive customizations in service model configuration for property mappings and marshalling behavior

Reviewed changes

Copilot reviewed 10 out of 17 changed files in this pull request and generated no comments.

Show a summary per file
File Description
ObjectNotInActiveTierErrorException.cs New exception class for objects not in active tier
ObjectNotInActiveTierErrorExceptionUnmarshaller.cs Unmarshaller for the new exception type
CopyObjectResponseUnmarshaller.cs (Generated) Generated response unmarshaller with header processing
CopyObjectRequestMarshaller.cs (Generated) Generated request marshaller with customization hooks
CopyObjectResponse.cs (Generated) Generated response model with all properties
CopyObjectRequest.cs (Generated) Generated request model with extensive documentation
PutBucketRequestMarshaller.cs Refactored to use shared ACL marshaller
HeaderACLRequestMarshaller.cs Added null checks for grants and permissions
CopyObjectResponseUnmarshaller.cs (Custom - deleted) Removed custom implementation
CopyObjectRequestMarshaller.cs (Custom - refactored) Reduced to customization hook calling shared utilities
CopyObjectResponse.cs (Custom - deleted) Removed custom implementation
CopyObjectRequest.cs (Custom - deleted) Removed custom implementation
s3.customizations.json Added extensive CopyObject customizations for property mappings and marshalling
ServiceModel.cs Added CopyObject to S3 allow list operations
Operation.cs Added exclusion logic for marshalling properties
BaseMarshaller.tt Added support for custom marshalling code injection and skipXmlIsSet
Comments suppressed due to low confidence (1)

generator/ServiceClientGeneratorLib/Generators/Marshallers/BaseMarshaller.tt:1

  • The opening brace on line 42 is not closed before the conditional block starting at line 48. This creates mismatched braces in the template logic flow.
<#@ template language="C#" inherits="Generators.BaseGenerator" #>

@muhammad-othman muhammad-othman force-pushed the muhamoth/S3-generate-CopyObject-operation branch 2 times, most recently from a89c174 to 00aa82f Compare December 12, 2025 19:51
@muhammad-othman muhammad-othman force-pushed the muhamoth/S3-generate-CopyObject-operation branch from 00aa82f to 1aa15bd Compare December 12, 2025 20:32
@muhammad-othman
Copy link
Member Author

Breaking Change Analysis for CopyObject Operation Migration (Commit 1aa15bd)

Summary

After detailed analysis of the CopyObject operation migration from custom to generated code, I have identified ZERO breaking changes. The migration appears to be backward compatible.

Files Analyzed (22 total)

  1. ✅ CopyObjectRequest.cs (Custom vs Generated)
  2. ✅ CopyObjectResponse.cs (Custom vs Generated)
  3. ✅ CopyObjectRequestMarshaller.cs (Old Custom vs New Custom + Generated)
  4. ✅ CopyObjectResponseUnmarshaller.cs (Old Custom vs New Generated)
  5. ✅ FilterRule.cs (IsSet methods removed - minor, not breaking)
  6. ✅ HeaderACLRequestMarshaller.cs (changes noted in diff)
  7. ✅ PutBucketRequestMarshaller.cs (changes noted in diff)
  8. ✅ ObjectNotInActiveTierErrorException.cs (new exception type)
  9. ✅ ObjectNotInActiveTierErrorExceptionUnmarshaller.cs (new unmarshaller)
  10. ✅ Generator files (BaseMarshaller.cs, BaseResponseUnmarshaller.cs, StructureGenerator.cs, etc.)

Detailed Analysis

CopyObjectRequest Model

Public Properties: All custom properties preserved in generated version

  • ✅ All getter/setter logic identical
  • ✅ IsSet methods for string properties still use !System.String.IsNullOrEmpty() (not changed to != null)
  • ✅ No properties removed
  • ⚠️ New properties added (CacheControl, ContentDisposition, ContentEncoding, ContentLanguage, Expires) - ADDITIVE, not breaking

Private Field Names Changed:

  • Custom: srcBucket, dstBucket, etagToMatch, etc.
  • Generated: _sourceBucket, _destinationBucket, _eTagToMatch, etc.
  • Not breaking - private implementation details only

CopyObjectResponse Model

All Properties Preserved:

  • ✅ ETag, LastModified, SourceVersionId, VersionId, Expiration
  • ✅ All ServerSideEncryption properties
  • ✅ All Checksum properties (CRC32, CRC32C, CRC64NVME, SHA1, SHA256, ChecksumType)
  • ✅ RequestCharged, BucketKeyEnabled
  • ✅ All IsSet methods unchanged

CopyObjectRequestMarshaller

Logic Split Between Generated + Custom Partial:

  • ✅ All original marshalling logic preserved in generated version

  • ✅ Custom logic moved to PreMarshallCustomization method:

    • HeaderACLRequestMarshaller.Marshall()
    • AmazonS3Util.SetMetadataHeaders()
    • Validation checks
    • Path resource setup
  • ConstructCopySourceHeaderValue helper method preserved in custom partial

  • ⚠️ New header marshalling added for new properties - ADDITIVE, not breaking

CopyObjectResponseUnmarshaller

Generated Version Includes All Original Logic:

  • ✅ All XML unmarshalling preserved (ETag, LastModified, Checksums)
  • ✅ All header unmarshalling preserved (Expiration, VersionId, SSE headers, etc.)
  • ✅ Includes PostUnmarshallCustomization hook for future extensibility
  • NEW: ObjectNotInActiveTierErrorException handling added - ADDITIVE, not breaking

FilterRule.cs

Minor Change:

  • IsSet methods removed from FilterRule model
  • Not breaking - IsSet methods are internal and properties remain unchanged

New Exception Type

  • ObjectNotInActiveTierErrorException added
  • Not breaking - new exception type for better error handling

Key Findings

✅ NO BREAKING CHANGES FOUND

  1. IsSet Methods: All string property IsSet methods in CopyObjectRequest still use !System.String.IsNullOrEmpty() - NOT changed to != null

  2. Public Properties: All public properties from custom version are present in generated version with identical getters/setters

  3. Marshalling Logic: All original marshalling behavior preserved, with custom logic appropriately moved to PreMarshallCustomization partial method

  4. Unmarshalling Logic: All original unmarshalling behavior preserved in generated version

  5. Response Output: No changes to response structure or data

  6. Backwards Compatibility: Code maintains full backward compatibility while adding new functionality

New Functionality Added (Non-Breaking)

  • CacheControl request property and marshalling
  • ContentDisposition request property and marshalling
  • ContentEncoding request property and marshalling
  • ContentLanguage request property and marshalling
  • Expires request property and marshalling
  • ObjectNotInActiveTierErrorException for better error handling

Conclusion

The migration of CopyObject operation from custom to generated code is CLEAN with ZERO breaking changes. The team successfully:

  1. Preserved all existing functionality
  2. Maintained backward compatibility
  3. Added new features without breaking existing code
  4. Properly split custom logic using partial methods (PreMarshallCustomization/PostMarshallCustomization)

Files Analyzed: 22 of 22 (100%)

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.

1 participant