-
Notifications
You must be signed in to change notification settings - Fork 872
Generate GetBucketMetricsConfiguration #4102
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: petesong/phase-3-pr-1-pt1
Are you sure you want to change the base?
Conversation
b8a8ffd to
3be7af0
Compare
|
I'm pasting the results of the AI analysis done on the larger PR here The added validation isn't a breaking change because the request will fail and throw Now I have all the information needed to provide a comprehensive analysis. Let me compare the deleted custom files with the generated ones and examine all the marshaller changes: Task Completed Breaking Changes Analysis - S3 Custom to Generated MigrationAfter analyzing all deleted custom files, their generated replacements, and modified marshallers, I have identified the following breaking changes: BREAKING CHANGES IDENTIFIED:1. AbortMultipartUploadRequestMarshaller.cs - NEW VALIDATION ADDEDIssue: Added new required field validation that didn't exist before: if (string.IsNullOrEmpty(publicRequest.UploadId))
throw new AmazonS3Exception("Request object does not have required field UploadId set");Impact: Customer code that previously could make AbortMultipartUpload requests without UploadId set will now throw an exception. 2. CopyPartRequestMarshaller.cs - NEW VALIDATIONS ADDEDIssue: Added two new required field validations: if (publicRequest.PartNumber == null)
throw new AmazonS3Exception("Request object does not have required field PartNumber set");
if (string.IsNullOrEmpty(publicRequest.UploadId))
throw new AmazonS3Exception("Request object does not have required field UploadId set");Impact: Customer code that previously could make CopyPart requests without PartNumber or UploadId set will now throw exceptions. 3. ListPartsRequestMarshaller.cs - NEW VALIDATION ADDEDIssue: Added new required field validation: if (string.IsNullOrEmpty(publicRequest.UploadId))
throw new AmazonS3Exception("Request object does not have required field UploadId set");Impact: Customer code that previously could make ListParts requests without UploadId set will now throw an exception. NO BREAKING CHANGES FOUND IN:Model Files Migration (✅ SAFE)
Differences are non-breaking:
Marshaller Logic Preservation (✅ SAFE)
SUMMARY:
The breaking changes are all related to new validation logic being added to existing marshallers rather than logic being lost during migration. These validations enforce that required fields are set before making API calls, which technically makes the SDK more strict than before. |
| if (string.IsNullOrEmpty(publicRequest.BucketName)) | ||
| throw new System.ArgumentException("BucketName is a required property and must be set before making this call.", "GetBucketMetricsConfigurationRequest.BucketName"); | ||
| if (string.IsNullOrEmpty(publicRequest.MetricsId)) | ||
| throw new AmazonS3Exception("Request object does not have required field MetricsId set"); |
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.
I think I missed the stand-up where we discussed this, but we're using the service exception here and System.ArgumentException above.
We weren't validating the metrics ID before (https://github.com/aws/aws-sdk-net/blob/main/sdk/src/Services/S3/Custom/Model/Internal/MarshallTransformations/GetBucketMetricsConfigurationRequestMarshaller.cs#L49), so would it make sense to use the same exception as missing bucket name?
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.
I missed this in the other PRs but it applies to the list and delete operations marshallers as well.
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.
So the reason I made it a service-level exception is because from my testing, when these required parameters aren't set, the SDK will throw AmazonS3Exception. So to not make it a breaking change I purposely made it throw AmazonS3Exception (this is actually what we do for resource path params too but S3 is just weird and we don't follow that)
| private static void UnmarshallResult(XmlUnmarshallerContext context, GetBucketMetricsConfigurationResponse response) | ||
| { | ||
| int originalDepth = context.CurrentDepth; | ||
| int targetDepth = originalDepth + 1; |
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.
(Forgot to publish this one...)
Do we have an integration test for this operation? The manual code had a section I don't see here (or the updated metrics unmarshaller):
Lines 58 to 59 in eb13820
| if (context.IsStartOfDocument) | |
| targetDepth += 2; |
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 do have integ tests for this :)
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.
just to explain though, the difference stems from the custom code not using the MetricsConfigurationUnmarshaller and trying to unmarshall the objects inside MetricsConfiguration. so it has to go 2 levels deep. Since here we are calling MetricsConfigurationUnmarshaller, we only have to go one level deep to find the MetricsConfiguration element. Then once we find that element we just go into the MetricsConfigurationUnmarshaller logic
Description
PR no.2 of phase 3
Continuation of this PR
Generates GetBucketMetricsConfiguration
Motivation and Context
Testing
Dry run passed
Screenshots (if appropriate)
Types of changes
Checklist
License