Skip to content

Commit 24fbf8f

Browse files
authored
Merge pull request #1082 from aws/shruti0085/telemetryUpdate
Migrate C# telemetry generator to .NET AWSDK v4
2 parents 8c88537 + 05d6d1a commit 24fbf8f

File tree

7 files changed

+5666
-2358
lines changed

7 files changed

+5666
-2358
lines changed

telemetry/csharp/AwsToolkit.Telemetry.Events.Tests/Generated/GeneratedCode.cs

Lines changed: 5610 additions & 2352 deletions
Large diffs are not rendered by default.

telemetry/csharp/AwsToolkit.Telemetry.SDK/AwsToolkit.Telemetry.SDK.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<AssemblyName>Amazon.AwsToolkit.Telemetry.SDK</AssemblyName>
77
<PackageId>AWS.Toolkit.Telemetry.SDK</PackageId>
88
<TargetFramework>net472</TargetFramework>
9+
<LangVersion>9.0</LangVersion>
910
<Authors>Amazon Web Services</Authors>
1011
<Company>Amazon Web Services</Company>
1112
<Product>AWS Toolkit Telemetry</Product>
@@ -21,7 +22,7 @@
2122
<AssemblyOriginatorKeyFile>..\toolkit-telemetry.snk</AssemblyOriginatorKeyFile>
2223
</PropertyGroup>
2324
<ItemGroup>
24-
<PackageReference Include="AWSSDK.Core" Version="3.7.13.1" />
25+
<PackageReference Include="AWSSDK.Core" Version="4.0.0.28" />
2526
</ItemGroup>
2627
<ItemGroup>
2728
<Reference Include="System" />

telemetry/csharp/AwsToolkit.Telemetry.SDK/AwsToolkit.Telemetry.SDK.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<tags>AWS AWSToolkit</tags>
1515
<dependencies>
1616
<group targetFramework="net472">
17-
<dependency id="AWSSDK.Core" version="3.7.13.1" />
17+
<dependency id="AWSSDK.Core" version="4.0.0.28" />
1818
</group>
1919
</dependencies>
2020
</metadata>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License").
5+
* You may not use this file except in compliance with the License.
6+
* A copy of the License is located at
7+
*
8+
* http://aws.amazon.com/apache2.0
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed
11+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
* express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
16+
using Amazon.Runtime;
17+
using Amazon.Runtime.Endpoints;
18+
using Amazon.Runtime.Internal;
19+
20+
namespace Amazon.ToolkitTelemetry
21+
{
22+
/// <summary>
23+
/// Configuration for accessing Amazon ToolkitTelemetry service - Custom partial class
24+
/// </summary>
25+
public partial class AmazonToolkitTelemetryConfig
26+
{
27+
/// <summary>
28+
/// Returns the endpoint that will be used for a particular request.
29+
/// </summary>
30+
/// <param name="parameters">A Container class for parameters used for endpoint resolution.</param>
31+
/// <returns>The resolved endpoint for the given request.</returns>
32+
public override Amazon.Runtime.Endpoints.Endpoint DetermineServiceOperationEndpoint(ServiceOperationEndpointParameters parameters)
33+
{
34+
var request = new DefaultRequest(parameters.Request, ServiceId);
35+
request.AlternateEndpoint = parameters.AlternateEndpoint;
36+
37+
var requestContext = new RequestContext(false);
38+
requestContext.ClientConfig = this;
39+
requestContext.OriginalRequest = parameters.Request;
40+
requestContext.Request = request;
41+
var executionContext = new Amazon.Runtime.Internal.ExecutionContext(requestContext, null);
42+
return new BaseEndpointResolver().GetEndpoint(executionContext);
43+
}
44+
}
45+
}

telemetry/csharp/TelemetryClient.proj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<BuildRoot Condition="'$(BuildRoot)' == ''">$(MSBuildThisFileDirectory)</BuildRoot>
55

66
<BuildTemp>$(BuildRoot)buildtemp\</BuildTemp>
7-
<DotNetSdkTag>3.7.354.0</DotNetSdkTag>
7+
<DotNetSdkTag>4.0.92.0</DotNetSdkTag>
88
<DotNetSdkClone>$(BuildTemp)dotnetsdk\</DotNetSdkClone>
99
<SdkGeneratorRoot>$(DotNetSdkClone)generator\</SdkGeneratorRoot>
1010
<SdkGenerator>$(SdkGeneratorRoot)ServiceClientGenerator\bin\Release\ServiceClientGenerator.exe</SdkGenerator>
@@ -52,6 +52,9 @@
5252

5353
<!-- Produce a generated csproj and files in a temp location -->
5454
<Target Name="generate-raw-telemetry-client">
55+
<!-- Create TestServiceModels folder -->
56+
<MakeDir Directories="$(BuildRoot)..\TestServiceModels" />
57+
<Message Text="Created TestServiceModels folder" />
5558

5659
<!-- Pull together Sdk Generator input files -->
5760
<ItemGroup>
@@ -98,6 +101,7 @@
98101
<Target Name="cleanup">
99102
<RemoveDir Directories="$(BuildTemp)" />
100103
<RemoveDir Directories="$(BuildRoot)\sdk" />
104+
<RemoveDir Directories="$(BuildRoot)..\TestServiceModels" />
101105
</Target>
102106

103107
</Project>

telemetry/csharp/client-generator-inputs/sdk-versions.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"file-description": "This file is used by the SDK Client Generator. See telemetry/csharp/README.md for details",
3-
"ProductVersion": "3.3.716.0",
4-
"CoreVersion": "3.3.106.2",
3+
"ProductVersion": "4.0.92.0",
4+
"CoreVersion": "4.0.0.28",
55
"DefaultToPreview": false,
66
"ServiceVersions": {
77
"ToolkitTelemetry": {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
22
"file-description": "This file is used by the SDK Client Generator. See telemetry/csharp/README.md for details"
3-
}
3+
}

0 commit comments

Comments
 (0)