Skip to content

Commit 1bd5bdf

Browse files
committed
fix unixtimestamp serialization on query xml clients
1 parent 4c5b525 commit 1bd5bdf

File tree

2 files changed

+16
-1
lines changed
  • tools/code-generation/generator/src/main

2 files changed

+16
-1
lines changed

tools/code-generation/generator/src/main/java/com/amazonaws/util/awsclientgenerator/domainmodels/codegeneration/cpp/CppViewHelper.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,21 @@ public static String computeTimestampFormatInQueryString(Shape shape) {
268268
return C2J_TIMESTAMP_FORMAT_TO_CPP_DATE_TIME_FORMAT.get("iso8601");
269269
}
270270

271+
public static String computeTimeStampAccessInQueryString(final Shape shape) {
272+
if (shape.getTimestampFormat() != null) {
273+
if (C2J_TIMESTAMP_FORMAT_TO_CPP_DATE_TIME_FORMAT.containsKey(shape.getTimestampFormat().toLowerCase())) {
274+
return String.format("ToGmtString(Aws::Utils::DateFormat::%s)",
275+
C2J_TIMESTAMP_FORMAT_TO_CPP_DATE_TIME_FORMAT.get(shape.getTimestampFormat().toLowerCase()));
276+
} else if (shape.getTimestampFormat().equalsIgnoreCase("unixtimestamp")) {
277+
return "SecondsWithMSPrecision()";
278+
} else {
279+
throw new RuntimeException("Illegal timestamp format: " + shape.getTimestampFormat());
280+
}
281+
}
282+
return String.format("ToGmtString(Aws::Utils::DateFormat::%s)",
283+
C2J_TIMESTAMP_FORMAT_TO_CPP_DATE_TIME_FORMAT.get("iso8601"));
284+
}
285+
271286
public static String computeTimestampFormatInXml(Shape shape) {
272287
if (shape.getTimestampFormat() != null) {
273288
return C2J_TIMESTAMP_FORMAT_TO_CPP_DATE_TIME_FORMAT.get(shape.getTimestampFormat().toLowerCase());

tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/common/request/AddRequestQueryParameter.vm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#if($shapeMember.shape.enum)
44
${shapeMember.shape.name}Mapper::GetNameFor${shapeMember.shape.name}(${memberVarName});
55
#elseif($shapeMember.shape.timeStamp)
6-
${memberVarName}.ToGmtString(Aws::Utils::DateFormat::$CppViewHelper.computeTimestampFormatInQueryString($shapeMember.shape));
6+
${memberVarName}.$CppViewHelper.computeTimeStampAccessInQueryString($shapeMember.shape);
77
#else
88
$memberVarName;
99
#end

0 commit comments

Comments
 (0)