mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-07 22:20:24 +00:00
Update vendored deps, including AWS SDK, openpgp, ftp, ...
This commit is contained in:
+58
-20
@@ -98,7 +98,6 @@ var extraImports = []string{
|
||||
"github.com/aws/aws-sdk-go/private/protocol",
|
||||
"github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil",
|
||||
"github.com/aws/aws-sdk-go/private/util",
|
||||
"github.com/stretchr/testify/assert",
|
||||
}
|
||||
|
||||
func addImports(code string) string {
|
||||
@@ -140,18 +139,25 @@ func Test{{ .OpName }}(t *testing.T) {
|
||||
|
||||
// build request
|
||||
{{ .TestCase.TestSuite.API.ProtocolPackage }}.Build(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect no error, got %v", req.Error)
|
||||
}
|
||||
|
||||
{{ if ne .TestCase.InputTest.Body "" }}// assert body
|
||||
assert.NotNil(t, r.Body)
|
||||
if r.Body == nil {
|
||||
t.Errorf("expect body not to be nil")
|
||||
}
|
||||
{{ .BodyAssertions }}{{ end }}
|
||||
|
||||
{{ if ne .TestCase.InputTest.URI "" }}// assert URL
|
||||
awstesting.AssertURL(t, "https://test{{ .TestCase.InputTest.URI }}", r.URL.String()){{ end }}
|
||||
|
||||
// assert headers
|
||||
{{ range $k, $v := .TestCase.InputTest.Headers }}assert.Equal(t, "{{ $v }}", r.Header.Get("{{ $k }}"))
|
||||
{{ end }}
|
||||
{{ 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)
|
||||
}
|
||||
{{ end }}
|
||||
}
|
||||
`))
|
||||
|
||||
@@ -184,25 +190,40 @@ func (t tplInputTestCaseData) BodyAssertions() string {
|
||||
fmt.Fprintf(code, "awstesting.AssertXML(t, `%s`, util.Trim(string(body)), %s{})",
|
||||
expectedBody, t.TestCase.Given.InputRef.ShapeName)
|
||||
} else {
|
||||
fmt.Fprintf(code, "assert.Equal(t, `%s`, util.Trim(string(body)))",
|
||||
expectedBody)
|
||||
code.WriteString(fmtAssertEqual(fmt.Sprintf("%q", expectedBody), "util.Trim(string(body))"))
|
||||
}
|
||||
case "json", "jsonrpc", "rest-json":
|
||||
if strings.HasPrefix(expectedBody, "{") {
|
||||
fmt.Fprintf(code, "awstesting.AssertJSON(t, `%s`, util.Trim(string(body)))",
|
||||
expectedBody)
|
||||
} else {
|
||||
fmt.Fprintf(code, "assert.Equal(t, `%s`, util.Trim(string(body)))",
|
||||
expectedBody)
|
||||
code.WriteString(fmtAssertEqual(fmt.Sprintf("%q", expectedBody), "util.Trim(string(body))"))
|
||||
}
|
||||
default:
|
||||
fmt.Fprintf(code, "assert.Equal(t, `%s`, util.Trim(string(body)))",
|
||||
expectedBody)
|
||||
code.WriteString(fmtAssertEqual(expectedBody, "util.Trim(string(body))"))
|
||||
}
|
||||
|
||||
return code.String()
|
||||
}
|
||||
|
||||
func fmtAssertEqual(e, a string) string {
|
||||
const format = `if e, a := %s, %s; e != a {
|
||||
t.Errorf("expect %%v, got %%v", e, a)
|
||||
}
|
||||
`
|
||||
|
||||
return fmt.Sprintf(format, e, a)
|
||||
}
|
||||
|
||||
func fmtAssertNil(v string) string {
|
||||
const format = `if e := %s; e != nil {
|
||||
t.Errorf("expect nil, got %%v", e)
|
||||
}
|
||||
`
|
||||
|
||||
return fmt.Sprintf(format, v)
|
||||
}
|
||||
|
||||
var tplOutputTestCase = template.Must(template.New("outputcase").Parse(`
|
||||
func Test{{ .OpName }}(t *testing.T) {
|
||||
svc := New{{ .TestCase.TestSuite.API.StructName }}(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
|
||||
@@ -218,10 +239,14 @@ func Test{{ .OpName }}(t *testing.T) {
|
||||
// unmarshal response
|
||||
{{ .TestCase.TestSuite.API.ProtocolPackage }}.UnmarshalMeta(req)
|
||||
{{ .TestCase.TestSuite.API.ProtocolPackage }}.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
{{ .Assertions }}
|
||||
}
|
||||
`))
|
||||
@@ -304,7 +329,7 @@ func walkMap(m map[string]interface{}) string {
|
||||
str += fmt.Sprintf("%q:", k)
|
||||
switch v.(type) {
|
||||
case bool:
|
||||
str += fmt.Sprintf("%b,\n", v.(bool))
|
||||
str += fmt.Sprintf("%t,\n", v.(bool))
|
||||
case string:
|
||||
str += fmt.Sprintf("%q,\n", v.(string))
|
||||
case int:
|
||||
@@ -434,7 +459,7 @@ func GenerateAssertions(out interface{}, shape *api.Shape, prefix string) string
|
||||
code += GenerateAssertions(v, s, prefix+"[\""+k+"\"]")
|
||||
}
|
||||
} else if shape.Type == "jsonvalue" {
|
||||
code += fmt.Sprintf("reflect.DeepEqual(%s, map[string]interface{}%s)", prefix, walkMap(out.(map[string]interface{})))
|
||||
code += fmt.Sprintf("reflect.DeepEqual(%s, map[string]interface{}%s)\n", prefix, walkMap(out.(map[string]interface{})))
|
||||
} else {
|
||||
for _, k := range keys {
|
||||
v := t[k]
|
||||
@@ -454,16 +479,28 @@ func GenerateAssertions(out interface{}, shape *api.Shape, prefix string) string
|
||||
default:
|
||||
switch shape.Type {
|
||||
case "timestamp":
|
||||
return fmt.Sprintf("assert.Equal(t, time.Unix(%#v, 0).UTC().String(), %s.String())\n", out, prefix)
|
||||
return fmtAssertEqual(
|
||||
fmt.Sprintf("time.Unix(%#v, 0).UTC().String()", out),
|
||||
fmt.Sprintf("%s.String()", prefix),
|
||||
)
|
||||
case "blob":
|
||||
return fmt.Sprintf("assert.Equal(t, %#v, string(%s))\n", out, prefix)
|
||||
return fmtAssertEqual(
|
||||
fmt.Sprintf("%#v", out),
|
||||
fmt.Sprintf("string(%s)", prefix),
|
||||
)
|
||||
case "integer", "long":
|
||||
return fmt.Sprintf("assert.Equal(t, int64(%#v), *%s)\n", out, prefix)
|
||||
return fmtAssertEqual(
|
||||
fmt.Sprintf("int64(%#v)", out),
|
||||
fmt.Sprintf("*%s", prefix),
|
||||
)
|
||||
default:
|
||||
if !reflect.ValueOf(out).IsValid() {
|
||||
return fmt.Sprintf("assert.Nil(t, %s)\n", prefix)
|
||||
return fmtAssertNil(prefix)
|
||||
}
|
||||
return fmt.Sprintf("assert.Equal(t, %#v, *%s)\n", out, prefix)
|
||||
return fmtAssertEqual(
|
||||
fmt.Sprintf("%#v", out),
|
||||
fmt.Sprintf("*%s", prefix),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -480,6 +517,7 @@ func getType(t string) uint {
|
||||
}
|
||||
|
||||
func main() {
|
||||
fmt.Println("Generating test suite", os.Args[1:])
|
||||
out := generateTestSuite(os.Args[1])
|
||||
if len(os.Args) == 3 {
|
||||
f, err := os.Create(os.Args[2])
|
||||
|
||||
+122
-7
@@ -147,19 +147,55 @@
|
||||
"InputShape": {
|
||||
"type": "structure",
|
||||
"members": {
|
||||
"ListArg": {
|
||||
"shape": "ListType"
|
||||
"ListStrings": {
|
||||
"shape": "ListStringType"
|
||||
},
|
||||
"ListBools": {
|
||||
"shape": "ListBoolType"
|
||||
},
|
||||
"ListFloats": {
|
||||
"shape": "ListFloatType"
|
||||
},
|
||||
"ListIntegers": {
|
||||
"shape": "ListIntegerType"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ListType": {
|
||||
"ListStringType": {
|
||||
"type": "list",
|
||||
"member": {
|
||||
"shape": "Strings"
|
||||
"shape": "StringType"
|
||||
}
|
||||
},
|
||||
"Strings": {
|
||||
"ListBoolType": {
|
||||
"type": "list",
|
||||
"member": {
|
||||
"shape": "BoolType"
|
||||
}
|
||||
},
|
||||
"ListFloatType": {
|
||||
"type": "list",
|
||||
"member": {
|
||||
"shape": "FloatType"
|
||||
}
|
||||
},
|
||||
"ListIntegerType": {
|
||||
"type": "list",
|
||||
"member": {
|
||||
"shape": "IntegerType"
|
||||
}
|
||||
},
|
||||
"StringType": {
|
||||
"type": "string"
|
||||
},
|
||||
"BoolType": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"FloatType": {
|
||||
"type": "float"
|
||||
},
|
||||
"IntegerType": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"cases": [
|
||||
@@ -171,15 +207,30 @@
|
||||
"name": "OperationName"
|
||||
},
|
||||
"params": {
|
||||
"ListArg": [
|
||||
"ListStrings": [
|
||||
"foo",
|
||||
"bar",
|
||||
"baz"
|
||||
],
|
||||
"ListBools": [
|
||||
true,
|
||||
false,
|
||||
false
|
||||
],
|
||||
"ListFloats": [
|
||||
1.1,
|
||||
2.718,
|
||||
3.14
|
||||
],
|
||||
"ListIntegers": [
|
||||
0,
|
||||
1,
|
||||
2
|
||||
]
|
||||
},
|
||||
"serialized": {
|
||||
"uri": "/",
|
||||
"body": "Action=OperationName&Version=2014-01-01&ListArg.1=foo&ListArg.2=bar&ListArg.3=baz"
|
||||
"body": "Action=OperationName&Version=2014-01-01&ListStrings.1=foo&ListStrings.2=bar&ListStrings.3=baz&ListBools.1=true&ListBools.2=false&ListBools.3=false&ListFloats.1=1.1&ListFloats.2=2.718&ListFloats.3=3.14&ListIntegers.1=0&ListIntegers.2=1&ListIntegers.3=2"
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -410,5 +461,69 @@
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Enum",
|
||||
"metadata": {
|
||||
"protocol": "ec2",
|
||||
"apiVersion": "2014-01-01"
|
||||
},
|
||||
"shapes": {
|
||||
"InputShape": {
|
||||
"type": "structure",
|
||||
"members": {
|
||||
"FooEnum": {
|
||||
"shape": "EnumType"
|
||||
},
|
||||
"ListEnums": {
|
||||
"shape": "EnumList"
|
||||
}
|
||||
}
|
||||
},
|
||||
"EnumType":{
|
||||
"type":"string",
|
||||
"enum":[
|
||||
"foo",
|
||||
"bar"
|
||||
]
|
||||
},
|
||||
"EnumList":{
|
||||
"type":"list",
|
||||
"member": {"shape": "EnumType"}
|
||||
}
|
||||
},
|
||||
"cases": [
|
||||
{
|
||||
"given": {
|
||||
"input": {
|
||||
"shape": "InputShape"
|
||||
},
|
||||
"name": "OperationName"
|
||||
},
|
||||
"params": {
|
||||
"ListEnums": ["foo", "", "bar"]
|
||||
},
|
||||
"serialized": {
|
||||
"uri": "/",
|
||||
"headers": {},
|
||||
"body": "Action=OperationName&Version=2014-01-01&ListEnums.1=foo&ListEnums.2=&ListEnums.3=bar"
|
||||
}
|
||||
},
|
||||
{
|
||||
"given": {
|
||||
"input": {
|
||||
"shape": "InputShape"
|
||||
},
|
||||
"name": "OperationName"
|
||||
},
|
||||
"params": {
|
||||
},
|
||||
"serialized": {
|
||||
"uri": "/",
|
||||
"headers": {},
|
||||
"body": "Action=OperationName&Version=2014-01-01"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
+70
@@ -535,5 +535,75 @@
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Enum",
|
||||
"metadata": {
|
||||
"protocol": "json",
|
||||
"apiVersion": "2014-01-01"
|
||||
},
|
||||
"shapes": {
|
||||
"InputShape": {
|
||||
"type": "structure",
|
||||
"members": {
|
||||
"FooEnum": {
|
||||
"shape": "EnumType"
|
||||
},
|
||||
"ListEnums": {
|
||||
"shape": "EnumList"
|
||||
}
|
||||
}
|
||||
},
|
||||
"EnumType":{
|
||||
"type":"string",
|
||||
"enum":[
|
||||
"foo",
|
||||
"bar"
|
||||
]
|
||||
},
|
||||
"EnumList":{
|
||||
"type":"list",
|
||||
"member": {"shape": "EnumType"}
|
||||
}
|
||||
},
|
||||
"cases": [
|
||||
{
|
||||
"given": {
|
||||
"input": {
|
||||
"shape": "InputShape"
|
||||
},
|
||||
"http": {
|
||||
"method": "POST"
|
||||
},
|
||||
"name": "OperationName"
|
||||
},
|
||||
"params": {
|
||||
"FooEnum": "foo",
|
||||
"ListEnums": ["foo", "", "bar"]
|
||||
},
|
||||
"serialized": {
|
||||
"uri": "/",
|
||||
"headers": {},
|
||||
"body": "{\"FooEnum\": \"foo\", \"ListEnums\": [\"foo\", \"\", \"bar\"]}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"given": {
|
||||
"input": {
|
||||
"shape": "InputShape"
|
||||
},
|
||||
"http": {
|
||||
"method": "POST"
|
||||
},
|
||||
"name": "OperationName"
|
||||
},
|
||||
"params": {
|
||||
},
|
||||
"serialized": {
|
||||
"uri": "/",
|
||||
"headers": {}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
+133
@@ -553,6 +553,50 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Base64 encoded Blobs nested",
|
||||
"metadata": {
|
||||
"protocol": "query",
|
||||
"apiVersion": "2014-01-01"
|
||||
},
|
||||
"shapes": {
|
||||
"InputShape": {
|
||||
"type": "structure",
|
||||
"members": {
|
||||
"BlobArgs": {
|
||||
"shape": "BlobsType"
|
||||
}
|
||||
}
|
||||
},
|
||||
"BlobsType": {
|
||||
"type": "list",
|
||||
"member": {
|
||||
"shape": "BlobType"
|
||||
},
|
||||
"flattened": true
|
||||
},
|
||||
"BlobType": {
|
||||
"type": "blob"
|
||||
}
|
||||
},
|
||||
"cases": [
|
||||
{
|
||||
"given": {
|
||||
"input": {
|
||||
"shape": "InputShape"
|
||||
},
|
||||
"name": "OperationName"
|
||||
},
|
||||
"params": {
|
||||
"BlobArgs": ["foo"]
|
||||
},
|
||||
"serialized": {
|
||||
"uri": "/",
|
||||
"body": "Action=OperationName&Version=2014-01-01&BlobArgs.1=Zm9v"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Timestamp values",
|
||||
"metadata": {
|
||||
@@ -836,5 +880,94 @@
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Enum",
|
||||
"metadata": {
|
||||
"protocol": "query",
|
||||
"apiVersion": "2014-01-01"
|
||||
},
|
||||
"shapes": {
|
||||
"InputShape": {
|
||||
"type": "structure",
|
||||
"members": {
|
||||
"FooEnum": {
|
||||
"shape": "EnumType"
|
||||
},
|
||||
"ListEnums": {
|
||||
"shape": "EnumList"
|
||||
}
|
||||
}
|
||||
},
|
||||
"EnumType":{
|
||||
"type":"string",
|
||||
"enum":[
|
||||
"foo",
|
||||
"bar"
|
||||
]
|
||||
},
|
||||
"EnumList":{
|
||||
"type":"list",
|
||||
"member": {"shape": "EnumType"}
|
||||
}
|
||||
},
|
||||
"cases": [
|
||||
{
|
||||
"given": {
|
||||
"input": {
|
||||
"shape": "InputShape"
|
||||
},
|
||||
"http": {
|
||||
"method": "POST"
|
||||
},
|
||||
"name": "OperationName"
|
||||
},
|
||||
"params": {
|
||||
"FooEnum": "foo",
|
||||
"ListEnums": ["foo", "", "bar"]
|
||||
},
|
||||
"serialized": {
|
||||
"uri": "/",
|
||||
"headers": {},
|
||||
"body": "Action=OperationName&Version=2014-01-01&FooEnum=foo&ListEnums.member.1=foo&ListEnums.member.2=&ListEnums.member.3=bar"
|
||||
}
|
||||
},
|
||||
{
|
||||
"given": {
|
||||
"input": {
|
||||
"shape": "InputShape"
|
||||
},
|
||||
"http": {
|
||||
"method": "POST"
|
||||
},
|
||||
"name": "OperationName"
|
||||
},
|
||||
"params": {
|
||||
"FooEnum": "foo"
|
||||
},
|
||||
"serialized": {
|
||||
"uri": "/",
|
||||
"headers": {},
|
||||
"body": "Action=OperationName&Version=2014-01-01&FooEnum=foo"
|
||||
}
|
||||
},
|
||||
{
|
||||
"given": {
|
||||
"input": {
|
||||
"shape": "InputShape"
|
||||
},
|
||||
"http": {
|
||||
"method": "POST"
|
||||
}, "name": "OperationName"
|
||||
},
|
||||
"params": {
|
||||
},
|
||||
"serialized": {
|
||||
"uri": "/",
|
||||
"headers": {},
|
||||
"body": "Action=OperationName&Version=2014-01-01"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
+153
-7
@@ -1310,17 +1310,46 @@
|
||||
"shapes": {
|
||||
"InputShape": {
|
||||
"type": "structure",
|
||||
"payload": "Body",
|
||||
"members": {
|
||||
"Attr": {
|
||||
"HeaderField": {
|
||||
"shape": "StringType",
|
||||
"jsonvalue": true,
|
||||
"location": "header",
|
||||
"locationName": "X-Amz-Foo"
|
||||
"jsonvalue": true,
|
||||
"location": "header",
|
||||
"locationName": "X-Amz-Foo"
|
||||
},
|
||||
"QueryField": {
|
||||
"shape": "StringType",
|
||||
"jsonvalue": true,
|
||||
"location": "querystring",
|
||||
"locationName": "Bar"
|
||||
},
|
||||
"Body": {
|
||||
"shape": "BodyStructure"
|
||||
}
|
||||
}
|
||||
},
|
||||
"StringType": {
|
||||
"type": "string"
|
||||
},
|
||||
"ListType": {
|
||||
"type": "list",
|
||||
"member": {
|
||||
"shape": "StringType",
|
||||
"jsonvalue": true
|
||||
}
|
||||
},
|
||||
"BodyStructure": {
|
||||
"type": "structure",
|
||||
"members": {
|
||||
"BodyField": {
|
||||
"shape": "StringType",
|
||||
"jsonvalue": true
|
||||
},
|
||||
"BodyListField": {
|
||||
"shape": "ListType"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"cases": [
|
||||
@@ -1335,12 +1364,16 @@
|
||||
"name": "OperationName"
|
||||
},
|
||||
"params": {
|
||||
"Attr": {"Foo":"Bar"}
|
||||
"HeaderField": {"Foo":"Bar"},
|
||||
"QueryField": {"Foo":"Bar"},
|
||||
"Body": {
|
||||
"BodyField": {"Foo":"Bar"}
|
||||
}
|
||||
},
|
||||
"serialized": {
|
||||
"uri": "/",
|
||||
"uri": "/?Bar=%7B%22Foo%22%3A%22Bar%22%7D",
|
||||
"headers": {"X-Amz-Foo": "eyJGb28iOiJCYXIifQ=="},
|
||||
"body": ""
|
||||
"body": "{\"BodyField\":\"{\\\"Foo\\\":\\\"Bar\\\"}\"}"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -1353,6 +1386,27 @@
|
||||
},
|
||||
"name": "OperationName"
|
||||
},
|
||||
"params": {
|
||||
"Body": {
|
||||
"BodyListField": [{"Foo":"Bar"}]
|
||||
}
|
||||
},
|
||||
"serialized": {
|
||||
"uri": "/",
|
||||
"headers": {},
|
||||
"body": "{\"BodyListField\":[\"{\\\"Foo\\\":\\\"Bar\\\"}\"]}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"given": {
|
||||
"input": {
|
||||
"shape": "InputShape"
|
||||
},
|
||||
"http": {
|
||||
"method": "POST"
|
||||
},
|
||||
"name": "OperationName"
|
||||
},
|
||||
"params": {
|
||||
},
|
||||
"serialized": {
|
||||
@@ -1362,5 +1416,97 @@
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Enum",
|
||||
"metadata": {
|
||||
"protocol": "rest-json",
|
||||
"apiVersion": "2014-01-01"
|
||||
},
|
||||
"shapes": {
|
||||
"InputShape": {
|
||||
"type": "structure",
|
||||
"members": {
|
||||
"HeaderEnum": {
|
||||
"shape": "EnumType",
|
||||
"location": "header",
|
||||
"locationName": "x-amz-enum"
|
||||
},
|
||||
"FooEnum": {
|
||||
"shape": "EnumType"
|
||||
},
|
||||
"QueryFooEnum": {
|
||||
"shape": "EnumType",
|
||||
"location": "querystring",
|
||||
"locationName": "Enum"
|
||||
},
|
||||
"ListEnums": {
|
||||
"shape": "EnumList"
|
||||
},
|
||||
"QueryListEnums": {
|
||||
"shape": "EnumList",
|
||||
"location": "querystring",
|
||||
"locationName": "List"
|
||||
}
|
||||
}
|
||||
},
|
||||
"EnumType":{
|
||||
"type":"string",
|
||||
"enum":[
|
||||
"foo",
|
||||
"bar",
|
||||
"0",
|
||||
"1"
|
||||
]
|
||||
},
|
||||
"EnumList":{
|
||||
"type":"list",
|
||||
"member": {"shape": "EnumType"}
|
||||
}
|
||||
},
|
||||
"cases": [
|
||||
{
|
||||
"given": {
|
||||
"input": {
|
||||
"shape": "InputShape"
|
||||
},
|
||||
"http": {
|
||||
"method": "POST",
|
||||
"requestUri": "/path"
|
||||
},
|
||||
"name": "OperationName"
|
||||
},
|
||||
"params": {
|
||||
"HeaderEnum": "baz",
|
||||
"FooEnum": "foo",
|
||||
"QueryFooEnum": "bar",
|
||||
"ListEnums": ["foo", "", "bar"],
|
||||
"QueryListEnums": ["0", "", "1"]
|
||||
},
|
||||
"serialized": {
|
||||
"uri": "/path?Enum=bar&List=0&List=1&List=",
|
||||
"headers": {"x-amz-enum": "baz"},
|
||||
"body": "{\"FooEnum\": \"foo\", \"ListEnums\": [\"foo\", \"\", \"bar\"]}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"given": {
|
||||
"input": {
|
||||
"shape": "InputShape"
|
||||
},
|
||||
"http": {
|
||||
"method": "POST",
|
||||
"requestUri": "/path"
|
||||
},
|
||||
"name": "OperationName"
|
||||
},
|
||||
"params": {
|
||||
},
|
||||
"serialized": {
|
||||
"uri": "/path",
|
||||
"headers": {}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
+92
@@ -1692,5 +1692,97 @@
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Enum",
|
||||
"metadata": {
|
||||
"protocol": "rest-xml",
|
||||
"apiVersion": "2014-01-01"
|
||||
},
|
||||
"shapes": {
|
||||
"InputShape": {
|
||||
"type": "structure",
|
||||
"members": {
|
||||
"HeaderEnum": {
|
||||
"shape": "EnumType",
|
||||
"location": "header",
|
||||
"locationName": "x-amz-enum"
|
||||
},
|
||||
"FooEnum": {
|
||||
"shape": "EnumType"
|
||||
},
|
||||
"URIFooEnum": {
|
||||
"shape": "EnumType",
|
||||
"location": "uri",
|
||||
"locationName": "URIEnum"
|
||||
},
|
||||
"ListEnums": {
|
||||
"shape": "EnumList"
|
||||
},
|
||||
"URIListEnums": {
|
||||
"shape": "EnumList",
|
||||
"location": "querystring",
|
||||
"locationName": "ListEnums"
|
||||
}
|
||||
}
|
||||
},
|
||||
"EnumType":{
|
||||
"type":"string",
|
||||
"enum":[
|
||||
"foo",
|
||||
"bar",
|
||||
"0",
|
||||
"1"
|
||||
]
|
||||
},
|
||||
"EnumList":{
|
||||
"type":"list",
|
||||
"member": {"shape": "EnumType"}
|
||||
}
|
||||
},
|
||||
"cases": [
|
||||
{
|
||||
"given": {
|
||||
"input": {
|
||||
"shape": "InputShape"
|
||||
},
|
||||
"http": {
|
||||
"method": "POST",
|
||||
"requestUri": "/Enum/{URIEnum}"
|
||||
},
|
||||
"name": "OperationName"
|
||||
},
|
||||
"params": {
|
||||
"HeaderEnum": "baz",
|
||||
"FooEnum": "foo",
|
||||
"URIFooEnum": "bar",
|
||||
"ListEnums": ["foo", "", "bar"],
|
||||
"URIListEnums": ["0", "", "1"]
|
||||
},
|
||||
"serialized": {
|
||||
"uri": "/Enum/bar?ListEnums=0&ListEnums=&ListEnums=1",
|
||||
"headers": {"x-amz-enum": "baz"},
|
||||
"body": "<InputShape><FooEnum>foo</FooEnum><ListEnums><member>foo</member><member></member><member>bar</member></ListEnums></InputShape>"
|
||||
}
|
||||
},
|
||||
{
|
||||
"given": {
|
||||
"input": {
|
||||
"shape": "InputShape"
|
||||
},
|
||||
"http": {
|
||||
"method": "POST",
|
||||
"requestUri": "/path"
|
||||
},
|
||||
"name": "OperationName"
|
||||
},
|
||||
"params": {
|
||||
},
|
||||
"serialized": {
|
||||
"uri": "/path",
|
||||
"headers": {}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
+49
@@ -450,5 +450,54 @@
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Enum output",
|
||||
"metadata": {
|
||||
"protocol": "ec2"
|
||||
},
|
||||
"shapes": {
|
||||
"OutputShape": {
|
||||
"type": "structure",
|
||||
"members": {
|
||||
"FooEnum": {
|
||||
"shape": "EC2EnumType"
|
||||
},
|
||||
"ListEnums": {
|
||||
"shape": "EC2EnumList"
|
||||
}
|
||||
}
|
||||
},
|
||||
"EC2EnumType":{
|
||||
"type":"string",
|
||||
"enum":[
|
||||
"foo",
|
||||
"bar"
|
||||
]
|
||||
},
|
||||
"EC2EnumList":{
|
||||
"type":"list",
|
||||
"member": {"shape": "EC2EnumType"}
|
||||
}
|
||||
},
|
||||
"cases": [
|
||||
{
|
||||
"given": {
|
||||
"output": {
|
||||
"shape": "OutputShape"
|
||||
},
|
||||
"name": "OperationName"
|
||||
},
|
||||
"result": {
|
||||
"FooEnum": "foo",
|
||||
"ListEnums": ["foo", "bar"]
|
||||
},
|
||||
"response": {
|
||||
"status_code": 200,
|
||||
"headers": {},
|
||||
"body": "<OperationNameResponse><FooEnum>foo</FooEnum><ListEnums><member>foo</member><member>bar</member></ListEnums></OperationNameResponse>"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
+49
@@ -365,5 +365,54 @@
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Enum output",
|
||||
"metadata": {
|
||||
"protocol": "json"
|
||||
},
|
||||
"shapes": {
|
||||
"OutputShape": {
|
||||
"type": "structure",
|
||||
"members": {
|
||||
"FooEnum": {
|
||||
"shape": "JSONEnumType"
|
||||
},
|
||||
"ListEnums": {
|
||||
"shape": "JSONEnumList"
|
||||
}
|
||||
}
|
||||
},
|
||||
"JSONEnumType":{
|
||||
"type":"string",
|
||||
"enum":[
|
||||
"foo",
|
||||
"bar"
|
||||
]
|
||||
},
|
||||
"JSONEnumList":{
|
||||
"type":"list",
|
||||
"member": {"shape": "JSONEnumType"}
|
||||
}
|
||||
},
|
||||
"cases": [
|
||||
{
|
||||
"given": {
|
||||
"output": {
|
||||
"shape": "OutputShape"
|
||||
},
|
||||
"name": "OperationName"
|
||||
},
|
||||
"result": {
|
||||
"FooEnum": "foo",
|
||||
"ListEnums": ["foo", "bar"]
|
||||
},
|
||||
"response": {
|
||||
"status_code": 200,
|
||||
"headers": {},
|
||||
"body": "{\"FooEnum\": \"foo\", \"ListEnums\": [\"foo\", \"bar\"]}"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
+49
@@ -772,5 +772,54 @@
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Enum output",
|
||||
"metadata": {
|
||||
"protocol": "query"
|
||||
},
|
||||
"shapes": {
|
||||
"OutputShape": {
|
||||
"type": "structure",
|
||||
"members": {
|
||||
"FooEnum": {
|
||||
"shape": "EC2EnumType"
|
||||
},
|
||||
"ListEnums": {
|
||||
"shape": "EC2EnumList"
|
||||
}
|
||||
}
|
||||
},
|
||||
"EC2EnumType":{
|
||||
"type":"string",
|
||||
"enum":[
|
||||
"foo",
|
||||
"bar"
|
||||
]
|
||||
},
|
||||
"EC2EnumList":{
|
||||
"type":"list",
|
||||
"member": {"shape": "EC2EnumType"}
|
||||
}
|
||||
},
|
||||
"cases": [
|
||||
{
|
||||
"given": {
|
||||
"output": {
|
||||
"shape": "OutputShape"
|
||||
},
|
||||
"name": "OperationName"
|
||||
},
|
||||
"result": {
|
||||
"FooEnum": "foo",
|
||||
"ListEnums": ["foo", "bar"]
|
||||
},
|
||||
"response": {
|
||||
"status_code": 200,
|
||||
"headers": {},
|
||||
"body": "<OperationNameResponse><FooEnum>foo</FooEnum><ListEnums><member>foo</member><member>bar</member></ListEnums></OperationNameResponse>"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
+131
-5
@@ -614,16 +614,30 @@
|
||||
"OutputShape": {
|
||||
"type": "structure",
|
||||
"members": {
|
||||
"Attr": {
|
||||
"HeaderField": {
|
||||
"shape": "StringType",
|
||||
"jsonvalue": true,
|
||||
"location": "header",
|
||||
"locationName": "X-Amz-Foo"
|
||||
"jsonvalue": true,
|
||||
"location": "header",
|
||||
"locationName": "X-Amz-Foo"
|
||||
},
|
||||
"BodyField":{
|
||||
"shape": "StringType",
|
||||
"jsonvalue": true
|
||||
},
|
||||
"BodyListField": {
|
||||
"shape": "ListType"
|
||||
}
|
||||
}
|
||||
},
|
||||
"StringType": {
|
||||
"type": "string"
|
||||
},
|
||||
"ListType": {
|
||||
"type": "list",
|
||||
"member": {
|
||||
"shape": "StringType",
|
||||
"jsonvalue": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"cases": [
|
||||
@@ -635,14 +649,126 @@
|
||||
"name": "OperationName"
|
||||
},
|
||||
"result": {
|
||||
"Attr": {"Foo":"Bar"}
|
||||
"HeaderField": {"Foo":"Bar"},
|
||||
"BodyField": {"Foo":"Bar"}
|
||||
},
|
||||
"response": {
|
||||
"status_code": 200,
|
||||
"headers": {"X-Amz-Foo": "eyJGb28iOiJCYXIifQ=="},
|
||||
"body": "{\"BodyField\":\"{\\\"Foo\\\":\\\"Bar\\\"}\"}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"given": {
|
||||
"output": {
|
||||
"shape": "OutputShape"
|
||||
},
|
||||
"name": "OperationName"
|
||||
},
|
||||
"result": {
|
||||
"BodyListField": [{"Foo":"Bar"}]
|
||||
},
|
||||
"response": {
|
||||
"status_code": 200,
|
||||
"headers": {},
|
||||
"body": "{\"BodyListField\":[\"{\\\"Foo\\\":\\\"Bar\\\"}\"]}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"given": {
|
||||
"output": {
|
||||
"shape": "OutputShape"
|
||||
},
|
||||
"name": "OperationName"
|
||||
},
|
||||
"result": {
|
||||
},
|
||||
"response": {
|
||||
"status_code": 200,
|
||||
"headers": {},
|
||||
"body": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Enum",
|
||||
"metadata": {
|
||||
"protocol": "rest-json",
|
||||
"apiVersion": "2014-01-01"
|
||||
},
|
||||
"shapes": {
|
||||
"OutputShape": {
|
||||
"type": "structure",
|
||||
"members": {
|
||||
"HeaderEnum": {
|
||||
"shape": "RESTJSONEnumType",
|
||||
"location": "header",
|
||||
"locationName": "x-amz-enum"
|
||||
},
|
||||
"FooEnum": {
|
||||
"shape": "RESTJSONEnumType"
|
||||
},
|
||||
"ListEnums": {
|
||||
"shape": "EnumList"
|
||||
}
|
||||
}
|
||||
},
|
||||
"RESTJSONEnumType":{
|
||||
"type":"string",
|
||||
"enum":[
|
||||
"foo",
|
||||
"bar",
|
||||
"0",
|
||||
"1"
|
||||
]
|
||||
},
|
||||
"EnumList":{
|
||||
"type":"list",
|
||||
"member": {"shape": "RESTJSONEnumType"}
|
||||
}
|
||||
},
|
||||
"cases": [
|
||||
{
|
||||
"given": {
|
||||
"output": {
|
||||
"shape": "OutputShape"
|
||||
},
|
||||
"http": {
|
||||
"method": "POST",
|
||||
"requestUri": "/path"
|
||||
},
|
||||
"name": "OperationName"
|
||||
},
|
||||
"result": {
|
||||
"HeaderEnum": "baz",
|
||||
"FooEnum": "foo",
|
||||
"ListEnums": ["foo", "bar"]
|
||||
},
|
||||
"response": {
|
||||
"status_code": 200,
|
||||
"headers": {"x-amz-enum": "baz"},
|
||||
"body": "{\"FooEnum\": \"foo\", \"ListEnums\": [\"foo\", \"bar\"]}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"given": {
|
||||
"input": {
|
||||
"shape": "OutputShape"
|
||||
},
|
||||
"http": {
|
||||
"method": "POST",
|
||||
"requestUri": "/path"
|
||||
},
|
||||
"name": "OperationName"
|
||||
},
|
||||
"result": {
|
||||
},
|
||||
"response": {
|
||||
"status_code": 200,
|
||||
"headers": {}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
+161
@@ -716,5 +716,166 @@
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Enum",
|
||||
"metadata": {
|
||||
"protocol": "rest-xml"
|
||||
},
|
||||
"shapes": {
|
||||
"OutputShape": {
|
||||
"type": "structure",
|
||||
"members": {
|
||||
"HeaderEnum": {
|
||||
"shape": "RESTJSONEnumType",
|
||||
"location": "header",
|
||||
"locationName": "x-amz-enum"
|
||||
},
|
||||
"FooEnum": {
|
||||
"shape": "RESTJSONEnumType"
|
||||
},
|
||||
"ListEnums": {
|
||||
"shape": "EnumList"
|
||||
}
|
||||
}
|
||||
},
|
||||
"RESTJSONEnumType":{
|
||||
"type":"string",
|
||||
"enum":[
|
||||
"foo",
|
||||
"bar",
|
||||
"0",
|
||||
"1"
|
||||
]
|
||||
},
|
||||
"EnumList":{
|
||||
"type":"list",
|
||||
"member": {"shape": "RESTJSONEnumType"}
|
||||
}
|
||||
},
|
||||
"cases": [
|
||||
{
|
||||
"given": {
|
||||
"output": {
|
||||
"shape": "OutputShape"
|
||||
},
|
||||
"http": {
|
||||
"method": "POST",
|
||||
"requestUri": "/path"
|
||||
},
|
||||
"name": "OperationName"
|
||||
},
|
||||
"result": {
|
||||
"HeaderEnum": "baz",
|
||||
"FooEnum": "foo",
|
||||
"ListEnums": ["0", "1"]
|
||||
},
|
||||
"response": {
|
||||
"status_code": 200,
|
||||
"headers": {"x-amz-enum": "baz"},
|
||||
"body": "<OperationNameResponse><FooEnum>foo</FooEnum><ListEnums><member>0</member><member>1</member></ListEnums></OperationNameResponse>"
|
||||
}
|
||||
},
|
||||
{
|
||||
"given": {
|
||||
"input": {
|
||||
"shape": "OutputShape"
|
||||
},
|
||||
"http": {
|
||||
"method": "POST",
|
||||
"requestUri": "/path"
|
||||
},
|
||||
"name": "OperationName"
|
||||
},
|
||||
"result": {
|
||||
},
|
||||
"response": {
|
||||
"status_code": 200,
|
||||
"headers": {}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "XML Attributes",
|
||||
"metadata": {
|
||||
"protocol": "rest-xml"
|
||||
},
|
||||
"shapes": {
|
||||
"OutputShape":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"ListItems":{
|
||||
"shape":"ListItemsShape",
|
||||
"locationName":"ItemsList"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ListItemsShape":{
|
||||
"type":"list",
|
||||
"member":{
|
||||
"shape":"ItemShape",
|
||||
"locationName":"Item"
|
||||
}
|
||||
},
|
||||
"ItemShape":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"ItemDetail":{"shape":"ItemDetailShape"}
|
||||
}
|
||||
},
|
||||
"ItemDetailShape":{
|
||||
"type":"structure",
|
||||
"required":["Type"],
|
||||
"members":{
|
||||
"ID":{"shape":"StringShape"},
|
||||
"Type":{
|
||||
"shape":"ItemType",
|
||||
"locationName":"xsi:type",
|
||||
"xmlAttribute":true
|
||||
}
|
||||
},
|
||||
"xmlNamespace":{
|
||||
"prefix":"xsi",
|
||||
"uri":"http://www.w3.org/2001/XMLSchema-instance"
|
||||
}
|
||||
},
|
||||
"StringShape":{
|
||||
"type":"string"
|
||||
},
|
||||
"ItemType":{
|
||||
"type":"string",
|
||||
"enum":[
|
||||
"Type1",
|
||||
"Type2",
|
||||
"Type3"
|
||||
]
|
||||
}
|
||||
},
|
||||
"cases": [
|
||||
{
|
||||
"given": {
|
||||
"output": {
|
||||
"shape": "OutputShape"
|
||||
},
|
||||
"http": {
|
||||
"method": "GET",
|
||||
"requestUri": "/path"
|
||||
},
|
||||
"name": "OperationName"
|
||||
},
|
||||
"result": {
|
||||
"ListItems": [
|
||||
{"ItemDetail": {"ID": "id1", "Type": "Type1"}},
|
||||
{"ItemDetail": {"ID": "id2", "Type": "Type2"}},
|
||||
{"ItemDetail": {"ID": "id3", "Type": "Type3"}}
|
||||
]
|
||||
},
|
||||
"response": {
|
||||
"status_code": 200,
|
||||
"body": "<SomeOutputDoc xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\"><ItemsList><Item><ItemDetail xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"Type1\"><ID>id1</ID></ItemDetail></Item><Item><ItemDetail xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"Type2\"><ID>id2</ID></ItemDetail></Item><Item><ItemDetail xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"Type3\"><ID>id3</ID></ItemDetail></Item></ItemsList></SomeOutputDoc>"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user