Skip to content

Commit 61813fe

Browse files
authored
GA release for NetworkTraversal (Azure#26758)
* GA new version of swagger autorest code and fixing serialization/deserialization issue * Allow expires on to be nullable * Fix code checks * Fix version string in csproj file * Add testing for Serialization/deserialization * Add new recordings * Remove nullable of ExpiresOn * Update PR * Update date
1 parent bfe7f69 commit 61813fe

File tree

64 files changed

+1547
-1319
lines changed

Some content is hidden

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

64 files changed

+1547
-1319
lines changed

sdk/communication/Azure.Communication.NetworkTraversal/CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
# Release History
22

3-
## 1.0.0-beta.4 (Unreleased)
3+
## 1.0.0 (2022-02-08)
44

55
### Features Added
66

77
### Breaking Changes
88

9+
- Removing GetRelayConfigurationOptions to call GetRelayConfiguration and GetRelayConfigurationAsync passing
10+
RouteType and CommunicationUserIdentifier explicitly.
11+
912
### Bugs Fixed
1013

1114
### Other Changes

sdk/communication/Azure.Communication.NetworkTraversal/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Azure Communication Network Traversal enables high bandwidth, low latency connec
1010
Install the Azure Communication Network Traversal client library for .NET with [NuGet][nuget]:
1111

1212
```dotnetcli
13-
dotnet add package Azure.Communication.NetworkTraversal --version 1.0.0-beta.3
13+
dotnet add package Azure.Communication.NetworkTraversal --version 1.0.0
1414
```
1515

1616
### Prerequisites
@@ -70,7 +70,7 @@ We guarantee that all client instance methods are thread-safe and independent of
7070
```C# Snippet:GetRelayConfigurationAsync
7171
Response<CommunicationRelayConfiguration> relayConfiguration = await client.GetRelayConfigurationAsync();
7272
DateTimeOffset turnTokenExpiresOn = relayConfiguration.Value.ExpiresOn;
73-
IReadOnlyList<CommunicationIceServer> iceServers = relayConfiguration.Value.IceServers;
73+
IList<CommunicationIceServer> iceServers = relayConfiguration.Value.IceServers;
7474
Console.WriteLine($"Expires On: {turnTokenExpiresOn}");
7575
foreach (CommunicationIceServer iceServer in iceServers)
7676
{
@@ -87,9 +87,9 @@ foreach (CommunicationIceServer iceServer in iceServers)
8787
## Getting a Relay Configuration for a user with a specified routeType
8888

8989
```C# Snippet:GetRelayConfigurationAsyncWithNearestRouteType
90-
Response<CommunicationRelayConfiguration> relayConfiguration = await client.GetRelayConfigurationAsync(new GetRelayConfigurationOptions { CommunicationUser = user, RouteType = RouteType.Nearest });
90+
Response<CommunicationRelayConfiguration> relayConfiguration = await client.GetRelayConfigurationAsync(user,RouteType.Nearest);
9191
DateTimeOffset turnTokenExpiresOn = relayConfiguration.Value.ExpiresOn;
92-
IReadOnlyList<CommunicationIceServer> iceServers = relayConfiguration.Value.IceServers;
92+
IList<CommunicationIceServer> iceServers = relayConfiguration.Value.IceServers;
9393
Console.WriteLine($"Expires On: {turnTokenExpiresOn}");
9494
foreach (CommunicationIceServer iceServer in iceServers)
9595
{

sdk/communication/Azure.Communication.NetworkTraversal/api/Azure.Communication.NetworkTraversal.netstandard2.0.cs

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ namespace Azure.Communication.NetworkTraversal
22
{
33
public partial class CommunicationIceServer
44
{
5-
internal CommunicationIceServer() { }
6-
public string Credential { get { throw null; } }
7-
public Azure.Communication.NetworkTraversal.RouteType RouteType { get { throw null; } }
8-
public System.Collections.Generic.IReadOnlyList<string> Urls { get { throw null; } }
9-
public string Username { get { throw null; } }
5+
public CommunicationIceServer(System.Collections.Generic.IEnumerable<string> urls, string username, string credential, Azure.Communication.NetworkTraversal.RouteType routeType) { }
6+
public string Credential { get { throw null; } set { } }
7+
public Azure.Communication.NetworkTraversal.RouteType RouteType { get { throw null; } set { } }
8+
public System.Collections.Generic.IList<string> Urls { get { throw null; } }
9+
public string Username { get { throw null; } set { } }
1010
}
1111
public partial class CommunicationRelayClient
1212
{
@@ -15,29 +15,22 @@ public CommunicationRelayClient(string connectionString) { }
1515
public CommunicationRelayClient(string connectionString, Azure.Communication.NetworkTraversal.CommunicationRelayClientOptions options) { }
1616
public CommunicationRelayClient(System.Uri endpoint, Azure.AzureKeyCredential keyCredential, Azure.Communication.NetworkTraversal.CommunicationRelayClientOptions options = null) { }
1717
public CommunicationRelayClient(System.Uri endpoint, Azure.Core.TokenCredential tokenCredential, Azure.Communication.NetworkTraversal.CommunicationRelayClientOptions options = null) { }
18-
public virtual Azure.Response<Azure.Communication.NetworkTraversal.CommunicationRelayConfiguration> GetRelayConfiguration(Azure.Communication.NetworkTraversal.Models.GetRelayConfigurationOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
19-
public virtual Azure.Response<Azure.Communication.NetworkTraversal.CommunicationRelayConfiguration> GetRelayConfiguration(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
20-
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Communication.NetworkTraversal.CommunicationRelayConfiguration>> GetRelayConfigurationAsync(Azure.Communication.NetworkTraversal.Models.GetRelayConfigurationOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
21-
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Communication.NetworkTraversal.CommunicationRelayConfiguration>> GetRelayConfigurationAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
18+
public virtual Azure.Response<Azure.Communication.NetworkTraversal.CommunicationRelayConfiguration> GetRelayConfiguration(Azure.Communication.CommunicationUserIdentifier communicationUser = null, Azure.Communication.NetworkTraversal.RouteType? routeType = default(Azure.Communication.NetworkTraversal.RouteType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
19+
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Communication.NetworkTraversal.CommunicationRelayConfiguration>> GetRelayConfigurationAsync(Azure.Communication.CommunicationUserIdentifier communicationUser = null, Azure.Communication.NetworkTraversal.RouteType? routeType = default(Azure.Communication.NetworkTraversal.RouteType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
2220
}
2321
public partial class CommunicationRelayClientOptions : Azure.Core.ClientOptions
2422
{
25-
public CommunicationRelayClientOptions(Azure.Communication.NetworkTraversal.CommunicationRelayClientOptions.ServiceVersion version = Azure.Communication.NetworkTraversal.CommunicationRelayClientOptions.ServiceVersion.V2021_10_08_preview) { }
23+
public CommunicationRelayClientOptions(Azure.Communication.NetworkTraversal.CommunicationRelayClientOptions.ServiceVersion version = Azure.Communication.NetworkTraversal.CommunicationRelayClientOptions.ServiceVersion.V2022_02_01) { }
2624
public enum ServiceVersion
2725
{
28-
V2021_10_08_preview = 1,
26+
V2022_02_01 = 1,
2927
}
3028
}
3129
public partial class CommunicationRelayConfiguration
3230
{
33-
internal CommunicationRelayConfiguration() { }
34-
public System.DateTimeOffset ExpiresOn { get { throw null; } }
35-
public System.Collections.Generic.IReadOnlyList<Azure.Communication.NetworkTraversal.CommunicationIceServer> IceServers { get { throw null; } }
36-
}
37-
public static partial class NetworkTraversalModelFactory
38-
{
39-
public static Azure.Communication.NetworkTraversal.CommunicationIceServer CommunicationIceServer(System.Collections.Generic.IEnumerable<string> urls = null, string username = null, string credential = null, Azure.Communication.NetworkTraversal.RouteType routeType = default(Azure.Communication.NetworkTraversal.RouteType)) { throw null; }
40-
public static Azure.Communication.NetworkTraversal.CommunicationRelayConfiguration CommunicationRelayConfiguration(System.DateTimeOffset expiresOn = default(System.DateTimeOffset), System.Collections.Generic.IEnumerable<Azure.Communication.NetworkTraversal.CommunicationIceServer> iceServers = null) { throw null; }
31+
public CommunicationRelayConfiguration(System.DateTimeOffset expiresOn, System.Collections.Generic.IEnumerable<Azure.Communication.NetworkTraversal.CommunicationIceServer> iceServers) { }
32+
public System.DateTimeOffset ExpiresOn { get { throw null; } set { } }
33+
public System.Collections.Generic.IList<Azure.Communication.NetworkTraversal.CommunicationIceServer> IceServers { get { throw null; } }
4134
}
4235
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
4336
public readonly partial struct RouteType : System.IEquatable<Azure.Communication.NetworkTraversal.RouteType>
@@ -58,12 +51,3 @@ public static partial class NetworkTraversalModelFactory
5851
public override string ToString() { throw null; }
5952
}
6053
}
61-
namespace Azure.Communication.NetworkTraversal.Models
62-
{
63-
public partial class GetRelayConfigurationOptions
64-
{
65-
public GetRelayConfigurationOptions() { }
66-
public Azure.Communication.CommunicationUserIdentifier CommunicationUser { get { throw null; } set { } }
67-
public Azure.Communication.NetworkTraversal.RouteType? RouteType { get { throw null; } set { } }
68-
}
69-
}

sdk/communication/Azure.Communication.NetworkTraversal/samples/Sample1_CommunicationRelayClient.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Every relay configuration has an expiry date and time stamped on it, indicating
4242
```C# Snippet:GetRelayConfiguration
4343
Response<CommunicationRelayConfiguration> relayConfiguration = client.GetRelayConfiguration();
4444
DateTimeOffset turnTokenExpiresOn = relayConfiguration.Value.ExpiresOn;
45-
IReadOnlyList<CommunicationIceServer> iceServers = relayConfiguration.Value.IceServers;
45+
IList<CommunicationIceServer> iceServers = relayConfiguration.Value.IceServers;
4646
Console.WriteLine($"Expires On: {turnTokenExpiresOn}");
4747
foreach (CommunicationIceServer iceServer in iceServers)
4848
{

sdk/communication/Azure.Communication.NetworkTraversal/samples/Sample1_CommunicationRelayClientAsync.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Every relay configuration has an expiry date and time stamped on it, indicating
4242
```C# Snippet:GetRelayConfigurationAsync
4343
Response<CommunicationRelayConfiguration> relayConfiguration = await client.GetRelayConfigurationAsync();
4444
DateTimeOffset turnTokenExpiresOn = relayConfiguration.Value.ExpiresOn;
45-
IReadOnlyList<CommunicationIceServer> iceServers = relayConfiguration.Value.IceServers;
45+
IList<CommunicationIceServer> iceServers = relayConfiguration.Value.IceServers;
4646
Console.WriteLine($"Expires On: {turnTokenExpiresOn}");
4747
foreach (CommunicationIceServer iceServer in iceServers)
4848
{

sdk/communication/Azure.Communication.NetworkTraversal/src/Azure.Communication.NetworkTraversal.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
For this release, see notes - https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/communication/Azure.Communication.NetworkTraversal/README.md and https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/communication/Azure.Communication.NetworkTraversal/CHANGELOG.md.
66
</Description>
77
<AssemblyTitle>Azure Communication Network Traversal Service</AssemblyTitle>
8-
<Version>1.0.0-beta.4</Version>
8+
<Version>1.0.0</Version>
99
<PackageTags>Microsoft Azure Communication Network Traversal Service;Microsoft;Azure;Azure Communication Service;Azure Communication Network Traversal Service;Network Traversal;Communication;$(PackageCommonTags)</PackageTags>
1010
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
1111
</PropertyGroup>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
using System;
5+
using System.Collections.Generic;
6+
using System.Text;
7+
using Azure.Core;
8+
9+
namespace Azure.Communication.NetworkTraversal
10+
{
11+
/// <summary>
12+
/// The user should be able to serialize or deserialize CommunicationIceServer
13+
/// for better experience.
14+
/// </summary>
15+
[CodeGenModel(Usage = new[] { "input", "converter" })]
16+
public partial class CommunicationIceServer
17+
{
18+
}
19+
}

sdk/communication/Azure.Communication.NetworkTraversal/src/CommunicationRelayClient.cs

Lines changed: 9 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System;
55
using System.Threading;
66
using System.Threading.Tasks;
7-
using Azure.Communication.NetworkTraversal.Models;
87
using Azure.Communication.Pipeline;
98
using Azure.Core;
109
using Azure.Core.Pipeline;
@@ -92,34 +91,17 @@ protected CommunicationRelayClient()
9291
}
9392

9493
/// <summary>Gets a Relay Configuration for a <see cref="CommunicationUserIdentifier"/>.</summary>
95-
/// <param name="options"> The <see cref="GetRelayConfigurationOptions"/> for the request. </param>
94+
/// <param name="communicationUser">The <see cref="CommunicationUserIdentifier"/> for whom to issue a token.</param>
95+
/// <param name="routeType"> The specified <see cref="RouteType"/> for the relay request </param>
9696
/// <param name="cancellationToken">The cancellation token to use.</param>
9797
/// <exception cref="RequestFailedException">The server returned an error.</exception>
98-
public virtual Response<CommunicationRelayConfiguration> GetRelayConfiguration(GetRelayConfigurationOptions options, CancellationToken cancellationToken = default)
98+
public virtual Response<CommunicationRelayConfiguration> GetRelayConfiguration(CommunicationUserIdentifier communicationUser = null, RouteType? routeType = null, CancellationToken cancellationToken = default)
9999
{
100100
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CommunicationRelayClient)}.{nameof(GetRelayConfiguration)}");
101101
scope.Start();
102102
try
103103
{
104-
return RestClient.IssueRelayConfiguration(options.CommunicationUser?.Id, options?.RouteType, cancellationToken);
105-
}
106-
catch (Exception ex)
107-
{
108-
scope.Failed(ex);
109-
throw;
110-
}
111-
}
112-
113-
/// <summary>Gets a Relay Configuration for a <see cref="CommunicationUserIdentifier"/>.</summary>
114-
/// <param name="cancellationToken">The cancellation token to use.</param>
115-
/// <exception cref="RequestFailedException">The server returned an error.</exception>
116-
public virtual Response<CommunicationRelayConfiguration> GetRelayConfiguration(CancellationToken cancellationToken = default)
117-
{
118-
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CommunicationRelayClient)}.{nameof(GetRelayConfiguration)}");
119-
scope.Start();
120-
try
121-
{
122-
return RestClient.IssueRelayConfiguration(cancellationToken: cancellationToken);
104+
return RestClient.IssueRelayConfiguration(communicationUser?.Id, routeType, cancellationToken);
123105
}
124106
catch (Exception ex)
125107
{
@@ -129,32 +111,16 @@ public virtual Response<CommunicationRelayConfiguration> GetRelayConfiguration(C
129111
}
130112

131113
/// <summary>Asynchronously gets a Relay Configuration for a <see cref="CommunicationUserIdentifier"/>.</summary>
132-
/// <param name="options"> The <see cref="GetRelayConfigurationOptions"/> for the request. </param>
133-
/// <param name="cancellationToken"> The cancellation token to use. </param>
134-
public virtual async Task<Response<CommunicationRelayConfiguration>> GetRelayConfigurationAsync(GetRelayConfigurationOptions options, CancellationToken cancellationToken = default)
135-
{
136-
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CommunicationRelayClient)}.{nameof(GetRelayConfiguration)}");
137-
scope.Start();
138-
try
139-
{
140-
return await RestClient.IssueRelayConfigurationAsync(options?.CommunicationUser?.Id, options?.RouteType, cancellationToken).ConfigureAwait(false);
141-
}
142-
catch (Exception ex)
143-
{
144-
scope.Failed(ex);
145-
throw;
146-
}
147-
}
148-
149-
/// <summary>Asynchronously gets a Relay Configuration for a <see cref="CommunicationUserIdentifier"/>.</summary>
150-
/// <param name="cancellationToken"> The cancellation token to use. </param>
151-
public virtual async Task<Response<CommunicationRelayConfiguration>> GetRelayConfigurationAsync(CancellationToken cancellationToken = default)
114+
/// <param name="communicationUser">The <see cref="CommunicationUserIdentifier"/> for whom to issue a token.</param>
115+
/// <param name="routeType"> The specified <see cref="RouteType"/> for the relay request </param>
116+
/// <param name="cancellationToken">The cancellation token to use.</param>
117+
public virtual async Task<Response<CommunicationRelayConfiguration>> GetRelayConfigurationAsync(CommunicationUserIdentifier communicationUser = null, RouteType? routeType = null, CancellationToken cancellationToken = default)
152118
{
153119
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CommunicationRelayClient)}.{nameof(GetRelayConfiguration)}");
154120
scope.Start();
155121
try
156122
{
157-
return await RestClient.IssueRelayConfigurationAsync(cancellationToken: cancellationToken).ConfigureAwait(false);
123+
return await RestClient.IssueRelayConfigurationAsync(communicationUser?.Id, routeType, cancellationToken).ConfigureAwait(false);
158124
}
159125
catch (Exception ex)
160126
{

sdk/communication/Azure.Communication.NetworkTraversal/src/CommunicationRelayClientOptions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class CommunicationRelayClientOptions : ClientOptions
1414
/// <summary>
1515
/// The latest version of the networking service.
1616
/// </summary>
17-
internal const ServiceVersion LatestVersion = ServiceVersion.V2021_10_08_preview;
17+
internal const ServiceVersion LatestVersion = ServiceVersion.V2022_02_01;
1818

1919
internal string ApiVersion { get; }
2020

@@ -25,7 +25,7 @@ public CommunicationRelayClientOptions(ServiceVersion version = LatestVersion)
2525
{
2626
ApiVersion = version switch
2727
{
28-
ServiceVersion.V2021_10_08_preview => "2021-10-08-preview",
28+
ServiceVersion.V2022_02_01 => "2022-02-01",
2929
_ => throw new ArgumentOutOfRangeException(nameof(version)),
3030
};
3131
}
@@ -38,9 +38,9 @@ public enum ServiceVersion
3838
#pragma warning disable CA1707 // Identifiers should not contain underscores
3939
#pragma warning disable AZC0016 // Invalid ServiceVersion member name.
4040
/// <summary>
41-
/// The V2021_10_08_preview of the networking service.
41+
/// The V2022_02_01 GA version of the networking service.
4242
/// </summary>
43-
V2021_10_08_preview = 1,
43+
V2022_02_01 = 1,
4444
#pragma warning restore AZC0016 // Invalid ServiceVersion member name.
4545
#pragma warning restore CA1707 // Identifiers should not contain underscores
4646
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
using System;
5+
using System.Collections.Generic;
6+
using System.Text;
7+
using Azure.Core;
8+
9+
namespace Azure.Communication.NetworkTraversal
10+
{
11+
[CodeGenModel(Usage = new[] { "input", "converter" })]
12+
public partial class CommunicationRelayConfiguration
13+
{
14+
}
15+
}

0 commit comments

Comments
 (0)