Skip to content

Commit

Permalink
Remove custom ResultWrapper property
Browse files Browse the repository at this point in the history
ResultWrapper can be derived from operation names directly.
  • Loading branch information
lsegal committed Mar 13, 2015
1 parent 4f4e828 commit a0112dc
Show file tree
Hide file tree
Showing 22 changed files with 1,105 additions and 1,599 deletions.
7 changes: 3 additions & 4 deletions aws/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ type Request struct {
}

type Operation struct {
Name string
HTTPMethod string
HTTPPath string
ResultWrapper string
Name string
HTTPMethod string
HTTPPath string
}

func NewRequest(service *Service, operation *Operation, params interface{}, data interface{}) *Request {
Expand Down
38 changes: 0 additions & 38 deletions internal/fixtures/protocol/output/query.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,44 +84,6 @@
}
]
},
{
"description": "Custom result wrapper",
"metadata": {
"protocol": "query"
},
"shapes": {
"OutputShape": {
"type": "structure",
"members": {
"Str": {
"shape": "StringType"
}
}
},
"StringType": {
"type": "string"
}
},
"cases": [
{
"given": {
"output": {
"resultWrapper": "Wrapper",
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"Str": "myname"
},
"response": {
"status_code": 200,
"headers": {},
"body": "<OperationNameResponse><Wrapper><Str>myname</Str></Wrapper><ResponseMetadata><RequestId>request-id</RequestId></ResponseMetadata></OperationNameResponse>"
}
}
]
},
{
"description": "Blob",
"metadata": {
Expand Down
1 change: 0 additions & 1 deletion internal/model/api/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ func (c *{{ .API.StructName }}) {{ .ExportedName }}Request(` +
Name: "{{ .Name }}",
{{ if ne .HTTP.Method "" }}HTTPMethod: "{{ .HTTP.Method }}",
{{ end }}{{ if ne .HTTP.RequestURI "" }}HTTPPath: "{{ .HTTP.RequestURI }}",
{{ end }}{{ if ne .OutputRef.ResultWrapper "" }}ResultWrapper: "{{ .OutputRef.ResultWrapper }}",
{{ end }}
}
}
Expand Down
1 change: 0 additions & 1 deletion internal/model/api/shape.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ type ShapeRef struct {
LocationName string
QueryName string
Flattened bool
ResultWrapper string
Streaming bool
XMLAttribute bool
XMLNamespace XMLInfo
Expand Down
2 changes: 1 addition & 1 deletion internal/protocol/ec2query/unmarshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func Unmarshal(r *aws.Request) {
defer r.HTTPResponse.Body.Close()
if r.DataFilled() {
decoder := xml.NewDecoder(r.HTTPResponse.Body)
err := xmlutil.UnmarshalXML(r.Data, decoder, r.Operation.ResultWrapper)
err := xmlutil.UnmarshalXML(r.Data, decoder, "")
if err != nil && err != io.EOF {
r.Error = err
return
Expand Down
2 changes: 1 addition & 1 deletion internal/protocol/query/unmarshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func Unmarshal(r *aws.Request) {
defer r.HTTPResponse.Body.Close()
if r.DataFilled() {
decoder := xml.NewDecoder(r.HTTPResponse.Body)
err := xmlutil.UnmarshalXML(r.Data, decoder, r.Operation.ResultWrapper)
err := xmlutil.UnmarshalXML(r.Data, decoder, r.Operation.Name+"Result")
if err != nil && err != io.EOF {
r.Error = err
return
Expand Down
Loading

0 comments on commit a0112dc

Please sign in to comment.