Skip to content

Commit bb8c11a

Browse files
v-pivamshijiriburantmerveprnaakanmu
authored
SipRouting trunk setting sdk changes. (#39858)
* SipRouting trunk setting sdk changes. * resoleved credential issue. * resolved the comment. * resolved the comments. * added changes in SipTrunk and SipTrunkRoute models. * resoved the comments. and runthe latest autorest. * added ___domain endpoints. * expose sip ___domain. * resolved the comments. * reolved lint error. * Resolved the PR comments and build isues. * Updated tests and recordings. * Updated recordings. * Added new samples and updated old ones. * Changed trunk_health to health * Fixing comments and newlines. * Fixing comment. * Updated recordings * Fixed the error caused by merge conflicts * Fixed the error build error caused by development status * Fixed the error build error caused by pylint * assets.json update * version update * assets update * updated release date * address PR comments: update ___domain tests, and fix comments and file names * fixed failing tests * update assets * update assets * update assets * update assets.json --------- Co-authored-by: Jiri Burant <[email protected]> Co-authored-by: Merve PARIN <[email protected]> Co-authored-by: Sola Akanmu <[email protected]>
1 parent 9c906cc commit bb8c11a

Some content is hidden

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

49 files changed

+2540
-601
lines changed

sdk/communication/azure-communication-phonenumbers/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Release History
22

3+
## 1.4.0b2 (2025-08-01)
4+
5+
### Features Added
6+
- Added API version `2024-11-15-preview` for SIP routing client
7+
38
## 1.4.0b1 (2025-07-22)
49

510
### Features Added

sdk/communication/azure-communication-phonenumbers/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "python",
44
"TagPrefix": "python/communication/azure-communication-phonenumbers",
5-
"Tag": "python/communication/azure-communication-phonenumbers_ee055c0573"
5+
"Tag": "python/communication/azure-communication-phonenumbers_b133516863"
66
}

sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
# license information.
55
# --------------------------------------------------------------------------
66

7-
VERSION = "1.4.0b1"
7+
VERSION = "1.4.0b2"
88

99
SDK_MONIKER = "communication-phonenumbers/{}".format(VERSION) # type: str

sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/__init__.py

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,32 @@
66

77

88
from ._sip_routing_client import SipRoutingClient
9-
from ._models import SipTrunk, SipTrunkRoute
9+
from ._models import SipTrunk, SipTrunkRoute, SipDomain
10+
from ._generated.models._enums import IpAddressVersion, PrivacyHeader
11+
from ._generated.models import(
12+
PingHealth,
13+
TlsHealth,
14+
TrunkHealth,
15+
OverallHealth,
16+
PingStatus,
17+
TlsStatus,
18+
HealthStatusReason,
19+
OverallHealthStatus
20+
)
1021

11-
__all__ = ["SipRoutingClient", "SipTrunk", "SipTrunkRoute"]
22+
__all__ = [
23+
"SipRoutingClient",
24+
"SipTrunk",
25+
"SipDomain",
26+
"SipTrunkRoute",
27+
"IpAddressVersion",
28+
"PrivacyHeader",
29+
"PingHealth",
30+
"TlsHealth",
31+
"TrunkHealth",
32+
"OverallHealth",
33+
"PingStatus",
34+
"TlsStatus",
35+
"HealthStatusReason",
36+
"OverallHealthStatus",
37+
]

sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/__init__.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,25 @@
55
# Code generated by Microsoft (R) AutoRest Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
8+
# pylint: disable=wrong-import-position
89

9-
from ._client import SIPRoutingService
10+
from typing import TYPE_CHECKING
11+
12+
if TYPE_CHECKING:
13+
from ._patch import * # pylint: disable=unused-wildcard-import
14+
15+
from ._client import SIPRoutingService # type: ignore
1016

1117
try:
1218
from ._patch import __all__ as _patch_all
13-
from ._patch import * # pylint: disable=unused-wildcard-import
19+
from ._patch import *
1420
except ImportError:
1521
_patch_all = []
1622
from ._patch import patch_sdk as _patch_sdk
1723

1824
__all__ = [
1925
"SIPRoutingService",
2026
]
21-
__all__.extend([p for p in _patch_all if p not in __all__])
27+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
2228

2329
_patch_sdk()

sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/_client.py

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,20 @@
88

99
from copy import deepcopy
1010
from typing import Any
11+
from typing_extensions import Self
1112

1213
from azure.core import PipelineClient
14+
from azure.core.credentials import AzureKeyCredential
15+
from azure.core.pipeline import policies
1316
from azure.core.rest import HttpRequest, HttpResponse
1417

1518
from . import models as _models
1619
from ._configuration import SIPRoutingServiceConfiguration
17-
from ._serialization import Deserializer, Serializer
20+
from ._utils.serialization import Deserializer, Serializer
1821
from .operations import SipRoutingOperations
1922

2023

21-
class SIPRoutingService: # pylint: disable=client-accepts-api-version-keyword
24+
class SIPRoutingService:
2225
"""SipRouting Service.
2326
2427
:ivar sip_routing: SipRoutingOperations operations
@@ -27,25 +30,43 @@ class SIPRoutingService: # pylint: disable=client-accepts-api-version-keyword
2730
:param endpoint: The communication resource, for example
2831
https://resourcename.communication.azure.com. Required.
2932
:type endpoint: str
30-
:keyword api_version: Api Version. Default value is "2023-03-01". Note that overriding this
31-
default value may result in unsupported behavior.
33+
:param credential: Credential needed for the client to connect to Azure. Required.
34+
:type credential: ~azure.core.credentials.AzureKeyCredential
35+
:keyword api_version: Api Version. Default value is "2024-11-15-preview". Note that overriding
36+
this default value may result in unsupported behavior.
3237
:paramtype api_version: str
3338
"""
3439

35-
def __init__( # pylint: disable=missing-client-constructor-parameter-credential
36-
self, endpoint: str, **kwargs: Any
37-
) -> None:
40+
def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any) -> None:
3841
_endpoint = "{endpoint}"
39-
self._config = SIPRoutingServiceConfiguration(endpoint=endpoint, **kwargs)
40-
self._client: PipelineClient = PipelineClient(base_url=_endpoint, config=self._config, **kwargs)
42+
self._config = SIPRoutingServiceConfiguration(endpoint=endpoint, credential=credential, **kwargs)
43+
44+
_policies = kwargs.pop("policies", None)
45+
if _policies is None:
46+
_policies = [
47+
policies.RequestIdPolicy(**kwargs),
48+
self._config.headers_policy,
49+
self._config.user_agent_policy,
50+
self._config.proxy_policy,
51+
policies.ContentDecodePolicy(**kwargs),
52+
self._config.redirect_policy,
53+
self._config.retry_policy,
54+
self._config.authentication_policy,
55+
self._config.custom_hook_policy,
56+
self._config.logging_policy,
57+
policies.DistributedTracingPolicy(**kwargs),
58+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
59+
self._config.http_logging_policy,
60+
]
61+
self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
4162

4263
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
4364
self._serialize = Serializer(client_models)
4465
self._deserialize = Deserializer(client_models)
4566
self._serialize.client_side_validation = False
4667
self.sip_routing = SipRoutingOperations(self._client, self._config, self._serialize, self._deserialize)
4768

48-
def send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
69+
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
4970
"""Runs the network request through the client's chained policies.
5071
5172
>>> from azure.core.rest import HttpRequest
@@ -69,12 +90,12 @@ def send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
6990
}
7091

7192
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
72-
return self._client.send_request(request_copy, **kwargs)
93+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
7394

7495
def close(self) -> None:
7596
self._client.close()
7697

77-
def __enter__(self) -> "SIPRoutingService":
98+
def __enter__(self) -> Self:
7899
self._client.__enter__()
79100
return self
80101

sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/_configuration.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,15 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
import sys
109
from typing import Any
1110

12-
from azure.core.configuration import Configuration
11+
from azure.core.credentials import AzureKeyCredential
1312
from azure.core.pipeline import policies
1413

15-
if sys.version_info >= (3, 8):
16-
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
17-
else:
18-
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
19-
2014
VERSION = "unknown"
2115

2216

23-
class SIPRoutingServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
17+
class SIPRoutingServiceConfiguration: # pylint: disable=too-many-instance-attributes
2418
"""Configuration for SIPRoutingService.
2519
2620
Note that all parameters used to create this instance are saved as instance
@@ -29,21 +23,26 @@ class SIPRoutingServiceConfiguration(Configuration): # pylint: disable=too-many
2923
:param endpoint: The communication resource, for example
3024
https://resourcename.communication.azure.com. Required.
3125
:type endpoint: str
32-
:keyword api_version: Api Version. Default value is "2023-03-01". Note that overriding this
33-
default value may result in unsupported behavior.
26+
:param credential: Credential needed for the client to connect to Azure. Required.
27+
:type credential: ~azure.core.credentials.AzureKeyCredential
28+
:keyword api_version: Api Version. Default value is "2024-11-15-preview". Note that overriding
29+
this default value may result in unsupported behavior.
3430
:paramtype api_version: str
3531
"""
3632

37-
def __init__(self, endpoint: str, **kwargs: Any) -> None:
38-
super(SIPRoutingServiceConfiguration, self).__init__(**kwargs)
39-
api_version: Literal["2023-03-01"] = kwargs.pop("api_version", "2023-03-01")
33+
def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any) -> None:
34+
api_version: str = kwargs.pop("api_version", "2024-11-15-preview")
4035

4136
if endpoint is None:
4237
raise ValueError("Parameter 'endpoint' must not be None.")
38+
if credential is None:
39+
raise ValueError("Parameter 'credential' must not be None.")
4340

4441
self.endpoint = endpoint
42+
self.credential = credential
4543
self.api_version = api_version
4644
kwargs.setdefault("sdk_moniker", "siproutingservice/{}".format(VERSION))
45+
self.polling_interval = kwargs.get("polling_interval", 30)
4746
self._configure(**kwargs)
4847

4948
def _configure(self, **kwargs: Any) -> None:
@@ -52,7 +51,9 @@ def _configure(self, **kwargs: Any) -> None:
5251
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
5352
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
5453
self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs)
55-
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
5654
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
5755
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
56+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
5857
self.authentication_policy = kwargs.get("authentication_policy")
58+
if self.credential and not self.authentication_policy:
59+
self.authentication_policy = policies.AzureKeyCredentialPolicy(self.credential, "access_key", **kwargs)

sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/_patch.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,7 @@
2828

2929
# This file is used for handwritten extensions to the generated code. Example:
3030
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
31+
32+
3133
def patch_sdk():
3234
pass
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# --------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
# Code generated by Microsoft (R) AutoRest Code Generator.
5+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
6+
# --------------------------------------------------------------------------

0 commit comments

Comments
 (0)