Skip to content

Commit 269c32e

Browse files
authored
Generate ListBuckets and ListDirectoryBuckets (#3850)
1 parent 2b6b275 commit 269c32e

32 files changed

+2682
-1751
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"services": [
3+
{
4+
"serviceName": "S3",
5+
"type": "patch",
6+
"changeLogMessages": [
7+
"Breaking Change: Fixed MaxBuckets on ListBuckets to use int? instead of int to be consistent with other request properties.",
8+
"Generate ListBuckets and ListDirectoryBuckets. Delete custom files."
9+
]
10+
}
11+
]
12+
}

generator/ServiceClientGeneratorLib/Example.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ public IList<string> GetRequestAssignments(int currentIndent)
159159
var last = InputParameters.Last().Key;
160160
foreach (var param in InputParameters)
161161
{
162+
if (Operation == null)
163+
continue;
162164
var member = Operation.RequestStructure.Members.GetMemberByName(param.Key);
163165

164166
if (null == member)
@@ -186,6 +188,8 @@ public IList<string> GetResponseAssignments()
186188

187189
foreach (var param in OutputParameters)
188190
{
191+
if (Operation == null)
192+
continue;
189193
var member = Operation.ResponseStructure.Members.GetMemberByName(param.Key);
190194

191195
if (null == member)

generator/ServiceClientGeneratorLib/GeneratorDriver.cs

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,8 @@ public void Execute()
195195

196196
if (Configuration.Namespace == "Amazon.S3")
197197
{
198-
ExecuteProjectFileGenerators();
199198
// The AmazonS3RetryPolicy simply populates the static list of requests to retry for a status code of 200 which returns an exception.
200199
ExecuteGenerator(new AmazonS3RetryPolicy(), "AmazonS3RetryPolicy.cs");
201-
return;
202200
}
203201
// The top level request that all operation requests are children of
204202
ExecuteGenerator(new BaseRequest(), "Amazon" + Configuration.ClassName + "Request.cs", "Model");
@@ -207,10 +205,16 @@ public void Execute()
207205
string.Format("ServiceEnumerations.{0}.cs", Configuration.ClassName) : "ServiceEnumerations.cs";
208206

209207
// Any enumerations for the service
210-
this.ExecuteGenerator(new ServiceEnumerations(), enumFileName);
208+
// skip s3 until we're at the end of s3 client generation
209+
if (this.Configuration.ServiceId != "S3")
210+
{
211+
this.ExecuteGenerator(new ServiceEnumerations(), enumFileName);
212+
}
213+
211214

212215
// Any paginators for the service
213-
if (Configuration.ServiceModel.HasPaginators)
216+
// skip paginators for s3 until we're at the end of s3 client generation
217+
if (Configuration.ServiceModel.HasPaginators && Configuration.ServiceId != "S3")
214218
{
215219
foreach (var operation in Configuration.ServiceModel.Operations)
216220
{
@@ -227,13 +231,14 @@ public void Execute()
227231

228232
// Do not generate base exception if this is a child model.
229233
// We use the base exceptions generated for the parent model.
230-
if (!this.Configuration.IsChildConfig)
234+
if (!this.Configuration.IsChildConfig && this.Configuration.ServiceId != "S3")
231235
{
232236
this.ExecuteGenerator(new BaseServiceException(), "Amazon" + this.Configuration.ClassName + "Exception.cs");
233237
}
234238

239+
var operations = Configuration.Namespace == "Amazon.S3" ? Configuration.ServiceModel.S3AllowListOperations : Configuration.ServiceModel.Operations;
235240
// Generates the Request, Response, Marshaller, Unmarshaller, and Exception objects for a given client operation
236-
foreach (var operation in Configuration.ServiceModel.Operations)
241+
foreach (var operation in operations)
237242
{
238243
GenerateRequest(operation);
239244
GenerateResponse(operation);
@@ -259,16 +264,19 @@ public void Execute()
259264
var fileName = string.Format("{0}EndpointDiscoveryMarshallingTests.cs", Configuration.ClassName);
260265
ExecuteTestGenerator(new EndpointDiscoveryMarshallingTests(), fileName, "Marshalling");
261266
}
262-
263-
// Test that simple customizations were generated correctly
264-
GenerateCustomizationTests();
265267
ExecuteProjectFileGenerators();
266-
if (this.Configuration.ServiceModel.Customizations.HasExamples)
268+
// Test that simple customizations were generated correctly
269+
if (this.Configuration.ServiceId != "S3")
267270
{
268-
var servicename = Configuration.Namespace.Split('.').Last();
269-
ExecuteExampleGenerator(new ExampleCode(), servicename + ".GeneratedSamples.cs", servicename);
270-
ExecuteExampleGenerator(new ExampleMetadata(), servicename + ".GeneratedSamples.extra.xml");
271+
GenerateCustomizationTests();
272+
if (this.Configuration.ServiceModel.Customizations.HasExamples)
273+
{
274+
var servicename = Configuration.Namespace.Split('.').Last();
275+
ExecuteExampleGenerator(new ExampleCode(), servicename + ".GeneratedSamples.cs", servicename);
276+
ExecuteExampleGenerator(new ExampleMetadata(), servicename + ".GeneratedSamples.extra.xml");
277+
}
271278
}
279+
272280
}
273281

274282
/// <summary>
@@ -280,7 +288,7 @@ void GenerateRequest(Operation operation)
280288
var requestGenerator = new StructureGenerator
281289
{
282290
ClassName = operation.Name + "Request",
283-
BaseClass = string.Format("Amazon{0}Request", Configuration.ClassName),
291+
BaseClass = this.Configuration.ServiceId != "S3" ? string.Format("Amazon{0}Request", Configuration.ClassName) : "AmazonWebServiceRequest",
284292
StructureType = StructureType.Request,
285293
Operation = operation
286294
};
@@ -671,6 +679,8 @@ void GenerateResponseUnmarshaller(Operation operation)
671679
// instead we generated a layer over the structure. That layer is EventStreamGenerator.tt.
672680
if (nestedStructure.IsEventStream)
673681
continue;
682+
if (this.Configuration.ServiceId == "S3" && nestedStructure.IsEvent || nestedStructure.IsEventStream)
683+
continue;
674684
// Skip already processed unmarshallers. This handles the case of structures being returned in mulitiple requests.
675685
if (!this._processedUnmarshallers.Contains(nestedStructure.Name))
676686
{
@@ -700,7 +710,13 @@ private void GenerateUnmarshaller(Shape shape)
700710

701711
if (this.Configuration.ServiceModel.Customizations.IsSubstitutedShape(nestedStructure.Name))
702712
continue;
703-
713+
if (this.Configuration.ServiceId == "S3")
714+
{
715+
if (shape.IsEvent || shape.IsEventStream)
716+
{
717+
continue;
718+
}
719+
}
704720
// Document structure don't need a custom unmarshaller, they use
705721
// the 'simple' DocumentMarshaller in AWSSDK.
706722
if (nestedStructure.IsDocument)
@@ -781,7 +797,6 @@ private void GenerateExceptions(Operation operation)
781797
// Skip exceptions that have already been generated for the parent model
782798
if (IsExceptionPresentInParentModel(this.Configuration, exceptionShape.Name) || this._processedStructures.Contains(exceptionShape.Name))
783799
continue;
784-
785800
var generator = new StructureGenerator()
786801
{
787802
ClassName = exceptionShape.Name,
@@ -1002,6 +1017,13 @@ void GenerateStructures(Operation operation)
10021017
if (definition.IsEventStream && !Configuration.ServiceModel.Operations.Any(x => string.Equals(x.ResponseEventStreamingMember?.Shape.Name, definition.Name)))
10031018
continue;
10041019

1020+
if (this.Configuration.ServiceId == "S3")
1021+
{
1022+
if (definition.IsEvent || definition.IsEventStream)
1023+
{
1024+
continue;
1025+
}
1026+
}
10051027
if (!this._processedStructures.Contains(definition.Name))
10061028
{
10071029
// if the shape had a substitution, we can skip generation

0 commit comments

Comments
 (0)