Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
11 changes: 11 additions & 0 deletions generator/.DevConfigs/40104287-a6e4-47b5-abcc-df8a1b50de48.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"services": [
{
"serviceName": "S3",
"type": "patch",
"changeLogMessages": [
"Generate PutBucketMetricsConfiguration, and add check in marshallers for required query strings. If required members for query strings are not set, the SDK will throw the base service-level exception."
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"core": {
"updateMinimum": true,
"type": "patch",
"changeLogMessages": [
"Add check to see if required query string parameters are set. If not set, then the SDK will throw the generic service level exception."
]
}
}
90 changes: 2 additions & 88 deletions generator/ServiceClientGeneratorLib/Customizations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,6 @@ public class CustomizationsModel
public const string FlattenShapeKey = "flattenShapes";
public const string ExcludeShapesKey = "excludeShapes";
public const string AlternateLocationNameKey = "alternateLocationName";
public const string ImplementsVisitorPatternKey = "implementsVisitorPattern";

JsonData _documentRoot;

Expand Down Expand Up @@ -1458,9 +1457,9 @@ public class PropertyModifier
private readonly HashSet<string> _injectXmlPrivateMemberAssignment;
private readonly HashSet<string> _injectXmlPropertyGetter;
private readonly HashSet<string> _injectedXmlPropertySetter;
private readonly HashSet<string> _injectXmlMarshallCode;
private readonly bool _skipSetter;
private readonly bool _skipXmlIsSet;
private readonly HashSet<string> _injectXmlMarshallCode;

internal PropertyModifier(string modelPropertyName, JsonData modifierData)
{
Expand Down Expand Up @@ -1706,7 +1705,7 @@ public HashSet<string> InjectXmlUnmarshallCode
/// ]
/// }
/// </summary>
public bool SkipContextTestExpressionUnmarshallingLogic { get { return _modifierData[SkipContextTestExpressionUnmarshallingLogicKey] != null; } }
public bool SkipContextTestExpressionUnmarshallingLogic { get { return _modifierData[SkipContextTestExpressionUnmarshallingLogicKey] != null; } }
}

#endregion
Expand Down Expand Up @@ -2093,91 +2092,6 @@ public string AlternateLocationName
private set;
}
}

/// <summary>
/// A class that represents shapes that implement the visitor pattern.
/// </summary>
public class VisitorPattern
{
/// <summary>
/// Creates a Visitor
/// </summary>
/// <param name="predicateName"></param>
/// <param name="visitorName"></param>
/// <param name="visitorParam"></param>
public VisitorPattern(string predicateName, string visitorName, string visitorParam)
{
PredicateName = predicateName;
VisitorName = visitorName;
VisitorParam = visitorParam;
}
/// <summary>
/// The name of the predicate which is typically a property of a top-level
/// filter class.
/// </summary>
public string PredicateName
{
get;
private set;
}

/// <summary>
/// The name of the visitor which the predicate accepts.
/// </summary>
public string VisitorName
{
get;
private set;
}

/// <summary>
/// The argument to pass into the visitor. In XML services, this is typically
/// xmlWriter.
/// </summary>
public string VisitorParam
{
get;
private set;
}

/// <summary>
/// This is purely to communicate back to the generator that the visitor pattern has been written.
/// We want to write the visitor pattern to preserve existing behavior but in the future if more members
/// are added to the structure which implements the visitor pattern, we want that to be codegened so we don't have
/// to manually add the new predicates to the visitor.
/// Once we write the visitor pattern in the marshaller, we set Visited to true and then proceed with normal code-gen
/// for the same structure.
/// </summary>
public bool Visited
{
get;
set;
}
}

public bool TryGetVisitorPattern(string shapeName, out VisitorPattern visitorPattern)
{
visitorPattern = null;
var data = _documentRoot[ImplementsVisitorPatternKey];
if (data != null && data[shapeName] != null)
{
string predicateName = (string)data[shapeName]["predicateName"];
string visitorName = (string)data[shapeName]["visitorName"];
string visitorParam = (string)data[shapeName]["visitorParam"];
visitorPattern = new VisitorPattern(predicateName, visitorName, visitorParam);
return true;
}

return false;
}

public VisitorPattern GetVisitorPattern(string shapeName)
{
if (TryGetVisitorPattern(shapeName, out VisitorPattern visitorPattern))
return visitorPattern;
else
return null;
}
#endregion

#region RuntimePipelineOverride
Expand Down
3 changes: 2 additions & 1 deletion generator/ServiceClientGeneratorLib/GeneratorDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1719,7 +1719,8 @@ private void S3NeedsCustomUpdate(Shape shape)
// a dictionary of shape name to number of members that shape has
var customUpdateShapes = new Dictionary<string, int>
{
{"LifecycleFilter", 5 }
{"LifecycleFilter", 5 },
{"MetricsFilter", 4 }
};
if (customUpdateShapes.TryGetValue(shape.Name, out int membersCount))
{
Expand Down
Loading