Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add awsQueryCompatible error code translation support #4597

Merged
merged 14 commits into from Dec 28, 2022
7 changes: 7 additions & 0 deletions private/model/api/api.go
Expand Up @@ -96,8 +96,11 @@ type Metadata struct {
ServiceID string

NoResolveEndpoint bool
AWSQueryCompatible *awsQueryCompatible
}

type awsQueryCompatible struct {}
isaiahvita marked this conversation as resolved.
Show resolved Hide resolved

// ProtocolSettings define how the SDK should handle requests in the context
// of of a protocol.
type ProtocolSettings struct {
Expand Down Expand Up @@ -639,7 +642,11 @@ func newClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint,
{{- if and $.WithGeneratedTypedErrors (gt (len $.ShapeListErrors) 0) }}
{{- $_ := $.AddSDKImport "private/protocol" }}
svc.Handlers.UnmarshalError.PushBackNamed(
{{- if .Metadata.AWSQueryCompatible }}
protocol.NewUnmarshalErrorHandler({{ .ProtocolPackage }}.NewUnmarshalTypedErrorWithOptions(exceptionFromCode, {{ .ProtocolPackage }}.WithQueryCompatibility())).NamedHandler(),
{{- else }}
protocol.NewUnmarshalErrorHandler({{ .ProtocolPackage }}.NewUnmarshalTypedError(exceptionFromCode)).NamedHandler(),
{{- end}}
)
{{- else }}
svc.Handlers.UnmarshalError.PushBackNamed({{ .ProtocolPackage }}.UnmarshalErrorHandler)
Expand Down
75 changes: 75 additions & 0 deletions private/model/api/codegentest/models/awsquerycompatible/api-2.json
@@ -0,0 +1,75 @@

{
"version":"2.0",
"metadata":{
"apiVersion":"2012-11-05",
"awsQueryCompatible": {

},
"endpointPrefix":"awsquerycompatible",
eddy-aws marked this conversation as resolved.
Show resolved Hide resolved
"jsonVersion":"1.1",
"protocol":"json",
"serviceAbbreviation":"AwsQueryCompatible",
"serviceFullName":"AWSQuery Compatible Service",
"serviceId":"AWSQueryCompatible",
"signatureVersion":"v4",
"uid":"awsquerycompatible-2012-11-05",
"xmlNamespace":"http://queue.amazonaws.com/doc/2012-11-05/"
},
"operations":{
"CreateQueue":{
"name":"CreateQueue",
"http":{
"method":"POST",
"requestUri":"/"
},
"input":{"shape":"CreateQueueRequest"},
"output":{
"shape":"CreateQueueResult",
"resultWrapper":"CreateQueueResult"
},
"errors":[
{"shape":"QueueDeletedRecently"},
{"shape":"QueueNameExists"}
]
}
},
"shapes":{
"CreateQueueRequest":{
"type":"structure",
"required":["QueueName"],
"members":{
"QueueName":{"shape":"String"}
}
},
"CreateQueueResult":{
"type":"structure",
"members":{
"QueueUrl":{"shape":"String"}
}
},
"QueueDeletedRecently":{
"type":"structure",
"members":{
},
"error":{
"code":"AWS.SimpleQueueService.QueueDeletedRecently",
"httpStatusCode":400,
"senderFault":true
},
"exception":true
},
"QueueNameExists":{
"type":"structure",
"members":{
},
"error":{
"code":"QueueAlreadyExists",
"httpStatusCode":400,
"senderFault":true
},
"exception":true
},
"String":{"type":"string"}
}
}
290 changes: 290 additions & 0 deletions private/model/api/codegentest/service/awsquerycompatible/api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.