Skip to content

Generate 8 more S3 Operations #3895

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

Open
wants to merge 4 commits into
base: development
Choose a base branch
from

Conversation

peterrsongg
Copy link
Contributor

@peterrsongg peterrsongg commented Jun 27, 2025

Description

Generates 9 more operations to conclude phase 1. I had to add a customization to exclude members from property generation but not from the marshallers because of PartDetail which inherits from PartETag. PartETag contains the excluded members.

I also updated the RestXmlExceptionUnmarshaller.tt file to get the Id2 and CfId which is unique to S3, as well as update the exception shapes themselves to add the constructor which takes these values in its constructor.

One change from this is that PutBucketPolicy's payload is set to request.Content instead of request.ContentStream. I've done a sanity check to make sure it still works. Per the model since the payload is a string, there is no need to wrap it in a memory stream. Also the payload member doesn't target the streaming trait so there is no need to stream it either.

One other minor change is that Tagging in PutBucketTagging was automatically initialized if it was null. This was a one-off customization we had that I intentionally left out to remove another customization hook. If we feel we want this added back, we can do that, but I will call this out as a breaking change.

Motivation and Context

Testing

DRY_RUN-2df7b27d-b938-44c2-aa9d-64c1ce797bf7

AssemblyComparer AWSSDK.S3.New.dll: Message Amazon.S3.Model.NoSuchUploadException/MethodAdded: New method System.Void .ctor(System.String, System.Exception, Amazon.Runtime.ErrorType, System.String, System.String, System.Net.HttpStatusCode, System.String, System.String) in Amazon.S3.Model.NoSuchUploadException
AssemblyComparer AWSSDK.S3.New.dll: Error Amazon.S3.Model.PartDetail/MethodRemoved: Missing method System.DateTime get_LastModified() in Amazon.S3.Model.PartDetail
AssemblyComparer AWSSDK.S3.New.dll: Message Amazon.S3.Model.PartDetail/MethodAdded: New method System.Nullable<System.DateTime> get_LastModified() in Amazon.S3.Model.PartDetail
AssemblyComparer AWSSDK.S3.New.dll: Error Amazon.S3.Model.PartDetail/MethodRemoved: Missing method System.Void set_LastModified(System.DateTime) in Amazon.S3.Model.PartDetail
AssemblyComparer AWSSDK.S3.New.dll: Message Amazon.S3.Model.PartDetail/MethodAdded: New method System.Void set_LastModified(System.Nullable<System.DateTime>) in Amazon.S3.Model.PartDetail
AssemblyComparer AWSSDK.S3.New.dll: Message Amazon.S3.Model.PutObjectTaggingRequest/MethodAdded: New method System.Void set_ContentMD5(System.String) in Amazon.S3.Model.PutObjectTaggingRequest
AssemblyComparer AWSSDK.S3.New.dll: Message Amazon.S3.Model.PutObjectTaggingRequest/MethodAdded: New method System.String get_ContentMD5() in Amazon.S3.Model.PutObjectTaggingRequest
AssemblyComparer AWSSDK.S3.New.dll: Message Amazon.S3.Model.NoSuchKeyException/MethodAdded: New method System.Void .ctor(System.String, System.Exception, Amazon.Runtime.ErrorType, System.String, System.String, System.Net.HttpStatusCode, System.String, System.String) in Amazon.S3.Model.NoSuchKeyException
    var putBucketPolicyResponse = await s3Client.PutBucketPolicyAsync(new PutBucketPolicyRequest
    {
        BucketName = bucketName,
        Policy = 
"""
{
"Version":"2008-10-17",
"Id":"test-put-bucket-policy",
"Statement" : [
    {
        "Effect":"Allow",
        "Sid":"1", 
        "Principal" : {
            "AWS": "arn:aws:iam::<account_id>:***"
        },
        "Action":["s3:*"],
        "Resource":"arn:aws:s3:::<bucket_name>*"
    }
    ]
}
"""
    }).ConfigureAwait(false);

executed successfully with flipping request.ContentStream to request.Content

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

@@ -1,97 +0,0 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this removal intentional? It's in the generated folder...

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 only used in GetBucketWebsite so I'm not sure how it got here...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it doesn't even exist here..
https://github.com/aws/aws-sdk-net/tree/main/sdk/src/Services/S3/Generated/Model

maybe a github UI thing? not sure how that happened

Copy link
Contributor

Choose a reason for hiding this comment

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

It's gone from the last diff, so maybe? But yeah need to make sure we don't remove generated code moving forward.

…PutObjectLockConfiguration, PutObjectRetention, PutObjectTagging, and PutPublicAccessBlock. Update s3 exception tt files
@peterrsongg peterrsongg force-pushed the petesong/generate-s3-phase-1-pr6 branch from f765e2a to a25b031 Compare July 2, 2025 21:33
@peterrsongg peterrsongg changed the title Generate 9 more S3 Operations Generate 8 more S3 Operations Jul 2, 2025
@peterrsongg peterrsongg requested a review from dscpinheiro July 2, 2025 21:36
/// Date and time at which the part was uploaded.
/// </para>
/// </summary>
public DateTime? LastModified
Copy link
Member

Choose a reason for hiding this comment

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

Looks like LastModified to isn't using nullable DateTime in v4, probably we missed it.
Changing it now is a breaking change, are we okay with that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, in my previous PRs Norm said as long as we call it out in the DevConfig it is fine, but just for these nullable type changes. So I included it in the dev config

Copy link
Member

Choose a reason for hiding this comment

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

It is not great to make these breaking changes but we are still early in V4 adoption and these fields missed so far are likely not the common fields used. I would prefer to take the hit of taking on the minor breaking change in this early part of V4 then add more complexity in our generator to support some fields not being nullable.

@peterrsongg If you find a property that looks like it would be frequent property being accessed like a bucket name then we should discuss.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gotcha, if i feel like the property is very commonly used I will bring it up for discussion

dscpinheiro
dscpinheiro previously approved these changes Jul 2, 2025
@@ -729,6 +730,8 @@ WriteXmlAttributeString(level + 1, member, variableName, isPayload: true, operat
{
#>
<#=new string(' ', level * 4)#>request.Content = Encoding.UTF8.GetBytes(<#=this.Operation.RequestPayloadMember.PrimitiveMarshaller#>(publicRequest.<#=this.Operation.RequestPayloadMember.PropertyName#>));
<#+
Copy link
Contributor

Choose a reason for hiding this comment

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

These lines (733 and 734) can be removed too now, right?

@@ -1,97 +0,0 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

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

It's gone from the last diff, so maybe? But yeah need to make sure we don't remove generated code moving forward.

@dscpinheiro dscpinheiro dismissed their stale review July 3, 2025 12:16

Need to validate a potential regression in another API that was auto-generated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants