Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._communication_identity_client import CommunicationIdentityClient
from ._communication_identity_client_async import CommunicationIdentityClient
__all__ = ['CommunicationIdentityClient']
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
from azure.core import AsyncPipelineClient
from msrest import Deserializer, Serializer

from ._configuration import CommunicationIdentityClientConfiguration
from .operations import CommunicationIdentityOperations
from ._configuration_async import CommunicationIdentityClientConfiguration
from .operations_async import CommunicationIdentityOperations
from .. import models


class CommunicationIdentityClient(object):
"""Azure Communication Identity Service.

:ivar communication_identity: CommunicationIdentityOperations operations
:vartype communication_identity: azure.communication.administration.aio.operations.CommunicationIdentityOperations
:vartype communication_identity: azure.communication.administration.aio.operations_async.CommunicationIdentityOperations
:param endpoint: Auth and Identity endpoint.
:type endpoint: str
"""
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.
# --------------------------------------------------------------------------

from ._communication_identity_operations import CommunicationIdentityOperations
from ._communication_identity_operations_async import CommunicationIdentityOperations

__all__ = [
'CommunicationIdentityOperations',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar
import warnings

from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest

Expand Down Expand Up @@ -54,12 +54,9 @@ async def create(
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.CommunicationIdentity"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map = {404: ResourceNotFoundError, 409: ResourceExistsError}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2020-07-20-preview2"
accept = "application/json"

# Construct URL
url = self.create.metadata['url'] # type: ignore
Expand All @@ -74,7 +71,7 @@ async def create(

# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
header_parameters['Accept'] = 'application/json'

request = self._client.post(url, query_parameters, header_parameters)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
Expand Down Expand Up @@ -109,9 +106,7 @@ async def delete(
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType[None]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map = {404: ResourceNotFoundError, 409: ResourceExistsError}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2020-07-20-preview2"

Expand Down Expand Up @@ -163,9 +158,7 @@ async def update(
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType[None]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map = {404: ResourceNotFoundError, 409: ResourceExistsError}
error_map.update(kwargs.pop('error_map', {}))

_body = models.CommunicationIdentityUpdateRequest(tokens_valid_from=tokens_valid_from)
Expand All @@ -192,6 +185,7 @@ async def update(
body_content = self._serialize.body(_body, 'CommunicationIdentityUpdateRequest')
body_content_kwargs['content'] = body_content
request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs)

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

Expand Down Expand Up @@ -224,15 +218,12 @@ async def issue_token(
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.CommunicationIdentityToken"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map = {404: ResourceNotFoundError, 409: ResourceExistsError}
error_map.update(kwargs.pop('error_map', {}))

_body = models.CommunicationTokenRequest(scopes=scopes)
api_version = "2020-07-20-preview2"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"

# Construct URL
url = self.issue_token.metadata['url'] # type: ignore
Expand All @@ -249,12 +240,13 @@ async def issue_token(
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
header_parameters['Accept'] = 'application/json'

body_content_kwargs = {} # type: Dict[str, Any]
body_content = self._serialize.body(_body, 'CommunicationTokenRequest')
body_content_kwargs['content'] = body_content
request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs)

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from typing import TYPE_CHECKING
import warnings

from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpRequest, HttpResponse

Expand Down Expand Up @@ -59,12 +59,9 @@ def create(
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.CommunicationIdentity"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map = {404: ResourceNotFoundError, 409: ResourceExistsError}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2020-07-20-preview2"
accept = "application/json"

# Construct URL
url = self.create.metadata['url'] # type: ignore
Expand All @@ -79,7 +76,7 @@ def create(

# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
header_parameters['Accept'] = 'application/json'

request = self._client.post(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
Expand Down Expand Up @@ -115,9 +112,7 @@ def delete(
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType[None]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map = {404: ResourceNotFoundError, 409: ResourceExistsError}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2020-07-20-preview2"

Expand Down Expand Up @@ -170,9 +165,7 @@ def update(
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType[None]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map = {404: ResourceNotFoundError, 409: ResourceExistsError}
error_map.update(kwargs.pop('error_map', {}))

_body = models.CommunicationIdentityUpdateRequest(tokens_valid_from=tokens_valid_from)
Expand All @@ -199,6 +192,7 @@ def update(
body_content = self._serialize.body(_body, 'CommunicationIdentityUpdateRequest')
body_content_kwargs['content'] = body_content
request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs)

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

Expand Down Expand Up @@ -232,15 +226,12 @@ def issue_token(
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.CommunicationIdentityToken"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map = {404: ResourceNotFoundError, 409: ResourceExistsError}
error_map.update(kwargs.pop('error_map', {}))

_body = models.CommunicationTokenRequest(scopes=scopes)
api_version = "2020-07-20-preview2"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"

# Construct URL
url = self.issue_token.metadata['url'] # type: ignore
Expand All @@ -257,12 +248,13 @@ def issue_token(
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
header_parameters['Accept'] = 'application/json'

body_content_kwargs = {} # type: Dict[str, Any]
body_content = self._serialize.body(_body, 'CommunicationTokenRequest')
body_content_kwargs['content'] = body_content
request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs)

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

Expand Down
Loading