Skip to content

Commit 0187041

Browse files
authored
Generate AbortMultipartUpload, CreateBucketMetadataTableConfiguration and DeleteBucket related operations. (#3870)
* Generate Listbuckets and ListDirectoryBuckets * Generate more s3 operations, add new customizemarshaller partial method for rest xml marshallers * change customizemarshaller to postmarshallcustomization * Add back dependencies accidentally removed in previous commit for generator * update devconfig * rerun structuregenerator.tt file to generate cs file
1 parent 1f2cf07 commit 0187041

File tree

84 files changed

+4349
-3053
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+4349
-3053
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"core": {
3+
"changeLogMessages": [
4+
"Generate PostMarshallCustomization partial method and make marshallers partial classes for rest-xml protocol services"
5+
],
6+
"type": "patch",
7+
"updateMinimum": true
8+
},
9+
"services": [
10+
{
11+
"serviceName": "S3",
12+
"type": "patch",
13+
"changeLogMessages": [
14+
"Generate DeleteBucket, DeleteBucketEncryption and related DeleteBucket operations. Generated AbortMultipartUpload and CreateBucketMetadataTableConfiguration. Delete relevant custom files."
15+
]
16+
}
17+
]
18+
}

generator/ServiceClientGeneratorLib/Customizations.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,7 +1220,7 @@ public OperationModifiers GetOperationModifiers(string operationName)
12201220
var data = _documentRoot[OperationModifiers.OperationModifiersKey];
12211221
if (data == null)
12221222
return null;
1223-
1223+
12241224
var operation = data[operationName] as JsonData;
12251225
if (operation == null)
12261226
return null;
@@ -1248,7 +1248,6 @@ public OperationModifiers GetOperationModifiers(string operationName)
12481248
modifiers.DeprecatedMessage = (string)operation[OperationModifiers.DeprecatedMessageKey];
12491249
if (operation[OperationModifiers.StopPaginationOnSameTokenKey] != null && operation[OperationModifiers.StopPaginationOnSameTokenKey].IsBoolean)
12501250
modifiers.StopPaginationOnSameToken = (bool)operation[OperationModifiers.StopPaginationOnSameTokenKey];
1251-
12521251
if (operation[OperationModifiers.MarshallNameOverrides] != null &&
12531252
operation[OperationModifiers.MarshallNameOverrides].IsArray)
12541253
{

generator/ServiceClientGeneratorLib/GeneratorDriver.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ public void Execute()
237237
}
238238

239239
var operations = Configuration.Namespace == "Amazon.S3" ? Configuration.ServiceModel.S3AllowListOperations : Configuration.ServiceModel.Operations;
240-
// Generates the Request, Response, Marshaller, Unmarshaller, and Exception objects for a given client operation
240+
241241
foreach (var operation in operations)
242242
{
243243
GenerateRequest(operation);
@@ -249,6 +249,8 @@ public void Execute()
249249
GenerateStructures(operation);
250250
GenerateEventStreamPublisher(operation);
251251
}
252+
// Generates the Request, Response, Marshaller, Unmarshaller, and Exception objects for a given client operation
253+
252254

253255
if (Configuration.ServiceModel.Customizations.GenerateCustomUnmarshaller)
254256
{

generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlRequestMarshaller.cs

Lines changed: 652 additions & 616 deletions
Large diffs are not rendered by default.

generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlRequestMarshaller.tt

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations
1717
/// <summary>
1818
/// <#=this.Operation.Name #> Request Marshaller
1919
/// </summary>
20-
public class <#=this.Operation.Name#>RequestMarshaller : IMarshaller<IRequest, <#=this.Operation.Name#>Request> , IMarshaller<IRequest,AmazonWebServiceRequest>
20+
public partial class <#=this.Operation.Name#>RequestMarshaller : IMarshaller<IRequest, <#=this.Operation.Name#>Request> , IMarshaller<IRequest,AmazonWebServiceRequest>
2121
{
2222
/// <summary>
2323
/// Marshaller the request object to the HTTP request.
@@ -38,6 +38,7 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations
3838
{
3939
var request = new DefaultRequest(publicRequest, "<#=this.Config.Namespace#>");
4040
<#
41+
4142
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)
4243
{
4344
#>
@@ -65,9 +66,26 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations
6566
ProcessHeaderMembers("publicRequest", this.Operation.RequestHeaderMembers);
6667
ProcessUriMembers("publicRequest", this.Operation);
6768
ProcessQueryStringMembers("publicRequest", this.Operation);
69+
if (this.Config.ServiceId == "S3")
70+
{
71+
// even though RequestUri contains the bucket name in s3. In reality, the bucket Name
72+
// is part of the endpoint so we remove it.
73+
string resourcePath = string.Empty;
74+
if (this.Operation.RequestUri.StartsWith("/{Bucket}"))
75+
resourcePath = this.Operation.RequestUri.Substring(9).Length == 0 ? "/" : this.Operation.RequestUri.Substring(9);
76+
else
77+
resourcePath = this.Operation.RequestUri;
78+
#>
79+
request.ResourcePath = "<#=resourcePath#>";
80+
<#
81+
}
82+
else
83+
{
6884
#>
6985
request.ResourcePath = "<#=this.Operation.RequestUri #>";
86+
7087
<#
88+
}
7189
// Process any members which are marshalled as part of the request body
7290
if(this.Operation.RequestHasBodyMembers || shouldMarshallPayload)
7391
{
@@ -99,12 +117,13 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations
99117
ProcessEndpointHostPrefixMembers(3, "publicRequest", this.Operation);
100118
}
101119
#>
102-
120+
PostMarshallCustomization(request, publicRequest);
103121
return request;
104122
}
105123
<#
106124
this.AddRequestSingletonMethod();
107125
#>
126+
partial void PostMarshallCustomization(DefaultRequest defaultRequest, <#=this.Operation.Name#>Request publicRequest);
108127
}
109128
}
110129

0 commit comments

Comments
 (0)