Skip to content

[Merge 2nd] Generate AbortMultipartUpload, CreateBucketMetadataTableConfiguration and DeleteBucket related operations. #3870

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

Merged
merged 6 commits into from
Jun 13, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions generator/.DevConfigs/7064092c-4180-4624-a402-c6d354a1dfeb.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"core": {
"changeLogMessages": [
"Generate PostMarshallCustomization partial method and make marshallers partial classes for rest-xml protocol services"
],
"type": "patch",
"updateMinimum": true
},
"services": [
{
"serviceName": "S3",
"type": "patch",
"changeLogMessages": [
"Generate DeleteBucket, DeleteBucketEncryption and related DeleteBucket operations. Generated AbortMultipartUpload and CreateBucketMetadataTableConfiguration. Delete relevant custom files."
]
}
]
}
3 changes: 1 addition & 2 deletions generator/ServiceClientGeneratorLib/Customizations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,7 @@ public OperationModifiers GetOperationModifiers(string operationName)
var data = _documentRoot[OperationModifiers.OperationModifiersKey];
if (data == null)
return null;

var operation = data[operationName] as JsonData;
if (operation == null)
return null;
Expand Down Expand Up @@ -1248,7 +1248,6 @@ public OperationModifiers GetOperationModifiers(string operationName)
modifiers.DeprecatedMessage = (string)operation[OperationModifiers.DeprecatedMessageKey];
if (operation[OperationModifiers.StopPaginationOnSameTokenKey] != null && operation[OperationModifiers.StopPaginationOnSameTokenKey].IsBoolean)
modifiers.StopPaginationOnSameToken = (bool)operation[OperationModifiers.StopPaginationOnSameTokenKey];

if (operation[OperationModifiers.MarshallNameOverrides] != null &&
operation[OperationModifiers.MarshallNameOverrides].IsArray)
{
Expand Down
4 changes: 3 additions & 1 deletion generator/ServiceClientGeneratorLib/GeneratorDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public void Execute()
}

var operations = Configuration.Namespace == "Amazon.S3" ? Configuration.ServiceModel.S3AllowListOperations : Configuration.ServiceModel.Operations;
// Generates the Request, Response, Marshaller, Unmarshaller, and Exception objects for a given client operation

foreach (var operation in operations)
{
GenerateRequest(operation);
Expand All @@ -249,6 +249,8 @@ public void Execute()
GenerateStructures(operation);
GenerateEventStreamPublisher(operation);
}
// Generates the Request, Response, Marshaller, Unmarshaller, and Exception objects for a given client operation


if (Configuration.ServiceModel.Customizations.GenerateCustomUnmarshaller)
{
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations
/// <summary>
/// <#=this.Operation.Name #> Request Marshaller
/// </summary>
public class <#=this.Operation.Name#>RequestMarshaller : IMarshaller<IRequest, <#=this.Operation.Name#>Request> , IMarshaller<IRequest,AmazonWebServiceRequest>
public partial class <#=this.Operation.Name#>RequestMarshaller : IMarshaller<IRequest, <#=this.Operation.Name#>Request> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
Expand All @@ -38,6 +38,7 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations
{
var request = new DefaultRequest(publicRequest, "<#=this.Config.Namespace#>");
<#

if ((this.Config.ServiceModel.H2Support == H2SupportDegree.Optional && this.Operation.IsEventStreamBidi) || (this.Config.ServiceModel.H2Support == H2SupportDegree.EventStream && this.Operation.IsEventStreamOutput) || this.Config.ServiceModel.H2Support == H2SupportDegree.Required)
{
#>
Expand Down Expand Up @@ -65,9 +66,26 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations
ProcessHeaderMembers("publicRequest", this.Operation.RequestHeaderMembers);
ProcessUriMembers("publicRequest", this.Operation);
ProcessQueryStringMembers("publicRequest", this.Operation);
if (this.Config.ServiceId == "S3")
{
// even though RequestUri contains the bucket name in s3. In reality, the bucket Name
// is part of the endpoint so we remove it.
string resourcePath = string.Empty;
if (this.Operation.RequestUri.StartsWith("/{Bucket}"))
resourcePath = this.Operation.RequestUri.Substring(9).Length == 0 ? "/" : this.Operation.RequestUri.Substring(9);
else
resourcePath = this.Operation.RequestUri;
#>
request.ResourcePath = "<#=resourcePath#>";
<#
}
else
{
#>
request.ResourcePath = "<#=this.Operation.RequestUri #>";

<#
}
// Process any members which are marshalled as part of the request body
if(this.Operation.RequestHasBodyMembers || shouldMarshallPayload)
{
Expand Down Expand Up @@ -99,12 +117,13 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations
ProcessEndpointHostPrefixMembers(3, "publicRequest", this.Operation);
}
#>

PostMarshallCustomization(request, publicRequest);
Copy link
Member

Choose a reason for hiding this comment

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

Since 99% of services won't implement this, why not add it only for the marshallers that need it instead of affecting all the xml marshallers?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Norm and I talked and he wanted this mechanism in here instead of another customization entry which would tell us to generate this for a specific subset.

Copy link
Member

@normj normj Jun 13, 2025

Choose a reason for hiding this comment

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

Since the other 99% won't implement the partial PostMarshallCustomization the compiler will just compile it away as if it doesn't exists. There is no runtime cost to the other marshallers and I want to avoid as much as possible in the end of this project the number of S3 specific checks we need to do in the generator.

Plus it might be a useful customization point in the future for other services.

return request;
}
<#
this.AddRequestSingletonMethod();
#>
partial void PostMarshallCustomization(DefaultRequest defaultRequest, <#=this.Operation.Name#>Request publicRequest);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -704,18 +704,18 @@ public override void GetObjectData(System.Runtime.Serialization.SerializationInf
if (this.StructureType == StructureType.Response && member.PropertyName == "ContentLength")
continue;

string eventPublisherDocumentation = null;
string evenPublisherDocumentation = null;
if (this.StructureType == StructureType.Request && member.ModelShape.IsEventStream)
{
eventPublisherDocumentation = GenerateEventPublisherDocumentation(member);
evenPublisherDocumentation = GenerateEventPublisherDocumentation(member);
}


#line default
#line hidden

#line 222 "C:\codebase\v4\aws-sdk-net-v4\generator\ServiceClientGeneratorLib\Generators\SourceFiles\StructureGenerator.tt"
this.FormatPropertyDocumentation(member, null, eventPublisherDocumentation, member.IsCollection);
#line 222 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\SourceFiles\StructureGenerator.tt"
this.FormatPropertyDocumentation(member, null, evenPublisherDocumentation);

#line default
#line hidden
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -736,12 +736,12 @@
</None>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Microsoft.CSharp" Version="4.4.1" />
<PackageReference Include="Microsoft.CSharp" Version="4.4.1" />
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 was already here

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Microsoft.CSharp" Version="4.4.1" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net45'">
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'net45'">
<PackageReference Include="System.CodeDom" Version="6.0.0" />
</ItemGroup>

</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net45'">
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'net45'">
<PackageReference Include="System.CodeDom" Version="6.0.0" />
<PackageReference Include="System.CodeDom" Version="6.0.0" />
</ItemGroup>
</Project>
20 changes: 10 additions & 10 deletions generator/ServiceClientGeneratorLib/ServiceModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -469,17 +469,17 @@ public List<Operation> S3AllowListOperations
{
_s3AllowListOperations = new List<Operation>()
{
//new Operation(this,"AbortMultipartUpload", DocumentRoot[OperationsKey]["AbortMultipartUpload"]),
//new Operation(this,"CreateBucketMetadataTableConfiguration", DocumentRoot[OperationsKey]["CreateBucketMetadataTableConfiguration"]),
new Operation(this,"AbortMultipartUpload", DocumentRoot[OperationsKey]["AbortMultipartUpload"]),
new Operation(this,"CreateBucketMetadataTableConfiguration", DocumentRoot[OperationsKey]["CreateBucketMetadataTableConfiguration"]),
//new Operation(this, "CreateSession", DocumentRoot[OperationsKey]["CreateSession"]),
//new Operation(this, "DeleteBucket", DocumentRoot[OperationsKey]["DeleteBucket"]),
//new Operation(this, "DeleteBucketEncryption", DocumentRoot[OperationsKey]["DeleteBucketEncryption"]),
//new Operation(this, "DeleteBucketMetadataTableConfiguration", DocumentRoot[OperationsKey]["DeleteBucketMetadataTableConfiguration"]),
//new Operation(this, "DeleteBucketOwnershipControls", DocumentRoot[OperationsKey]["DeleteBucketOwnershipControls"]),
//new Operation(this, "DeleteBucketPolicy", DocumentRoot[OperationsKey]["DeleteBucketPolicy"]),
//new Operation(this, "DeleteBucketReplication", DocumentRoot[OperationsKey]["DeleteBucketReplication"]),
//new Operation(this, "DeleteBucketTagging", DocumentRoot[OperationsKey]["DeleteBucketTagging"]),
//new Operation(this, "DeletePublicAccessBlock", DocumentRoot[OperationsKey]["DeletePublicAccessBlock"]),
new Operation(this, "DeleteBucket", DocumentRoot[OperationsKey]["DeleteBucket"]),
new Operation(this, "DeleteBucketEncryption", DocumentRoot[OperationsKey]["DeleteBucketEncryption"]),
new Operation(this, "DeleteBucketMetadataTableConfiguration", DocumentRoot[OperationsKey]["DeleteBucketMetadataTableConfiguration"]),
new Operation(this, "DeleteBucketOwnershipControls", DocumentRoot[OperationsKey]["DeleteBucketOwnershipControls"]),
new Operation(this, "DeleteBucketPolicy", DocumentRoot[OperationsKey]["DeleteBucketPolicy"]),
new Operation(this, "DeleteBucketReplication", DocumentRoot[OperationsKey]["DeleteBucketReplication"]),
new Operation(this, "DeleteBucketTagging", DocumentRoot[OperationsKey]["DeleteBucketTagging"]),
new Operation(this, "DeletePublicAccessBlock", DocumentRoot[OperationsKey]["DeletePublicAccessBlock"]),
//new Operation(this, "GetBucketAccelerateConfiguration", DocumentRoot[OperationsKey]["GetBucketAccelerateConfiguration"]),
//new Operation(this, "GetBucketAnalyticsConfiguration", DocumentRoot[OperationsKey]["GetBucketAnalyticsConfiguration"]),
//new Operation(this, "GetBucketEncryption", DocumentRoot[OperationsKey]["GetBucketEncryption"]),
Expand Down
Loading