4
4
# license information.
5
5
# --------------------------------------------------------------------------
6
6
7
- from typing import TYPE_CHECKING , List
7
+ from typing import TYPE_CHECKING , List , Any
8
8
from urllib .parse import urlparse
9
9
10
10
from azure .core .tracing .decorator import distributed_trace
@@ -33,13 +33,12 @@ class SipRoutingClient(object):
33
33
this default value may result in unsupported behavior.
34
34
:paramtype api_version: str
35
35
"""
36
-
37
36
def __init__ (
38
37
self ,
39
- endpoint , # type : str
40
- credential , # type: TokenCredential
41
- ** kwargs # type : Any
42
- ): # type: (...) -> SipRoutingClient
38
+ endpoint : str ,
39
+ credential : " TokenCredential" ,
40
+ ** kwargs : Any
41
+ ) -> None :
43
42
44
43
if not credential :
45
44
raise ValueError ("credential can not be None" )
@@ -63,10 +62,9 @@ def __init__(
63
62
@classmethod
64
63
def from_connection_string (
65
64
cls ,
66
- conn_str , # type: str
67
- ** kwargs # type: Any
68
- ):
69
- # type: (...) -> SipRoutingClient
65
+ conn_str : str ,
66
+ ** kwargs : Any
67
+ ) -> "SipRoutingClient" :
70
68
"""Factory method for creating client from connection string.
71
69
72
70
:param str conn_str: Connection string containing endpoint and credentials.
@@ -79,9 +77,9 @@ def from_connection_string(
79
77
@distributed_trace
80
78
def get_trunk (
81
79
self ,
82
- trunk_fqdn , # type : str
83
- ** kwargs # type : Any
84
- ): # type: (...) -> SipTrunk
80
+ trunk_fqdn : str ,
81
+ ** kwargs : Any
82
+ ) -> SipTrunk :
85
83
"""Retrieve a single SIP trunk.
86
84
87
85
:param trunk_fqdn: FQDN of the desired SIP trunk.
@@ -101,9 +99,9 @@ def get_trunk(
101
99
@distributed_trace
102
100
def set_trunk (
103
101
self ,
104
- trunk , # type : SipTrunk
105
- ** kwargs # type : Any
106
- ): # type: (...) -> None
102
+ trunk : SipTrunk ,
103
+ ** kwargs : Any
104
+ ) -> None :
107
105
"""Modifies SIP trunk with the given FQDN. If it doesn't exist, adds a new trunk.
108
106
109
107
:param trunk: Trunk object to be set.
@@ -120,9 +118,9 @@ def set_trunk(
120
118
@distributed_trace
121
119
def delete_trunk (
122
120
self ,
123
- trunk_fqdn , # type : str
124
- ** kwargs # type : Any
125
- ): # type: (...) -> None
121
+ trunk_fqdn : str ,
122
+ ** kwargs : Any
123
+ ) -> None :
126
124
"""Deletes SIP trunk.
127
125
128
126
:param trunk_fqdn: FQDN of the trunk to be deleted.
@@ -138,8 +136,9 @@ def delete_trunk(
138
136
139
137
@distributed_trace
140
138
def list_trunks (
141
- self , ** kwargs # type: Any
142
- ): # type: (...) -> ItemPaged[SipTrunk]
139
+ self ,
140
+ ** kwargs : Any
141
+ ) -> ItemPaged [SipTrunk ]:
143
142
"""Retrieves the currently configured SIP trunks.
144
143
145
144
:returns: Current SIP trunks configuration.
@@ -159,8 +158,9 @@ def get_next(nextLink=None):
159
158
160
159
@distributed_trace
161
160
def list_routes (
162
- self , ** kwargs # type: Any
163
- ): # type: (...) -> ItemPaged[SipTrunkRoute]
161
+ self ,
162
+ ** kwargs : Any
163
+ ) -> ItemPaged [SipTrunkRoute ]:
164
164
"""Retrieves the currently configured SIP routes.
165
165
166
166
:returns: Current SIP routes configuration.
@@ -184,9 +184,9 @@ def get_next(nextLink=None):
184
184
@distributed_trace
185
185
def set_trunks (
186
186
self ,
187
- trunks , # type : List[SipTrunk]
188
- ** kwargs # type : Any
189
- ): # type: (...) -> None
187
+ trunks : List [SipTrunk ],
188
+ ** kwargs : Any
189
+ ) -> None :
190
190
"""Overwrites the list of SIP trunks.
191
191
192
192
:param trunks: New list of trunks to be set.
@@ -213,9 +213,9 @@ def set_trunks(
213
213
@distributed_trace
214
214
def set_routes (
215
215
self ,
216
- routes , # type : List[SipTrunkRoute]
217
- ** kwargs # type : Any
218
- ): # type: (...) -> None
216
+ routes : List [SipTrunkRoute ],
217
+ ** kwargs : Any
218
+ ) -> None :
219
219
"""Overwrites the list of SIP routes.
220
220
221
221
:param routes: New list of routes to be set.
@@ -235,15 +235,15 @@ def set_routes(
235
235
]
236
236
self ._rest_service .sip_routing .update (body = SipConfiguration (routes = routes_internal ), ** kwargs )
237
237
238
- def _list_trunks_ (self , ** kwargs ) :
238
+ def _list_trunks_ (self , ** kwargs : Any ) -> List [ SipTrunk ] :
239
239
config = self ._rest_service .sip_routing .get (** kwargs )
240
240
return [SipTrunk (fqdn = k , sip_signaling_port = v .sip_signaling_port ) for k , v in config .trunks .items ()]
241
241
242
242
def _update_trunks_ (
243
243
self ,
244
- trunks , # type : List[SipTrunk]
245
- ** kwargs # type : Any
246
- ): # type: (...) -> SipTrunk
244
+ trunks : List [SipTrunk ],
245
+ ** kwargs : Any
246
+ ) -> List [ SipTrunk ]:
247
247
trunks_internal = {x .fqdn : SipTrunkInternal (sip_signaling_port = x .sip_signaling_port ) for x in trunks }
248
248
modified_config = SipConfiguration (trunks = trunks_internal )
249
249
0 commit comments