Skip to content

Commit 63f1711

Browse files
authored
Feature/siprouting ga version (Azure#34748)
* Updated sanitization rules for SipRouting tests. * Updated SDK version to GA. * Updated API * Updated sip routing tests to use User Agent based config. * Reverting changes for skipping tests. * Did new recordings of tests to fix missing connection string. * Addressing PR comments.
1 parent c79794c commit 63f1711

File tree

41 files changed

+3057
-3907
lines changed

Some content is hidden

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

41 files changed

+3057
-3907
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
## 1.1.0-beta.4 (Unreleased)
44

55
### Features Added
6+
- Added support for SIP routing API version `2023-03-01`, releasing SIP routing functionality from public preview to GA.
7+
- Added environment variable `AZURE_TEST_DOMAIN` for SIP routing tests to support domain verification.
68

79
### Breaking Changes
810

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,10 @@ public SipRoutingClient(System.Uri endpoint, Azure.Core.TokenCredential tokenCre
281281
}
282282
public partial class SipRoutingClientOptions : Azure.Core.ClientOptions
283283
{
284-
public SipRoutingClientOptions(Azure.Communication.PhoneNumbers.SipRouting.SipRoutingClientOptions.ServiceVersion version = Azure.Communication.PhoneNumbers.SipRouting.SipRoutingClientOptions.ServiceVersion.V2021_05_01_Preview) { }
284+
public SipRoutingClientOptions(Azure.Communication.PhoneNumbers.SipRouting.SipRoutingClientOptions.ServiceVersion version = Azure.Communication.PhoneNumbers.SipRouting.SipRoutingClientOptions.ServiceVersion.V2023_03_01) { }
285285
public enum ServiceVersion
286286
{
287-
V2021_05_01_Preview = 1,
287+
V2023_03_01 = 1,
288288
}
289289
}
290290
public partial class SipTrunk

sdk/communication/Azure.Communication.PhoneNumbers/src/SipRouting/SipRoutingClient.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public virtual Response SetTrunk(
172172
scope.Start();
173173
try
174174
{
175-
return _restClient.PatchSipConfiguration(config, cancellationToken);
175+
return _restClient.Update(config, cancellationToken);
176176
}
177177
catch (Exception ex)
178178
{
@@ -196,7 +196,7 @@ public virtual async Task<Response> SetTrunkAsync(
196196
scope.Start();
197197
try
198198
{
199-
return await _restClient.PatchSipConfigurationAsync(config, cancellationToken).ConfigureAwait(false);
199+
return await _restClient.UpdateAsync(config, cancellationToken).ConfigureAwait(false);
200200
}
201201
catch (Exception ex)
202202
{
@@ -220,7 +220,7 @@ public virtual Response DeleteTrunk(
220220
scope.Start();
221221
try
222222
{
223-
return _restClient.PatchSipConfiguration(removeConfig, cancellationToken);
223+
return _restClient.Update(removeConfig, cancellationToken);
224224
}
225225
catch (Exception ex)
226226
{
@@ -244,7 +244,7 @@ public virtual async Task<Response> DeleteTrunkAsync(
244244
scope.Start();
245245
try
246246
{
247-
return await _restClient.PatchSipConfigurationAsync(removeConfig, cancellationToken).ConfigureAwait(false);
247+
return await _restClient.UpdateAsync(removeConfig, cancellationToken).ConfigureAwait(false);
248248
}
249249
catch (Exception ex)
250250
{
@@ -372,7 +372,7 @@ public virtual Response SetTrunks(
372372
return currentConfig.GetRawResponse();
373373
}
374374

375-
return _restClient.PatchSipConfiguration(new SipConfiguration(newTrunks), cancellationToken);
375+
return _restClient.Update(new SipConfiguration(newTrunks), cancellationToken);
376376
}
377377
catch (Exception ex)
378378
{
@@ -412,7 +412,7 @@ public virtual async Task<Response> SetTrunksAsync(
412412
return currentConfig.GetRawResponse();
413413
}
414414

415-
return await _restClient.PatchSipConfigurationAsync(new SipConfiguration(newTrunks), cancellationToken).ConfigureAwait(false);
415+
return await _restClient.UpdateAsync(new SipConfiguration(newTrunks), cancellationToken).ConfigureAwait(false);
416416
}
417417
catch (Exception ex) {
418418
scope.Failed(ex);
@@ -434,7 +434,7 @@ public virtual Response SetRoutes(
434434
try
435435
{
436436
var config = new SipConfiguration(routes);
437-
var response = _restClient.PatchSipConfiguration(config, cancellationToken);
437+
var response = _restClient.Update(config, cancellationToken);
438438

439439
return response;
440440
}
@@ -459,7 +459,7 @@ public virtual async Task<Response> SetRoutesAsync(
459459
try
460460
{
461461
var config = new SipConfiguration(routes);
462-
return await _restClient.PatchSipConfigurationAsync(config, cancellationToken).ConfigureAwait(false);
462+
return await _restClient.UpdateAsync(config, cancellationToken).ConfigureAwait(false);
463463
}
464464
catch (Exception ex)
465465
{

sdk/communication/Azure.Communication.PhoneNumbers/src/SipRouting/SipRoutingClientOptions.cs

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

1919
internal string ApiVersion { get; }
2020

@@ -25,7 +25,7 @@ public SipRoutingClientOptions(ServiceVersion version = LatestVersion)
2525
{
2626
ApiVersion = version switch
2727
{
28-
ServiceVersion.V2021_05_01_Preview => "2021-05-01-preview",
28+
ServiceVersion.V2023_03_01 => "2023-03-01",
2929
_ => throw new ArgumentOutOfRangeException(nameof(version)),
3030
};
3131
}
@@ -36,10 +36,10 @@ public SipRoutingClientOptions(ServiceVersion version = LatestVersion)
3636
public enum ServiceVersion
3737
{
3838
/// <summary>
39-
/// The V1 of the calling configuration service.
39+
/// The GA of the calling configuration service.
4040
/// </summary>
4141
#pragma warning disable CA1707 // Identifiers should not contain underscores
42-
V2021_05_01_Preview = 1
42+
V2023_03_01 = 1
4343
#pragma warning restore CA1707 // Identifiers should not contain underscores
4444

4545
}

sdk/communication/Azure.Communication.PhoneNumbers/src/SipRouting/SipRoutingRestClient.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace Azure.Communication.PhoneNumbers.SipRouting
1212
[CodeGenClient("SIPRoutingServiceRestClient")]
1313
internal partial class SipRoutingRestClient
1414
{
15-
internal HttpMessage CreatePatchSipConfigurationRequest(SipConfiguration body)
15+
internal HttpMessage CreateUpdateRequest(SipConfiguration body)
1616
{
1717
var message = _pipeline.CreateMessage();
1818
var request = message.Request;
@@ -33,12 +33,12 @@ internal HttpMessage CreatePatchSipConfigurationRequest(SipConfiguration body)
3333
return message;
3434
}
3535

36-
/// <summary> Patches SIP configuration for resource. </summary>
37-
/// <param name="body"> Configuration patch. </param>
36+
/// <summary> Updates SIP configuration for resource. </summary>
37+
/// <param name="body"> Configuration update. </param>
3838
/// <param name="cancellationToken"> The cancellation token to use. </param>
39-
public async Task<Response> PatchSipConfigurationAsync(SipConfiguration body = null, CancellationToken cancellationToken = default)
39+
public async Task<Response> UpdateAsync(SipConfiguration body = null, CancellationToken cancellationToken = default)
4040
{
41-
using var message = CreatePatchSipConfigurationRequest(body);
41+
using var message = CreateUpdateRequest(body);
4242
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
4343
switch (message.Response.Status)
4444
{
@@ -58,12 +58,12 @@ public async Task<Response> PatchSipConfigurationAsync(SipConfiguration body = n
5858
}
5959
}
6060

61-
/// <summary> Patches SIP configuration for resource. </summary>
62-
/// <param name="body"> Configuration patch. </param>
61+
/// <summary> Updates SIP configuration for resource. </summary>
62+
/// <param name="body"> Configuration update. </param>
6363
/// <param name="cancellationToken"> The cancellation token to use. </param>
64-
public Response PatchSipConfiguration(SipConfiguration body = null, CancellationToken cancellationToken = default)
64+
public Response Update(SipConfiguration body = null, CancellationToken cancellationToken = default)
6565
{
66-
using var message = CreatePatchSipConfigurationRequest(body);
66+
using var message = CreateUpdateRequest(body);
6767
_pipeline.Send(message, cancellationToken);
6868
switch (message.Response.Status)
6969
{

sdk/communication/Azure.Communication.PhoneNumbers/src/SipRouting/autorest_siprouting.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Run following command from the project root folder to generate code (note: AutoR
66
> see https://aka.ms/autorest
77
88
``` yaml
9-
tag: package-2021-05-01-preview
10-
require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/01563419f540c27a96abae75f9feaa3e5e9a1f13/specification/communication/data-plane/SipRouting/readme.md
9+
tag: package-2023-03
10+
require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/66174681c09b101de03fd35399080cfbccc93e8f/specification/communication/data-plane/SipRouting/readme.md
1111
output-folder: $(project-folder)\SipRouting\Generated
1212
namespace: Azure.Communication.PhoneNumbers.SipRouting
1313
enable-xml: true
@@ -19,32 +19,32 @@ model-namespace: false
1919
generation1-convenience-client: true
2020
```
2121
22-
# The types with Patch suffix, used in API are not used for SDK, to keep the things simple. Therefore, they are removed from autorest.
23-
### Change SipConfigurationPatch to SipConfiguration
22+
# The types with Update suffix, used in API are not used for SDK, to keep the things simple. Therefore, they are removed from autorest.
23+
### Change SipConfigurationUpdate to SipConfiguration
2424
``` yaml
2525
directive:
2626
from: swagger-document
27-
where: $.paths.*[?(@.operationId == "PatchSipConfiguration")].parameters..[?(@.description == "Configuration patch.")]
27+
where: $.paths.*[?(@.operationId == "SipRouting_Update")].parameters..[?(@.description == "Sip configuration update object.")]
2828
transform: >
2929
$.schema = {"$ref": "#/definitions/SipConfiguration"}
3030
```
3131
32-
### Remove TrunkPatch type
32+
### Remove TrunkUpdate type
3333
``` yaml
3434
directive:
3535
from: swagger-document
3636
where: $.definitions
3737
transform: >
38-
delete $.TrunkPatch
38+
delete $.TrunkUpdate
3939
```
4040
41-
### Remove SipConfigurationPatch type
41+
### Remove SipConfigurationUpdate type
4242
``` yaml
4343
directive:
4444
from: swagger-document
4545
where: $.definitions
4646
transform: >
47-
delete $.SipConfigurationPatch
47+
delete $.SipConfigurationUpdate
4848
```
4949
5050
### Move all the models to the main namespace

sdk/communication/Azure.Communication.PhoneNumbers/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ extends:
2525
Clouds: Public,Int
2626
EnvVars:
2727
# SKIP_PHONENUMBER_LIVE_TESTS skips certain phone number tests such as purchase and release
28-
SKIP_PHONENUMBER_LIVE_TESTS: TRUE
28+
SKIP_PHONENUMBER_LIVE_TESTS: TRUE

0 commit comments

Comments
 (0)