-
Notifications
You must be signed in to change notification settings - Fork 863
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
Split GetACL into GetBucketACL and GetObject ACL and the same for PutACL #3408
Conversation
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.
This approach seems a bit complicated IMO. What about removing GetACL
and PutACL
from the generator and the models, and add them and add them manually?
I agree that it is a bit complicated, but unfortunately it is just the way that customizations work in the generator, especially renames. All it does is point to the original json object in the model but renames the operation. We need to create a copy of this operation basically with the original name to be able to generate both GetACL and GetBucketACL in the client file. I was thinking maybe we could use this functionality in the future? but you're probably right, it is better to manually add them, and delete this added complexity to the generator. I will see what the team thinks |
2eb83db
to
e83c9f2
Compare
} | ||
finally | ||
{ | ||
AmazonS3Util.DeleteS3BucketWithObjects(Client, bucketName); |
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 don't think this finally is correct, the bucketName
variable here doesn't refer to the bucket you created but the private static
variable with the same name:
private static string bucketName; |
I'd either use a different variable name in this method or update it not to create a new bucket at all (you'd need to confirm changing the ACLs doesn't impact the other tests here - as they all share the same bucket).
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.
thank you for pointing that out. I moved the variable outside the try
block and renamed it. I also just ran the integ test and confirmed it is deleting the right bucket.
…CL into PutObjectACL and PutBucketACL. Obsolete PutACL and GetACL.
e83c9f2
to
aa5ea9f
Compare
Do we have to create this new custom S3 client? What about using the existing extension S3 client file instead? |
Nope, I just moved them to the extension file instead |
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 have one general question too: Is there a reason why we're using lowercase for the operation names / request objects? For example, the changelog (and PR title) mention GetACL into GetBucketACL and GetObjectACL
but then the classes are named GetBucketAcl
and GetObjectAcl
.
|
||
|
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.
What are these extra lines for?
generator/ServiceClientGeneratorLib/Generators/Endpoints/EndpointResolver.tt
Show resolved
Hide resolved
@@ -271,6 +271,7 @@ namespace Amazon.S3.Model | |||
/// </para> | |||
/// </li> </ul> | |||
/// </summary> | |||
/// |
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.
Remove this extra line.
@@ -82,8 +82,6 @@ | |||
<PrivateAssets>all</PrivateAssets> | |||
</PackageReference> | |||
</ItemGroup> | |||
<ItemGroup> |
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.
This <ItemGroup>
removal seems odd, I don't see any generator changes included in this PR that could've caused 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.
this was a manual change I made on accident😅, rerunning the generator removed this.
{ | ||
#region GetACL | ||
[Obsolete("GetACL combines both GetBucketAcl and GetObjectAcl and is deprecated. Please use the separated GetObjectAcl and GetBucketAcl operations.")] | ||
Task<GetACLResponse> GetACLAsync(string bucketName, System.Threading.CancellationToken cancellationToken = default(CancellationToken)); |
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.
This method is missing documentation. Also, since this is the bcl
folder, shouldn't you also have to include the non-async methods?
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.
good call, i did a manual test and the non-async methods were callable so I thought I was in the clear, but based on the pattern the other methods follow it looks like I missed adding it here.
"serviceName": "S3", | ||
"type": "patch", | ||
"changeLogMessages": [ | ||
"Split GetACL into GetBucketACL and GetObjectACL. Split PutACL into PutObjectACL and PutBucketACL. Obsolete PutACL and GetACL" |
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'd expand this message a bit more (for example, if this goes into the V4 tracker issue, is there enough information for customers to understand why we're doing this?)
Yeah so when we did the customization for |
Addressed all comments and the PR is ready for another pass (dry-run also succeeded) |
{ | ||
"serviceName": "S3", | ||
"type": "patch", | ||
"changeLogMessages": [ |
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.
No need to change, but since this is an array you could also split this into multiple messages so it's easier to read. Like this:
"changeLogMessages": [
"Split `GetACL` into `GetBucketAcl` and `GetObjectAcl`",
"Split `PutACL` into `PutObjectACL` and `PutBucketACL`",
"Obsolete `PutACL` and `GetACL`: These operations are being split ..."
]
Description
GetACL
andPutACL
in the SDK is a combination ofGetBucketACL
andPutBucketACL
and there is a customization made to rename the method and exclude theGetObjectACL
methods. This PR obsoletes the existingGetACL
/PutACL
operations and adds theGetBucketACL
andGetObjectACL
/PutBucketACL
andPutObjectACL
operations. It also adds the handwritten custom marshallers/request classes etc. and refactors any existing unit/integ test to use the new operations.I put the GetACL and PutACL into a custom partial
AmazonS3Client
and did the same thing forIAmazonS3
.Motivation and Context
Testing
Dry run passes.
Added an integ test.
Also did a manual test and made sure that the old method is still callable.
Screenshots (if appropriate)
Types of changes
Checklist
License