// ------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version: 17.0.0.0 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // // ------------------------------------------------------------------------------ namespace ServiceClientGenerator.Generators.Marshallers { using System.Linq; using System.Text; using System.Collections.Generic; using System; /// /// Class to produce the template output /// #line 1 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryResponseUnmarshaller.tt" [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] public partial class AWSQueryResponseUnmarshaller : BaseResponseUnmarshaller { #line hidden /// /// Create the template output /// public override string TransformText() { #line 6 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryResponseUnmarshaller.tt" AddLicenseHeader(); AddCommonUsingStatements(); #line default #line hidden this.Write("namespace "); #line 11 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.Config.Namespace)); #line default #line hidden this.Write(".Model.Internal.MarshallTransformations\r\n{\r\n /// \r\n /// Response U" + "nmarshaller for "); #line 14 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default #line hidden this.Write(" operation\r\n /// \r\n public class "); #line 16 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default #line hidden this.Write(@"ResponseUnmarshaller : XmlResponseUnmarshaller { /// /// Unmarshaller the response from the service to the response class. /// /// /// public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { "); #line 25 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default #line hidden this.Write("Response response = new "); #line 25 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.Operation.Name)); #line default #line hidden this.Write(@"Response(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.IsStartElement) { if(context.TestExpression("""); #line 33 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default #line hidden this.Write(@"Result"", 2)) { UnmarshallResult(context, response); continue; } if (context.TestExpression(""ResponseMetadata"", 2)) { response.ResponseMetadata = ResponseMetadataUnmarshaller.Instance.Unmarshall(context); } } } return response; } "); #line 49 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryResponseUnmarshaller.tt" if (this.Structure == null || this.Structure.Members.Count == 0) { #line default #line hidden this.Write("\t\t[System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Usage\", \"CA1801:Rev" + "iewUnusedParameters\", MessageId=\"response\")]\r\n"); #line 54 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryResponseUnmarshaller.tt" } #line default #line hidden this.Write(" private static void UnmarshallResult(XmlUnmarshallerContext context, "); #line 57 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default #line hidden this.Write(@"Response response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) targetDepth += 2; while (context.ReadAtDepth(originalDepth)) { if (context.IsStartElement || context.IsAttribute) { "); #line 71 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryResponseUnmarshaller.tt" if(this.Structure != null) { if(this.IsWrapped) { #line default #line hidden this.Write(" if ( context.TestExpression(\""); #line 77 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.Structure.MarshallName)); #line default #line hidden this.Write("\", targetDepth))\r\n {\r\n response."); #line 79 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(MemberAccessorFor(this.Structure.Name))); #line default #line hidden this.Write(" = "); #line 79 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.Structure.Name)); #line default #line hidden this.Write("Unmarshaller.Instance.Unmarshall(context);\r\n continue;\r\n " + " }\r\n"); #line 82 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryResponseUnmarshaller.tt" } else { foreach (var member in this.Structure.Members) { var testExpression = GeneratorHelpers.DetermineAWSQueryTestExpression(member); #line default #line hidden this.Write(" if (context.TestExpression(\""); #line 90 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(testExpression)); #line default #line hidden this.Write("\", targetDepth))\r\n {\r\n var unmarshaller" + " = "); #line 92 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.DetermineTypeUnmarshallerInstantiate())); #line default #line hidden this.Write(";\r\n"); #line 93 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryResponseUnmarshaller.tt" if (member.IsMap || member.IsList) { #line default #line hidden this.Write(" var item = unmarshaller.Unmarshall(context);\r\n " + " response."); #line 98 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(MemberAccessorFor(member.PropertyName))); #line default #line hidden this.Write(".Add(item);\r\n"); #line 99 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryResponseUnmarshaller.tt" } else { #line default #line hidden this.Write(" response."); #line 104 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(MemberAccessorFor(member.PropertyName))); #line default #line hidden this.Write(" = unmarshaller.Unmarshall(context);\r\n"); #line 105 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryResponseUnmarshaller.tt" } #line default #line hidden this.Write(" continue;\r\n }\r\n"); #line 110 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryResponseUnmarshaller.tt" } } } #line default #line hidden this.Write(@" } } return; } /// /// Unmarshaller error response to exception. /// /// /// /// /// public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new XmlUnmarshallerContext(streamCopy, false, null)) { "); #line 140 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryResponseUnmarshaller.tt" foreach (var exception in this.Operation.Exceptions) { #line default #line hidden this.Write(" if (errorResponse.Code != null && errorResponse.Code.Equals(\""); #line 144 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(exception.Code)); #line default #line hidden this.Write("\"))\r\n {\r\n return "); #line 146 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(exception.Name)); #line default #line hidden this.Write("Unmarshaller.Instance.Unmarshall(contextCopy, errorResponse);\r\n }\r" + "\n"); #line 148 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryResponseUnmarshaller.tt" } #line default #line hidden this.Write(" }\r\n return new "); #line 152 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.BaseException)); #line default #line hidden this.Write("(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, e" + "rrorResponse.RequestId, statusCode);\r\n }\r\n"); #line 154 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryResponseUnmarshaller.tt" this.AddResponseSingletonMethod(); #line default #line hidden this.Write(" }\r\n}\r\n"); return this.GenerationEnvironment.ToString(); } #line 159 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryResponseUnmarshaller.tt" // if the result fields have been wrapped in a subordinate structure, wire the accessor // to use it when addressing a member string MemberAccessorFor(string memberName) { if (string.IsNullOrEmpty(WrappedResultMember)) return memberName; return string.Concat(WrappedResultMember, ".", memberName); } #line default #line hidden } #line default #line hidden }