Skip to content

Commit e018a18

Browse files
skotambkarjasdel
authored andcommitted
private/model/api: Add support for TimestampFormat in protocols (#358)
Adds support for the timestampForamt API model trait to the V2 SDK. The SDK will now generate API client parameters with the correct time format for APIs modeled with custom time stamp formats specified. V2 Port of aws/aws-sdk-go#2066 Fix #202 Fix #286
1 parent 321443f commit e018a18

File tree

2,038 files changed

+7692
-5512
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,038 files changed

+7692
-5512
lines changed

CHANGELOG_PENDING.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
### SDK Features
22

33
### SDK Enhancements
4+
* `private/protocol`: Add support for TimestampFormat in protocols ([#358](https://github.com/aws/aws-sdk-go-v2/pull/358))
5+
* Adds support for the timestampForamt API model trait to the V2 SDK. The SDK will now generate API client parameters with the correct time format for APIs modeled with custom time stamp formats specified.
6+
* Fixes [#202](https://github.com/aws/aws-sdk-go-v2/issues/202)
7+
* Fixes [#286](https://github.com/aws/aws-sdk-go-v2/issues/286)
48

59
### SDK Bugs
610
* `private/model/api`: Fix API doc being generated with wrong value ([#359](https://github.com/aws/aws-sdk-go-v2/pull/359))
@@ -9,3 +13,6 @@
913
* `aws/ec2rolecreds`: Fix security creds path to include trailing slash ([#356](https://github.com/aws/aws-sdk-go-v2/pull/356))
1014
* Fixes the iamSecurityCredsPath var to include a trailing slash preventing redirects when making requests to the EC2 Instance Metadata service.
1115
* Fixes [#351](https://github.com/aws/aws-sdk-go-v2/issues/351)
16+
17+
18+

models/protocol_tests/generate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ func (i *testCase) TestCase(idx int) string {
310310
case "rest-xml":
311311
i.InputTest.Body = util.SortXML(bytes.NewReader([]byte(i.InputTest.Body)))
312312
case "json", "rest-json":
313-
i.InputTest.Body = strings.Replace(i.InputTest.Body, " ", "", -1)
313+
// Nothing to do
314314
}
315315

316316
jsonValues := buildJSONValues(i.Given.InputRef.Shape)

models/protocol_tests/input/ec2.json

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,9 +383,20 @@
383383
"members": {
384384
"TimeArg": {
385385
"shape": "TimestampType"
386+
},
387+
"TimeCustom": {
388+
"timestampFormat": "unixTimestamp",
389+
"shape": "TimestampType"
390+
},
391+
"TimeFormat": {
392+
"shape": "TimestampFormatType"
386393
}
387394
}
388395
},
396+
"TimestampFormatType": {
397+
"timestampFormat": "unixTimestamp",
398+
"type": "timestamp"
399+
},
389400
"TimestampType": {
390401
"type": "timestamp"
391402
}
@@ -399,11 +410,13 @@
399410
"name": "OperationName"
400411
},
401412
"params": {
402-
"TimeArg": 1422172800
413+
"TimeArg": 1422172800,
414+
"TimeCustom": 1422172800,
415+
"TimeFormat": 1422172800
403416
},
404417
"serialized": {
405418
"uri": "/",
406-
"body": "Action=OperationName&Version=2014-01-01&TimeArg=2015-01-25T08%3A00%3A00Z"
419+
"body": "Action=OperationName&Version=2014-01-01&TimeArg=2015-01-25T08%3A00%3A00Z&TimeCustom=1422172800&TimeFormat=1422172800"
407420
}
408421
}
409422
]

models/protocol_tests/input/json.json

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,20 @@
5757
"members": {
5858
"TimeArg": {
5959
"shape": "TimestampType"
60+
},
61+
"TimeCustom": {
62+
"timestampFormat": "rfc822",
63+
"shape": "TimestampType"
64+
},
65+
"TimeFormat": {
66+
"shape": "TimestampFormatType"
6067
}
6168
}
6269
},
70+
"TimestampFormatType": {
71+
"timestampFormat": "rfc822",
72+
"type": "timestamp"
73+
},
6374
"TimestampType": {
6475
"type": "timestamp"
6576
}
@@ -73,10 +84,12 @@
7384
"name": "OperationName"
7485
},
7586
"params": {
76-
"TimeArg": 1422172800
87+
"TimeArg": 1422172800,
88+
"TimeCustom": 1422172800,
89+
"TimeFormat": 1422172800
7790
},
7891
"serialized": {
79-
"body": "{\"TimeArg\": 1422172800}",
92+
"body": "{\"TimeArg\": 1422172800, \"TimeCustom\": \"Sun, 25 Jan 2015 08:00:00 GMT\", \"TimeFormat\": \"Sun, 25 Jan 2015 08:00:00 GMT\"}",
8093
"headers": {
8194
"X-Amz-Target": "com.amazonaws.foo.OperationName",
8295
"Content-Type": "application/x-amz-json-1.1"

models/protocol_tests/input/query.json

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,9 +609,20 @@
609609
"members": {
610610
"TimeArg": {
611611
"shape": "TimestampType"
612+
},
613+
"TimeCustom": {
614+
"timestampFormat": "unixTimestamp",
615+
"shape": "TimestampType"
616+
},
617+
"TimeFormat": {
618+
"shape": "TimestampFormatType"
612619
}
613620
}
614621
},
622+
"TimestampFormatType": {
623+
"timestampFormat": "unixTimestamp",
624+
"type": "timestamp"
625+
},
615626
"TimestampType": {
616627
"type": "timestamp"
617628
}
@@ -625,11 +636,13 @@
625636
"name": "OperationName"
626637
},
627638
"params": {
628-
"TimeArg": 1422172800
639+
"TimeArg": 1422172800,
640+
"TimeCustom": 1422172800,
641+
"TimeFormat": 1422172800
629642
},
630643
"serialized": {
631644
"uri": "/",
632-
"body": "Action=OperationName&Version=2014-01-01&TimeArg=2015-01-25T08%3A00%3A00Z"
645+
"body": "Action=OperationName&Version=2014-01-01&TimeArg=2015-01-25T08%3A00%3A00Z&TimeCustom=1422172800&TimeFormat=1422172800"
633646
}
634647
}
635648
]

models/protocol_tests/input/rest-json.json

Lines changed: 58 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,9 +1103,51 @@
11031103
"shape": "TimestampType",
11041104
"location": "header",
11051105
"locationName": "x-amz-timearg"
1106+
},
1107+
"TimeArgInQuery": {
1108+
"shape": "TimestampType",
1109+
"location": "querystring",
1110+
"locationName": "TimeQuery"
1111+
},
1112+
"TimeCustom": {
1113+
"timestampFormat": "iso8601",
1114+
"shape": "TimestampType"
1115+
},
1116+
"TimeCustomInHeader": {
1117+
"timestampFormat": "unixTimestamp",
1118+
"shape": "TimestampType",
1119+
"location": "header",
1120+
"locationName": "x-amz-timecustom-header"
1121+
},
1122+
"TimeCustomInQuery": {
1123+
"timestampFormat": "unixTimestamp",
1124+
"shape": "TimestampType",
1125+
"location": "querystring",
1126+
"locationName": "TimeCustomQuery"
1127+
},
1128+
"TimeFormat": {
1129+
"shape": "TimestampFormatRfcType"
1130+
},
1131+
"TimeFormatInHeader": {
1132+
"shape": "TimestampFormatUnixType",
1133+
"location": "header",
1134+
"locationName": "x-amz-timeformat-header"
1135+
},
1136+
"TimeFormatInQuery": {
1137+
"shape": "TimestampFormatUnixType",
1138+
"location": "querystring",
1139+
"locationName": "TimeFormatQuery"
11061140
}
11071141
}
11081142
},
1143+
"TimestampFormatRfcType": {
1144+
"timestampFormat": "rfc822",
1145+
"type": "timestamp"
1146+
},
1147+
"TimestampFormatUnixType": {
1148+
"timestampFormat": "unixTimestamp",
1149+
"type": "timestamp"
1150+
},
11091151
"TimestampType": {
11101152
"type": "timestamp"
11111153
}
@@ -1123,32 +1165,25 @@
11231165
"name": "OperationName"
11241166
},
11251167
"params": {
1126-
"TimeArg": 1422172800
1168+
"TimeArg": 1422172800,
1169+
"TimeArgInQuery": 1422172800,
1170+
"TimeArgInHeader": 1422172800,
1171+
"TimeCustom": 1422172800,
1172+
"TimeCustomInQuery": 1422172800,
1173+
"TimeCustomInHeader": 1422172800,
1174+
"TimeFormat": 1422172800,
1175+
"TimeFormatInQuery": 1422172800,
1176+
"TimeFormatInHeader": 1422172800
11271177
},
11281178
"serialized": {
1129-
"uri": "/path",
1130-
"headers": {},
1131-
"body": "{\"TimeArg\": 1422172800}"
1132-
}
1133-
},
1134-
{
1135-
"given": {
1136-
"input": {
1137-
"shape": "InputShape"
1138-
},
1139-
"http": {
1140-
"method": "POST",
1141-
"requestUri": "/path"
1179+
"uri": "/path?TimeQuery=2015-01-25T08%3A00%3A00Z&TimeCustomQuery=1422172800&TimeFormatQuery=1422172800",
1180+
"headers": {
1181+
"x-amz-timearg": "Sun, 25 Jan 2015 08:00:00 GMT",
1182+
"x-amz-timecustom-header": "1422172800",
1183+
"x-amz-timeformat-header": "1422172800",
1184+
"Content-Type": "application/json"
11421185
},
1143-
"name": "OperationName"
1144-
},
1145-
"params": {
1146-
"TimeArgInHeader": 1422172800
1147-
},
1148-
"serialized": {
1149-
"uri": "/path",
1150-
"headers": {"x-amz-timearg": "Sun, 25 Jan 2015 08:00:00 GMT"},
1151-
"body": ""
1186+
"body": "{\"TimeArg\": 1422172800, \"TimeCustom\": \"2015-01-25T08:00:00Z\", \"TimeFormat\": \"Sun, 25 Jan 2015 08:00:00 GMT\"}"
11521187
}
11531188
}
11541189
]

0 commit comments

Comments
 (0)