Update Go AWS SDK to the latest version

This commit is contained in:
Andrey Smirnov
2019-07-13 00:03:55 +03:00
committed by Andrey Smirnov
parent d08be990ef
commit 94a72b23ff
2183 changed files with 885887 additions and 228114 deletions
+44 -13
View File
@@ -29,10 +29,35 @@ const (
type testSuite struct {
*api.API
Description string
Cases []testCase
Type uint
title string
Description string
ClientEndpoint string
Cases []testCase
Type uint
title string
}
func (s *testSuite) UnmarshalJSON(p []byte) error {
type stub testSuite
var v stub
if err := json.Unmarshal(p, &v); err != nil {
return err
}
if len(v.ClientEndpoint) == 0 {
v.ClientEndpoint = "https://test"
}
for i := 0; i < len(v.Cases); i++ {
if len(v.Cases[i].InputTest.Host) == 0 {
v.Cases[i].InputTest.Host = "test"
}
if len(v.Cases[i].InputTest.URI) == 0 {
v.Cases[i].InputTest.URI = "/"
}
}
*s = testSuite(v)
return nil
}
type testCase struct {
@@ -46,6 +71,7 @@ type testCase struct {
type testExpectation struct {
Body string
Host string
URI string
Headers map[string]string
JSONValues map[string]string
@@ -129,7 +155,7 @@ func (t *testSuite) TestSuite() string {
var tplInputTestCase = template.Must(template.New("inputcase").Parse(`
func Test{{ .OpName }}(t *testing.T) {
svc := New{{ .TestCase.TestSuite.API.StructName }}(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
svc := New{{ .TestCase.TestSuite.API.StructName }}(unit.Session, &aws.Config{Endpoint: aws.String("{{ .TestCase.TestSuite.ClientEndpoint }}")})
{{ if ne .ParamsString "" }}input := {{ .ParamsString }}
{{ range $k, $v := .JSONValues -}}
input.{{ $k }} = {{ $v }}
@@ -138,7 +164,7 @@ func Test{{ .OpName }}(t *testing.T) {
r := req.HTTPRequest
// build request
{{ .TestCase.TestSuite.API.ProtocolPackage }}.Build(req)
req.Build()
if req.Error != nil {
t.Errorf("expect no error, got %v", req.Error)
}
@@ -149,13 +175,13 @@ func Test{{ .OpName }}(t *testing.T) {
}
{{ .BodyAssertions }}{{ end }}
{{ if ne .TestCase.InputTest.URI "" }}// assert URL
awstesting.AssertURL(t, "https://test{{ .TestCase.InputTest.URI }}", r.URL.String()){{ end }}
// assert URL
awstesting.AssertURL(t, "https://{{ .TestCase.InputTest.Host }}{{ .TestCase.InputTest.URI }}", r.URL.String())
// assert headers
{{ range $k, $v := .TestCase.InputTest.Headers -}}
if e, a := "{{ $v }}", r.Header.Get("{{ $k }}"); e != a {
t.Errorf("expect %v to be %v", e, a)
t.Errorf("expect %v, got %v", e, a)
}
{{ end }}
}
@@ -237,8 +263,8 @@ func Test{{ .OpName }}(t *testing.T) {
{{ end }}
// unmarshal response
{{ .TestCase.TestSuite.API.ProtocolPackage }}.UnmarshalMeta(req)
{{ .TestCase.TestSuite.API.ProtocolPackage }}.Unmarshal(req)
req.Handlers.UnmarshalMeta.Run(req)
req.Handlers.Unmarshal.Run(req)
if req.Error != nil {
t.Errorf("expect not error, got %v", req.Error)
}
@@ -270,7 +296,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)
@@ -394,6 +420,7 @@ func generateTestSuite(filename string) string {
suite.API.NoConstServiceNames = true // don't generate service names
suite.API.Setup()
suite.API.Metadata.EndpointPrefix = suite.API.PackageName()
suite.API.Metadata.EndpointsID = suite.API.Metadata.EndpointPrefix
// Sort in order for deterministic test generation
names := make([]string, 0, len(suite.API.Shapes))
@@ -481,7 +508,7 @@ func GenerateAssertions(out interface{}, shape *api.Shape, prefix string) string
case "timestamp":
return fmtAssertEqual(
fmt.Sprintf("time.Unix(%#v, 0).UTC().String()", out),
fmt.Sprintf("%s.String()", prefix),
fmt.Sprintf("%s.UTC().String()", prefix),
)
case "blob":
return fmtAssertEqual(
@@ -517,6 +544,10 @@ func getType(t string) uint {
}
func main() {
if len(os.Getenv("AWS_SDK_CODEGEN_DEBUG")) != 0 {
api.LogDebug(os.Stdout)
}
fmt.Println("Generating test suite", os.Args[1:])
out := generateTestSuite(os.Args[1])
if len(os.Args) == 3 {
+86 -3
View File
@@ -383,9 +383,20 @@
"members": {
"TimeArg": {
"shape": "TimestampType"
},
"TimeCustom": {
"timestampFormat": "unixTimestamp",
"shape": "TimestampType"
},
"TimeFormat": {
"shape": "TimestampFormatType"
}
}
},
"TimestampFormatType": {
"timestampFormat": "unixTimestamp",
"type": "timestamp"
},
"TimestampType": {
"type": "timestamp"
}
@@ -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"
}
}
]
@@ -420,7 +433,7 @@
"members": {
"Token": {
"shape": "StringType",
"idempotencyToken": true
"idempotencyToken": true
}
}
},
@@ -525,5 +538,75 @@
}
}
]
},
{
"description": "Endpoint host trait",
"metadata": {
"protocol": "ec2",
"apiVersion": "2014-01-01"
},
"clientEndpoint": "https://service.region.amazonaws.com",
"shapes": {
"StaticInputShape": {
"type": "structure",
"members": {
"Name": {
"shape": "StringType"
}
}
},
"MemberRefInputShape": {
"type": "structure",
"members": {
"Name": {
"shape": "StringType",
"hostLabel": true
}
}
},
"StringType": {
"type": "string"
}
},
"cases": [
{
"given": {
"name": "StaticOp",
"input": {
"shape": "StaticInputShape"
},
"endpoint":{
"hostPrefix": "data-"
}
},
"params": {
"Name": "myname"
},
"serialized": {
"uri": "/",
"body": "Action=StaticOp&Version=2014-01-01&Name=myname",
"host": "data-service.region.amazonaws.com"
}
},
{
"given": {
"name": "MemberRefOp",
"input": {
"shape": "MemberRefInputShape"
},
"endpoint":{
"hostPrefix": "foo-{Name}."
}
},
"params": {
"Name": "myname"
},
"serialized": {
"uri": "/",
"body": "Action=MemberRefOp&Version=2014-01-01&Name=myname",
"host": "foo-myname.service.region.amazonaws.com"
}
}
]
}
]
+109 -9
View File
@@ -57,9 +57,20 @@
"members": {
"TimeArg": {
"shape": "TimestampType"
},
"TimeCustom": {
"timestampFormat": "rfc822",
"shape": "TimestampType"
},
"TimeFormat": {
"shape": "TimestampFormatType"
}
}
},
"TimestampFormatType": {
"timestampFormat": "rfc822",
"type": "timestamp"
},
"TimestampType": {
"type": "timestamp"
}
@@ -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"
@@ -101,7 +114,7 @@
"shape": "BlobType"
},
"BlobMap": {
"shape": "BlobMapType"
"shape": "BlobMapType"
}
}
},
@@ -146,8 +159,8 @@
},
"params": {
"BlobMap": {
"key1": "foo",
"key2": "bar"
"key1": "foo",
"key2": "bar"
}
},
"serialized": {
@@ -180,7 +193,7 @@
"ListOfStructures": {
"type": "list",
"member": {
"shape": "BlobType"
"shape": "BlobType"
}
},
"BlobType": {
@@ -204,8 +217,10 @@
"serialized": {
"body": "{\"ListParam\": [\"Zm9v\", \"YmFy\"]}",
"uri": "/",
"headers": {"X-Amz-Target": "com.amazonaws.foo.OperationName",
"Content-Type": "application/x-amz-json-1.1"}
"headers": {
"X-Amz-Target": "com.amazonaws.foo.OperationName",
"Content-Type": "application/x-amz-json-1.1"
}
}
}
]
@@ -488,7 +503,7 @@
"members": {
"Token": {
"shape": "StringType",
"idempotencyToken": true
"idempotencyToken": true
}
}
},
@@ -605,5 +620,90 @@
}
}
]
},
{
"description": "Endpoint host trait static prefix",
"metadata": {
"protocol": "json",
"jsonVersion": "1.1",
"targetPrefix": "com.amazonaws.foo"
},
"clientEndpoint": "https://service.region.amazonaws.com",
"shapes": {
"StaticInputShape": {
"type": "structure",
"members": {
"Name": {
"shape": "StringType"
}
}
},
"MemberRefInputShape": {
"type": "structure",
"members": {
"Name": {
"shape": "StringType",
"hostLabel": true
}
}
},
"StringType": {
"type": "string"
}
},
"cases": [
{
"given": {
"name": "StaticOp",
"input": {
"shape": "StaticInputShape"
},
"http": {
"method": "POST"
},
"endpoint":{
"hostPrefix": "data-"
}
},
"params": {
"Name": "myname"
},
"serialized": {
"headers": {
"X-Amz-Target": "com.amazonaws.foo.StaticOp",
"Content-Type": "application/x-amz-json-1.1"
},
"uri": "/",
"body": "{\"Name\": \"myname\"}",
"host": "data-service.region.amazonaws.com"
}
},
{
"given": {
"name": "MemberRefOp",
"input": {
"shape": "MemberRefInputShape"
},
"http": {
"method": "POST"
},
"endpoint":{
"hostPrefix": "foo-{Name}."
}
},
"params": {
"Name": "myname"
},
"serialized": {
"headers": {
"X-Amz-Target": "com.amazonaws.foo.MemberRefOp",
"Content-Type": "application/x-amz-json-1.1"
},
"uri": "/",
"body": "{\"Name\": \"myname\"}",
"host": "foo-myname.service.region.amazonaws.com"
}
}
]
}
]
+92 -3
View File
@@ -609,9 +609,20 @@
"members": {
"TimeArg": {
"shape": "TimestampType"
},
"TimeCustom": {
"timestampFormat": "unixTimestamp",
"shape": "TimestampType"
},
"TimeFormat": {
"shape": "TimestampFormatType"
}
}
},
"TimestampFormatType": {
"timestampFormat": "unixTimestamp",
"type": "timestamp"
},
"TimestampType": {
"type": "timestamp"
}
@@ -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"
}
}
]
@@ -833,7 +846,7 @@
"members": {
"Token": {
"shape": "StringType",
"idempotencyToken": true
"idempotencyToken": true
}
}
},
@@ -969,5 +982,81 @@
}
}
]
},
{
"description": "Endpoint host trait",
"metadata": {
"protocol": "query",
"apiVersion": "2014-01-01"
},
"clientEndpoint": "https://service.region.amazonaws.com",
"shapes": {
"StaticInputShape": {
"type": "structure",
"members": {
"Name": {
"shape": "StringType"
}
}
},
"MemberRefInputShape": {
"type": "structure",
"members": {
"Name": {
"shape": "StringType",
"hostLabel": true
}
}
},
"StringType": {
"type": "string"
}
},
"cases": [
{
"given": {
"name": "StaticOp",
"input": {
"shape": "StaticInputShape"
},
"http": {
"method": "POST"
},
"endpoint":{
"hostPrefix": "data-"
}
},
"params": {
"Name": "myname"
},
"serialized": {
"uri": "/",
"body": "Action=StaticOp&Version=2014-01-01&Name=myname",
"host": "data-service.region.amazonaws.com"
}
},
{
"given": {
"name": "MemberRefOp",
"input": {
"shape": "MemberRefInputShape"
},
"http": {
"method": "POST"
},
"endpoint":{
"hostPrefix": "foo-{Name}."
}
},
"params": {
"Name": "myname"
},
"serialized": {
"uri": "/",
"body": "Action=MemberRefOp&Version=2014-01-01&Name=myname",
"host": "foo-myname.service.region.amazonaws.com"
}
}
]
}
]
+268 -43
View File
@@ -475,7 +475,9 @@
"serialized": {
"body": "{\"Config\": {\"A\": \"one\", \"B\": \"two\"}}",
"uri": "/2014-01-01/jobsByPipeline/foo?Ascending=true&PageToken=bar",
"headers": {}
"headers": {
"Content-Type": "application/json"
}
}
}
]
@@ -556,7 +558,8 @@
"body": "{\"Config\": {\"A\": \"one\", \"B\": \"two\"}}",
"uri": "/2014-01-01/jobsByPipeline/foo?Ascending=true&PageToken=bar",
"headers": {
"x-amz-checksum": "12345"
"x-amz-checksum": "12345",
"Content-Type": "application/json"
}
}
}
@@ -672,12 +675,15 @@
},
"serialized": {
"body": "{\"Bar\": \"QmxvYiBwYXJhbQ==\"}",
"uri": "/2014-01-01/foo_name"
"uri": "/2014-01-01/foo_name",
"headers": {
"Content-Type": "application/json"
}
}
}
]
},
{
{
"description": "Blob payload",
"metadata": {
"protocol": "rest-json",
@@ -789,7 +795,10 @@
"serialized": {
"method": "POST",
"body": "{\"baz\": \"bar\"}",
"uri": "/"
"uri": "/",
"headers": {
"Content-Type": "application/json"
}
}
},
{
@@ -939,7 +948,9 @@
},
"serialized": {
"uri": "/path" ,
"headers": {},
"headers": {
"Content-Type": "application/json"
},
"body": "{\"RecursiveStruct\": {\"NoRecurse\": \"foo\"}}"
}
},
@@ -963,7 +974,9 @@
},
"serialized": {
"uri": "/path",
"headers": {},
"headers": {
"Content-Type": "application/json"
},
"body": "{\"RecursiveStruct\": {\"RecursiveStruct\": {\"NoRecurse\": \"foo\"}}}"
}
},
@@ -991,7 +1004,9 @@
},
"serialized": {
"uri": "/path",
"headers": {},
"headers": {
"Content-Type": "application/json"
},
"body": "{\"RecursiveStruct\": {\"RecursiveStruct\": {\"RecursiveStruct\": {\"RecursiveStruct\": {\"NoRecurse\": \"foo\"}}}}}"
}
},
@@ -1020,7 +1035,9 @@
},
"serialized": {
"uri": "/path",
"headers": {},
"headers": {
"Content-Type": "application/json"
},
"body": "{\"RecursiveStruct\": {\"RecursiveList\": [{\"NoRecurse\": \"foo\"}, {\"NoRecurse\": \"bar\"}]}}"
}
},
@@ -1051,7 +1068,9 @@
},
"serialized": {
"uri": "/path",
"headers": {},
"headers": {
"Content-Type": "application/json"
},
"body": "{\"RecursiveStruct\": {\"RecursiveList\": [{\"NoRecurse\": \"foo\"}, {\"RecursiveStruct\": {\"NoRecurse\": \"bar\"}}]}}"
}
},
@@ -1080,7 +1099,9 @@
},
"serialized": {
"uri": "/path",
"headers": {},
"headers": {
"Content-Type": "application/json"
},
"body": "{\"RecursiveStruct\": {\"RecursiveMap\": {\"foo\": {\"NoRecurse\": \"foo\"}, \"bar\": {\"NoRecurse\": \"bar\"}}}}"
}
}
@@ -1103,9 +1124,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"
}
@@ -1123,32 +1186,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"
"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"
},
"http": {
"method": "POST",
"requestUri": "/path"
},
"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\"}"
}
}
]
@@ -1190,7 +1246,9 @@
},
"serialized": {
"uri": "/path",
"headers": {},
"headers": {
"Content-Type": "application/json"
},
"body": "{\"timestamp_location\": 1422172800}"
}
}
@@ -1251,7 +1309,7 @@
"members": {
"Token": {
"shape": "StringType",
"idempotencyToken": true
"idempotencyToken": true
}
}
},
@@ -1276,7 +1334,9 @@
},
"serialized": {
"uri": "/path",
"headers": {},
"headers": {
"Content-Type": "application/json"
},
"body": "{\"Token\": \"abc123\"}"
}
},
@@ -1295,7 +1355,9 @@
},
"serialized": {
"uri": "/path",
"headers": {},
"headers": {
"Content-Type": "application/json"
},
"body": "{\"Token\": \"00000000-0000-4000-8000-000000000000\"}"
}
}
@@ -1372,7 +1434,10 @@
},
"serialized": {
"uri": "/?Bar=%7B%22Foo%22%3A%22Bar%22%7D",
"headers": {"X-Amz-Foo": "eyJGb28iOiJCYXIifQ=="},
"headers": {
"X-Amz-Foo": "eyJGb28iOiJCYXIifQ==",
"Content-Type": "application/json"
},
"body": "{\"BodyField\":\"{\\\"Foo\\\":\\\"Bar\\\"}\"}"
}
},
@@ -1393,11 +1458,13 @@
},
"serialized": {
"uri": "/",
"headers": {},
"headers": {
"Content-Type": "application/json"
},
"body": "{\"BodyListField\":[\"{\\\"Foo\\\":\\\"Bar\\\"}\"]}"
}
},
{
{
"given": {
"input": {
"shape": "InputShape"
@@ -1481,11 +1548,14 @@
"FooEnum": "foo",
"QueryFooEnum": "bar",
"ListEnums": ["foo", "", "bar"],
"QueryListEnums": ["0", "", "1"]
"QueryListEnums": ["0", "1", ""]
},
"serialized": {
"uri": "/path?Enum=bar&List=0&List=1&List=",
"headers": {"x-amz-enum": "baz"},
"headers": {
"x-amz-enum": "baz",
"Content-Type": "application/json"
},
"body": "{\"FooEnum\": \"foo\", \"ListEnums\": [\"foo\", \"\", \"bar\"]}"
}
},
@@ -1508,5 +1578,160 @@
}
}
]
},
{
"description": "Endpoint host trait",
"metadata": {
"protocol": "rest-json",
"apiVersion": "2014-01-01"
},
"clientEndpoint": "https://service.region.amazonaws.com",
"shapes": {
"StaticInputShape": {
"type": "structure",
"members": {
"Name": {
"shape": "StringType"
}
}
},
"MemberRefInputShape": {
"type": "structure",
"members": {
"Name": {
"shape": "StringType",
"hostLabel": true
}
}
},
"StringType": {
"type": "string"
}
},
"cases": [
{
"given": {
"name": "StaticOp",
"input": {
"shape": "StaticInputShape"
},
"http": {
"method": "POST",
"requestUri": "/path"
},
"endpoint":{
"hostPrefix": "data-"
}
},
"params": {
"Name": "myname"
},
"serialized": {
"uri": "/path",
"headers": {
"Content-Type": "application/json"
},
"body": "{\"Name\": \"myname\"}",
"host": "data-service.region.amazonaws.com"
}
},
{
"given": {
"name": "MemberRefOp",
"input": {
"shape": "MemberRefInputShape"
},
"http": {
"method": "POST",
"requestUri": "/path"
},
"endpoint":{
"hostPrefix": "foo-{Name}."
}
},
"params": {
"Name": "myname"
},
"serialized": {
"uri": "/path",
"headers": {
"Content-Type": "application/json"
},
"body": "{\"Name\": \"myname\"}",
"host": "foo-myname.service.region.amazonaws.com"
}
}
]
},
{
"description": "Header whitespace",
"metadata": {
"protocol": "rest-json",
"apiVersion": "2014-01-01"
},
"shapes": {
"InputShape": {
"type": "structure",
"members": {
"Header1": {
"shape": "StringType",
"location": "header"
},
"HeaderMap": {
"shape": "StringMap",
"location": "headers",
"locationName": "header-map-"
}
}
},
"StringType": {
"type": "string"
},
"StringMap": {
"type": "map",
"key": {
"shape": "StringType"
},
"value": {
"shape": "StringType"
}
}
},
"cases": [
{
"given": {
"http": {
"method": "GET",
"requestUri": "/"
},
"input": {
"shape": "InputShape"
},
"name": "OperationName"
},
"params": {
"Header1": " headerValue",
"HeaderMap": {
"leading-space": " value",
"with-space": " value ",
"leading-tab": " value",
" key-leading-space": "value",
" key-with-space ": "value"
}
},
"serialized": {
"body": "",
"uri": "/",
"headers": {
"header1": "headerValue",
"header-map-leading-space": "value",
"header-map-with-space": "value",
"header-map-leading-tab": "value",
"header-map-key-leading-space": "value",
"header-map-key-with-space": "value"
}
}
}
]
}
]
+279 -72
View File
@@ -599,7 +599,7 @@
]
},
{
"description": "Blob and timestamp shapes",
"description": "Blob shapes",
"metadata": {
"protocol": "rest-xml",
"apiVersion": "2014-01-01"
@@ -616,17 +616,11 @@
"StructureShape": {
"type": "structure",
"members": {
"t": {
"shape": "TShape"
},
"b": {
"shape": "BShape"
}
}
},
"TShape": {
"type": "timestamp"
},
"BShape": {
"type": "blob"
}
@@ -647,19 +641,122 @@
},
"params": {
"StructureParam": {
"t": 1422172800,
"b": "foo"
}
},
"serialized": {
"method": "POST",
"body": "<OperationRequest xmlns=\"https://foo/\"><StructureParam><t>2015-01-25T08:00:00Z</t><b>Zm9v</b></StructureParam></OperationRequest>",
"body": "<OperationRequest xmlns=\"https://foo/\"><StructureParam><b>Zm9v</b></StructureParam></OperationRequest>",
"uri": "/2014-01-01/hostedzone",
"headers": {}
}
}
]
},
{
"description": "Timestamp shapes",
"metadata": {
"protocol": "rest-xml",
"apiVersion": "2014-01-01"
},
"shapes": {
"InputShape": {
"type": "structure",
"members": {
"TimeArg": {
"shape": "TimestampType"
},
"TimeArgInHeader": {
"shape": "TimestampType",
"location": "header",
"locationName": "x-amz-timearg"
},
"TimeArgInQuery": {
"shape": "TimestampType",
"location": "querystring",
"locationName": "TimeQuery"
},
"TimeCustom": {
"timestampFormat": "rfc822",
"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"
}
},
"cases": [
{
"given": {
"http": {
"method": "POST",
"requestUri": "/2014-01-01/hostedzone"
},
"input": {
"shape": "InputShape",
"locationName": "TimestampStructure",
"xmlNamespace": {"uri": "https://foo/"}
},
"name": "OperationName"
},
"params": {
"TimeArg": 1422172800,
"TimeArgInQuery": 1422172800,
"TimeArgInHeader": 1422172800,
"TimeCustom": 1422172800,
"TimeCustomInQuery": 1422172800,
"TimeCustomInHeader": 1422172800,
"TimeFormat": 1422172800,
"TimeFormatInQuery": 1422172800,
"TimeFormatInHeader": 1422172800
},
"serialized": {
"method": "POST",
"body": "<TimestampStructure xmlns=\"https://foo/\"><TimeArg>2015-01-25T08:00:00Z</TimeArg><TimeCustom>Sun, 25 Jan 2015 08:00:00 GMT</TimeCustom><TimeFormat>Sun, 25 Jan 2015 08:00:00 GMT</TimeFormat></TimestampStructure>",
"uri": "/2014-01-01/hostedzone?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"
}
}
}
]
},
{
"description": "Header maps",
"metadata": {
@@ -1205,21 +1302,21 @@
}
},
"Grantee": {
"type": "structure",
"members": {
"Type": {
"shape": "Type",
"locationName": "xsi:type",
"xmlAttribute": true
},
"EmailAddress": {
"shape": "StringType"
}
},
"xmlNamespace": {
"prefix": "xsi",
"uri":"http://www.w3.org/2001/XMLSchema-instance"
}
"type": "structure",
"members": {
"Type": {
"shape": "Type",
"locationName": "xsi:type",
"xmlAttribute": true
},
"EmailAddress": {
"shape": "StringType"
}
},
"xmlNamespace": {
"prefix": "xsi",
"uri":"http://www.w3.org/2001/XMLSchema-instance"
}
},
"Type": {
"type": "string"
@@ -1586,51 +1683,6 @@
}
]
},
{
"description": "Timestamp in header",
"metadata": {
"protocol": "rest-xml",
"apiVersion": "2014-01-01"
},
"shapes": {
"InputShape": {
"type": "structure",
"members": {
"TimeArgInHeader": {
"shape": "TimestampType",
"location": "header",
"locationName": "x-amz-timearg"
}
}
},
"TimestampType": {
"type": "timestamp"
}
},
"cases": [
{
"given": {
"input": {
"shape": "InputShape"
},
"http": {
"method": "POST",
"requestUri": "/path"
},
"name": "OperationName"
},
"params": {
"TimeArgInHeader": 1422172800
},
"serialized": {
"method": "POST",
"body": "",
"uri": "/path",
"headers": {"x-amz-timearg": "Sun, 25 Jan 2015 08:00:00 GMT"}
}
}
]
},
{
"description": "Idempotency token auto fill",
"metadata": {
@@ -1643,7 +1695,7 @@
"members": {
"Token": {
"shape": "StringType",
"idempotencyToken": true
"idempotencyToken": true
}
}
},
@@ -1702,6 +1754,9 @@
"shapes": {
"InputShape": {
"type": "structure",
"required": [
"URIFooEnum"
],
"members": {
"HeaderEnum": {
"shape": "EnumType",
@@ -1772,15 +1827,167 @@
},
"http": {
"method": "POST",
"requestUri": "/path"
"requestUri": "/Enum/{URIEnum}"
},
"name": "OperationName"
},
"params": {
"URIFooEnum": "bar"
},
"serialized": {
"uri": "/Enum/bar",
"headers": {}
}
}
]
},
{
"description": "Endpoint host trait",
"metadata": {
"protocol": "rest-xml",
"apiVersion": "2014-01-01"
},
"clientEndpoint": "https://service.region.amazonaws.com",
"shapes": {
"StaticInputShape": {
"type": "structure",
"members": {
"Name": {
"shape": "StringType"
}
}
},
"MemberRefInputShape": {
"type": "structure",
"members": {
"Name": {
"shape": "StringType",
"hostLabel": true
}
}
},
"StringType": {
"type": "string"
}
},
"cases": [
{
"given": {
"name": "StaticOp",
"input": {
"shape": "StaticInputShape",
"locationName": "StaticOpRequest"
},
"http": {
"method": "POST",
"requestUri": "/path"
},
"endpoint":{
"hostPrefix": "data-"
}
},
"params": {
"Name": "myname"
},
"serialized": {
"uri": "/path",
"headers": {}
"body": "<StaticOpRequest><Name>myname</Name></StaticOpRequest>",
"host": "data-service.region.amazonaws.com"
}
},
{
"given": {
"name": "MemberRefOp",
"input": {
"shape": "MemberRefInputShape",
"locationName": "MemberRefOpRequest"
},
"http": {
"method": "POST",
"requestUri": "/path"
},
"endpoint":{
"hostPrefix": "foo-{Name}."
}
},
"params": {
"Name": "myname"
},
"serialized": {
"uri": "/path",
"body": "<MemberRefOpRequest><Name>myname</Name></MemberRefOpRequest>",
"host": "foo-myname.service.region.amazonaws.com"
}
}
]
},
{
"description": "Header whitespace",
"metadata": {
"protocol": "rest-xml",
"apiVersion": "2014-01-01"
},
"shapes": {
"InputShape": {
"type": "structure",
"members": {
"Header1": {
"shape": "StringType",
"location": "header"
},
"HeaderMap": {
"shape": "StringMap",
"location": "headers",
"locationName": "header-map-"
}
}
},
"StringType": {
"type": "string"
},
"StringMap": {
"type": "map",
"key": {
"shape": "StringType"
},
"value": {
"shape": "StringType"
}
}
},
"cases": [
{
"given": {
"http": {
"method": "GET",
"requestUri": "/"
},
"input": {
"shape": "InputShape"
},
"name": "OperationName"
},
"params": {
"Header1": " headerValue",
"HeaderMap": {
"leading-space": " value",
"with-space": " value ",
"leading-tab": " value",
" key-leading-space": "value",
" key-with-space ": "value"
}
},
"serialized": {
"body": "",
"uri": "/",
"headers": {
"header1": "headerValue",
"header-map-leading-space": "value",
"header-map-with-space": "value",
"header-map-leading-tab": "value",
"header-map-key-leading-space": "value",
"header-map-key-with-space": "value"
}
}
}
]
+68
View File
@@ -451,6 +451,74 @@
}
]
},
{
"description": "Timestamp members",
"metadata": {
"protocol": "ec2"
},
"shapes": {
"OutputShape": {
"type": "structure",
"members": {
"TimeArg": {
"shape": "TimestampType"
},
"TimeCustom": {
"timestampFormat": "rfc822",
"shape": "TimestampType"
},
"TimeFormat": {
"shape": "TimestampFormatType"
},
"StructMember": {
"shape": "TimeContainer"
}
}
},
"TimeContainer": {
"type": "structure",
"members": {
"foo": {
"shape": "TimestampType"
},
"bar": {
"shape": "TimestampFormatType"
}
}
},
"TimestampFormatType": {
"timestampFormat": "unixTimestamp",
"type": "timestamp"
},
"TimestampType": {
"type": "timestamp"
}
},
"cases": [
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"TimeArg": 1398796238,
"TimeCustom": 1398796238,
"TimeFormat": 1398796238,
"StructMember": {
"foo": 1398796238,
"bar": 1398796238
}
},
"response": {
"status_code": 200,
"headers": {},
"body": "<OperationNameResponse><StructMember><foo>2014-04-29T18:30:38Z</foo><bar>1398796238</bar></StructMember><TimeArg>2014-04-29T18:30:38Z</TimeArg><TimeCustom>Tue, 29 Apr 2014 18:30:38 GMT</TimeCustom><TimeFormat>1398796238</TimeFormat><RequestId>requestid</RequestId></OperationNameResponse>"
}
}
]
},
{
"description": "Enum output",
"metadata": {
+86 -9
View File
@@ -142,24 +142,38 @@
"OutputShape": {
"type": "structure",
"members": {
"TimeMember": {
"shape": "TimeType"
"TimeArg": {
"shape": "TimestampType"
},
"TimeCustom": {
"timestampFormat": "rfc822",
"shape": "TimestampType"
},
"TimeFormat": {
"shape": "TimestampFormatType"
},
"StructMember": {
"shape": "TimeContainer"
}
}
},
"TimeType": {
"type": "timestamp"
},
"TimeContainer": {
"type": "structure",
"members": {
"foo": {
"shape": "TimeType"
"shape": "TimestampType"
},
"bar": {
"shape": "TimestampFormatType"
}
}
},
"TimestampFormatType": {
"timestampFormat": "iso8601",
"type": "timestamp"
},
"TimestampType": {
"type": "timestamp"
}
},
"cases": [
@@ -171,15 +185,18 @@
"name": "OperationName"
},
"result": {
"TimeMember": 1398796238,
"TimeArg": 1398796238,
"TimeCustom": 1398796238,
"TimeFormat": 1398796238,
"StructMember": {
"foo": 1398796238
"foo": 1398796238,
"bar": 1398796238
}
},
"response": {
"status_code": 200,
"headers": {},
"body": "{\"TimeMember\": 1398796238, \"StructMember\": {\"foo\": 1398796238}}"
"body": "{\"TimeArg\": 1398796238, \"TimeCustom\": \"Tue, 29 Apr 2014 18:30:38 GMT\", \"TimeFormat\": \"2014-04-29T18:30:38Z\", \"StructMember\": {\"foo\": 1398796238, \"bar\": \"2014-04-29T18:30:38Z\"}}"
}
}
]
@@ -414,5 +431,65 @@
}
}
]
},
{
"description": "unmodeled non-json response payload",
"metadata": {
"protocol": "json"
},
"shapes": {
"OutputShape": {
"type": "structure",
"members": {
}
}
},
"cases": [
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
},
"response": {
"status_code": 200,
"headers": {},
"body": "success"
}
},
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
},
"response": {
"status_code": 200,
"headers": {},
"body": "\"success\""
}
},
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
},
"response": {
"status_code": 200,
"headers": {},
"body": "{}"
}
}
]
}
]
@@ -773,6 +773,74 @@
}
]
},
{
"description": "Timestamp members",
"metadata": {
"protocol": "query"
},
"shapes": {
"OutputShape": {
"type": "structure",
"members": {
"TimeArg": {
"shape": "TimestampType"
},
"TimeCustom": {
"timestampFormat": "rfc822",
"shape": "TimestampType"
},
"TimeFormat": {
"shape": "TimestampFormatType"
},
"StructMember": {
"shape": "TimeContainer"
}
}
},
"TimeContainer": {
"type": "structure",
"members": {
"foo": {
"shape": "TimestampType"
},
"bar": {
"shape": "TimestampFormatType"
}
}
},
"TimestampFormatType": {
"timestampFormat": "unixTimestamp",
"type": "timestamp"
},
"TimestampType": {
"type": "timestamp"
}
},
"cases": [
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"TimeArg": 1398796238,
"TimeCustom": 1398796238,
"TimeFormat": 1398796238,
"StructMember": {
"foo": 1398796238,
"bar": 1398796238
}
},
"response": {
"status_code": 200,
"headers": {},
"body": "<OperationNameResponse><StructMember><foo>2014-04-29T18:30:38Z</foo><bar>1398796238</bar></StructMember><TimeArg>2014-04-29T18:30:38Z</TimeArg><TimeCustom>Tue, 29 Apr 2014 18:30:38 GMT</TimeCustom><TimeFormat>1398796238</TimeFormat><RequestId>requestid</RequestId></OperationNameResponse>"
}
}
]
},
{
"description": "Enum output",
"metadata": {
+70 -25
View File
@@ -166,24 +166,54 @@
"OutputShape": {
"type": "structure",
"members": {
"TimeMember": {
"shape": "TimeType"
"TimeArg": {
"shape": "TimestampType"
},
"TimeArgInHeader": {
"shape": "TimestampType",
"location": "header",
"locationName": "x-amz-timearg"
},
"TimeCustom": {
"timestampFormat": "rfc822",
"shape": "TimestampType"
},
"TimeCustomInHeader": {
"timestampFormat": "unixTimestamp",
"shape": "TimestampType",
"location": "header",
"locationName": "x-amz-timecustom"
},
"TimeFormat": {
"shape": "TimestampFormatType"
},
"TimeFormatInHeader": {
"shape": "TimestampFormatType",
"location": "header",
"locationName": "x-amz-timeformat"
},
"StructMember": {
"shape": "TimeContainer"
}
}
},
"TimeType": {
"type": "timestamp"
},
"TimeContainer": {
"type": "structure",
"members": {
"foo": {
"shape": "TimeType"
"shape": "TimestampType"
},
"bar": {
"shape": "TimestampFormatType"
}
}
},
"TimestampFormatType": {
"timestampFormat": "iso8601",
"type": "timestamp"
},
"TimestampType": {
"type": "timestamp"
}
},
"cases": [
@@ -195,15 +225,25 @@
"name": "OperationName"
},
"result": {
"TimeMember": 1398796238,
"TimeArg": 1398796238,
"TimeArgInHeader": 1398796238,
"TimeCustom": 1398796238,
"TimeCustomInHeader": 1398796238,
"TimeFormat": 1398796238,
"TimeFormatInHeader": 1398796238,
"StructMember": {
"foo": 1398796238
"foo": 1398796238,
"bar": 1398796238
}
},
"response": {
"status_code": 200,
"headers": {},
"body": "{\"TimeMember\": 1398796238, \"StructMember\": {\"foo\": 1398796238}}"
"headers": {
"x-amz-timearg": "Tue, 29 Apr 2014 18:30:38 GMT",
"x-amz-timecustom": "1398796238",
"x-amz-timeformat": "2014-04-29T18:30:38Z"
},
"body": "{\"TimeArg\": 1398796238, \"TimeCustom\": \"Tue, 29 Apr 2014 18:30:38 GMT\", \"TimeFormat\": \"2014-04-29T18:30:38Z\", \"StructMember\": {\"foo\": 1398796238, \"bar\": \"2014-04-29T18:30:38Z\"}}"
}
}
]
@@ -447,6 +487,26 @@
}
]
},
{
"description": "Ignores undefined output",
"metadata": {
"protocol": "rest-json"
},
"shapes": {},
"cases": [
{
"given": {
"name": "OperationName"
},
"result": {},
"response": {
"status_code": 200,
"headers": {},
"body": "OK"
}
}
]
},
{
"description": "Supports header maps",
"metadata": {
@@ -673,21 +733,6 @@
"headers": {},
"body": "{\"BodyListField\":[\"{\\\"Foo\\\":\\\"Bar\\\"}\"]}"
}
},
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
},
"response": {
"status_code": 200,
"headers": {},
"body": ""
}
}
]
},
@@ -717,6 +717,97 @@
}
]
},
{
"description": "Timestamp members",
"metadata": {
"protocol": "rest-xml"
},
"shapes": {
"OutputShape": {
"type": "structure",
"members": {
"TimeArg": {
"shape": "TimestampType"
},
"TimeArgInHeader": {
"shape": "TimestampType",
"location": "header",
"locationName": "x-amz-timearg"
},
"TimeCustom": {
"timestampFormat": "rfc822",
"shape": "TimestampType"
},
"TimeCustomInHeader": {
"timestampFormat": "unixTimestamp",
"shape": "TimestampType",
"location": "header",
"locationName": "x-amz-timecustom"
},
"TimeFormat": {
"shape": "TimestampFormatType"
},
"TimeFormatInHeader": {
"shape": "TimestampFormatType",
"location": "header",
"locationName": "x-amz-timeformat"
},
"StructMember": {
"shape": "TimeContainer"
}
}
},
"TimeContainer": {
"type": "structure",
"members": {
"foo": {
"shape": "TimestampType"
},
"bar": {
"shape": "TimestampFormatType"
}
}
},
"TimestampFormatType": {
"timestampFormat": "unixTimestamp",
"type": "timestamp"
},
"TimestampType": {
"type": "timestamp"
}
},
"cases": [
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"TimeArg": 1398796238,
"TimeArgInHeader": 1398796238,
"TimeCustom": 1398796238,
"TimeCustomInHeader": 1398796238,
"TimeFormat": 1398796238,
"TimeFormatInHeader": 1398796238,
"StructMember": {
"foo": 1398796238,
"bar": 1398796238
}
},
"response": {
"status_code": 200,
"headers": {
"x-amz-timearg": "Tue, 29 Apr 2014 18:30:38 GMT",
"x-amz-timecustom": "1398796238",
"x-amz-timeformat": "1398796238"
},
"body": "<OperationNameResponse><StructMember><foo>2014-04-29T18:30:38Z</foo><bar>1398796238</bar></StructMember><TimeArg>2014-04-29T18:30:38Z</TimeArg><TimeCustom>Tue, 29 Apr 2014 18:30:38 GMT</TimeCustom><TimeFormat>1398796238</TimeFormat><RequestId>requestid</RequestId></OperationNameResponse>"
}
}
]
},
{
"description": "Enum",
"metadata": {