Skip to content

Commit 86ff816

Browse files
Add CBOR Unmarshaller generators placeholders
1 parent 6469a3f commit 86ff816

11 files changed

+1577
-55
lines changed
Lines changed: 238 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,238 @@
1+
// ------------------------------------------------------------------------------
2+
// <auto-generated>
3+
// This code was generated by a tool.
4+
// Runtime Version: 17.0.0.0
5+
//
6+
// Changes to this file may cause incorrect behavior and will be lost if
7+
// the code is regenerated.
8+
// </auto-generated>
9+
// ------------------------------------------------------------------------------
10+
namespace ServiceClientGenerator.Generators.Marshallers
11+
{
12+
using System.Linq;
13+
using System.Text;
14+
using System.Collections.Generic;
15+
using System;
16+
17+
/// <summary>
18+
/// Class to produce the template output
19+
/// </summary>
20+
21+
#line 1 "C:\repos\aws-sdk-net-v4\generator\ServiceClientGeneratorLib\Generators\Marshallers\CborExceptionUnmarshaller.tt"
22+
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")]
23+
public partial class CborExceptionUnmarshaller : BaseResponseUnmarshaller
24+
{
25+
#line hidden
26+
/// <summary>
27+
/// Create the template output
28+
/// </summary>
29+
public override string TransformText()
30+
{
31+
32+
#line 6 "C:\repos\aws-sdk-net-v4\generator\ServiceClientGeneratorLib\Generators\Marshallers\CborExceptionUnmarshaller.tt"
33+
34+
AddLicenseHeader();
35+
36+
AddCommonUsingStatements();
37+
38+
39+
#line default
40+
#line hidden
41+
this.Write("using System.Text.Json;\r\nusing Amazon.Util;\r\n#pragma warning disable CS0612,CS061" +
42+
"8\r\nnamespace ");
43+
44+
#line 14 "C:\repos\aws-sdk-net-v4\generator\ServiceClientGeneratorLib\Generators\Marshallers\CborExceptionUnmarshaller.tt"
45+
this.Write(this.ToStringHelper.ToStringWithCulture(this.Config.Namespace));
46+
47+
#line default
48+
#line hidden
49+
this.Write(".Model.Internal.MarshallTransformations\r\n{\r\n /// <summary>\r\n /// Response U" +
50+
"nmarshaller for ");
51+
52+
#line 17 "C:\repos\aws-sdk-net-v4\generator\ServiceClientGeneratorLib\Generators\Marshallers\CborExceptionUnmarshaller.tt"
53+
this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName));
54+
55+
#line default
56+
#line hidden
57+
this.Write(" Object\r\n /// </summary> \r\n public class ");
58+
59+
#line 19 "C:\repos\aws-sdk-net-v4\generator\ServiceClientGeneratorLib\Generators\Marshallers\CborExceptionUnmarshaller.tt"
60+
this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName));
61+
62+
#line default
63+
#line hidden
64+
this.Write("Unmarshaller : IJsonErrorResponseUnmarshaller<");
65+
66+
#line 19 "C:\repos\aws-sdk-net-v4\generator\ServiceClientGeneratorLib\Generators\Marshallers\CborExceptionUnmarshaller.tt"
67+
this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName));
68+
69+
#line default
70+
#line hidden
71+
this.Write(@", JsonUnmarshallerContext>
72+
{
73+
/// <summary>
74+
/// Unmarshaller the response from the service to the response class.
75+
/// </summary>
76+
/// <param name=""context""></param>
77+
/// <param name=""reader""></param>
78+
/// <returns></returns>
79+
public ");
80+
81+
#line 27 "C:\repos\aws-sdk-net-v4\generator\ServiceClientGeneratorLib\Generators\Marshallers\CborExceptionUnmarshaller.tt"
82+
this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName));
83+
84+
#line default
85+
#line hidden
86+
this.Write(@" Unmarshall(JsonUnmarshallerContext context, ref StreamingUtf8JsonReader reader)
87+
{
88+
return this.Unmarshall(context, new Amazon.Runtime.Internal.ErrorResponse(), ref reader);
89+
}
90+
91+
/// <summary>
92+
/// Unmarshaller the response from the service to the response class.
93+
/// </summary>
94+
/// <param name=""context""></param>
95+
/// <param name=""errorResponse""></param>
96+
/// <param name=""reader""></param>
97+
/// <returns></returns>
98+
public ");
99+
100+
#line 39 "C:\repos\aws-sdk-net-v4\generator\ServiceClientGeneratorLib\Generators\Marshallers\CborExceptionUnmarshaller.tt"
101+
this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName));
102+
103+
#line default
104+
#line hidden
105+
this.Write(@" Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse, ref StreamingUtf8JsonReader reader)
106+
{
107+
if (context.Stream.Length > 0)
108+
{
109+
context.Read(ref reader);
110+
}
111+
112+
");
113+
114+
#line 46 "C:\repos\aws-sdk-net-v4\generator\ServiceClientGeneratorLib\Generators\Marshallers\CborExceptionUnmarshaller.tt"
115+
116+
if (this.Config.ServiceModel.IsAwsQueryCompatible)
117+
{
118+
GenerateAWSQueryCompatibleBlock();
119+
120+
121+
#line default
122+
#line hidden
123+
this.Write(" ");
124+
125+
#line 51 "C:\repos\aws-sdk-net-v4\generator\ServiceClientGeneratorLib\Generators\Marshallers\CborExceptionUnmarshaller.tt"
126+
this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName));
127+
128+
#line default
129+
#line hidden
130+
this.Write(" unmarshalledObject = new ");
131+
132+
#line 51 "C:\repos\aws-sdk-net-v4\generator\ServiceClientGeneratorLib\Generators\Marshallers\CborExceptionUnmarshaller.tt"
133+
this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName));
134+
135+
#line default
136+
#line hidden
137+
this.Write("(errorResponse.Message, errorResponse.InnerException,\r\n errorType," +
138+
" errorCode, errorResponse.RequestId, errorResponse.StatusCode);\r\n");
139+
140+
#line 53 "C:\repos\aws-sdk-net-v4\generator\ServiceClientGeneratorLib\Generators\Marshallers\CborExceptionUnmarshaller.tt"
141+
142+
}
143+
else
144+
{
145+
146+
147+
#line default
148+
#line hidden
149+
this.Write(" ");
150+
151+
#line 58 "C:\repos\aws-sdk-net-v4\generator\ServiceClientGeneratorLib\Generators\Marshallers\CborExceptionUnmarshaller.tt"
152+
this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName));
153+
154+
#line default
155+
#line hidden
156+
this.Write(" unmarshalledObject = new ");
157+
158+
#line 58 "C:\repos\aws-sdk-net-v4\generator\ServiceClientGeneratorLib\Generators\Marshallers\CborExceptionUnmarshaller.tt"
159+
this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName));
160+
161+
#line default
162+
#line hidden
163+
this.Write("(errorResponse.Message, errorResponse.InnerException,\r\n errorRespo" +
164+
"nse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode)" +
165+
";\r\n");
166+
167+
#line 60 "C:\repos\aws-sdk-net-v4\generator\ServiceClientGeneratorLib\Generators\Marshallers\CborExceptionUnmarshaller.tt"
168+
169+
}
170+
171+
172+
#line default
173+
#line hidden
174+
this.Write(" \r\n int targetDepth = context.CurrentDepth;\r\n if (co" +
175+
"ntext.Stream.Length > 0)\r\n {\r\n while (context.ReadAtDe" +
176+
"pth(targetDepth, ref reader))\r\n {\r\n");
177+
178+
#line 69 "C:\repos\aws-sdk-net-v4\generator\ServiceClientGeneratorLib\Generators\Marshallers\CborExceptionUnmarshaller.tt"
179+
180+
if(this.Structure != null)
181+
{
182+
foreach (var member in this.Structure.Members)
183+
{
184+
185+
186+
#line default
187+
#line hidden
188+
this.Write(" if (context.TestExpression(\"");
189+
190+
#line 75 "C:\repos\aws-sdk-net-v4\generator\ServiceClientGeneratorLib\Generators\Marshallers\CborExceptionUnmarshaller.tt"
191+
this.Write(this.ToStringHelper.ToStringWithCulture(member.MarshallName));
192+
193+
#line default
194+
#line hidden
195+
this.Write("\", targetDepth))\r\n {\r\n var unmarshaller" +
196+
" = ");
197+
198+
#line 77 "C:\repos\aws-sdk-net-v4\generator\ServiceClientGeneratorLib\Generators\Marshallers\CborExceptionUnmarshaller.tt"
199+
this.Write(this.ToStringHelper.ToStringWithCulture(member.DetermineTypeUnmarshallerInstantiate()));
200+
201+
#line default
202+
#line hidden
203+
this.Write(";\r\n unmarshalledObject.");
204+
205+
#line 78 "C:\repos\aws-sdk-net-v4\generator\ServiceClientGeneratorLib\Generators\Marshallers\CborExceptionUnmarshaller.tt"
206+
this.Write(this.ToStringHelper.ToStringWithCulture(member.PropertyName));
207+
208+
#line default
209+
#line hidden
210+
this.Write(" = unmarshaller.Unmarshall(context, ref reader);\r\n continu" +
211+
"e;\r\n }\r\n");
212+
213+
#line 81 "C:\repos\aws-sdk-net-v4\generator\ServiceClientGeneratorLib\Generators\Marshallers\CborExceptionUnmarshaller.tt"
214+
215+
}
216+
}
217+
218+
219+
#line default
220+
#line hidden
221+
this.Write(" }\r\n }\r\n \r\n return unmarshalledObje" +
222+
"ct;\r\n }\r\n\r\n");
223+
224+
#line 91 "C:\repos\aws-sdk-net-v4\generator\ServiceClientGeneratorLib\Generators\Marshallers\CborExceptionUnmarshaller.tt"
225+
226+
this.AddStructureSingletonMethod();
227+
228+
229+
#line default
230+
#line hidden
231+
this.Write(" }\r\n}");
232+
return this.GenerationEnvironment.ToString();
233+
}
234+
}
235+
236+
#line default
237+
#line hidden
238+
}
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<#@ template language="C#" inherits="BaseResponseUnmarshaller"#>
2+
<#@ assembly name="System.Core" #>
3+
<#@ import namespace="System.Linq" #>
4+
<#@ import namespace="System.Text" #>
5+
<#@ import namespace="System.Collections.Generic" #>
6+
<#
7+
AddLicenseHeader();
8+
9+
AddCommonUsingStatements();
10+
#>
11+
using System.Text.Json;
12+
using Amazon.Util;
13+
#pragma warning disable CS0612,CS0618
14+
namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations
15+
{
16+
/// <summary>
17+
/// Response Unmarshaller for <#=this.UnmarshallerBaseName #> Object
18+
/// </summary>
19+
public class <#=this.UnmarshallerBaseName #>Unmarshaller : IJsonErrorResponseUnmarshaller<<#=this.UnmarshallerBaseName #>, JsonUnmarshallerContext>
20+
{
21+
/// <summary>
22+
/// Unmarshaller the response from the service to the response class.
23+
/// </summary>
24+
/// <param name="context"></param>
25+
/// <param name="reader"></param>
26+
/// <returns></returns>
27+
public <#=this.UnmarshallerBaseName #> Unmarshall(JsonUnmarshallerContext context, ref StreamingUtf8JsonReader reader)
28+
{
29+
return this.Unmarshall(context, new Amazon.Runtime.Internal.ErrorResponse(), ref reader);
30+
}
31+
32+
/// <summary>
33+
/// Unmarshaller the response from the service to the response class.
34+
/// </summary>
35+
/// <param name="context"></param>
36+
/// <param name="errorResponse"></param>
37+
/// <param name="reader"></param>
38+
/// <returns></returns>
39+
public <#=this.UnmarshallerBaseName #> Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse, ref StreamingUtf8JsonReader reader)
40+
{
41+
if (context.Stream.Length > 0)
42+
{
43+
context.Read(ref reader);
44+
}
45+
46+
<#
47+
if (this.Config.ServiceModel.IsAwsQueryCompatible)
48+
{
49+
GenerateAWSQueryCompatibleBlock();
50+
#>
51+
<#=this.UnmarshallerBaseName #> unmarshalledObject = new <#=this.UnmarshallerBaseName #>(errorResponse.Message, errorResponse.InnerException,
52+
errorType, errorCode, errorResponse.RequestId, errorResponse.StatusCode);
53+
<#
54+
}
55+
else
56+
{
57+
#>
58+
<#=this.UnmarshallerBaseName #> unmarshalledObject = new <#=this.UnmarshallerBaseName #>(errorResponse.Message, errorResponse.InnerException,
59+
errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
60+
<#
61+
}
62+
#>
63+
64+
int targetDepth = context.CurrentDepth;
65+
if (context.Stream.Length > 0)
66+
{
67+
while (context.ReadAtDepth(targetDepth, ref reader))
68+
{
69+
<#
70+
if(this.Structure != null)
71+
{
72+
foreach (var member in this.Structure.Members)
73+
{
74+
#>
75+
if (context.TestExpression("<#=member.MarshallName#>", targetDepth))
76+
{
77+
var unmarshaller = <#= member.DetermineTypeUnmarshallerInstantiate() #>;
78+
unmarshalledObject.<#=member.PropertyName#> = unmarshaller.Unmarshall(context, ref reader);
79+
continue;
80+
}
81+
<#
82+
}
83+
}
84+
#>
85+
}
86+
}
87+
88+
return unmarshalledObject;
89+
}
90+
91+
<#
92+
this.AddStructureSingletonMethod();
93+
#>
94+
}
95+
}

0 commit comments

Comments
 (0)