Skip to content

SipRouting trunk setting sdk changes. #39858

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

v-pivamshi
Copy link
Contributor

Description

Please add an informative description that covers that changes made by the pull request and link all relevant issues.

If an SDK is being regenerated based on a new swagger spec, a link to the pull request containing these swagger spec changes has been included above.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@azure-sdk
Copy link
Collaborator

API change check

APIView has identified API level changes in this PR and created following API reviews.

azure-communication-phonenumbers

@v-pivamshi
Copy link
Contributor Author

User Story 3920786: SDK Implementation: Python

  1. Generated swagger.
  2. Added api changes.

@v-dharmarajv v-dharmarajv marked this pull request as ready for review March 17, 2025 16:47
@@ -238,10 +254,148 @@ async def set_routes(
]
await self._rest_service.sip_routing.update(body=SipConfiguration(routes=routes_internal), **kwargs)

@distributed_trace_async
async def test_routes_with_number_async(
Copy link
Member

@jiriburant jiriburant Apr 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feedback from review:
Change the function def to:
async def get_routes_for_number(self, target_phone_number:str, test_routes: SipTrunkRoute[], **kwargs: Any) : # type: (...) -> SipTrunkRoute[]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function accepts array of routes, internally maps it to SipConfiguration and sends it to API. The response "RoutesForNumber" object is not exposed, instead we just return the contained list of matching routes.

@@ -235,10 +249,148 @@ def set_routes(
]
self._rest_service.sip_routing.update(body=SipConfiguration(routes=routes_internal), **kwargs)

@distributed_trace
def test_routes_with_number(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feedback from review:
Change the function def to:
def get_routes_for_number(self, target_phone_number: str, test_routes: SipTrunkRoute[], **kwargs: Any): # type: (...) -> SipTrunkRoute[]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, internally map the test_routes to sipConfiguration and send it to API. And when receiving the response from API, map the resulting RoutesForNumber to SipTrunkRoute[] and return only that.

@@ -83,20 +85,26 @@ def from_connection_string(
async def get_trunk(
self,
trunk_fqdn, # type: str
include_health: Optional[bool] = None,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feedback from review:
Remove include_health parameter and just always return trunk health (always call the GET API with the ExpandEnum.TRUNKS_HEALTH parameter)

@@ -141,10 +149,14 @@ async def delete_trunk(

@distributed_trace
def list_trunks(
self, **kwargs # type: Any
self,
include_health: Optional[bool] = None,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feedback from review:
Remove include_health parameter and just always return trunk health (always call the GET API with the ExpandEnum.TRUNKS_HEALTH parameter)

@@ -138,10 +144,14 @@ def delete_trunk(

@distributed_trace
def list_trunks(
self, **kwargs # type: Any
self,
include_health: Optional[bool] = None,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feedback from review:
Remove include_health parameter and just always return trunk health (always call the GET API with the ExpandEnum.TRUNKS_HEALTH parameter)

@@ -80,20 +82,24 @@ def from_connection_string(
def get_trunk(
self,
trunk_fqdn, # type: str
include_health: Optional[bool] = None,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feedback from review:
Remove include_health parameter and just always return trunk health (always call the GET API with the ExpandEnum.TRUNKS_HEALTH parameter)

from: swagger-document
where: "$.definitions.OverallHealth"
transform: >
$.properties.reason["x-ms-enum"].name = "UnhealthyStatusReason";
Copy link
Member

@jiriburant jiriburant Apr 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feedback from review:
Rename the UnhealthyStatusReason to HealthStatusReason, so change this directive to:

Directive renaming "InactiveStatusReason" enum to "HealthStatusReason"

directive:
  from: swagger-document
  where: "$.definitions.OverallHealth"
  transform: >
    $.properties.reason["x-ms-enum"].name = "HealthStatusReason";

And regenerate the code.

}

_attribute_map = {
"enabled": {"key": "enabled", "type": "bool"},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing "fqdn" property. Please add it and also add it to constructor (similarly as enabled).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants