Skip to content

Commit

Permalink
GA release for NetworkTraversal (Azure#22415)
Browse files Browse the repository at this point in the history
* GA changes, API View feedback

* Remove undesired file

* Resolve PR comments

* Fix version number

* Update PR
  • Loading branch information
AriZavala2 authored Feb 3, 2022
1 parent 85816db commit 88d1b54
Show file tree
Hide file tree
Showing 33 changed files with 297 additions and 211 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# Release History

## 1.1.0 (Unreleased)

### Features Added
## 1.0.0 (2022-02-03)

### Breaking Changes

### Bugs Fixed
- Making parameters for get_relay_configuration keyword only

### Other Changes
Python 2.7 is no longer supported. Please use Python version 3.6 or later.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ relay_client = CommunicationRelayClient.from_connection_string(self.connection_s
```python
# We need a user from Identity
user = identity_client.create_user()
relay_configuration = relay_client.get_relay_configuration(user)
relay_configuration = relay_client.get_relay_configuration(user=user)

for iceServer in config.ice_servers:
assert iceServer.username is not None
Expand Down Expand Up @@ -103,7 +103,7 @@ for iceServer in config.ice_servers:
```python
# We need a user from Identity
user = identity_client.create_user()
relay_configuration = relay_client.get_relay_configuration(user, RouteType.NEAREST)
relay_configuration = relay_client.get_relay_configuration(user=user, route_type=RouteType.NEAREST)

for iceServer in config.ice_servers:
assert iceServer.username is not None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

# pylint: disable=bad-option-value, unused-import
from ._communication_relay_client import CommunicationRelayClient
from ._generated.models import RouteType
from ._generated.models import RouteType, CommunicationRelayConfiguration, CommunicationIceServer
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def from_connection_string(
@distributed_trace
def get_relay_configuration(
self,
*,
user=None, # type: CommunicationUserIdentifier
route_type=None, # type: Optional[Union[str, "RouteType"]]
**kwargs # type: Any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
from ._communication_network_traversal_client import CommunicationNetworkTraversalClient
__all__ = ['CommunicationNetworkTraversalClient']

try:
from ._patch import patch_sdk # type: ignore
patch_sdk()
except ImportError:
pass
# `._patch.py` is used for handwritten extensions to the generated code
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
from ._patch import patch_sdk
patch_sdk()
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@
from azure.core.rest import HttpRequest, HttpResponse

class CommunicationNetworkTraversalClient(object):
"""Azure Communication Networking Service.
"""Azure Communication Network Traversal Service.
:ivar communication_network_traversal: CommunicationNetworkTraversalOperations operations
:vartype communication_network_traversal:
azure.communication.networktraversal.operations.CommunicationNetworkTraversalOperations
:param endpoint: The communication resource, for example
https://my-resource.communication.azure.com.
:type endpoint: str
:keyword api_version: Api Version. The default value is "2021-10-08-preview". Note that
overriding this default value may result in unsupported behavior.
:keyword api_version: Api Version. The default value is "2022-02-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CommunicationNetworkTraversalClientConfiguration(Configuration):
:param endpoint: The communication resource, for example https://my-resource.communication.azure.com.
:type endpoint: str
:keyword api_version: Api Version. The default value is "2021-10-08-preview". Note that overriding this default value may result in unsupported behavior.
:keyword api_version: Api Version. The default value is "2022-02-01". Note that overriding this default value may result in unsupported behavior.
:paramtype api_version: str
"""

Expand All @@ -36,7 +36,7 @@ def __init__(
):
# type: (...) -> None
super(CommunicationNetworkTraversalClientConfiguration, self).__init__(**kwargs)
api_version = kwargs.pop('api_version', "2021-10-08-preview") # type: str
api_version = kwargs.pop('api_version', "2022-02-01") # type: str

if endpoint is None:
raise ValueError("Parameter 'endpoint' must not be None.")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# coding=utf-8
# --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#
# --------------------------------------------------------------------------

# This file is used for handwritten extensions to the generated code. Example:
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
def patch_sdk():
pass
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
from ._communication_network_traversal_client import CommunicationNetworkTraversalClient
__all__ = ['CommunicationNetworkTraversalClient']

try:
from ._patch import patch_sdk # type: ignore
patch_sdk()
except ImportError:
pass
# `._patch.py` is used for handwritten extensions to the generated code
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
from ._patch import patch_sdk
patch_sdk()
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
from .operations import CommunicationNetworkTraversalOperations

class CommunicationNetworkTraversalClient:
"""Azure Communication Networking Service.
"""Azure Communication Network Traversal Service.
:ivar communication_network_traversal: CommunicationNetworkTraversalOperations operations
:vartype communication_network_traversal:
azure.communication.networktraversal.aio.operations.CommunicationNetworkTraversalOperations
:param endpoint: The communication resource, for example
https://my-resource.communication.azure.com.
:type endpoint: str
:keyword api_version: Api Version. The default value is "2021-10-08-preview". Note that
overriding this default value may result in unsupported behavior.
:keyword api_version: Api Version. The default value is "2022-02-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CommunicationNetworkTraversalClientConfiguration(Configuration):
:param endpoint: The communication resource, for example https://my-resource.communication.azure.com.
:type endpoint: str
:keyword api_version: Api Version. The default value is "2021-10-08-preview". Note that overriding this default value may result in unsupported behavior.
:keyword api_version: Api Version. The default value is "2022-02-01". Note that overriding this default value may result in unsupported behavior.
:paramtype api_version: str
"""

Expand All @@ -31,7 +31,7 @@ def __init__(
**kwargs: Any
) -> None:
super(CommunicationNetworkTraversalClientConfiguration, self).__init__(**kwargs)
api_version = kwargs.pop('api_version', "2021-10-08-preview") # type: str
api_version = kwargs.pop('api_version', "2022-02-01") # type: str

if endpoint is None:
raise ValueError("Parameter 'endpoint' must not be None.")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# coding=utf-8
# --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#
# --------------------------------------------------------------------------

# This file is used for handwritten extensions to the generated code. Example:
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
def patch_sdk():
pass
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,19 @@ async def issue_relay_configuration(
route_type: Optional[Union[str, "_models.RouteType"]] = None,
**kwargs: Any
) -> "_models.CommunicationRelayConfiguration":
"""Issue a configuration for an STUN/TURN server for an existing identity.
"""Issue a configuration for an STUN/TURN server.
Issue a configuration for an STUN/TURN server for an existing identity.
Issue a configuration for an STUN/TURN server.
:param id: An existing ACS identity.
:param id: An identity to be associated with telemetry for data relayed using the returned
credentials. Must be an existing ACS user identity. If not provided, the telemetry will not
contain an associated identity value.
:type id: str
:param route_type: The routing methodology to where the ICE server will be located from the
client.
:param route_type: Filter the routing methodology returned. If not provided, will return all
route types in separate ICE servers.
:type route_type: str or ~azure.communication.networktraversal.models.RouteType
:keyword api_version: Api Version. The default value is "2021-10-08-preview". Note that
overriding this default value may result in unsupported behavior.
:keyword api_version: Api Version. The default value is "2022-02-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: CommunicationRelayConfiguration, or the result of cls(response)
Expand All @@ -73,19 +75,19 @@ async def issue_relay_configuration(
}
error_map.update(kwargs.pop('error_map', {}))

api_version = kwargs.pop('api_version', "2021-10-08-preview") # type: str
api_version = kwargs.pop('api_version', "2022-02-01") # type: str
content_type = kwargs.pop('content_type', "application/json") # type: Optional[str]

_body = _models.CommunicationRelayConfigurationRequest(id=id, route_type=route_type)
if _body is not None:
json = self._serialize.body(_body, 'CommunicationRelayConfigurationRequest')
_json = self._serialize.body(_body, 'CommunicationRelayConfigurationRequest')
else:
json = None
_json = None

request = build_issue_relay_configuration_request(
api_version=api_version,
content_type=content_type,
json=json,
json=_json,
template_url=self.issue_relay_configuration.metadata['url'],
)
request = _convert_request(request)
Expand All @@ -109,5 +111,5 @@ async def issue_relay_configuration(

return deserialized

issue_relay_configuration.metadata = {'url': '/networktraversal/:issueRelayConfiguration'} # type: ignore
issue_relay_configuration.metadata = {'url': '/networkTraversal/:issueRelayConfiguration'} # type: ignore

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@


class RouteType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
"""The routing methodology to where the ICE server will be located from the client.
"""The routing methodology to where the ICE server will be located from the client. "any" will
have higher reliability while "nearest" will have lower latency. It is recommended to default
to use the "any" routing method unless there are specific scenarios which minimizing latency is
critical.
"""

ANY = "any"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ class CommunicationIceServer(msrest.serialization.Model):
:ivar credential: Required. Credential for the server.
:vartype credential: str
:ivar route_type: Required. The routing methodology to where the ICE server will be located
from the client. Possible values include: "any", "nearest".
from the client. "any" will have higher reliability while "nearest" will have lower latency. It
is recommended to default to use the "any" routing method unless there are specific scenarios
which minimizing latency is critical. Possible values include: "any", "nearest".
:vartype route_type: str or ~azure.communication.networktraversal.models.RouteType
"""

Expand Down Expand Up @@ -134,7 +136,9 @@ def __init__(
:keyword credential: Required. Credential for the server.
:paramtype credential: str
:keyword route_type: Required. The routing methodology to where the ICE server will be located
from the client. Possible values include: "any", "nearest".
from the client. "any" will have higher reliability while "nearest" will have lower latency. It
is recommended to default to use the "any" routing method unless there are specific scenarios
which minimizing latency is critical. Possible values include: "any", "nearest".
:paramtype route_type: str or ~azure.communication.networktraversal.models.RouteType
"""
super(CommunicationIceServer, self).__init__(**kwargs)
Expand All @@ -150,7 +154,7 @@ class CommunicationRelayConfiguration(msrest.serialization.Model):
All required parameters must be populated in order to send to Azure.
:ivar expires_on: Required. The date for which the username and credentials are not longer
valid.
valid. Will be 48 hours from request time.
:vartype expires_on: ~datetime.datetime
:ivar ice_servers: Required. An array representing the credentials and the STUN/TURN server
URLs for use in ICE negotiations.
Expand All @@ -173,7 +177,7 @@ def __init__(
):
"""
:keyword expires_on: Required. The date for which the username and credentials are not longer
valid.
valid. Will be 48 hours from request time.
:paramtype expires_on: ~datetime.datetime
:keyword ice_servers: Required. An array representing the credentials and the STUN/TURN server
URLs for use in ICE negotiations.
Expand All @@ -188,10 +192,12 @@ def __init__(
class CommunicationRelayConfigurationRequest(msrest.serialization.Model):
"""Request for a CommunicationRelayConfiguration.
:ivar id: An existing ACS identity.
:ivar id: An identity to be associated with telemetry for data relayed using the returned
credentials. Must be an existing ACS user identity. If not provided, the telemetry will not
contain an associated identity value.
:vartype id: str
:ivar route_type: The routing methodology to where the ICE server will be located from the
client. Possible values include: "any", "nearest".
:ivar route_type: Filter the routing methodology returned. If not provided, will return all
route types in separate ICE servers. Possible values include: "any", "nearest".
:vartype route_type: str or ~azure.communication.networktraversal.models.RouteType
"""

Expand All @@ -205,10 +211,12 @@ def __init__(
**kwargs
):
"""
:keyword id: An existing ACS identity.
:keyword id: An identity to be associated with telemetry for data relayed using the returned
credentials. Must be an existing ACS user identity. If not provided, the telemetry will not
contain an associated identity value.
:paramtype id: str
:keyword route_type: The routing methodology to where the ICE server will be located from the
client. Possible values include: "any", "nearest".
:keyword route_type: Filter the routing methodology returned. If not provided, will return all
route types in separate ICE servers. Possible values include: "any", "nearest".
:paramtype route_type: str or ~azure.communication.networktraversal.models.RouteType
"""
super(CommunicationRelayConfigurationRequest, self).__init__(**kwargs)
Expand Down
Loading

0 comments on commit 88d1b54

Please sign in to comment.