Skip to content

Commit

Permalink
Added support for TimestampFormat in protocols. Fix aws#202
Browse files Browse the repository at this point in the history
  • Loading branch information
Kotambkar committed Aug 19, 2019
1 parent 30227e2 commit 492dc39
Show file tree
Hide file tree
Showing 2,038 changed files with 7,681 additions and 5,508 deletions.
2 changes: 1 addition & 1 deletion models/protocol_tests/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ func (i *testCase) TestCase(idx int) string {
case "rest-xml":
i.InputTest.Body = util.SortXML(bytes.NewReader([]byte(i.InputTest.Body)))
case "json", "rest-json":
i.InputTest.Body = strings.Replace(i.InputTest.Body, " ", "", -1)
// Nothing to do
}

jsonValues := buildJSONValues(i.Given.InputRef.Shape)
Expand Down
17 changes: 15 additions & 2 deletions models/protocol_tests/input/ec2.json
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,20 @@
"members": {
"TimeArg": {
"shape": "TimestampType"
},
"TimeCustom": {
"timestampFormat": "unixTimestamp",
"shape": "TimestampType"
},
"TimeFormat": {
"shape": "TimestampFormatType"
}
}
},
"TimestampFormatType": {
"timestampFormat": "unixTimestamp",
"type": "timestamp"
},
"TimestampType": {
"type": "timestamp"
}
Expand All @@ -399,11 +410,13 @@
"name": "OperationName"
},
"params": {
"TimeArg": 1422172800
"TimeArg": 1422172800,
"TimeCustom": 1422172800,
"TimeFormat": 1422172800
},
"serialized": {
"uri": "/",
"body": "Action=OperationName&Version=2014-01-01&TimeArg=2015-01-25T08%3A00%3A00Z"
"body": "Action=OperationName&Version=2014-01-01&TimeArg=2015-01-25T08%3A00%3A00Z&TimeCustom=1422172800&TimeFormat=1422172800"
}
}
]
Expand Down
17 changes: 15 additions & 2 deletions models/protocol_tests/input/json.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,20 @@
"members": {
"TimeArg": {
"shape": "TimestampType"
},
"TimeCustom": {
"timestampFormat": "rfc822",
"shape": "TimestampType"
},
"TimeFormat": {
"shape": "TimestampFormatType"
}
}
},
"TimestampFormatType": {
"timestampFormat": "rfc822",
"type": "timestamp"
},
"TimestampType": {
"type": "timestamp"
}
Expand All @@ -73,10 +84,12 @@
"name": "OperationName"
},
"params": {
"TimeArg": 1422172800
"TimeArg": 1422172800,
"TimeCustom": 1422172800,
"TimeFormat": 1422172800
},
"serialized": {
"body": "{\"TimeArg\": 1422172800}",
"body": "{\"TimeArg\": 1422172800, \"TimeCustom\": \"Sun, 25 Jan 2015 08:00:00 GMT\", \"TimeFormat\": \"Sun, 25 Jan 2015 08:00:00 GMT\"}",
"headers": {
"X-Amz-Target": "com.amazonaws.foo.OperationName",
"Content-Type": "application/x-amz-json-1.1"
Expand Down
17 changes: 15 additions & 2 deletions models/protocol_tests/input/query.json
Original file line number Diff line number Diff line change
Expand Up @@ -609,9 +609,20 @@
"members": {
"TimeArg": {
"shape": "TimestampType"
},
"TimeCustom": {
"timestampFormat": "unixTimestamp",
"shape": "TimestampType"
},
"TimeFormat": {
"shape": "TimestampFormatType"
}
}
},
"TimestampFormatType": {
"timestampFormat": "unixTimestamp",
"type": "timestamp"
},
"TimestampType": {
"type": "timestamp"
}
Expand All @@ -625,11 +636,13 @@
"name": "OperationName"
},
"params": {
"TimeArg": 1422172800
"TimeArg": 1422172800,
"TimeCustom": 1422172800,
"TimeFormat": 1422172800
},
"serialized": {
"uri": "/",
"body": "Action=OperationName&Version=2014-01-01&TimeArg=2015-01-25T08%3A00%3A00Z"
"body": "Action=OperationName&Version=2014-01-01&TimeArg=2015-01-25T08%3A00%3A00Z&TimeCustom=1422172800&TimeFormat=1422172800"
}
}
]
Expand Down
81 changes: 58 additions & 23 deletions models/protocol_tests/input/rest-json.json
Original file line number Diff line number Diff line change
Expand Up @@ -1103,9 +1103,51 @@
"shape": "TimestampType",
"location": "header",
"locationName": "x-amz-timearg"
},
"TimeArgInQuery": {
"shape": "TimestampType",
"location": "querystring",
"locationName": "TimeQuery"
},
"TimeCustom": {
"timestampFormat": "iso8601",
"shape": "TimestampType"
},
"TimeCustomInHeader": {
"timestampFormat": "unixTimestamp",
"shape": "TimestampType",
"location": "header",
"locationName": "x-amz-timecustom-header"
},
"TimeCustomInQuery": {
"timestampFormat": "unixTimestamp",
"shape": "TimestampType",
"location": "querystring",
"locationName": "TimeCustomQuery"
},
"TimeFormat": {
"shape": "TimestampFormatRfcType"
},
"TimeFormatInHeader": {
"shape": "TimestampFormatUnixType",
"location": "header",
"locationName": "x-amz-timeformat-header"
},
"TimeFormatInQuery": {
"shape": "TimestampFormatUnixType",
"location": "querystring",
"locationName": "TimeFormatQuery"
}
}
},
"TimestampFormatRfcType": {
"timestampFormat": "rfc822",
"type": "timestamp"
},
"TimestampFormatUnixType": {
"timestampFormat": "unixTimestamp",
"type": "timestamp"
},
"TimestampType": {
"type": "timestamp"
}
Expand All @@ -1123,32 +1165,25 @@
"name": "OperationName"
},
"params": {
"TimeArg": 1422172800
"TimeArg": 1422172800,
"TimeArgInQuery": 1422172800,
"TimeArgInHeader": 1422172800,
"TimeCustom": 1422172800,
"TimeCustomInQuery": 1422172800,
"TimeCustomInHeader": 1422172800,
"TimeFormat": 1422172800,
"TimeFormatInQuery": 1422172800,
"TimeFormatInHeader": 1422172800
},
"serialized": {
"uri": "/path",
"headers": {},
"body": "{\"TimeArg\": 1422172800}"
}
},
{
"given": {
"input": {
"shape": "InputShape"
},
"http": {
"method": "POST",
"requestUri": "/path"
"uri": "/path?TimeQuery=2015-01-25T08%3A00%3A00Z&TimeCustomQuery=1422172800&TimeFormatQuery=1422172800",
"headers": {
"x-amz-timearg": "Sun, 25 Jan 2015 08:00:00 GMT",
"x-amz-timecustom-header": "1422172800",
"x-amz-timeformat-header": "1422172800",
"Content-Type": "application/json"
},
"name": "OperationName"
},
"params": {
"TimeArgInHeader": 1422172800
},
"serialized": {
"uri": "/path",
"headers": {"x-amz-timearg": "Sun, 25 Jan 2015 08:00:00 GMT"},
"body": ""
"body": "{\"TimeArg\": 1422172800, \"TimeCustom\": \"2015-01-25T08:00:00Z\", \"TimeFormat\": \"Sun, 25 Jan 2015 08:00:00 GMT\"}"
}
}
]
Expand Down
Loading

0 comments on commit 492dc39

Please sign in to comment.