-
Notifications
You must be signed in to change notification settings - Fork 873
Generate PutBucketAnalyticsConfiguration #4126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: peterrsongg/petesong/phase-3-pr-2-all/1
Are you sure you want to change the base?
Generate PutBucketAnalyticsConfiguration #4126
Conversation
stack-info: PR: #4126, branch: peterrsongg/petesong/phase-3-pr-2-all/2
839af32 to
6a201fb
Compare
46a57f7 to
42efdb7
Compare
Breaking Changes Analysis ReportSummaryAnalyzed 69 files changed in this PR migrating S3 Analytics and CreateSession operations from Custom to Generated code. Total Breaking Changes Found: 5 files with issues BREAKING CHANGES DETECTED1. AnalyticsConfiguration.csFile: ISSUE: Internal validation method logic changed
2. AnalyticsExportDestination.csFile: ISSUE: Added Required attribute to S3BucketDestination property
3. AnalyticsS3BucketDestination.csFile: ISSUES (Multiple): a) BucketName Required Attribute Added
b) Format Required Attribute Added
c) Internal Validation Methods Changed
4. StorageClassAnalysisDataExport.csFile: ISSUES (Multiple): a) Destination Required Attribute Added
b) OutputSchemaVersion Required Attribute Added
5. GetBucketAnalyticsConfigurationRequest.csFile: ISSUES (Multiple): a) AnalyticsId Required Attribute Added
b) BucketName Required Attribute Added
c) Internal Validation Methods Changed
VERIFIED AS CORRECTThe following changes were verified as correctly preserving existing behavior:
Files Analyzed: 69/69 (100%)Model Files Analyzed (16):✅ AnalyticsConfiguration.cs ✅ AnalyticsExportDestination.cs Marshaller/Unmarshaller Files Analyzed (23):✅ All marshaller and unmarshaller files verified for custom logic preservation Configuration Files Analyzed (2):✅ generator/ServiceClientGeneratorLib/ServiceModel.cs ✅ generator/ServiceModels/s3/s3.customizations.json CRITICAL IMPACT SUMMARYThe most severe breaking changes are:
These changes violate backward compatibility and will cause runtime errors for existing customer code. |
There was a problem hiding this 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 PutBucketAnalyticsConfiguration operation and related models by migrating from custom handwritten code to generated code based on the S3 service model. This is part 2 of a 5-part stacked PR series, with a dev config to be added in the final merge PR.
Key Changes:
- Migrates
PutBucketAnalyticsConfigurationRequest,PutBucketAnalyticsConfigurationResponse, and related model classes from custom to generated code - Preserves custom marshalling logic for
AnalyticsFilterthrough theAnalyticsFilterCustomMarshallpartial method - Adds generator customizations to maintain compatibility (property name mappings, custom IsSet logic, and string-based Format handling)
Reviewed Changes
Copilot reviewed 6 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
generator/ServiceClientGeneratorLib/ServiceModel.cs |
Enables code generation for PutBucketAnalyticsConfiguration by uncommenting the operation |
generator/ServiceModels/s3/s3.customizations.json |
Adds customizations for property name mappings (Id→AnalyticsId, Filter→AnalyticsFilter), custom IsSet implementations, custom marshalling injection for AnalyticsFilter, and Format property type configuration |
sdk/src/Services/S3/Custom/Model/AnalyticsConfiguration.cs |
Deleted - replaced with generated version |
sdk/src/Services/S3/Custom/Model/AnalyticsS3BucketDestination.cs |
Deleted - replaced with generated version |
sdk/src/Services/S3/Custom/Model/Internal/MarshallTransformations/PutBucketAnalyticsConfigurationRequestMarshaller.cs |
Refactored to retain only custom logic: AnalyticsFilterCustomMarshall for filter marshalling and PostMarshallCustomization for checksum handling |
sdk/src/Services/S3/Custom/Model/Internal/MarshallTransformations/PutBucketAnalyticsConfigurationResponseUnmarshaller.cs |
Deleted - replaced with generated version that includes error handling and partial customization hooks |
sdk/src/Services/S3/Generated/Model/AnalyticsConfiguration.cs |
New generated model with properly documented properties and Required attributes |
sdk/src/Services/S3/Generated/Model/AnalyticsExportDestination.cs |
Updated to generated version with improved documentation and standardized field naming |
sdk/src/Services/S3/Generated/Model/AnalyticsS3BucketDestination.cs |
New generated model replacing custom implementation, with Format changed to string type (maintains compatibility via implicit conversion) |
sdk/src/Services/S3/Generated/Model/PutBucketAnalyticsConfigurationRequest.cs |
Updated to generated version with enhanced documentation, standardized field naming (_fieldName convention), and preserved validation logic |
sdk/src/Services/S3/Generated/Model/PutBucketAnalyticsConfigurationResponse.cs |
Updated to generated version with cleaner structure |
sdk/src/Services/S3/Generated/Model/StorageClassAnalysis.cs |
Updated to generated version with improved documentation and standardized field naming |
sdk/src/Services/S3/Generated/Model/StorageClassAnalysisDataExport.cs |
Updated to generated version with improved documentation, Required attributes, and reordered properties (Destination before OutputSchemaVersion) |
sdk/src/Services/S3/Generated/Model/Internal/MarshallTransformations/PutBucketAnalyticsConfigurationRequestMarshaller.cs |
New generated marshaller that calls custom AnalyticsFilterCustomMarshall and PostMarshallCustomization methods, with updated parameter handling using request.Parameters.Add + UseQueryString pattern |
sdk/src/Services/S3/Generated/Model/Internal/MarshallTransformations/PutBucketAnalyticsConfigurationResponseUnmarshaller.cs |
New generated unmarshaller with comprehensive error handling and partial customization support |
| AnalyticsFilterCustomMarshall(publicRequest, xmlWriter); | ||
| if(publicRequest.AnalyticsConfiguration.IsSetAnalyticsId()) | ||
| xmlWriter.WriteElementString("Id", StringUtils.FromString(publicRequest.AnalyticsConfiguration.AnalyticsId)); | ||
|
|
||
| if (publicRequest.AnalyticsConfiguration.StorageClassAnalysis != null) | ||
| { | ||
| xmlWriter.WriteStartElement("StorageClassAnalysis"); | ||
| if (publicRequest.AnalyticsConfiguration.StorageClassAnalysis.DataExport != null) | ||
| { | ||
| xmlWriter.WriteStartElement("DataExport"); | ||
| if (publicRequest.AnalyticsConfiguration.StorageClassAnalysis.DataExport.Destination != null) | ||
| { | ||
| xmlWriter.WriteStartElement("Destination"); | ||
| if (publicRequest.AnalyticsConfiguration.StorageClassAnalysis.DataExport.Destination.S3BucketDestination != null) | ||
| { | ||
| xmlWriter.WriteStartElement("S3BucketDestination"); | ||
| if(publicRequest.AnalyticsConfiguration.StorageClassAnalysis.DataExport.Destination.S3BucketDestination.IsSetBucketAccountId()) | ||
| xmlWriter.WriteElementString("BucketAccountId", StringUtils.FromString(publicRequest.AnalyticsConfiguration.StorageClassAnalysis.DataExport.Destination.S3BucketDestination.BucketAccountId)); | ||
| if(publicRequest.AnalyticsConfiguration.StorageClassAnalysis.DataExport.Destination.S3BucketDestination.IsSetBucketName()) | ||
| xmlWriter.WriteElementString("Bucket", StringUtils.FromString(publicRequest.AnalyticsConfiguration.StorageClassAnalysis.DataExport.Destination.S3BucketDestination.BucketName)); | ||
| if(publicRequest.AnalyticsConfiguration.StorageClassAnalysis.DataExport.Destination.S3BucketDestination.IsSetFormat()) | ||
| xmlWriter.WriteElementString("Format", StringUtils.FromString(publicRequest.AnalyticsConfiguration.StorageClassAnalysis.DataExport.Destination.S3BucketDestination.Format)); | ||
| if(publicRequest.AnalyticsConfiguration.StorageClassAnalysis.DataExport.Destination.S3BucketDestination.IsSetPrefix()) | ||
| xmlWriter.WriteElementString("Prefix", StringUtils.FromString(publicRequest.AnalyticsConfiguration.StorageClassAnalysis.DataExport.Destination.S3BucketDestination.Prefix)); | ||
| xmlWriter.WriteEndElement(); | ||
| } | ||
| xmlWriter.WriteEndElement(); | ||
| } | ||
| if(publicRequest.AnalyticsConfiguration.StorageClassAnalysis.DataExport.IsSetOutputSchemaVersion()) | ||
| xmlWriter.WriteElementString("OutputSchemaVersion", StringUtils.FromString(publicRequest.AnalyticsConfiguration.StorageClassAnalysis.DataExport.OutputSchemaVersion)); |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The XML element ordering has changed from the custom marshaller implementation. The old order was: Id → Filter → StorageClassAnalysis → DataExport → OutputSchemaVersion → Destination. The new generated order is: Filter → Id → StorageClassAnalysis → DataExport → Destination → OutputSchemaVersion.
While XML is generally order-independent and your testing confirms this works, consider documenting this ordering change in the PR description for future reference, especially since you mentioned this is part of a migration from custom to generated code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have tests for this, right? But seems like something we should verify - I may be misremembering but did we have issues for ordering?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup we have tests here:
aws-sdk-net/sdk/test/Services/S3/IntegrationTests/StorageInsightsAnalyticsTests.cs
Line 63 in 3cc57db
| public void BucketAnalyticsConfigurationsAndFilterTest() |
The issue we had for ordering was only for xmlAttributes, we have to write the attribute immediately after writing the element. The ordering of the elements themselves do not matter
Description
2 of 5 stacked PRs. Generates PutBucketAnalyticsConfiguration.
I will create one DevConfig with all these in merge PR.
Note
I didn't change IsSet for
AnalyticsIdandBucketNamebecause we already check ifString.IsNullOrEmptyin the marshaller and fail the request if not set. THere is no need to change theIsSetand I want to keep customizations at a minimum. Responses don't useIsSetso it doesn't matter there.Motivation and Context
Testing
Fuzz-Testing results good
Base-Branch dry run passed
Screenshots (if appropriate)
Types of changes
Checklist
License