<#@ template language="C#" inherits="BaseResponseUnmarshaller"#> <#@ assembly name="System.Core" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> <# AddLicenseHeader(); AddCommonUsingStatements(); #> using ThirdParty.Json.LitJson; namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations { /// /// Response Unmarshaller for <#=this.UnmarshallerBaseName #> Object /// public class <#=this.UnmarshallerBaseName #>Unmarshaller : IErrorResponseUnmarshaller<<#=this.UnmarshallerBaseName #>, JsonUnmarshallerContext> { /// /// Unmarshaller the response from the service to the response class. /// /// /// public <#=this.UnmarshallerBaseName #> Unmarshall(JsonUnmarshallerContext context) { return this.Unmarshall(context, new Amazon.Runtime.Internal.ErrorResponse()); } /// /// Unmarshaller the response from the service to the response class. /// /// /// /// public <#=this.UnmarshallerBaseName #> Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse) { context.Read(); <# if (this.Config.ServiceModel.IsAwsQueryCompatible) { GenerateAWSQueryCompatibleBlock(); #> <#=this.UnmarshallerBaseName #> unmarshalledObject = new <#=this.UnmarshallerBaseName #>(errorResponse.Message, errorResponse.InnerException, errorType, errorCode, errorResponse.RequestId, errorResponse.StatusCode); <# } else { #> <#=this.UnmarshallerBaseName #> unmarshalledObject = new <#=this.UnmarshallerBaseName #>(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode); <# } #> int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { <# if(this.Structure != null) { foreach (var member in this.Structure.Members) { #> if (context.TestExpression("<#=member.MarshallName#>", targetDepth)) { var unmarshaller = <#= member.DetermineTypeUnmarshallerInstantiate() #>; unmarshalledObject.<#=member.PropertyName#> = unmarshaller.Unmarshall(context); continue; } <# } } #> } return unmarshalledObject; } <# this.AddStructureSingletonMethod(); #> } }