Skip to content

Commit

Permalink
Add autogenerated code
Browse files Browse the repository at this point in the history
  • Loading branch information
AriZavala2 committed Nov 10, 2021
1 parent d3ee41d commit 8a16451
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(
super(CommunicationNetworkTraversalClientConfiguration, self).__init__(**kwargs)

self.endpoint = endpoint
self.api_version = "2021-06-21-preview"
self.api_version = "2021-10-08-preview"
kwargs.setdefault('sdk_moniker', 'communicationnetworktraversalclient/{}'.format(VERSION))
self._configure(**kwargs)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(
super(CommunicationNetworkTraversalClientConfiguration, self).__init__(**kwargs)

self.endpoint = endpoint
self.api_version = "2021-06-21-preview"
self.api_version = "2021-10-08-preview"
kwargs.setdefault('sdk_moniker', 'communicationnetworktraversalclient/{}'.format(VERSION))
self._configure(**kwargs)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import functools
from typing import Any, Callable, Dict, Generic, Optional, TypeVar
from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union
import warnings

from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
Expand Down Expand Up @@ -48,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None:
async def issue_relay_configuration(
self,
id: Optional[str] = None,
route_type: Optional[Union[str, "_models.CommunicationRelayConfigurationRequestRouteType"]] = None,
**kwargs: Any
) -> "_models.CommunicationRelayConfiguration":
"""Issue a configuration for an STUN/TURN server for an existing identity.
Expand All @@ -56,6 +57,10 @@ async def issue_relay_configuration(
:param id: An existing ACS identity.
:type id: str
:param route_type: The routing methodology to where the ICE server will be located from the
client.
:type route_type: str or
~azure.communication.networktraversal.models.CommunicationRelayConfigurationRequestRouteType
:keyword callable cls: A custom type or function that will be passed the direct response
:return: CommunicationRelayConfiguration, or the result of cls(response)
:rtype: ~azure.communication.networktraversal.models.CommunicationRelayConfiguration
Expand All @@ -69,7 +74,7 @@ async def issue_relay_configuration(

content_type = kwargs.pop('content_type', "application/json") # type: Optional[str]

_body = _models.CommunicationRelayConfigurationRequest(id=id)
_body = _models.CommunicationRelayConfigurationRequest(id=id, route_type=route_type)
if _body is not None:
json = self._serialize.body(_body, 'CommunicationRelayConfigurationRequest')
else:
Expand All @@ -86,7 +91,7 @@ async def issue_relay_configuration(
}
request.url = self._client.format_url(request.url, **path_format_arguments)

pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,17 @@
from ._models import CommunicationRelayConfiguration # type: ignore
from ._models import CommunicationRelayConfigurationRequest # type: ignore

from ._communication_network_traversal_client_enums import (
CommunicationIceServerRouteType,
CommunicationRelayConfigurationRequestRouteType,
)

__all__ = [
'CommunicationError',
'CommunicationErrorResponse',
'CommunicationIceServer',
'CommunicationRelayConfiguration',
'CommunicationRelayConfigurationRequest',
'CommunicationIceServerRouteType',
'CommunicationRelayConfigurationRequestRouteType',
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from enum import Enum
from six import with_metaclass
from azure.core import CaseInsensitiveEnumMeta


class CommunicationIceServerRouteType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
"""The routing methodology to where the ICE server will be located from the client.
"""

ANY = "any"
NEAREST = "nearest"

class CommunicationRelayConfigurationRequestRouteType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
"""The routing methodology to where the ICE server will be located from the client.
"""

ANY = "any"
NEAREST = "nearest"
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,24 @@ class CommunicationIceServer(msrest.serialization.Model):
:vartype username: str
: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".
:vartype route_type: str or
~azure.communication.networktraversal.models.CommunicationIceServerRouteType
"""

_validation = {
'urls': {'required': True},
'username': {'required': True},
'credential': {'required': True},
'route_type': {'required': True},
}

_attribute_map = {
'urls': {'key': 'urls', 'type': '[str]'},
'username': {'key': 'username', 'type': 'str'},
'credential': {'key': 'credential', 'type': 'str'},
'route_type': {'key': 'routeType', 'type': 'str'},
}

def __init__(
Expand All @@ -128,11 +134,16 @@ def __init__(
:paramtype username: str
: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".
:paramtype route_type: str or
~azure.communication.networktraversal.models.CommunicationIceServerRouteType
"""
super(CommunicationIceServer, self).__init__(**kwargs)
self.urls = kwargs['urls']
self.username = kwargs['username']
self.credential = kwargs['credential']
self.route_type = kwargs['route_type']


class CommunicationRelayConfiguration(msrest.serialization.Model):
Expand Down Expand Up @@ -181,10 +192,15 @@ class CommunicationRelayConfigurationRequest(msrest.serialization.Model):
:ivar id: An existing ACS identity.
: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".
:vartype route_type: str or
~azure.communication.networktraversal.models.CommunicationRelayConfigurationRequestRouteType
"""

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'route_type': {'key': 'routeType', 'type': 'str'},
}

def __init__(
Expand All @@ -194,6 +210,11 @@ def __init__(
"""
:keyword id: An existing ACS identity.
: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".
:paramtype route_type: str or
~azure.communication.networktraversal.models.CommunicationRelayConfigurationRequestRouteType
"""
super(CommunicationRelayConfigurationRequest, self).__init__(**kwargs)
self.id = kwargs.get('id', None)
self.route_type = kwargs.get('route_type', None)
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
# --------------------------------------------------------------------------

import datetime
from typing import List, Optional
from typing import List, Optional, Union

from azure.core.exceptions import HttpResponseError
import msrest.serialization

from ._communication_network_traversal_client_enums import *


class CommunicationError(msrest.serialization.Model):
"""The Communication Services error.
Expand Down Expand Up @@ -111,18 +113,24 @@ class CommunicationIceServer(msrest.serialization.Model):
:vartype username: str
: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".
:vartype route_type: str or
~azure.communication.networktraversal.models.CommunicationIceServerRouteType
"""

_validation = {
'urls': {'required': True},
'username': {'required': True},
'credential': {'required': True},
'route_type': {'required': True},
}

_attribute_map = {
'urls': {'key': 'urls', 'type': '[str]'},
'username': {'key': 'username', 'type': 'str'},
'credential': {'key': 'credential', 'type': 'str'},
'route_type': {'key': 'routeType', 'type': 'str'},
}

def __init__(
Expand All @@ -131,6 +139,7 @@ def __init__(
urls: List[str],
username: str,
credential: str,
route_type: Union[str, "CommunicationIceServerRouteType"],
**kwargs
):
"""
Expand All @@ -140,11 +149,16 @@ def __init__(
:paramtype username: str
: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".
:paramtype route_type: str or
~azure.communication.networktraversal.models.CommunicationIceServerRouteType
"""
super(CommunicationIceServer, self).__init__(**kwargs)
self.urls = urls
self.username = username
self.credential = credential
self.route_type = route_type


class CommunicationRelayConfiguration(msrest.serialization.Model):
Expand Down Expand Up @@ -196,21 +210,32 @@ class CommunicationRelayConfigurationRequest(msrest.serialization.Model):
:ivar id: An existing ACS identity.
: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".
:vartype route_type: str or
~azure.communication.networktraversal.models.CommunicationRelayConfigurationRequestRouteType
"""

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'route_type': {'key': 'routeType', 'type': 'str'},
}

def __init__(
self,
*,
id: Optional[str] = None,
route_type: Optional[Union[str, "CommunicationRelayConfigurationRequestRouteType"]] = None,
**kwargs
):
"""
:keyword id: An existing ACS identity.
: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".
:paramtype route_type: str or
~azure.communication.networktraversal.models.CommunicationRelayConfigurationRequestRouteType
"""
super(CommunicationRelayConfigurationRequest, self).__init__(**kwargs)
self.id = id
self.route_type = route_type
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any, Callable, Dict, Generic, Optional, TypeVar
from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union

T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
Expand All @@ -35,7 +35,7 @@ def build_issue_relay_configuration_request(
# type: (...) -> HttpRequest
content_type = kwargs.pop('content_type', None) # type: Optional[str]

api_version = "2021-06-21-preview"
api_version = "2021-10-08-preview"
accept = "application/json"
# Construct URL
url = kwargs.pop("template_url", '/networktraversal/:issueRelayConfiguration')
Expand Down Expand Up @@ -85,6 +85,7 @@ def __init__(self, client, config, serializer, deserializer):
def issue_relay_configuration(
self,
id=None, # type: Optional[str]
route_type=None, # type: Optional[Union[str, "_models.CommunicationRelayConfigurationRequestRouteType"]]
**kwargs # type: Any
):
# type: (...) -> "_models.CommunicationRelayConfiguration"
Expand All @@ -94,6 +95,10 @@ def issue_relay_configuration(
:param id: An existing ACS identity.
:type id: str
:param route_type: The routing methodology to where the ICE server will be located from the
client.
:type route_type: str or
~azure.communication.networktraversal.models.CommunicationRelayConfigurationRequestRouteType
:keyword callable cls: A custom type or function that will be passed the direct response
:return: CommunicationRelayConfiguration, or the result of cls(response)
:rtype: ~azure.communication.networktraversal.models.CommunicationRelayConfiguration
Expand All @@ -107,7 +112,7 @@ def issue_relay_configuration(

content_type = kwargs.pop('content_type', "application/json") # type: Optional[str]

_body = _models.CommunicationRelayConfigurationRequest(id=id)
_body = _models.CommunicationRelayConfigurationRequest(id=id, route_type=route_type)
if _body is not None:
json = self._serialize.body(_body, 'CommunicationRelayConfigurationRequest')
else:
Expand All @@ -124,7 +129,7 @@ def issue_relay_configuration(
}
request.url = self._client.format_url(request.url, **path_format_arguments)

pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ autorest ./SWAGGER.md

### Settings
``` yaml
tag: package-2021-06-21-preview
require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/4c8162b0a1f7bbd46e9aedc0e19bbe181e549c4c/specification/communication/data-plane/NetworkTraversal/readme.md
tag: package-2021-10-08-preview
require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/283fd578dca61390523cae07a2312a34ea87ec90/specification/communication/data-plane/NetworkTraversal/readme.md
output-folder: ../azure/communication/networktraversal/_generated/
namespace: azure.communication.networktraversal
license-header: MICROSOFT_MIT_NO_VERSION
Expand Down

0 comments on commit 8a16451

Please sign in to comment.