Skip to content
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

Regenerated Clients with Paginator Support #885

Merged
merged 3 commits into from
Nov 24, 2020
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -1920,7 +1920,7 @@
"cloudTrailEventSource": "REPLACE_WITH_EVENT_SOURCE"
},
"aws.auth#sigv4": {
"name": ""
"name": "groundstation"
},
"aws.protocols#restJson1": {},
"smithy.api#documentation": "<p>Welcome to the AWS Ground Station API Reference. AWS Ground Station is a fully managed service that\n enables you to control satellite communications, downlink and process satellite data, and\n scale your satellite operations efficiently and cost-effectively without having\n to build or manage your own ground station infrastructure.</p>",
Expand Down
2 changes: 1 addition & 1 deletion codegen/sdk-codegen/aws-models/rds-data.2018-08-01.json
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@
"cloudTrailEventSource": "rds-data.amazonaws.com"
},
"aws.auth#sigv4": {
"name": ""
"name": "rds-data"
},
"aws.protocols#restJson1": {},
"smithy.api#cors": {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,11 @@ protected void serializeStructure(GenerationContext context, StructureShape shap
Shape target = context.getModel().expectShape(member.getTarget());
String serializedMemberName = getSerializedMemberName(member);

GoValueAccessUtils.writeIfNonZeroValueMember(context, writer, member, "v", (operand) -> {
writer.write("ok := object.Key($S)", serializedMemberName);
target.accept(getMemberSerVisitor(member, operand, "ok"));
});
GoValueAccessUtils.writeIfNonZeroValueMember(context.getModel(), context.getSymbolProvider(), writer,
member, "v", (operand) -> {
writer.write("ok := object.Key($S)", serializedMemberName);
target.accept(getMemberSerVisitor(member, operand, "ok"));
});
writer.write("");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,16 @@ protected void serializeStructure(GenerationContext context, StructureShape shap
}
Shape target = context.getModel().expectShape(member.getTarget());

GoValueAccessUtils.writeIfNonZeroValueMember(context, writer, member, "v", (operand) -> {
String locationName = getSerializedLocationName(member, member.getMemberName());
if (isFlattened(context, member)) {
writer.write("objectKey := object.FlatKey($S)", locationName);
} else {
writer.write("objectKey := object.Key($S)", locationName);
}
target.accept(getMemberSerVisitor(member, operand, "objectKey"));
});
GoValueAccessUtils.writeIfNonZeroValueMember(context.getModel(), context.getSymbolProvider(), writer,
member, "v", (operand) -> {
String locationName = getSerializedLocationName(member, member.getMemberName());
if (isFlattened(context, member)) {
writer.write("objectKey := object.FlatKey($S)", locationName);
} else {
writer.write("objectKey := object.Key($S)", locationName);
}
target.accept(getMemberSerVisitor(member, operand, "objectKey"));
});
writer.write("");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,14 @@ public static void generateXMLStartElement(
// Traverse member shapes to get attributes
shape.members().stream().forEach(memberShape -> {
if (memberShape.hasTrait(XmlAttributeTrait.class)) {
GoValueAccessUtils.writeIfNonZeroValueMember(context, writer, memberShape, inputSrc, (operand) -> {
// xml attributes should always be string
String dest = "av";
formatXmlAttributeValueAsString(context, memberShape, operand, dest);
writer.write("$L = append($L, smithyxml.NewAttribute($S, $L))",
attrName, attrName, getSerializedXMLMemberName(memberShape), dest);
});
GoValueAccessUtils.writeIfNonZeroValueMember(context.getModel(), context.getSymbolProvider(),
writer, memberShape, inputSrc, (operand) -> {
// xml attributes should always be string
String dest = "av";
formatXmlAttributeValueAsString(context, memberShape, operand, dest);
writer.write("$L = append($L, smithyxml.NewAttribute($S, $L))",
attrName, attrName, getSerializedXMLMemberName(memberShape), dest);
});
}
});

Expand Down Expand Up @@ -225,7 +226,9 @@ public static void initializeXmlDecoder(GoWriter writer, String bodyLocation, St
* @param returnExtras the extra variables to be returned with the wrapped error check statement
* @param returnOnEOF the variable to return in case an EOF error occurs while initializing xml decoder
*/
public static void initializeXmlDecoder(GoWriter writer, String bodyLocation, String returnExtras, String returnOnEOF) {
public static void initializeXmlDecoder(
GoWriter writer, String bodyLocation, String returnExtras, String returnOnEOF
) {
// Use a ring buffer and tee reader to help in pinpointing any deserialization errors.
writer.addUseImports(SmithyGoDependency.SMITHY_IO);
writer.write("var buff [1024]byte");
Expand Down Expand Up @@ -293,12 +296,12 @@ public static void writeXmlErrorMessageCodeDeserializer(ProtocolGenerator.Genera
AwsCustomGoDependency.S3_SHARED_CUSTOMIZATION
).build();

if (isS3Service(service)){
if (isS3Service(service)) {
// s3 service
writer.openBlock("errorComponents, err := $T(errorBody, $T{",
"})", getErrorComponentFunction, errorOptions, () -> {
writer.write("UseStatusCode : true, StatusCode : response.StatusCode,");
});
writer.write("UseStatusCode : true, StatusCode : response.StatusCode,");
});
} else {
// s3 control
writer.openBlock("errorComponents, err := $T(errorBody, $T{",
Expand All @@ -322,7 +325,7 @@ public static void writeXmlErrorMessageCodeDeserializer(ProtocolGenerator.Genera

writer.addUseImports(AwsGoDependency.AWS_MIDDLEWARE);
writer.openBlock("if reqID := errorComponents.RequestID; len(reqID)!=0 {", "}", () -> {
writer.write("awsmiddleware.SetRequestIDMetadata(metadata, reqID)");
writer.write("awsmiddleware.SetRequestIDMetadata(metadata, reqID)");
});
writer.insertTrailingNewline();

Expand All @@ -336,12 +339,12 @@ public static void writeXmlErrorMessageCodeDeserializer(ProtocolGenerator.Genera

// returns true if service is either s3 or s3 control and needs s3 customization
private static boolean requiresS3Customization(ServiceShape service) {
String serviceId= service.expectTrait(ServiceTrait.class).getSdkId();
String serviceId = service.expectTrait(ServiceTrait.class).getSdkId();
return serviceId.equalsIgnoreCase("S3") || serviceId.equalsIgnoreCase("S3 Control");
}

private static boolean isS3Service(ServiceShape service) {
String serviceId= service.expectTrait(ServiceTrait.class).getSdkId();
String serviceId = service.expectTrait(ServiceTrait.class).getSdkId();
return serviceId.equalsIgnoreCase("S3");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected void serializeCollection(GenerationContext context, CollectionShape sh

writer.openBlock("for i := range v {", "}", () -> {
// Serialize zero members as empty values.
GoValueAccessUtils.writeIfZeroValue(context, writer, member, "v[i]", () -> {
GoValueAccessUtils.writeIfZeroValue(context.getModel(), writer, member, "v[i]", () -> {
writer.write("am := array.Member()");
writer.write("am.Close()");
writer.write("continue");
Expand Down Expand Up @@ -105,7 +105,7 @@ protected void serializeMap(GenerationContext context, MapShape shape) {
writer.insertTrailingNewline();

// Serialize zero values as empty values.
GoValueAccessUtils.writeIfZeroValue(context, writer, shape.getValue(), "v[i]", () -> {
GoValueAccessUtils.writeIfZeroValue(context.getModel(), writer, shape.getValue(), "v[i]", () -> {
writer.write("entry.Close()");
writer.write("continue");
});
Expand Down Expand Up @@ -149,17 +149,18 @@ protected void serializeStructure(GenerationContext context, StructureShape shap

writer.addUseImports(SmithyGoDependency.SMITHY_XML);

GoValueAccessUtils.writeIfNonZeroValueMember(context, writer, member, "v", (operand) -> {
XmlProtocolUtils.generateXMLStartElement(context, member, "root", "v");

// check if member shape has flattened trait
if (member.hasTrait(XmlFlattenedTrait.class)) {
writer.write("el := value.FlattenedElement($L)", "root");
} else {
writer.write("el := value.MemberElement($L)", "root");
}
target.accept(getMemberSerVisitor(member, operand, "el"));
});
GoValueAccessUtils.writeIfNonZeroValueMember(context.getModel(), context.getSymbolProvider(), writer,
member, "v", (operand) -> {
XmlProtocolUtils.generateXMLStartElement(context, member, "root", "v");

// check if member shape has flattened trait
if (member.hasTrait(XmlFlattenedTrait.class)) {
writer.write("el := value.FlattenedElement($L)", "root");
} else {
writer.write("el := value.MemberElement($L)", "root");
}
target.accept(getMemberSerVisitor(member, operand, "el"));
});

writer.insertTrailingNewline();
}
Expand Down
4 changes: 4 additions & 0 deletions internal/protocoltest/awsrestjson/api_op_JsonLists.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 13 additions & 9 deletions internal/protocoltest/awsrestjson/api_op_JsonLists_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 30 additions & 2 deletions internal/protocoltest/awsrestjson/api_op_JsonMaps.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading