Skip to content

Commit f664606

Browse files
Generate CloudWatchLogs and TranscribeStreaming services with CBOR protocol
1 parent e204e67 commit f664606

File tree

419 files changed

+13298
-11370
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

419 files changed

+13298
-11370
lines changed

generator/ServiceModels/logs/logs-2014-03-28.normal.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"endpointPrefix":"logs",
66
"jsonVersion":"1.1",
77
"protocol":"json",
8-
"protocols":["json"],
8+
"protocols":["smithy-rpc-v2-cbor"],
99
"serviceFullName":"Amazon CloudWatch Logs",
1010
"serviceId":"CloudWatch Logs",
1111
"signatureVersion":"v4",

generator/ServiceModels/transcribe-streaming/transcribe-streaming-2017-10-26.normal.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"endpointPrefix":"transcribestreaming",
66
"protocol":"rest-json",
77
"protocolSettings":{"h2":"eventstream"},
8-
"protocols":["rest-json"],
8+
"protocols":["smithy-rpc-v2-cbor"],
9+
"targetPrefix":"TranscribeStreaming_20140328",
910
"serviceFullName":"Amazon Transcribe Streaming Service",
1011
"serviceId":"Transcribe Streaming",
1112
"signatureVersion":"v4",

sdk/src/Services/CloudWatchLogs/AWSSDK.CloudWatchLogs.NetFramework.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262

6363
<ItemGroup>
6464
<ProjectReference Include="../../Core/AWSSDK.Core.NetFramework.csproj"/>
65+
<ProjectReference Include="../../../../extensions/src/AWSSDK.Extensions.CborProtocol/AWSSDK.Extensions.CborProtocol.NetFramework.csproj"/>
6566
</ItemGroup>
6667

6768
<ItemGroup Condition="$(RunAnalyzersDuringBuild)">

sdk/src/Services/CloudWatchLogs/AWSSDK.CloudWatchLogs.NetStandard.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<SignAssembly>true</SignAssembly>
2323
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
2424

25+
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
2526
<NoWarn>CA1822</NoWarn>
2627
</PropertyGroup>
2728
<!-- Async Enumerable Compatibility -->
@@ -72,6 +73,7 @@
7273

7374
<ItemGroup>
7475
<ProjectReference Include="../../Core/AWSSDK.Core.NetStandard.csproj"/>
76+
<ProjectReference Include="../../../../extensions/src/AWSSDK.Extensions.CborProtocol/AWSSDK.Extensions.CborProtocol.NetStandard.csproj"/>
7577
</ItemGroup>
7678

7779
<ItemGroup Condition="$(RunAnalyzersDuringBuild)">

sdk/src/Services/CloudWatchLogs/CloudWatchLogs.sln

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AWSSDK.Core.NetFramework",
88
EndProject
99
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AWSSDK.Core.NetStandard", "../../Core/AWSSDK.Core.NetStandard.csproj", "{A855B58E-ED32-40AE-AE8F-054F448B9F2C}"
1010
EndProject
11+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AWSSDK.Extensions.CborProtocol.NetFramework", "../../../../extensions/src/AWSSDK.Extensions.CborProtocol/AWSSDK.Extensions.CborProtocol.NetFramework.csproj", "{957847D9-235C-4E84-BC47-30FEF3C5ED89}"
12+
EndProject
13+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AWSSDK.Extensions.CborProtocol.NetStandard", "../../../../extensions/src/AWSSDK.Extensions.CborProtocol/AWSSDK.Extensions.CborProtocol.NetStandard.csproj", "{DAAA5B0F-1DC6-477B-906A-1F67A387334F}"
14+
EndProject
1115
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Services", "Services", "{939EC5C2-8345-43E2-8F97-72EEEBEEA0AB}"
1216
EndProject
1317
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CloudWatchLogs", "CloudWatchLogs", "{0810B0A1-10E6-FF46-EE4E-A184162081C7}"
@@ -60,6 +64,14 @@ Global
6064
{A855B58E-ED32-40AE-AE8F-054F448B9F2C}.Debug|Any CPU.Build.0 = Debug|Any CPU
6165
{A855B58E-ED32-40AE-AE8F-054F448B9F2C}.Release|Any CPU.ActiveCfg = Release|Any CPU
6266
{A855B58E-ED32-40AE-AE8F-054F448B9F2C}.Release|Any CPU.Build.0 = Release|Any CPU
67+
{957847D9-235C-4E84-BC47-30FEF3C5ED89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
68+
{957847D9-235C-4E84-BC47-30FEF3C5ED89}.Debug|Any CPU.Build.0 = Debug|Any CPU
69+
{957847D9-235C-4E84-BC47-30FEF3C5ED89}.Release|Any CPU.ActiveCfg = Release|Any CPU
70+
{957847D9-235C-4E84-BC47-30FEF3C5ED89}.Release|Any CPU.Build.0 = Release|Any CPU
71+
{DAAA5B0F-1DC6-477B-906A-1F67A387334F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
72+
{DAAA5B0F-1DC6-477B-906A-1F67A387334F}.Debug|Any CPU.Build.0 = Debug|Any CPU
73+
{DAAA5B0F-1DC6-477B-906A-1F67A387334F}.Release|Any CPU.ActiveCfg = Release|Any CPU
74+
{DAAA5B0F-1DC6-477B-906A-1F67A387334F}.Release|Any CPU.Build.0 = Release|Any CPU
6375
{CCC0D3A9-0A83-4CAF-85CD-BE8834822D96}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
6476
{CCC0D3A9-0A83-4CAF-85CD-BE8834822D96}.Debug|Any CPU.Build.0 = Debug|Any CPU
6577
{CCC0D3A9-0A83-4CAF-85CD-BE8834822D96}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -127,6 +139,8 @@ Global
127139
GlobalSection(NestedProjects) = preSolution
128140
{7DE3AFA0-1B2D-41B1-82BD-120B8B210B43} = {9863FCB3-BFA4-4B9C-B8F6-302BA5F660B8}
129141
{A855B58E-ED32-40AE-AE8F-054F448B9F2C} = {9863FCB3-BFA4-4B9C-B8F6-302BA5F660B8}
142+
{957847D9-235C-4E84-BC47-30FEF3C5ED89} = {9863FCB3-BFA4-4B9C-B8F6-302BA5F660B8}
143+
{DAAA5B0F-1DC6-477B-906A-1F67A387334F} = {9863FCB3-BFA4-4B9C-B8F6-302BA5F660B8}
130144
{0810B0A1-10E6-FF46-EE4E-A184162081C7} = {939EC5C2-8345-43E2-8F97-72EEEBEEA0AB}
131145
{CCC0D3A9-0A83-4CAF-85CD-BE8834822D96} = {0810B0A1-10E6-FF46-EE4E-A184162081C7}
132146
{73D50B75-AA9F-469F-A2BB-DFD51160CE5D} = {0810B0A1-10E6-FF46-EE4E-A184162081C7}

sdk/src/Services/CloudWatchLogs/Generated/Model/FieldsData.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
using Amazon.Runtime;
2727
using Amazon.Runtime.Internal;
28+
using Amazon.Extensions.CborProtocol.Internal.Transform;
2829
using Amazon.Runtime.EventStreams;
2930
using Amazon.Runtime.EventStreams.Internal;
3031
using Amazon.CloudWatchLogs.Model.Internal.MarshallTransformations;

sdk/src/Services/CloudWatchLogs/Generated/Model/GetLogObjectResponseStream.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
using Amazon.Runtime;
2727
using Amazon.Runtime.Internal;
28+
using Amazon.Extensions.CborProtocol.Internal.Transform;
2829
using Amazon.Runtime.EventStreams;
2930
using Amazon.Runtime.EventStreams.Internal;
3031
using Amazon.CloudWatchLogs.Model.Internal.MarshallTransformations;
@@ -51,9 +52,9 @@ public sealed class GetLogObjectResponseStream : EnumerableEventOutputStream<IEv
5152
{"Initial-Response", payload => new InitialResponseEvent(payload)},
5253
{"Fields", payload =>
5354
{
54-
var context = EventStreamUtils.ConvertMessageToJsonContext(payload);
55-
var reader = new StreamingUtf8JsonReader(context.Stream);
56-
return new FieldsDataUnmarshaller().Unmarshall(context, ref reader);
55+
var stream = EventStreamUtils.ConvertMessageToStream(payload);
56+
var context = new CborUnmarshallerContext(stream, false, null);
57+
return new FieldsDataUnmarshaller().Unmarshall(context);
5758
}
5859
},
5960
};
@@ -63,13 +64,13 @@ public sealed class GetLogObjectResponseStream : EnumerableEventOutputStream<IEv
6364
protected override IDictionary<string,Func<IEventStreamMessage,CloudWatchLogsEventStreamException>> ExceptionMapping {get;} =
6465
new Dictionary<string,Func<IEventStreamMessage,CloudWatchLogsEventStreamException>>(StringComparer.OrdinalIgnoreCase)
6566
{
66-
{"InternalStreamingException", payload =>
67-
{
68-
var context = EventStreamUtils.ConvertMessageToJsonContext(payload);
69-
var reader = new StreamingUtf8JsonReader(context.Stream);
70-
return new CloudWatchLogsEventStreamException(Encoding.UTF8.GetString(payload.Payload), new InternalStreamingExceptionUnmarshaller().Unmarshall(context, ref reader));
71-
}
72-
},
67+
{"InternalStreamingException", payload =>
68+
{
69+
var stream = EventStreamUtils.ConvertMessageToStream(payload);
70+
var context = new CborUnmarshallerContext(stream, false, null);
71+
return new CloudWatchLogsEventStreamException(Encoding.UTF8.GetString(payload.Payload), new InternalStreamingExceptionUnmarshaller().Unmarshall(context));
72+
}
73+
},
7374
};
7475
// Backing by a volatile bool. The flag only changes one way, so no need for a lock.
7576
// This is located in the subclass to be CLS compliant.

sdk/src/Services/CloudWatchLogs/Generated/Model/Internal/MarshallTransformations/AccessDeniedExceptionUnmarshaller.cs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,51 +29,52 @@
2929
using Amazon.Runtime.Internal;
3030
using Amazon.Runtime.Internal.Transform;
3131
using Amazon.Runtime.Internal.Util;
32-
using System.Text.Json;
3332
using Amazon.Util;
33+
using System.Formats.Cbor;
34+
using Amazon.Extensions.CborProtocol.Internal.Transform;
3435
#pragma warning disable CS0612,CS0618
3536
namespace Amazon.CloudWatchLogs.Model.Internal.MarshallTransformations
3637
{
3738
/// <summary>
3839
/// Response Unmarshaller for AccessDeniedException Object
3940
/// </summary>
40-
public class AccessDeniedExceptionUnmarshaller : IJsonErrorResponseUnmarshaller<AccessDeniedException, JsonUnmarshallerContext>
41+
public class AccessDeniedExceptionUnmarshaller : ICborErrorResponseUnmarshaller<AccessDeniedException, CborUnmarshallerContext>
4142
{
4243
/// <summary>
4344
/// Unmarshaller the response from the service to the response class.
4445
/// </summary>
4546
/// <param name="context"></param>
46-
/// <param name="reader"></param>
4747
/// <returns></returns>
48-
public AccessDeniedException Unmarshall(JsonUnmarshallerContext context, ref StreamingUtf8JsonReader reader)
48+
public AccessDeniedException Unmarshall(CborUnmarshallerContext context)
4949
{
50-
return this.Unmarshall(context, new Amazon.Runtime.Internal.ErrorResponse(), ref reader);
50+
return this.Unmarshall(context, new Amazon.Runtime.Internal.ErrorResponse());
5151
}
5252

5353
/// <summary>
5454
/// Unmarshaller the response from the service to the response class.
5555
/// </summary>
5656
/// <param name="context"></param>
5757
/// <param name="errorResponse"></param>
58-
/// <param name="reader"></param>
5958
/// <returns></returns>
60-
public AccessDeniedException Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse, ref StreamingUtf8JsonReader reader)
59+
public AccessDeniedException Unmarshall(CborUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
6160
{
62-
if (context.Stream.Length > 0)
63-
{
64-
context.Read(ref reader);
65-
}
66-
6761
AccessDeniedException unmarshalledObject = new AccessDeniedException(errorResponse.Message, errorResponse.InnerException,
6862
errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
69-
70-
int targetDepth = context.CurrentDepth;
71-
if (context.Stream.Length > 0)
63+
var reader = context.Reader;
64+
context.AddPathSegment("AccessDeniedException");
65+
reader.ReadStartMap();
66+
while (reader.PeekState() != CborReaderState.EndMap)
7267
{
73-
while (context.ReadAtDepth(targetDepth, ref reader))
68+
string propertyName = reader.ReadTextString();
69+
switch (propertyName)
7470
{
71+
default:
72+
reader.SkipValue();
73+
break;
7574
}
7675
}
76+
reader.ReadEndMap();
77+
context.PopPathSegment();
7778

7879
return unmarshalledObject;
7980
}

sdk/src/Services/CloudWatchLogs/Generated/Model/Internal/MarshallTransformations/AccountPolicyUnmarshaller.cs

Lines changed: 73 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -29,76 +29,101 @@
2929
using Amazon.Runtime.Internal;
3030
using Amazon.Runtime.Internal.Transform;
3131
using Amazon.Runtime.Internal.Util;
32-
using System.Text.Json;
32+
using System.Formats.Cbor;
33+
using Amazon.Extensions.CborProtocol.Internal.Transform;
3334
#pragma warning disable CS0612,CS0618
3435
namespace Amazon.CloudWatchLogs.Model.Internal.MarshallTransformations
3536
{
3637
/// <summary>
3738
/// Response Unmarshaller for AccountPolicy Object
3839
/// </summary>
39-
public class AccountPolicyUnmarshaller : IJsonUnmarshaller<AccountPolicy, JsonUnmarshallerContext>
40+
public class AccountPolicyUnmarshaller : ICborUnmarshaller<AccountPolicy, CborUnmarshallerContext>
4041
{
4142
/// <summary>
4243
/// Unmarshaller the response from the service to the response class.
4344
/// </summary>
4445
/// <param name="context"></param>
45-
/// <param name="reader"></param>
4646
/// <returns>The unmarshalled object</returns>
47-
public AccountPolicy Unmarshall(JsonUnmarshallerContext context, ref StreamingUtf8JsonReader reader)
47+
public AccountPolicy Unmarshall(CborUnmarshallerContext context)
4848
{
4949
AccountPolicy unmarshalledObject = new AccountPolicy();
5050
if (context.IsEmptyResponse)
5151
return null;
52-
context.Read(ref reader);
53-
if (context.CurrentTokenType == JsonTokenType.Null)
52+
var reader = context.Reader;
53+
if (reader.PeekState() == CborReaderState.Null)
54+
{
55+
reader.ReadNull();
5456
return null;
57+
}
5558

56-
int targetDepth = context.CurrentDepth;
57-
while (context.ReadAtDepth(targetDepth, ref reader))
59+
reader.ReadStartMap();
60+
while (reader.PeekState() != CborReaderState.EndMap)
5861
{
59-
if (context.TestExpression("accountId", targetDepth))
60-
{
61-
var unmarshaller = StringUnmarshaller.Instance;
62-
unmarshalledObject.AccountId = unmarshaller.Unmarshall(context, ref reader);
63-
continue;
64-
}
65-
if (context.TestExpression("lastUpdatedTime", targetDepth))
66-
{
67-
var unmarshaller = NullableLongUnmarshaller.Instance;
68-
unmarshalledObject.LastUpdatedTime = unmarshaller.Unmarshall(context, ref reader);
69-
continue;
70-
}
71-
if (context.TestExpression("policyDocument", targetDepth))
72-
{
73-
var unmarshaller = StringUnmarshaller.Instance;
74-
unmarshalledObject.PolicyDocument = unmarshaller.Unmarshall(context, ref reader);
75-
continue;
76-
}
77-
if (context.TestExpression("policyName", targetDepth))
78-
{
79-
var unmarshaller = StringUnmarshaller.Instance;
80-
unmarshalledObject.PolicyName = unmarshaller.Unmarshall(context, ref reader);
81-
continue;
82-
}
83-
if (context.TestExpression("policyType", targetDepth))
84-
{
85-
var unmarshaller = StringUnmarshaller.Instance;
86-
unmarshalledObject.PolicyType = unmarshaller.Unmarshall(context, ref reader);
87-
continue;
88-
}
89-
if (context.TestExpression("scope", targetDepth))
90-
{
91-
var unmarshaller = StringUnmarshaller.Instance;
92-
unmarshalledObject.Scope = unmarshaller.Unmarshall(context, ref reader);
93-
continue;
94-
}
95-
if (context.TestExpression("selectionCriteria", targetDepth))
62+
string propertyName = reader.ReadTextString();
63+
switch (propertyName)
9664
{
97-
var unmarshaller = StringUnmarshaller.Instance;
98-
unmarshalledObject.SelectionCriteria = unmarshaller.Unmarshall(context, ref reader);
99-
continue;
65+
case "accountId":
66+
{
67+
context.AddPathSegment("AccountId");
68+
var unmarshaller = CborStringUnmarshaller.Instance;
69+
unmarshalledObject.AccountId = unmarshaller.Unmarshall(context);
70+
context.PopPathSegment();
71+
break;
72+
}
73+
case "lastUpdatedTime":
74+
{
75+
context.AddPathSegment("LastUpdatedTime");
76+
var unmarshaller = CborNullableLongUnmarshaller.Instance;
77+
unmarshalledObject.LastUpdatedTime = unmarshaller.Unmarshall(context);
78+
context.PopPathSegment();
79+
break;
80+
}
81+
case "policyDocument":
82+
{
83+
context.AddPathSegment("PolicyDocument");
84+
var unmarshaller = CborStringUnmarshaller.Instance;
85+
unmarshalledObject.PolicyDocument = unmarshaller.Unmarshall(context);
86+
context.PopPathSegment();
87+
break;
88+
}
89+
case "policyName":
90+
{
91+
context.AddPathSegment("PolicyName");
92+
var unmarshaller = CborStringUnmarshaller.Instance;
93+
unmarshalledObject.PolicyName = unmarshaller.Unmarshall(context);
94+
context.PopPathSegment();
95+
break;
96+
}
97+
case "policyType":
98+
{
99+
context.AddPathSegment("PolicyType");
100+
var unmarshaller = CborStringUnmarshaller.Instance;
101+
unmarshalledObject.PolicyType = unmarshaller.Unmarshall(context);
102+
context.PopPathSegment();
103+
break;
104+
}
105+
case "scope":
106+
{
107+
context.AddPathSegment("Scope");
108+
var unmarshaller = CborStringUnmarshaller.Instance;
109+
unmarshalledObject.Scope = unmarshaller.Unmarshall(context);
110+
context.PopPathSegment();
111+
break;
112+
}
113+
case "selectionCriteria":
114+
{
115+
context.AddPathSegment("SelectionCriteria");
116+
var unmarshaller = CborStringUnmarshaller.Instance;
117+
unmarshalledObject.SelectionCriteria = unmarshaller.Unmarshall(context);
118+
context.PopPathSegment();
119+
break;
120+
}
121+
default:
122+
reader.SkipValue();
123+
break;
100124
}
101125
}
126+
reader.ReadEndMap();
102127
return unmarshalledObject;
103128
}
104129

0 commit comments

Comments
 (0)