Skip to content

Commit

Permalink
Adding the Azure.Communication.NetworkTraversal SDK - update
Browse files Browse the repository at this point in the history
  • Loading branch information
ajpeacock0 committed May 19, 2021
1 parent 1aff526 commit ede4b12
Show file tree
Hide file tree
Showing 21 changed files with 769 additions and 188 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
# Release History

## 1.0.0-beta.1 (2021-02-22-preview1)
## 1.0.0-beta.1 (2021-05-25)

### Added
- Added CommunicationRelayClient in preview.
- Added CommunicationRelayClient.GetRelayConfiguration in preview.
- Added CommunicationRelayClient.GetRelayConfigurationAsync in preview.
This is the first release of Azure Communication Services for Network Traversal. For more information, please see the [README][read_me].

### Breaking
This is a Public Preview version, so breaking changes are possible in subsequent releases as we improve the product. To provide feedback, please submit an issue in our [Azure SDK for .NET GitHub repo](https://github.com/Azure/azure-sdk-for-net/issues).

<!-- LINKS -->
[read_me]: https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/communication/Azure.Communication.NetworkTraversal/README.md
<!--[read_me]: https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/communication/Azure.Communication.NetworkTraversal/README.md-->
19 changes: 13 additions & 6 deletions sdk/communication/Azure.Communication.NetworkTraversal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ var client = new CommunicationRelayClient(connectionString);

Or alternatively using the endpoint and access key acquired from an Azure Communication Resources in the [Azure Portal][azure_portal].

```C# Snippet:CreateCommunicationNetworkingFromAccessKey
```C# Snippet:CreateCommunicationRelayFromAccessKey
var endpoint = new Uri("https://my-resource.communication.azure.com");
var accessKey = "<access_key>";
var client = new CommunicationRelayClient(endpoint, new AzureKeyCredential(accessKey));
```

Clients also have the option to authenticate using a valid Active Directory token.

```C# Snippet:CreateCommunicationNetworkingFromToken
```C# Snippet:CreateCommunicationRelayFromToken
var endpoint = new Uri("https://my-resource.communication.azure.com");
TokenCredential tokenCredential = new DefaultAzureCredential();
var client = new CommunicationRelayClient(endpoint, tokenCredential);
Expand Down Expand Up @@ -68,7 +68,7 @@ We guarantee that all client instance methods are thread-safe and independent of

## Generating TURN credentials for a user

```C# Snippet:CreateTURNTokenAsync
```C# Snippet:GetRelayConfigurationAsync
Response<CommunicationRelayConfiguration> turnTokenResponse = await client.GetRelayConfigurationAsync(user);
DateTimeOffset turnTokenExpiresOn = turnTokenResponse.Value.ExpiresOn;
IReadOnlyList<CommunicationTurnServer> turnServers = turnTokenResponse.Value.TurnServers;
Expand All @@ -84,6 +84,14 @@ foreach (CommunicationTurnServer turnServer in turnServers)
}
```

## Troubleshooting

> TODO
## Next steps

> TODO
## Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit [cla.microsoft.com][cla].
Expand All @@ -94,16 +102,15 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m

[azure_sub]: https://azure.microsoft.com/free/
[azure_portal]: https://portal.azure.com
[source]: https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/communication/Azure.Communication.NetworkTraversal/src
[source_samples]: https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/communication/Azure.Communication.NetworkTraversal/samples
<!--[source]: https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/communication/Azure.Communication.NetworkTraversal/src-->
<!--[source_samples]: https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/communication/Azure.Communication.NetworkTraversal/samples-->
[cla]: https://cla.microsoft.com
[coc]: https://opensource.microsoft.com/codeofconduct/
[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
[coc_contact]: mailto:[email protected]
<!--[package]: https://www.nuget.org/packages/Azure.Communication.NetworkTraversal-->
[product_docs]: https://docs.microsoft.com/azure/communication-services/overview
[nuget]: https://www.nuget.org/
[user_access_token]: https://docs.microsoft.com/azure/communication-services/quickstarts/access-tokens?pivots=programming-language-csharp
[communication_resource_docs]: https://docs.microsoft.com/azure/communication-services/quickstarts/create-communication-resource?tabs=windows&pivots=platform-azp
[communication_resource_create_portal]: https://docs.microsoft.com/azure/communication-services/quickstarts/create-communication-resource?tabs=windows&pivots=platform-azp
[communication_resource_create_power_shell]: https://docs.microsoft.com/powershell/module/az.communication/new-azcommunicationservice
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ public CommunicationRelayClient(System.Uri endpoint, Azure.Core.TokenCredential
}
public partial class CommunicationRelayClientOptions : Azure.Core.ClientOptions
{
public CommunicationRelayClientOptions(Azure.Communication.NetworkTraversal.CommunicationRelayClientOptions.ServiceVersion version = Azure.Communication.Networking.CommunicationRelayClientOptions.ServiceVersion.V2021_02_22_preview1) { }
public CommunicationRelayClientOptions(Azure.Communication.NetworkTraversal.CommunicationRelayClientOptions.ServiceVersion version = Azure.Communication.NetworkTraversal.CommunicationRelayClientOptions.ServiceVersion.V2021_02_22_preview1) { }
public enum ServiceVersion
{
V2021_02_22_preview1 = 0,
V2021_02_22_preview1 = 1,
}
}
public partial class CommunicationRelayConfiguration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ require:
payload-flattening-threshold: 3
```
### Rename OperationId to for RestClient rename
```yaml
Expand Down
21 changes: 21 additions & 0 deletions sdk/communication/Azure.Communication.NetworkTraversal/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
trigger: none

extends:
template: /eng/pipelines/templates/stages/archetype-sdk-tests.yml
parameters:
ServiceDirectory: communication
Project: Azure.Communication.NetworkTraversal
CloudConfig:
Public:
SubscriptionConfigurations:
- $(sub-config-azure-cloud-test-resources)
- $(sub-config-communication-services-cloud-test-resources-common)
- $(sub-config-communication-services-cloud-test-resources-net)
Int:
SubscriptionConfigurations:
- $(sub-config-communication-int-test-resources-common)
- $(sub-config-communication-int-test-resources-net)
Clouds: Public,Int
EnvVars:
# SKIP_PHONENUMBER_LIVE_TESTS skips certain phone number tests such as purchase and release
SKIP_PHONENUMBER_LIVE_TESTS: TRUE
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using Azure.Communication.Identity;
using Azure.Communication.Pipeline;
using Azure.Core;
using Azure.Core.TestFramework;
using Azure.Identity;
using NUnit.Framework;

namespace Azure.Communication.NetworkTraversal.Tests
{
Expand All @@ -14,16 +15,6 @@ public class CommunicationRelayClientLiveTestBase : RecordedTestBase<Communicati
public CommunicationRelayClientLiveTestBase(bool isAsync) : base(isAsync)
=> Sanitizer = new CommunicationRelayClientRecordedTestSanitizer();

[OneTimeSetUp]
public void Setup()
{
if (TestEnvironment.ShouldIgnoreTests)
{
Assert.Ignore("Networking tests are skipped " +
"because networking package is not included in the TEST_PACKAGES_ENABLED variable");
}
}

/// <summary>
/// Creates a <see cref="CommunicationRelayClient" /> with the connectionstring via environment
/// variables and instruments it to make use of the Azure Core Test Framework functionalities.
Expand All @@ -32,20 +23,20 @@ public void Setup()
protected CommunicationRelayClient CreateClientWithConnectionString()
=> InstrumentClient(
new CommunicationRelayClient(
TestEnvironment.ConnectionString,
TestEnvironment.LiveTestDynamicConnectionString,
CreateNetworkingClientOptionsWithCorrelationVectorLogs()));

protected CommunicationRelayClient CreateClientWithAzureKeyCredential()
=> InstrumentClient(
new CommunicationRelayClient(
TestEnvironment.Endpoint,
new AzureKeyCredential(TestEnvironment.AccessKey),
TestEnvironment.LiveTestDynamicEndpoint,
new AzureKeyCredential(TestEnvironment.LiveTestDynamicAccessKey),
CreateNetworkingClientOptionsWithCorrelationVectorLogs()));

protected CommunicationRelayClient CreateClientWithTokenCredential()
=> InstrumentClient(
new CommunicationRelayClient(
TestEnvironment.Endpoint,
TestEnvironment.LiveTestDynamicEndpoint,
(Mode == RecordedTestMode.Playback) ? new MockCredential() : new DefaultAzureCredential(),
CreateNetworkingClientOptionsWithCorrelationVectorLogs()));

Expand All @@ -57,7 +48,7 @@ protected CommunicationRelayClient CreateClientWithTokenCredential()
protected CommunicationIdentityClient CreateInstrumentedCommunicationIdentityClient()
=> InstrumentClient(
new CommunicationIdentityClient(
TestEnvironment.ConnectionString,
TestEnvironment.LiveTestDynamicConnectionString,
InstrumentClientOptions(new CommunicationIdentityClientOptions())));

private CommunicationRelayClientOptions CreateNetworkingClientOptionsWithCorrelationVectorLogs()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ namespace Azure.Communication.Pipeline
public class CommunicationRelayClientRecordedTestSanitizer : CommunicationRecordedTestSanitizer
{
public CommunicationRelayClientRecordedTestSanitizer()
=> AddJsonPathSanitizer("$..token");
=> AddJsonPathSanitizer("$..credential");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,5 @@ namespace Azure.Communication.NetworkTraversal.Tests
{
public class CommunicationRelayClientTestEnvironment : CommunicationTestEnvironment
{
// please find the allowed package value in tests.yml
private const string NetworkTraversalPackagesEnabled = "networktraversal";
public override string ExpectedTestPackagesEnabled { get { return NetworkTraversalPackagesEnabled; } }
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ede4b12

Please sign in to comment.