Skip to content

Commit

Permalink
TURN: Adding RouteType optional parameter to GetRelayConfiguration (#…
Browse files Browse the repository at this point in the history
…25032)

* Add Anycast parameter to GetRelayConfiguration

* Update PR, removing unused snippet.

* Modified swagger, so adding new autogenerated code

* Update PR

* Update PR, add new recordings, reenable non-identity tests

* Adding GetRelayOptions and updating Readme and changelog

* Update PR

* Update PR
  • Loading branch information
AriZavala2 authored Nov 18, 2021
1 parent f7f1aa1 commit 941cf29
Show file tree
Hide file tree
Showing 58 changed files with 2,458 additions and 742 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Release History

## 1.0.0-beta.3 (Unreleased)
## 1.0.0-beta.3 (2021-11-18)

### Features Added
- Making user identity an optional argument when calling GetRelayConfiguration and GetRelayConfigurationAsync

- RouteType is a new added parameter that allows the user to specify the desired routing protocol for the
requested RelayConfiguration
- Introducing GetRelayConfigurationOptions which contains the optional parameters UserIdentity and RouteType
when calling the methods GetRelayConfiguration and GetRelayConfigurationAsync.

### Breaking Changes

Expand Down
12 changes: 7 additions & 5 deletions sdk/communication/Azure.Communication.NetworkTraversal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Azure Communication Network Traversal enables high bandwidth, low latency connec
Install the Azure Communication Network Traversal client library for .NET with [NuGet][nuget]:

```dotnetcli
dotnet add package Azure.Communication.NetworkTraversal --version 1.0.0-beta.2
dotnet add package Azure.Communication.NetworkTraversal --version 1.0.0-beta.3
```

### Prerequisites
Expand Down Expand Up @@ -68,7 +68,7 @@ We guarantee that all client instance methods are thread-safe and independent of
## Getting a Relay Configuration for a user

```C# Snippet:GetRelayConfigurationAsync
Response<CommunicationRelayConfiguration> relayConfiguration = await client.GetRelayConfigurationAsync(user);
Response<CommunicationRelayConfiguration> relayConfiguration = await client.GetRelayConfigurationAsync();
DateTimeOffset turnTokenExpiresOn = relayConfiguration.Value.ExpiresOn;
IReadOnlyList<CommunicationIceServer> iceServers = relayConfiguration.Value.IceServers;
Console.WriteLine($"Expires On: {turnTokenExpiresOn}");
Expand All @@ -80,13 +80,14 @@ foreach (CommunicationIceServer iceServer in iceServers)
}
Console.WriteLine($"ICE Server Username: {iceServer.Username}");
Console.WriteLine($"ICE Server Credential: {iceServer.Credential}");
Console.WriteLine($"ICE Server RouteType: {iceServer.RouteType}");
}
```

## Getting a Relay Configuration for a user without identity async
## Getting a Relay Configuration for a user with a specified routeType

```C# Snippet:GetRelayConfigurationAsyncWithoutIdentity
Response<CommunicationRelayConfiguration> relayConfiguration = await client.GetRelayConfigurationAsync();
```C# Snippet:GetRelayConfigurationAsyncWithNearestRouteType
Response<CommunicationRelayConfiguration> relayConfiguration = await client.GetRelayConfigurationAsync(new GetRelayConfigurationOptions { CommunicationUser = user, RouteType = RouteType.Nearest });
DateTimeOffset turnTokenExpiresOn = relayConfiguration.Value.ExpiresOn;
IReadOnlyList<CommunicationIceServer> iceServers = relayConfiguration.Value.IceServers;
Console.WriteLine($"Expires On: {turnTokenExpiresOn}");
Expand All @@ -98,6 +99,7 @@ foreach (CommunicationIceServer iceServer in iceServers)
}
Console.WriteLine($"ICE Server Username: {iceServer.Username}");
Console.WriteLine($"ICE Server Credential: {iceServer.Credential}");
Console.WriteLine($"ICE Server Route Type: {iceServer.RouteType}");
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ public partial class CommunicationIceServer
{
internal CommunicationIceServer() { }
public string Credential { get { throw null; } }
public Azure.Communication.NetworkTraversal.RouteType RouteType { get { throw null; } }
public System.Collections.Generic.IReadOnlyList<string> Urls { get { throw null; } }
public string Username { get { throw null; } }
}
Expand All @@ -14,15 +15,17 @@ public CommunicationRelayClient(string connectionString) { }
public CommunicationRelayClient(string connectionString, Azure.Communication.NetworkTraversal.CommunicationRelayClientOptions options) { }
public CommunicationRelayClient(System.Uri endpoint, Azure.AzureKeyCredential keyCredential, Azure.Communication.NetworkTraversal.CommunicationRelayClientOptions options = null) { }
public CommunicationRelayClient(System.Uri endpoint, Azure.Core.TokenCredential tokenCredential, Azure.Communication.NetworkTraversal.CommunicationRelayClientOptions options = null) { }
public virtual Azure.Response<Azure.Communication.NetworkTraversal.CommunicationRelayConfiguration> GetRelayConfiguration(Azure.Communication.CommunicationUserIdentifier communicationUser = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Communication.NetworkTraversal.CommunicationRelayConfiguration>> GetRelayConfigurationAsync(Azure.Communication.CommunicationUserIdentifier communicationUser = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
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; }
public virtual Azure.Response<Azure.Communication.NetworkTraversal.CommunicationRelayConfiguration> GetRelayConfiguration(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
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; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Communication.NetworkTraversal.CommunicationRelayConfiguration>> GetRelayConfigurationAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
public partial class CommunicationRelayClientOptions : Azure.Core.ClientOptions
{
public CommunicationRelayClientOptions(Azure.Communication.NetworkTraversal.CommunicationRelayClientOptions.ServiceVersion version = Azure.Communication.NetworkTraversal.CommunicationRelayClientOptions.ServiceVersion.V2021_06_21_preview) { }
public CommunicationRelayClientOptions(Azure.Communication.NetworkTraversal.CommunicationRelayClientOptions.ServiceVersion version = Azure.Communication.NetworkTraversal.CommunicationRelayClientOptions.ServiceVersion.V2021_10_08_preview) { }
public enum ServiceVersion
{
V2021_06_21_preview = 1,
V2021_10_08_preview = 1,
}
}
public partial class CommunicationRelayConfiguration
Expand All @@ -33,7 +36,34 @@ internal CommunicationRelayConfiguration() { }
}
public static partial class NetworkTraversalModelFactory
{
public static Azure.Communication.NetworkTraversal.CommunicationIceServer CommunicationIceServer(System.Collections.Generic.IEnumerable<string> urls = null, string username = null, string credential = null) { throw null; }
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; }
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; }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct RouteType : System.IEquatable<Azure.Communication.NetworkTraversal.RouteType>
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public RouteType(string value) { throw null; }
public static Azure.Communication.NetworkTraversal.RouteType Any { get { throw null; } }
public static Azure.Communication.NetworkTraversal.RouteType Nearest { get { throw null; } }
public bool Equals(Azure.Communication.NetworkTraversal.RouteType other) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public override bool Equals(object obj) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public override int GetHashCode() { throw null; }
public static bool operator ==(Azure.Communication.NetworkTraversal.RouteType left, Azure.Communication.NetworkTraversal.RouteType right) { throw null; }
public static implicit operator Azure.Communication.NetworkTraversal.RouteType (string value) { throw null; }
public static bool operator !=(Azure.Communication.NetworkTraversal.RouteType left, Azure.Communication.NetworkTraversal.RouteType right) { throw null; }
public override string ToString() { throw null; }
}
}
namespace Azure.Communication.NetworkTraversal.Models
{
public partial class GetRelayConfigurationOptions
{
public GetRelayConfigurationOptions() { }
public Azure.Communication.CommunicationUserIdentifier CommunicationUser { get { throw null; } set { } }
public Azure.Communication.NetworkTraversal.RouteType? RouteType { get { throw null; } set { } }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ A configuration is returned for the user. Each configuration consists of a URL f
Every relay configuration has an expiry date and time stamped on it, indicating when the set of TURN credentials will no longer be accepted. Once the credentials have expired, you can renew the token by calling the same method.

```C# Snippet:GetRelayConfiguration
Response<CommunicationRelayConfiguration> relayConfiguration = client.GetRelayConfiguration(user);
Response<CommunicationRelayConfiguration> relayConfiguration = client.GetRelayConfiguration();
DateTimeOffset turnTokenExpiresOn = relayConfiguration.Value.ExpiresOn;
IReadOnlyList<CommunicationIceServer> iceServers = relayConfiguration.Value.IceServers;
Console.WriteLine($"Expires On: {turnTokenExpiresOn}");
Expand All @@ -52,6 +52,7 @@ foreach (CommunicationIceServer iceServer in iceServers)
}
Console.WriteLine($"ICE Server Username: {iceServer.Username}");
Console.WriteLine($"ICE Server Credential: {iceServer.Credential}");
Console.WriteLine($"ICE Server RouteType: {iceServer.RouteType}");
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ A configuration is returned for the user. Each configuration consists of a URL f
Every relay configuration has an expiry date and time stamped on it, indicating when the set of TURN credentials will no longer be accepted. Once the credentials have expired, you can renew the token by calling the same method.

```C# Snippet:GetRelayConfigurationAsync
Response<CommunicationRelayConfiguration> relayConfiguration = await client.GetRelayConfigurationAsync(user);
Response<CommunicationRelayConfiguration> relayConfiguration = await client.GetRelayConfigurationAsync();
DateTimeOffset turnTokenExpiresOn = relayConfiguration.Value.ExpiresOn;
IReadOnlyList<CommunicationIceServer> iceServers = relayConfiguration.Value.IceServers;
Console.WriteLine($"Expires On: {turnTokenExpiresOn}");
Expand All @@ -52,6 +52,7 @@ foreach (CommunicationIceServer iceServer in iceServers)
}
Console.WriteLine($"ICE Server Username: {iceServer.Username}");
Console.WriteLine($"ICE Server Credential: {iceServer.Credential}");
Console.WriteLine($"ICE Server RouteType: {iceServer.RouteType}");
}
```

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>
This client library enables working with the Microsoft Azure Communication Network Traversal service.
Expand Down
Loading

0 comments on commit 941cf29

Please sign in to comment.