Skip to content

Commit

Permalink
private/model/api: Add support for TimestampFormat in protocols (#358)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
skotambkar authored and jasdel committed Aug 20, 2019
1 parent 321443f commit e018a18
Show file tree
Hide file tree
Showing 2,038 changed files with 7,692 additions and 5,512 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
### SDK Features

### SDK Enhancements
* `private/protocol`: Add support for TimestampFormat in protocols ([#358](https://github.com/aws/aws-sdk-go-v2/pull/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.
* Fixes [#202](https://github.com/aws/aws-sdk-go-v2/issues/202)
* Fixes [#286](https://github.com/aws/aws-sdk-go-v2/issues/286)

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



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 e018a18

Please sign in to comment.